@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
package/.turbo/turbo-build.log
CHANGED
|
@@ -4,5 +4,5 @@ $ rollup -c
|
|
|
4
4
|
[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
5
5
|
[1m[33m(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
6
6
|
[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning[39m[22m
|
|
7
|
-
[32mcreated [1mlib/index.js, es/index.js[22m in [
|
|
7
|
+
[32mcreated [1mlib/index.js, es/index.js[22m in [1m22.7s[22m[39m
|
|
8
8
|
$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -3118,7 +3118,8 @@ var getTypographyTheme = function getTypographyTheme(theme) {
|
|
|
3118
3118
|
xxxxlarge: theme.fontSizes.xxxxlarge,
|
|
3119
3119
|
xxxxxlarge: theme.fontSizes.xxxxxlarge,
|
|
3120
3120
|
'6xlarge': theme.fontSizes['6xlarge'],
|
|
3121
|
-
'7xlarge': theme.fontSizes['7xlarge']
|
|
3121
|
+
'7xlarge': theme.fontSizes['7xlarge'],
|
|
3122
|
+
caption: theme.fontSizes.small
|
|
3122
3123
|
};
|
|
3123
3124
|
var lineHeights = {
|
|
3124
3125
|
xsmall: theme.lineHeights.xsmall,
|
|
@@ -3130,7 +3131,8 @@ var getTypographyTheme = function getTypographyTheme(theme) {
|
|
|
3130
3131
|
xxxxlarge: theme.lineHeights.xxxxlarge,
|
|
3131
3132
|
xxxxxlarge: theme.lineHeights.xxxxxlarge,
|
|
3132
3133
|
'6xlarge': theme.lineHeights['6xlarge'],
|
|
3133
|
-
'7xlarge': theme.lineHeights['7xlarge']
|
|
3134
|
+
'7xlarge': theme.lineHeights['7xlarge'],
|
|
3135
|
+
caption: theme.lineHeights.small
|
|
3134
3136
|
};
|
|
3135
3137
|
return {
|
|
3136
3138
|
colors: colors,
|
|
@@ -6190,7 +6192,7 @@ var Spacer$1 = index$a(View)(function (_ref3) {
|
|
|
6190
6192
|
};
|
|
6191
6193
|
});
|
|
6192
6194
|
|
|
6193
|
-
var FONTWEIGHT_MAP = {
|
|
6195
|
+
var FONTWEIGHT_MAP$1 = {
|
|
6194
6196
|
light: 'light',
|
|
6195
6197
|
regular: 'regular',
|
|
6196
6198
|
'semi-bold': 'semiBold'
|
|
@@ -6207,12 +6209,12 @@ var StyledText$3 = index$a(Text$1)(function (_ref) {
|
|
|
6207
6209
|
letterSpacing: theme.__hd__.typography.fontSizes[themeFontSize] * 0.03
|
|
6208
6210
|
};
|
|
6209
6211
|
return _objectSpread2(_objectSpread2({}, sizeStyles), {}, {
|
|
6210
|
-
fontFamily: theme.__hd__.typography.fonts[themeTypeface][FONTWEIGHT_MAP[themeFontWeight]],
|
|
6212
|
+
fontFamily: theme.__hd__.typography.fonts[themeTypeface][FONTWEIGHT_MAP$1[themeFontWeight]],
|
|
6211
6213
|
color: theme.__hd__.typography.colors[themeIntent]
|
|
6212
6214
|
});
|
|
6213
6215
|
});
|
|
6214
6216
|
|
|
6215
|
-
var _excluded$
|
|
6217
|
+
var _excluded$v = ["children", "fontSize", "fontWeight", "intent", "typeface", "allowFontScaling"];
|
|
6216
6218
|
var Text = function Text(_ref) {
|
|
6217
6219
|
var children = _ref.children,
|
|
6218
6220
|
_ref$fontSize = _ref.fontSize,
|
|
@@ -6225,7 +6227,7 @@ var Text = function Text(_ref) {
|
|
|
6225
6227
|
typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
|
|
6226
6228
|
_ref$allowFontScaling = _ref.allowFontScaling,
|
|
6227
6229
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
6228
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
6230
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$v);
|
|
6229
6231
|
return /*#__PURE__*/React.createElement(StyledText$3, _extends$1({}, nativeProps, {
|
|
6230
6232
|
themeFontSize: fontSize,
|
|
6231
6233
|
themeFontWeight: fontWeight,
|
|
@@ -6235,8 +6237,45 @@ var Text = function Text(_ref) {
|
|
|
6235
6237
|
}), children);
|
|
6236
6238
|
};
|
|
6237
6239
|
|
|
6240
|
+
var FONTWEIGHT_MAP = {
|
|
6241
|
+
light: 'light',
|
|
6242
|
+
regular: 'regular',
|
|
6243
|
+
'semi-bold': 'semiBold'
|
|
6244
|
+
};
|
|
6245
|
+
|
|
6246
|
+
var StyledCaption = index$a(Text$1)(function (_ref) {
|
|
6247
|
+
var themeFontWeight = _ref.themeFontWeight,
|
|
6248
|
+
themeIntent = _ref.themeIntent,
|
|
6249
|
+
theme = _ref.theme;
|
|
6250
|
+
return {
|
|
6251
|
+
fontSize: theme.__hd__.typography.fontSizes.caption,
|
|
6252
|
+
lineHeight: theme.__hd__.typography.lineHeights.caption,
|
|
6253
|
+
letterSpacing: theme.__hd__.typography.fontSizes.caption * (themeFontWeight === 'regular' ? 0.04 : 0.02),
|
|
6254
|
+
color: theme.__hd__.typography.colors[themeIntent],
|
|
6255
|
+
fontFamily: theme.__hd__.typography.fonts.neutral[FONTWEIGHT_MAP[themeFontWeight]]
|
|
6256
|
+
};
|
|
6257
|
+
});
|
|
6258
|
+
|
|
6259
|
+
var _excluded$u = ["children", "fontWeight", "intent", "allowFontScaling"];
|
|
6260
|
+
var Caption = function Caption(_ref) {
|
|
6261
|
+
var children = _ref.children,
|
|
6262
|
+
_ref$fontWeight = _ref.fontWeight,
|
|
6263
|
+
fontWeight = _ref$fontWeight === void 0 ? 'regular' : _ref$fontWeight,
|
|
6264
|
+
_ref$intent = _ref.intent,
|
|
6265
|
+
intent = _ref$intent === void 0 ? 'body' : _ref$intent,
|
|
6266
|
+
_ref$allowFontScaling = _ref.allowFontScaling,
|
|
6267
|
+
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
6268
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$u);
|
|
6269
|
+
return /*#__PURE__*/React.createElement(StyledCaption, _extends$1({}, nativeProps, {
|
|
6270
|
+
themeFontWeight: fontWeight,
|
|
6271
|
+
themeIntent: intent,
|
|
6272
|
+
allowFontScaling: allowFontScaling
|
|
6273
|
+
}), children);
|
|
6274
|
+
};
|
|
6275
|
+
|
|
6238
6276
|
var Typography = {
|
|
6239
|
-
Text: Text
|
|
6277
|
+
Text: Text,
|
|
6278
|
+
Caption: Caption
|
|
6240
6279
|
};
|
|
6241
6280
|
|
|
6242
6281
|
// 🔴 DO NOT EDIT — This file is generated automatically.
|
package/lib/index.js
CHANGED
|
@@ -3148,7 +3148,8 @@ var getTypographyTheme = function getTypographyTheme(theme) {
|
|
|
3148
3148
|
xxxxlarge: theme.fontSizes.xxxxlarge,
|
|
3149
3149
|
xxxxxlarge: theme.fontSizes.xxxxxlarge,
|
|
3150
3150
|
'6xlarge': theme.fontSizes['6xlarge'],
|
|
3151
|
-
'7xlarge': theme.fontSizes['7xlarge']
|
|
3151
|
+
'7xlarge': theme.fontSizes['7xlarge'],
|
|
3152
|
+
caption: theme.fontSizes.small
|
|
3152
3153
|
};
|
|
3153
3154
|
var lineHeights = {
|
|
3154
3155
|
xsmall: theme.lineHeights.xsmall,
|
|
@@ -3160,7 +3161,8 @@ var getTypographyTheme = function getTypographyTheme(theme) {
|
|
|
3160
3161
|
xxxxlarge: theme.lineHeights.xxxxlarge,
|
|
3161
3162
|
xxxxxlarge: theme.lineHeights.xxxxxlarge,
|
|
3162
3163
|
'6xlarge': theme.lineHeights['6xlarge'],
|
|
3163
|
-
'7xlarge': theme.lineHeights['7xlarge']
|
|
3164
|
+
'7xlarge': theme.lineHeights['7xlarge'],
|
|
3165
|
+
caption: theme.lineHeights.small
|
|
3164
3166
|
};
|
|
3165
3167
|
return {
|
|
3166
3168
|
colors: colors,
|
|
@@ -6220,7 +6222,7 @@ var Spacer$1 = index$a(reactNative.View)(function (_ref3) {
|
|
|
6220
6222
|
};
|
|
6221
6223
|
});
|
|
6222
6224
|
|
|
6223
|
-
var FONTWEIGHT_MAP = {
|
|
6225
|
+
var FONTWEIGHT_MAP$1 = {
|
|
6224
6226
|
light: 'light',
|
|
6225
6227
|
regular: 'regular',
|
|
6226
6228
|
'semi-bold': 'semiBold'
|
|
@@ -6237,12 +6239,12 @@ var StyledText$3 = index$a(reactNative.Text)(function (_ref) {
|
|
|
6237
6239
|
letterSpacing: theme.__hd__.typography.fontSizes[themeFontSize] * 0.03
|
|
6238
6240
|
};
|
|
6239
6241
|
return _objectSpread2(_objectSpread2({}, sizeStyles), {}, {
|
|
6240
|
-
fontFamily: theme.__hd__.typography.fonts[themeTypeface][FONTWEIGHT_MAP[themeFontWeight]],
|
|
6242
|
+
fontFamily: theme.__hd__.typography.fonts[themeTypeface][FONTWEIGHT_MAP$1[themeFontWeight]],
|
|
6241
6243
|
color: theme.__hd__.typography.colors[themeIntent]
|
|
6242
6244
|
});
|
|
6243
6245
|
});
|
|
6244
6246
|
|
|
6245
|
-
var _excluded$
|
|
6247
|
+
var _excluded$v = ["children", "fontSize", "fontWeight", "intent", "typeface", "allowFontScaling"];
|
|
6246
6248
|
var Text = function Text(_ref) {
|
|
6247
6249
|
var children = _ref.children,
|
|
6248
6250
|
_ref$fontSize = _ref.fontSize,
|
|
@@ -6255,7 +6257,7 @@ var Text = function Text(_ref) {
|
|
|
6255
6257
|
typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
|
|
6256
6258
|
_ref$allowFontScaling = _ref.allowFontScaling,
|
|
6257
6259
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
6258
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
6260
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$v);
|
|
6259
6261
|
return /*#__PURE__*/React__default["default"].createElement(StyledText$3, _extends$1({}, nativeProps, {
|
|
6260
6262
|
themeFontSize: fontSize,
|
|
6261
6263
|
themeFontWeight: fontWeight,
|
|
@@ -6265,8 +6267,45 @@ var Text = function Text(_ref) {
|
|
|
6265
6267
|
}), children);
|
|
6266
6268
|
};
|
|
6267
6269
|
|
|
6270
|
+
var FONTWEIGHT_MAP = {
|
|
6271
|
+
light: 'light',
|
|
6272
|
+
regular: 'regular',
|
|
6273
|
+
'semi-bold': 'semiBold'
|
|
6274
|
+
};
|
|
6275
|
+
|
|
6276
|
+
var StyledCaption = index$a(reactNative.Text)(function (_ref) {
|
|
6277
|
+
var themeFontWeight = _ref.themeFontWeight,
|
|
6278
|
+
themeIntent = _ref.themeIntent,
|
|
6279
|
+
theme = _ref.theme;
|
|
6280
|
+
return {
|
|
6281
|
+
fontSize: theme.__hd__.typography.fontSizes.caption,
|
|
6282
|
+
lineHeight: theme.__hd__.typography.lineHeights.caption,
|
|
6283
|
+
letterSpacing: theme.__hd__.typography.fontSizes.caption * (themeFontWeight === 'regular' ? 0.04 : 0.02),
|
|
6284
|
+
color: theme.__hd__.typography.colors[themeIntent],
|
|
6285
|
+
fontFamily: theme.__hd__.typography.fonts.neutral[FONTWEIGHT_MAP[themeFontWeight]]
|
|
6286
|
+
};
|
|
6287
|
+
});
|
|
6288
|
+
|
|
6289
|
+
var _excluded$u = ["children", "fontWeight", "intent", "allowFontScaling"];
|
|
6290
|
+
var Caption = function Caption(_ref) {
|
|
6291
|
+
var children = _ref.children,
|
|
6292
|
+
_ref$fontWeight = _ref.fontWeight,
|
|
6293
|
+
fontWeight = _ref$fontWeight === void 0 ? 'regular' : _ref$fontWeight,
|
|
6294
|
+
_ref$intent = _ref.intent,
|
|
6295
|
+
intent = _ref$intent === void 0 ? 'body' : _ref$intent,
|
|
6296
|
+
_ref$allowFontScaling = _ref.allowFontScaling,
|
|
6297
|
+
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
6298
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$u);
|
|
6299
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledCaption, _extends$1({}, nativeProps, {
|
|
6300
|
+
themeFontWeight: fontWeight,
|
|
6301
|
+
themeIntent: intent,
|
|
6302
|
+
allowFontScaling: allowFontScaling
|
|
6303
|
+
}), children);
|
|
6304
|
+
};
|
|
6305
|
+
|
|
6268
6306
|
var Typography = {
|
|
6269
|
-
Text: Text
|
|
6307
|
+
Text: Text,
|
|
6308
|
+
Caption: Caption
|
|
6270
6309
|
};
|
|
6271
6310
|
|
|
6272
6311
|
// 🔴 DO NOT EDIT — This file is generated automatically.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.31.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/react": "^11.9.3",
|
|
24
|
-
"@hero-design/colors": "8.
|
|
24
|
+
"@hero-design/colors": "8.31.0",
|
|
25
25
|
"date-fns": "^2.16.1",
|
|
26
26
|
"events": "^3.2.0",
|
|
27
27
|
"hero-editor": "^1.9.21"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@babel/preset-typescript": "^7.17.12",
|
|
46
46
|
"@babel/runtime": "^7.18.9",
|
|
47
47
|
"@emotion/jest": "^11.9.3",
|
|
48
|
-
"@hero-design/eslint-plugin": "8.
|
|
48
|
+
"@hero-design/eslint-plugin": "8.31.0",
|
|
49
49
|
"@react-native-community/datetimepicker": "^3.5.2",
|
|
50
50
|
"@react-native-community/slider": "4.1.12",
|
|
51
51
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"@types/react-native": "^0.67.7",
|
|
62
62
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
63
63
|
"babel-plugin-inline-import": "^3.0.0",
|
|
64
|
-
"eslint-config-hd": "8.
|
|
64
|
+
"eslint-config-hd": "8.31.0",
|
|
65
65
|
"eslint-plugin-import": "^2.27.5",
|
|
66
66
|
"jest": "^27.3.1",
|
|
67
|
-
"prettier-config-hd": "8.
|
|
67
|
+
"prettier-config-hd": "8.31.0",
|
|
68
68
|
"react": "18.0.0",
|
|
69
69
|
"react-native": "0.69.7",
|
|
70
70
|
"react-native-gesture-handler": "~2.1.0",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Text } from 'react-native';
|
|
2
|
+
import styled from '@emotion/native';
|
|
3
|
+
import { FONTWEIGHT_MAP, ThemeIntent } from '../types';
|
|
4
|
+
|
|
5
|
+
const StyledCaption = styled(Text)<{
|
|
6
|
+
themeFontWeight: 'regular' | 'semi-bold';
|
|
7
|
+
themeIntent: ThemeIntent;
|
|
8
|
+
}>(({ themeFontWeight, themeIntent, theme }) => ({
|
|
9
|
+
fontSize: theme.__hd__.typography.fontSizes.caption,
|
|
10
|
+
lineHeight: theme.__hd__.typography.lineHeights.caption,
|
|
11
|
+
letterSpacing:
|
|
12
|
+
theme.__hd__.typography.fontSizes.caption *
|
|
13
|
+
(themeFontWeight === 'regular' ? 0.04 : 0.02),
|
|
14
|
+
color: theme.__hd__.typography.colors[themeIntent],
|
|
15
|
+
fontFamily:
|
|
16
|
+
theme.__hd__.typography.fonts.neutral[FONTWEIGHT_MAP[themeFontWeight]],
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
export { StyledCaption };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderWithTheme from '../../../../testHelpers/renderWithTheme';
|
|
3
|
+
import { StyledCaption } from '../StyledCaption';
|
|
4
|
+
|
|
5
|
+
describe('StyledCaption', () => {
|
|
6
|
+
it.each`
|
|
7
|
+
fontWeight
|
|
8
|
+
${'regular'}
|
|
9
|
+
${'semi-bold'}
|
|
10
|
+
`('has $fontWeight fontWeight style', ({ fontWeight }) => {
|
|
11
|
+
const { toJSON } = renderWithTheme(
|
|
12
|
+
<StyledCaption themeFontWeight={fontWeight} themeIntent="body">
|
|
13
|
+
This is a test
|
|
14
|
+
</StyledCaption>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
expect(toJSON()).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it.each`
|
|
21
|
+
intent
|
|
22
|
+
${'body'}
|
|
23
|
+
${'subdued'}
|
|
24
|
+
${'primary'}
|
|
25
|
+
${'success'}
|
|
26
|
+
${'info'}
|
|
27
|
+
${'warning'}
|
|
28
|
+
${'danger'}
|
|
29
|
+
${'inverted'}
|
|
30
|
+
`('has $intent intent style', ({ intent }) => {
|
|
31
|
+
const { toJSON } = renderWithTheme(
|
|
32
|
+
<StyledCaption themeFontWeight="regular" themeIntent={intent}>
|
|
33
|
+
This is a test
|
|
34
|
+
</StyledCaption>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
expect(toJSON()).toMatchSnapshot();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`StyledCaption has body intent style 1`] = `
|
|
4
|
+
<Text
|
|
5
|
+
style={
|
|
6
|
+
Array [
|
|
7
|
+
Object {
|
|
8
|
+
"color": "#001f23",
|
|
9
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
10
|
+
"fontSize": 12,
|
|
11
|
+
"letterSpacing": 0.48,
|
|
12
|
+
"lineHeight": 16,
|
|
13
|
+
},
|
|
14
|
+
undefined,
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
themeFontWeight="regular"
|
|
18
|
+
themeIntent="body"
|
|
19
|
+
>
|
|
20
|
+
This is a test
|
|
21
|
+
</Text>
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
exports[`StyledCaption has danger intent style 1`] = `
|
|
25
|
+
<Text
|
|
26
|
+
style={
|
|
27
|
+
Array [
|
|
28
|
+
Object {
|
|
29
|
+
"color": "#f46363",
|
|
30
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
31
|
+
"fontSize": 12,
|
|
32
|
+
"letterSpacing": 0.48,
|
|
33
|
+
"lineHeight": 16,
|
|
34
|
+
},
|
|
35
|
+
undefined,
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
themeFontWeight="regular"
|
|
39
|
+
themeIntent="danger"
|
|
40
|
+
>
|
|
41
|
+
This is a test
|
|
42
|
+
</Text>
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
exports[`StyledCaption has info intent style 1`] = `
|
|
46
|
+
<Text
|
|
47
|
+
style={
|
|
48
|
+
Array [
|
|
49
|
+
Object {
|
|
50
|
+
"color": "#4568fb",
|
|
51
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
52
|
+
"fontSize": 12,
|
|
53
|
+
"letterSpacing": 0.48,
|
|
54
|
+
"lineHeight": 16,
|
|
55
|
+
},
|
|
56
|
+
undefined,
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
themeFontWeight="regular"
|
|
60
|
+
themeIntent="info"
|
|
61
|
+
>
|
|
62
|
+
This is a test
|
|
63
|
+
</Text>
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
exports[`StyledCaption has inverted intent style 1`] = `
|
|
67
|
+
<Text
|
|
68
|
+
style={
|
|
69
|
+
Array [
|
|
70
|
+
Object {
|
|
71
|
+
"color": "#ffffff",
|
|
72
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
73
|
+
"fontSize": 12,
|
|
74
|
+
"letterSpacing": 0.48,
|
|
75
|
+
"lineHeight": 16,
|
|
76
|
+
},
|
|
77
|
+
undefined,
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
themeFontWeight="regular"
|
|
81
|
+
themeIntent="inverted"
|
|
82
|
+
>
|
|
83
|
+
This is a test
|
|
84
|
+
</Text>
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
exports[`StyledCaption has primary intent style 1`] = `
|
|
88
|
+
<Text
|
|
89
|
+
style={
|
|
90
|
+
Array [
|
|
91
|
+
Object {
|
|
92
|
+
"color": "#401960",
|
|
93
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
94
|
+
"fontSize": 12,
|
|
95
|
+
"letterSpacing": 0.48,
|
|
96
|
+
"lineHeight": 16,
|
|
97
|
+
},
|
|
98
|
+
undefined,
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
themeFontWeight="regular"
|
|
102
|
+
themeIntent="primary"
|
|
103
|
+
>
|
|
104
|
+
This is a test
|
|
105
|
+
</Text>
|
|
106
|
+
`;
|
|
107
|
+
|
|
108
|
+
exports[`StyledCaption has regular fontWeight style 1`] = `
|
|
109
|
+
<Text
|
|
110
|
+
style={
|
|
111
|
+
Array [
|
|
112
|
+
Object {
|
|
113
|
+
"color": "#001f23",
|
|
114
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
115
|
+
"fontSize": 12,
|
|
116
|
+
"letterSpacing": 0.48,
|
|
117
|
+
"lineHeight": 16,
|
|
118
|
+
},
|
|
119
|
+
undefined,
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
themeFontWeight="regular"
|
|
123
|
+
themeIntent="body"
|
|
124
|
+
>
|
|
125
|
+
This is a test
|
|
126
|
+
</Text>
|
|
127
|
+
`;
|
|
128
|
+
|
|
129
|
+
exports[`StyledCaption has semi-bold fontWeight style 1`] = `
|
|
130
|
+
<Text
|
|
131
|
+
style={
|
|
132
|
+
Array [
|
|
133
|
+
Object {
|
|
134
|
+
"color": "#001f23",
|
|
135
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
136
|
+
"fontSize": 12,
|
|
137
|
+
"letterSpacing": 0.24,
|
|
138
|
+
"lineHeight": 16,
|
|
139
|
+
},
|
|
140
|
+
undefined,
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
themeFontWeight="semi-bold"
|
|
144
|
+
themeIntent="body"
|
|
145
|
+
>
|
|
146
|
+
This is a test
|
|
147
|
+
</Text>
|
|
148
|
+
`;
|
|
149
|
+
|
|
150
|
+
exports[`StyledCaption has subdued intent style 1`] = `
|
|
151
|
+
<Text
|
|
152
|
+
style={
|
|
153
|
+
Array [
|
|
154
|
+
Object {
|
|
155
|
+
"color": "#4d6265",
|
|
156
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
157
|
+
"fontSize": 12,
|
|
158
|
+
"letterSpacing": 0.48,
|
|
159
|
+
"lineHeight": 16,
|
|
160
|
+
},
|
|
161
|
+
undefined,
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
themeFontWeight="regular"
|
|
165
|
+
themeIntent="subdued"
|
|
166
|
+
>
|
|
167
|
+
This is a test
|
|
168
|
+
</Text>
|
|
169
|
+
`;
|
|
170
|
+
|
|
171
|
+
exports[`StyledCaption has success intent style 1`] = `
|
|
172
|
+
<Text
|
|
173
|
+
style={
|
|
174
|
+
Array [
|
|
175
|
+
Object {
|
|
176
|
+
"color": "#5ace7d",
|
|
177
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
178
|
+
"fontSize": 12,
|
|
179
|
+
"letterSpacing": 0.48,
|
|
180
|
+
"lineHeight": 16,
|
|
181
|
+
},
|
|
182
|
+
undefined,
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
themeFontWeight="regular"
|
|
186
|
+
themeIntent="success"
|
|
187
|
+
>
|
|
188
|
+
This is a test
|
|
189
|
+
</Text>
|
|
190
|
+
`;
|
|
191
|
+
|
|
192
|
+
exports[`StyledCaption has warning intent style 1`] = `
|
|
193
|
+
<Text
|
|
194
|
+
style={
|
|
195
|
+
Array [
|
|
196
|
+
Object {
|
|
197
|
+
"color": "#ffbe71",
|
|
198
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
199
|
+
"fontSize": 12,
|
|
200
|
+
"letterSpacing": 0.48,
|
|
201
|
+
"lineHeight": 16,
|
|
202
|
+
},
|
|
203
|
+
undefined,
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
themeFontWeight="regular"
|
|
207
|
+
themeIntent="warning"
|
|
208
|
+
>
|
|
209
|
+
This is a test
|
|
210
|
+
</Text>
|
|
211
|
+
`;
|