@hero-design/rn 8.34.3 → 8.34.5
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/.eslintrc.js +1 -0
- package/.turbo/turbo-build.log +1 -1
- package/es/index.js +9 -33
- package/lib/index.js +9 -33
- package/package.json +7 -7
- package/src/components/Tag/StyledTag.tsx +6 -35
- package/src/components/Tag/__tests__/Tag.spec.tsx +13 -13
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +38 -77
- package/src/components/Tag/index.tsx +8 -6
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +2 -2
- package/src/theme/components/tag.ts +2 -2
- package/types/components/Tag/StyledTag.d.ts +1 -4
- package/types/components/Tag/index.d.ts +1 -0
- package/types/theme/components/tag.d.ts +1 -1
package/.eslintrc.js
CHANGED
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 [1m29.7s[22m[39m
|
|
8
8
|
$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -2874,8 +2874,8 @@ var getTagTheme = function getTagTheme(theme) {
|
|
|
2874
2874
|
"default": theme.borderWidths.base
|
|
2875
2875
|
};
|
|
2876
2876
|
var colors = {
|
|
2877
|
-
primary: theme.colors.
|
|
2878
|
-
primaryBackground:
|
|
2877
|
+
primary: theme.colors.primary,
|
|
2878
|
+
primaryBackground: theme.colors.highlightedSurface,
|
|
2879
2879
|
info: theme.colors.onInfoSurface,
|
|
2880
2880
|
infoBackground: theme.colors.infoSurface,
|
|
2881
2881
|
success: theme.colors.onSuccessSurface,
|
|
@@ -16594,44 +16594,21 @@ var index$2 = Object.assign(Tabs, {
|
|
|
16594
16594
|
useIsFocused: useIsFocused
|
|
16595
16595
|
});
|
|
16596
16596
|
|
|
16597
|
-
var getFilledStyles = function getFilledStyles(themeIntent, theme) {
|
|
16598
|
-
return {
|
|
16599
|
-
textColor: theme.__hd__.tag.colors[themeIntent],
|
|
16600
|
-
borderColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")],
|
|
16601
|
-
backgroundColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")]
|
|
16602
|
-
};
|
|
16603
|
-
};
|
|
16604
|
-
var getOutlinedStyles = function getOutlinedStyles(themeIntent, theme) {
|
|
16605
|
-
return {
|
|
16606
|
-
textColor: theme.__hd__.tag.colors[themeIntent],
|
|
16607
|
-
borderColor: theme.__hd__.tag.colors[themeIntent],
|
|
16608
|
-
backgroundColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")]
|
|
16609
|
-
};
|
|
16610
|
-
};
|
|
16611
16597
|
var StyledView = index$b(View)(function (_ref) {
|
|
16612
16598
|
var themeIntent = _ref.themeIntent,
|
|
16613
|
-
themeVariant = _ref.themeVariant,
|
|
16614
16599
|
theme = _ref.theme;
|
|
16615
|
-
var _ref2 = themeVariant === 'filled' ? getFilledStyles(themeIntent, theme) : getOutlinedStyles(themeIntent, theme),
|
|
16616
|
-
borderColor = _ref2.borderColor,
|
|
16617
|
-
backgroundColor = _ref2.backgroundColor;
|
|
16618
16600
|
return {
|
|
16619
|
-
|
|
16601
|
+
backgroundColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")],
|
|
16620
16602
|
borderRadius: theme.__hd__.tag.radii["default"],
|
|
16621
16603
|
paddingVertical: theme.__hd__.tag.space.verticalPadding,
|
|
16622
|
-
paddingHorizontal: theme.__hd__.tag.space.horizontalPadding
|
|
16623
|
-
borderColor: borderColor,
|
|
16624
|
-
backgroundColor: backgroundColor
|
|
16604
|
+
paddingHorizontal: theme.__hd__.tag.space.horizontalPadding
|
|
16625
16605
|
};
|
|
16626
16606
|
});
|
|
16627
|
-
var StyledText = index$b(Typography.Caption)(function (
|
|
16628
|
-
var themeIntent =
|
|
16629
|
-
|
|
16630
|
-
theme = _ref3.theme;
|
|
16631
|
-
var _ref4 = themeVariant === 'filled' ? getFilledStyles(themeIntent, theme) : getOutlinedStyles(themeIntent, theme),
|
|
16632
|
-
textColor = _ref4.textColor;
|
|
16607
|
+
var StyledText = index$b(Typography.Caption)(function (_ref2) {
|
|
16608
|
+
var themeIntent = _ref2.themeIntent,
|
|
16609
|
+
theme = _ref2.theme;
|
|
16633
16610
|
return {
|
|
16634
|
-
color:
|
|
16611
|
+
color: theme.__hd__.tag.colors[themeIntent],
|
|
16635
16612
|
includeFontPadding: false,
|
|
16636
16613
|
textAlignVertical: 'center',
|
|
16637
16614
|
textAlign: 'center'
|
|
@@ -16648,14 +16625,13 @@ var Tag = function Tag(_ref) {
|
|
|
16648
16625
|
style = _ref.style,
|
|
16649
16626
|
testID = _ref.testID,
|
|
16650
16627
|
nativeProps = _objectWithoutProperties(_ref, _excluded$2);
|
|
16628
|
+
useDeprecation("Tag's variant prop is deprecated and will be removed in the next major release. Please remove it.", variant !== undefined);
|
|
16651
16629
|
return /*#__PURE__*/React.createElement(StyledView, _extends$1({}, nativeProps, {
|
|
16652
16630
|
themeIntent: intent,
|
|
16653
|
-
themeVariant: variant,
|
|
16654
16631
|
style: style,
|
|
16655
16632
|
testID: testID
|
|
16656
16633
|
}), typeof content === 'string' ? /*#__PURE__*/React.createElement(StyledText, {
|
|
16657
16634
|
themeIntent: intent,
|
|
16658
|
-
themeVariant: variant,
|
|
16659
16635
|
fontWeight: "semi-bold"
|
|
16660
16636
|
}, content) : content);
|
|
16661
16637
|
};
|
package/lib/index.js
CHANGED
|
@@ -2905,8 +2905,8 @@ var getTagTheme = function getTagTheme(theme) {
|
|
|
2905
2905
|
"default": theme.borderWidths.base
|
|
2906
2906
|
};
|
|
2907
2907
|
var colors = {
|
|
2908
|
-
primary: theme.colors.
|
|
2909
|
-
primaryBackground:
|
|
2908
|
+
primary: theme.colors.primary,
|
|
2909
|
+
primaryBackground: theme.colors.highlightedSurface,
|
|
2910
2910
|
info: theme.colors.onInfoSurface,
|
|
2911
2911
|
infoBackground: theme.colors.infoSurface,
|
|
2912
2912
|
success: theme.colors.onSuccessSurface,
|
|
@@ -16625,44 +16625,21 @@ var index$2 = Object.assign(Tabs, {
|
|
|
16625
16625
|
useIsFocused: useIsFocused
|
|
16626
16626
|
});
|
|
16627
16627
|
|
|
16628
|
-
var getFilledStyles = function getFilledStyles(themeIntent, theme) {
|
|
16629
|
-
return {
|
|
16630
|
-
textColor: theme.__hd__.tag.colors[themeIntent],
|
|
16631
|
-
borderColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")],
|
|
16632
|
-
backgroundColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")]
|
|
16633
|
-
};
|
|
16634
|
-
};
|
|
16635
|
-
var getOutlinedStyles = function getOutlinedStyles(themeIntent, theme) {
|
|
16636
|
-
return {
|
|
16637
|
-
textColor: theme.__hd__.tag.colors[themeIntent],
|
|
16638
|
-
borderColor: theme.__hd__.tag.colors[themeIntent],
|
|
16639
|
-
backgroundColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")]
|
|
16640
|
-
};
|
|
16641
|
-
};
|
|
16642
16628
|
var StyledView = index$b(reactNative.View)(function (_ref) {
|
|
16643
16629
|
var themeIntent = _ref.themeIntent,
|
|
16644
|
-
themeVariant = _ref.themeVariant,
|
|
16645
16630
|
theme = _ref.theme;
|
|
16646
|
-
var _ref2 = themeVariant === 'filled' ? getFilledStyles(themeIntent, theme) : getOutlinedStyles(themeIntent, theme),
|
|
16647
|
-
borderColor = _ref2.borderColor,
|
|
16648
|
-
backgroundColor = _ref2.backgroundColor;
|
|
16649
16631
|
return {
|
|
16650
|
-
|
|
16632
|
+
backgroundColor: theme.__hd__.tag.colors["".concat(themeIntent, "Background")],
|
|
16651
16633
|
borderRadius: theme.__hd__.tag.radii["default"],
|
|
16652
16634
|
paddingVertical: theme.__hd__.tag.space.verticalPadding,
|
|
16653
|
-
paddingHorizontal: theme.__hd__.tag.space.horizontalPadding
|
|
16654
|
-
borderColor: borderColor,
|
|
16655
|
-
backgroundColor: backgroundColor
|
|
16635
|
+
paddingHorizontal: theme.__hd__.tag.space.horizontalPadding
|
|
16656
16636
|
};
|
|
16657
16637
|
});
|
|
16658
|
-
var StyledText = index$b(Typography.Caption)(function (
|
|
16659
|
-
var themeIntent =
|
|
16660
|
-
|
|
16661
|
-
theme = _ref3.theme;
|
|
16662
|
-
var _ref4 = themeVariant === 'filled' ? getFilledStyles(themeIntent, theme) : getOutlinedStyles(themeIntent, theme),
|
|
16663
|
-
textColor = _ref4.textColor;
|
|
16638
|
+
var StyledText = index$b(Typography.Caption)(function (_ref2) {
|
|
16639
|
+
var themeIntent = _ref2.themeIntent,
|
|
16640
|
+
theme = _ref2.theme;
|
|
16664
16641
|
return {
|
|
16665
|
-
color:
|
|
16642
|
+
color: theme.__hd__.tag.colors[themeIntent],
|
|
16666
16643
|
includeFontPadding: false,
|
|
16667
16644
|
textAlignVertical: 'center',
|
|
16668
16645
|
textAlign: 'center'
|
|
@@ -16679,14 +16656,13 @@ var Tag = function Tag(_ref) {
|
|
|
16679
16656
|
style = _ref.style,
|
|
16680
16657
|
testID = _ref.testID,
|
|
16681
16658
|
nativeProps = _objectWithoutProperties(_ref, _excluded$2);
|
|
16659
|
+
useDeprecation("Tag's variant prop is deprecated and will be removed in the next major release. Please remove it.", variant !== undefined);
|
|
16682
16660
|
return /*#__PURE__*/React__default["default"].createElement(StyledView, _extends$1({}, nativeProps, {
|
|
16683
16661
|
themeIntent: intent,
|
|
16684
|
-
themeVariant: variant,
|
|
16685
16662
|
style: style,
|
|
16686
16663
|
testID: testID
|
|
16687
16664
|
}), typeof content === 'string' ? /*#__PURE__*/React__default["default"].createElement(StyledText, {
|
|
16688
16665
|
themeIntent: intent,
|
|
16689
|
-
themeVariant: variant,
|
|
16690
16666
|
fontWeight: "semi-bold"
|
|
16691
16667
|
}, content) : content);
|
|
16692
16668
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.34.
|
|
3
|
+
"version": "8.34.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/react": "^11.9.3",
|
|
24
|
-
"@hero-design/colors": "8.34.
|
|
24
|
+
"@hero-design/colors": "8.34.5",
|
|
25
25
|
"date-fns": "^2.16.1",
|
|
26
26
|
"events": "^3.2.0",
|
|
27
27
|
"hero-editor": "^1.9.21"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@hero-design/react-native-month-year-picker": "^8.34.
|
|
30
|
+
"@hero-design/react-native-month-year-picker": "^8.34.5",
|
|
31
31
|
"@react-native-community/datetimepicker": "^3.5.2",
|
|
32
32
|
"@react-native-community/slider": "4.1.12",
|
|
33
33
|
"react": "18.0.0",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@babel/preset-typescript": "^7.17.12",
|
|
48
48
|
"@babel/runtime": "^7.18.9",
|
|
49
49
|
"@emotion/jest": "^11.9.3",
|
|
50
|
-
"@hero-design/eslint-plugin": "8.34.
|
|
51
|
-
"@hero-design/react-native-month-year-picker": "^8.34.
|
|
50
|
+
"@hero-design/eslint-plugin": "8.34.5",
|
|
51
|
+
"@hero-design/react-native-month-year-picker": "^8.34.5",
|
|
52
52
|
"@react-native-community/datetimepicker": "^3.5.2",
|
|
53
53
|
"@react-native-community/slider": "4.1.12",
|
|
54
54
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"@types/react-native": "^0.67.7",
|
|
65
65
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
66
66
|
"babel-plugin-inline-import": "^3.0.0",
|
|
67
|
-
"eslint-config-hd": "8.34.
|
|
67
|
+
"eslint-config-hd": "8.34.5",
|
|
68
68
|
"eslint-plugin-import": "^2.27.5",
|
|
69
69
|
"jest": "^27.3.1",
|
|
70
|
-
"prettier-config-hd": "8.34.
|
|
70
|
+
"prettier-config-hd": "8.34.5",
|
|
71
71
|
"react": "18.0.0",
|
|
72
72
|
"react-native": "0.69.7",
|
|
73
73
|
"react-native-gesture-handler": "~2.5.0",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { View } from 'react-native';
|
|
2
1
|
import styled from '@emotion/native';
|
|
3
|
-
import {
|
|
2
|
+
import { View } from 'react-native';
|
|
4
3
|
import Typography from '../Typography';
|
|
5
4
|
|
|
6
5
|
type ThemeIntent =
|
|
@@ -11,54 +10,26 @@ type ThemeIntent =
|
|
|
11
10
|
| 'danger'
|
|
12
11
|
| 'archived';
|
|
13
12
|
|
|
14
|
-
type ThemeVariant = 'filled' | 'outlined';
|
|
15
|
-
|
|
16
|
-
const getFilledStyles = (themeIntent: ThemeIntent, theme: Theme) => ({
|
|
17
|
-
textColor: theme.__hd__.tag.colors[themeIntent],
|
|
18
|
-
borderColor: theme.__hd__.tag.colors[`${themeIntent}Background`],
|
|
19
|
-
backgroundColor: theme.__hd__.tag.colors[`${themeIntent}Background`],
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const getOutlinedStyles = (themeIntent: ThemeIntent, theme: Theme) => ({
|
|
23
|
-
textColor: theme.__hd__.tag.colors[themeIntent],
|
|
24
|
-
borderColor: theme.__hd__.tag.colors[themeIntent],
|
|
25
|
-
backgroundColor: theme.__hd__.tag.colors[`${themeIntent}Background`],
|
|
26
|
-
});
|
|
27
|
-
|
|
28
13
|
const StyledView = styled(View)<{
|
|
29
14
|
themeIntent: ThemeIntent;
|
|
30
|
-
|
|
31
|
-
}>(({ themeIntent, themeVariant, theme }) => {
|
|
32
|
-
const { borderColor, backgroundColor } =
|
|
33
|
-
themeVariant === 'filled'
|
|
34
|
-
? getFilledStyles(themeIntent, theme)
|
|
35
|
-
: getOutlinedStyles(themeIntent, theme);
|
|
36
|
-
|
|
15
|
+
}>(({ themeIntent, theme }) => {
|
|
37
16
|
return {
|
|
38
|
-
|
|
17
|
+
backgroundColor: theme.__hd__.tag.colors[`${themeIntent}Background`],
|
|
39
18
|
borderRadius: theme.__hd__.tag.radii.default,
|
|
40
19
|
paddingVertical: theme.__hd__.tag.space.verticalPadding,
|
|
41
20
|
paddingHorizontal: theme.__hd__.tag.space.horizontalPadding,
|
|
42
|
-
borderColor,
|
|
43
|
-
backgroundColor,
|
|
44
21
|
};
|
|
45
22
|
});
|
|
46
23
|
|
|
47
24
|
const StyledText = styled(Typography.Caption)<{
|
|
48
25
|
themeIntent: ThemeIntent;
|
|
49
|
-
|
|
50
|
-
}>(({ themeIntent, themeVariant, theme }) => {
|
|
51
|
-
const { textColor } =
|
|
52
|
-
themeVariant === 'filled'
|
|
53
|
-
? getFilledStyles(themeIntent, theme)
|
|
54
|
-
: getOutlinedStyles(themeIntent, theme);
|
|
55
|
-
|
|
26
|
+
}>(({ themeIntent, theme }) => {
|
|
56
27
|
return {
|
|
57
|
-
color:
|
|
28
|
+
color: theme.__hd__.tag.colors[themeIntent],
|
|
58
29
|
includeFontPadding: false,
|
|
59
30
|
textAlignVertical: 'center',
|
|
60
31
|
textAlign: 'center',
|
|
61
32
|
};
|
|
62
33
|
});
|
|
63
34
|
|
|
64
|
-
export {
|
|
35
|
+
export { StyledText, StyledView };
|
|
@@ -5,21 +5,21 @@ import Typography from '../../Typography';
|
|
|
5
5
|
|
|
6
6
|
describe('Tag', () => {
|
|
7
7
|
it.each`
|
|
8
|
-
|
|
9
|
-
${'
|
|
10
|
-
${'
|
|
11
|
-
${'
|
|
12
|
-
${'
|
|
13
|
-
${'
|
|
14
|
-
${'
|
|
15
|
-
${'
|
|
16
|
-
${'
|
|
17
|
-
${'
|
|
8
|
+
intent | content | expected
|
|
9
|
+
${'success'} | ${'SUCCESS'} | ${'SUCCESS'}
|
|
10
|
+
${'warning'} | ${'WARNING'} | ${'WARNING'}
|
|
11
|
+
${'danger'} | ${'DANGER'} | ${'DANGER'}
|
|
12
|
+
${'info'} | ${'INFO'} | ${'INFO'}
|
|
13
|
+
${'primary'} | ${'PRIMARY'} | ${'PRIMARY'}
|
|
14
|
+
${'warning'} | ${'WARNING'} | ${'WARNING'}
|
|
15
|
+
${'danger'} | ${'DANGER'} | ${'DANGER'}
|
|
16
|
+
${'info'} | ${'INFO'} | ${'INFO'}
|
|
17
|
+
${'primary'} | ${'PRIMARY'} | ${'PRIMARY'}
|
|
18
18
|
`(
|
|
19
|
-
'renders correctly when
|
|
20
|
-
({
|
|
19
|
+
'renders correctly when intent is $intent',
|
|
20
|
+
({ intent, content, expected }) => {
|
|
21
21
|
const { getByText, toJSON } = renderWithTheme(
|
|
22
|
-
<Tag content={content} intent={intent}
|
|
22
|
+
<Tag content={content} intent={intent} />
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
expect(toJSON()).toMatchSnapshot();
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Tag renders correctly when
|
|
3
|
+
exports[`Tag renders correctly when intent is danger 1`] = `
|
|
4
4
|
<View
|
|
5
5
|
style={
|
|
6
6
|
Array [
|
|
7
7
|
Object {
|
|
8
8
|
"backgroundColor": "#fcebe7",
|
|
9
|
-
"borderColor": "#fcebe7",
|
|
10
9
|
"borderRadius": 4,
|
|
11
|
-
"borderWidth": 1,
|
|
12
10
|
"paddingHorizontal": 8,
|
|
13
11
|
"paddingVertical": 4,
|
|
14
12
|
},
|
|
@@ -16,7 +14,6 @@ exports[`Tag renders correctly when variant is filled and intent is danger 1`] =
|
|
|
16
14
|
]
|
|
17
15
|
}
|
|
18
16
|
themeIntent="danger"
|
|
19
|
-
themeVariant="filled"
|
|
20
17
|
>
|
|
21
18
|
<Text
|
|
22
19
|
allowFontScaling={false}
|
|
@@ -42,30 +39,26 @@ exports[`Tag renders correctly when variant is filled and intent is danger 1`] =
|
|
|
42
39
|
}
|
|
43
40
|
themeFontWeight="semi-bold"
|
|
44
41
|
themeIntent="body"
|
|
45
|
-
themeVariant="filled"
|
|
46
42
|
>
|
|
47
43
|
DANGER
|
|
48
44
|
</Text>
|
|
49
45
|
</View>
|
|
50
46
|
`;
|
|
51
47
|
|
|
52
|
-
exports[`Tag renders correctly when
|
|
48
|
+
exports[`Tag renders correctly when intent is danger 2`] = `
|
|
53
49
|
<View
|
|
54
50
|
style={
|
|
55
51
|
Array [
|
|
56
52
|
Object {
|
|
57
|
-
"backgroundColor": "#
|
|
58
|
-
"borderColor": "#ecf0ff",
|
|
53
|
+
"backgroundColor": "#fcebe7",
|
|
59
54
|
"borderRadius": 4,
|
|
60
|
-
"borderWidth": 1,
|
|
61
55
|
"paddingHorizontal": 8,
|
|
62
56
|
"paddingVertical": 4,
|
|
63
57
|
},
|
|
64
58
|
undefined,
|
|
65
59
|
]
|
|
66
60
|
}
|
|
67
|
-
themeIntent="
|
|
68
|
-
themeVariant="filled"
|
|
61
|
+
themeIntent="danger"
|
|
69
62
|
>
|
|
70
63
|
<Text
|
|
71
64
|
allowFontScaling={false}
|
|
@@ -80,7 +73,7 @@ exports[`Tag renders correctly when variant is filled and intent is info 1`] = `
|
|
|
80
73
|
},
|
|
81
74
|
Array [
|
|
82
75
|
Object {
|
|
83
|
-
"color": "#
|
|
76
|
+
"color": "#cb300a",
|
|
84
77
|
"includeFontPadding": false,
|
|
85
78
|
"textAlign": "center",
|
|
86
79
|
"textAlignVertical": "center",
|
|
@@ -91,30 +84,26 @@ exports[`Tag renders correctly when variant is filled and intent is info 1`] = `
|
|
|
91
84
|
}
|
|
92
85
|
themeFontWeight="semi-bold"
|
|
93
86
|
themeIntent="body"
|
|
94
|
-
themeVariant="filled"
|
|
95
87
|
>
|
|
96
|
-
|
|
88
|
+
DANGER
|
|
97
89
|
</Text>
|
|
98
90
|
</View>
|
|
99
91
|
`;
|
|
100
92
|
|
|
101
|
-
exports[`Tag renders correctly when
|
|
93
|
+
exports[`Tag renders correctly when intent is info 1`] = `
|
|
102
94
|
<View
|
|
103
95
|
style={
|
|
104
96
|
Array [
|
|
105
97
|
Object {
|
|
106
|
-
"backgroundColor":
|
|
107
|
-
"borderColor": undefined,
|
|
98
|
+
"backgroundColor": "#ecf0ff",
|
|
108
99
|
"borderRadius": 4,
|
|
109
|
-
"borderWidth": 1,
|
|
110
100
|
"paddingHorizontal": 8,
|
|
111
101
|
"paddingVertical": 4,
|
|
112
102
|
},
|
|
113
103
|
undefined,
|
|
114
104
|
]
|
|
115
105
|
}
|
|
116
|
-
themeIntent="
|
|
117
|
-
themeVariant="filled"
|
|
106
|
+
themeIntent="info"
|
|
118
107
|
>
|
|
119
108
|
<Text
|
|
120
109
|
allowFontScaling={false}
|
|
@@ -129,7 +118,7 @@ exports[`Tag renders correctly when variant is filled and intent is primary 1`]
|
|
|
129
118
|
},
|
|
130
119
|
Array [
|
|
131
120
|
Object {
|
|
132
|
-
"color": "#
|
|
121
|
+
"color": "#355bfb",
|
|
133
122
|
"includeFontPadding": false,
|
|
134
123
|
"textAlign": "center",
|
|
135
124
|
"textAlignVertical": "center",
|
|
@@ -140,30 +129,26 @@ exports[`Tag renders correctly when variant is filled and intent is primary 1`]
|
|
|
140
129
|
}
|
|
141
130
|
themeFontWeight="semi-bold"
|
|
142
131
|
themeIntent="body"
|
|
143
|
-
themeVariant="filled"
|
|
144
132
|
>
|
|
145
|
-
|
|
133
|
+
INFO
|
|
146
134
|
</Text>
|
|
147
135
|
</View>
|
|
148
136
|
`;
|
|
149
137
|
|
|
150
|
-
exports[`Tag renders correctly when
|
|
138
|
+
exports[`Tag renders correctly when intent is info 2`] = `
|
|
151
139
|
<View
|
|
152
140
|
style={
|
|
153
141
|
Array [
|
|
154
142
|
Object {
|
|
155
|
-
"backgroundColor": "#
|
|
156
|
-
"borderColor": "#fff6eb",
|
|
143
|
+
"backgroundColor": "#ecf0ff",
|
|
157
144
|
"borderRadius": 4,
|
|
158
|
-
"borderWidth": 1,
|
|
159
145
|
"paddingHorizontal": 8,
|
|
160
146
|
"paddingVertical": 4,
|
|
161
147
|
},
|
|
162
148
|
undefined,
|
|
163
149
|
]
|
|
164
150
|
}
|
|
165
|
-
themeIntent="
|
|
166
|
-
themeVariant="filled"
|
|
151
|
+
themeIntent="info"
|
|
167
152
|
>
|
|
168
153
|
<Text
|
|
169
154
|
allowFontScaling={false}
|
|
@@ -178,7 +163,7 @@ exports[`Tag renders correctly when variant is filled and intent is warning 1`]
|
|
|
178
163
|
},
|
|
179
164
|
Array [
|
|
180
165
|
Object {
|
|
181
|
-
"color": "#
|
|
166
|
+
"color": "#355bfb",
|
|
182
167
|
"includeFontPadding": false,
|
|
183
168
|
"textAlign": "center",
|
|
184
169
|
"textAlignVertical": "center",
|
|
@@ -189,30 +174,26 @@ exports[`Tag renders correctly when variant is filled and intent is warning 1`]
|
|
|
189
174
|
}
|
|
190
175
|
themeFontWeight="semi-bold"
|
|
191
176
|
themeIntent="body"
|
|
192
|
-
themeVariant="filled"
|
|
193
177
|
>
|
|
194
|
-
|
|
178
|
+
INFO
|
|
195
179
|
</Text>
|
|
196
180
|
</View>
|
|
197
181
|
`;
|
|
198
182
|
|
|
199
|
-
exports[`Tag renders correctly when
|
|
183
|
+
exports[`Tag renders correctly when intent is primary 1`] = `
|
|
200
184
|
<View
|
|
201
185
|
style={
|
|
202
186
|
Array [
|
|
203
187
|
Object {
|
|
204
|
-
"backgroundColor": "#
|
|
205
|
-
"borderColor": "#cb300a",
|
|
188
|
+
"backgroundColor": "#ece8ef",
|
|
206
189
|
"borderRadius": 4,
|
|
207
|
-
"borderWidth": 1,
|
|
208
190
|
"paddingHorizontal": 8,
|
|
209
191
|
"paddingVertical": 4,
|
|
210
192
|
},
|
|
211
193
|
undefined,
|
|
212
194
|
]
|
|
213
195
|
}
|
|
214
|
-
themeIntent="
|
|
215
|
-
themeVariant="outlined"
|
|
196
|
+
themeIntent="primary"
|
|
216
197
|
>
|
|
217
198
|
<Text
|
|
218
199
|
allowFontScaling={false}
|
|
@@ -227,7 +208,7 @@ exports[`Tag renders correctly when variant is outlined and intent is danger 1`]
|
|
|
227
208
|
},
|
|
228
209
|
Array [
|
|
229
210
|
Object {
|
|
230
|
-
"color": "#
|
|
211
|
+
"color": "#401960",
|
|
231
212
|
"includeFontPadding": false,
|
|
232
213
|
"textAlign": "center",
|
|
233
214
|
"textAlignVertical": "center",
|
|
@@ -238,30 +219,26 @@ exports[`Tag renders correctly when variant is outlined and intent is danger 1`]
|
|
|
238
219
|
}
|
|
239
220
|
themeFontWeight="semi-bold"
|
|
240
221
|
themeIntent="body"
|
|
241
|
-
themeVariant="outlined"
|
|
242
222
|
>
|
|
243
|
-
|
|
223
|
+
PRIMARY
|
|
244
224
|
</Text>
|
|
245
225
|
</View>
|
|
246
226
|
`;
|
|
247
227
|
|
|
248
|
-
exports[`Tag renders correctly when
|
|
228
|
+
exports[`Tag renders correctly when intent is primary 2`] = `
|
|
249
229
|
<View
|
|
250
230
|
style={
|
|
251
231
|
Array [
|
|
252
232
|
Object {
|
|
253
|
-
"backgroundColor": "#
|
|
254
|
-
"borderColor": "#355bfb",
|
|
233
|
+
"backgroundColor": "#ece8ef",
|
|
255
234
|
"borderRadius": 4,
|
|
256
|
-
"borderWidth": 1,
|
|
257
235
|
"paddingHorizontal": 8,
|
|
258
236
|
"paddingVertical": 4,
|
|
259
237
|
},
|
|
260
238
|
undefined,
|
|
261
239
|
]
|
|
262
240
|
}
|
|
263
|
-
themeIntent="
|
|
264
|
-
themeVariant="outlined"
|
|
241
|
+
themeIntent="primary"
|
|
265
242
|
>
|
|
266
243
|
<Text
|
|
267
244
|
allowFontScaling={false}
|
|
@@ -276,7 +253,7 @@ exports[`Tag renders correctly when variant is outlined and intent is info 1`] =
|
|
|
276
253
|
},
|
|
277
254
|
Array [
|
|
278
255
|
Object {
|
|
279
|
-
"color": "#
|
|
256
|
+
"color": "#401960",
|
|
280
257
|
"includeFontPadding": false,
|
|
281
258
|
"textAlign": "center",
|
|
282
259
|
"textAlignVertical": "center",
|
|
@@ -287,30 +264,26 @@ exports[`Tag renders correctly when variant is outlined and intent is info 1`] =
|
|
|
287
264
|
}
|
|
288
265
|
themeFontWeight="semi-bold"
|
|
289
266
|
themeIntent="body"
|
|
290
|
-
themeVariant="outlined"
|
|
291
267
|
>
|
|
292
|
-
|
|
268
|
+
PRIMARY
|
|
293
269
|
</Text>
|
|
294
270
|
</View>
|
|
295
271
|
`;
|
|
296
272
|
|
|
297
|
-
exports[`Tag renders correctly when
|
|
273
|
+
exports[`Tag renders correctly when intent is success 1`] = `
|
|
298
274
|
<View
|
|
299
275
|
style={
|
|
300
276
|
Array [
|
|
301
277
|
Object {
|
|
302
|
-
"backgroundColor":
|
|
303
|
-
"borderColor": "#001f23",
|
|
278
|
+
"backgroundColor": "#f0fef4",
|
|
304
279
|
"borderRadius": 4,
|
|
305
|
-
"borderWidth": 1,
|
|
306
280
|
"paddingHorizontal": 8,
|
|
307
281
|
"paddingVertical": 4,
|
|
308
282
|
},
|
|
309
283
|
undefined,
|
|
310
284
|
]
|
|
311
285
|
}
|
|
312
|
-
themeIntent="
|
|
313
|
-
themeVariant="outlined"
|
|
286
|
+
themeIntent="success"
|
|
314
287
|
>
|
|
315
288
|
<Text
|
|
316
289
|
allowFontScaling={false}
|
|
@@ -325,7 +298,7 @@ exports[`Tag renders correctly when variant is outlined and intent is primary 1`
|
|
|
325
298
|
},
|
|
326
299
|
Array [
|
|
327
300
|
Object {
|
|
328
|
-
"color": "#
|
|
301
|
+
"color": "#017d6d",
|
|
329
302
|
"includeFontPadding": false,
|
|
330
303
|
"textAlign": "center",
|
|
331
304
|
"textAlignVertical": "center",
|
|
@@ -336,30 +309,26 @@ exports[`Tag renders correctly when variant is outlined and intent is primary 1`
|
|
|
336
309
|
}
|
|
337
310
|
themeFontWeight="semi-bold"
|
|
338
311
|
themeIntent="body"
|
|
339
|
-
themeVariant="outlined"
|
|
340
312
|
>
|
|
341
|
-
|
|
313
|
+
SUCCESS
|
|
342
314
|
</Text>
|
|
343
315
|
</View>
|
|
344
316
|
`;
|
|
345
317
|
|
|
346
|
-
exports[`Tag renders correctly when
|
|
318
|
+
exports[`Tag renders correctly when intent is warning 1`] = `
|
|
347
319
|
<View
|
|
348
320
|
style={
|
|
349
321
|
Array [
|
|
350
322
|
Object {
|
|
351
|
-
"backgroundColor": "#
|
|
352
|
-
"borderColor": "#017d6d",
|
|
323
|
+
"backgroundColor": "#fff6eb",
|
|
353
324
|
"borderRadius": 4,
|
|
354
|
-
"borderWidth": 1,
|
|
355
325
|
"paddingHorizontal": 8,
|
|
356
326
|
"paddingVertical": 4,
|
|
357
327
|
},
|
|
358
328
|
undefined,
|
|
359
329
|
]
|
|
360
330
|
}
|
|
361
|
-
themeIntent="
|
|
362
|
-
themeVariant="outlined"
|
|
331
|
+
themeIntent="warning"
|
|
363
332
|
>
|
|
364
333
|
<Text
|
|
365
334
|
allowFontScaling={false}
|
|
@@ -374,7 +343,7 @@ exports[`Tag renders correctly when variant is outlined and intent is success 1`
|
|
|
374
343
|
},
|
|
375
344
|
Array [
|
|
376
345
|
Object {
|
|
377
|
-
"color": "#
|
|
346
|
+
"color": "#ac5d00",
|
|
378
347
|
"includeFontPadding": false,
|
|
379
348
|
"textAlign": "center",
|
|
380
349
|
"textAlignVertical": "center",
|
|
@@ -385,22 +354,19 @@ exports[`Tag renders correctly when variant is outlined and intent is success 1`
|
|
|
385
354
|
}
|
|
386
355
|
themeFontWeight="semi-bold"
|
|
387
356
|
themeIntent="body"
|
|
388
|
-
themeVariant="outlined"
|
|
389
357
|
>
|
|
390
|
-
|
|
358
|
+
WARNING
|
|
391
359
|
</Text>
|
|
392
360
|
</View>
|
|
393
361
|
`;
|
|
394
362
|
|
|
395
|
-
exports[`Tag renders correctly when
|
|
363
|
+
exports[`Tag renders correctly when intent is warning 2`] = `
|
|
396
364
|
<View
|
|
397
365
|
style={
|
|
398
366
|
Array [
|
|
399
367
|
Object {
|
|
400
368
|
"backgroundColor": "#fff6eb",
|
|
401
|
-
"borderColor": "#ac5d00",
|
|
402
369
|
"borderRadius": 4,
|
|
403
|
-
"borderWidth": 1,
|
|
404
370
|
"paddingHorizontal": 8,
|
|
405
371
|
"paddingVertical": 4,
|
|
406
372
|
},
|
|
@@ -408,7 +374,6 @@ exports[`Tag renders correctly when variant is outlined and intent is warning 1`
|
|
|
408
374
|
]
|
|
409
375
|
}
|
|
410
376
|
themeIntent="warning"
|
|
411
|
-
themeVariant="outlined"
|
|
412
377
|
>
|
|
413
378
|
<Text
|
|
414
379
|
allowFontScaling={false}
|
|
@@ -434,7 +399,6 @@ exports[`Tag renders correctly when variant is outlined and intent is warning 1`
|
|
|
434
399
|
}
|
|
435
400
|
themeFontWeight="semi-bold"
|
|
436
401
|
themeIntent="body"
|
|
437
|
-
themeVariant="outlined"
|
|
438
402
|
>
|
|
439
403
|
WARNING
|
|
440
404
|
</Text>
|
|
@@ -446,10 +410,8 @@ exports[`Tag renders correctly with custom content 1`] = `
|
|
|
446
410
|
style={
|
|
447
411
|
Array [
|
|
448
412
|
Object {
|
|
449
|
-
"backgroundColor":
|
|
450
|
-
"borderColor": "#001f23",
|
|
413
|
+
"backgroundColor": "#ece8ef",
|
|
451
414
|
"borderRadius": 4,
|
|
452
|
-
"borderWidth": 1,
|
|
453
415
|
"paddingHorizontal": 8,
|
|
454
416
|
"paddingVertical": 4,
|
|
455
417
|
},
|
|
@@ -457,7 +419,6 @@ exports[`Tag renders correctly with custom content 1`] = `
|
|
|
457
419
|
]
|
|
458
420
|
}
|
|
459
421
|
themeIntent="primary"
|
|
460
|
-
themeVariant="outlined"
|
|
461
422
|
>
|
|
462
423
|
<Text
|
|
463
424
|
allowFontScaling={false}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
3
3
|
import { StyledText, StyledView } from './StyledTag';
|
|
4
|
+
import { useDeprecation } from '../../utils/hooks';
|
|
4
5
|
|
|
5
6
|
interface TagProps extends ViewProps {
|
|
6
7
|
/**
|
|
@@ -12,6 +13,7 @@ interface TagProps extends ViewProps {
|
|
|
12
13
|
*/
|
|
13
14
|
intent?: 'primary' | 'info' | 'success' | 'warning' | 'danger' | 'archived';
|
|
14
15
|
/**
|
|
16
|
+
* @deprecated Tag variant prop is deprecated and will be removed in the next major release. Please remove it.
|
|
15
17
|
* Tag variant.
|
|
16
18
|
*/
|
|
17
19
|
variant?: 'filled' | 'outlined';
|
|
@@ -33,20 +35,20 @@ const Tag = ({
|
|
|
33
35
|
testID,
|
|
34
36
|
...nativeProps
|
|
35
37
|
}: TagProps): JSX.Element => {
|
|
38
|
+
useDeprecation(
|
|
39
|
+
`Tag's variant prop is deprecated and will be removed in the next major release. Please remove it.`,
|
|
40
|
+
variant !== undefined
|
|
41
|
+
);
|
|
42
|
+
|
|
36
43
|
return (
|
|
37
44
|
<StyledView
|
|
38
45
|
{...nativeProps}
|
|
39
46
|
themeIntent={intent}
|
|
40
|
-
themeVariant={variant}
|
|
41
47
|
style={style}
|
|
42
48
|
testID={testID}
|
|
43
49
|
>
|
|
44
50
|
{typeof content === 'string' ? (
|
|
45
|
-
<StyledText
|
|
46
|
-
themeIntent={intent}
|
|
47
|
-
themeVariant={variant}
|
|
48
|
-
fontWeight="semi-bold"
|
|
49
|
-
>
|
|
51
|
+
<StyledText themeIntent={intent} fontWeight="semi-bold">
|
|
50
52
|
{content}
|
|
51
53
|
</StyledText>
|
|
52
54
|
) : (
|
|
@@ -925,8 +925,8 @@ Object {
|
|
|
925
925
|
"dangerBackground": "#fcebe7",
|
|
926
926
|
"info": "#355bfb",
|
|
927
927
|
"infoBackground": "#ecf0ff",
|
|
928
|
-
"primary": "#
|
|
929
|
-
"primaryBackground":
|
|
928
|
+
"primary": "#401960",
|
|
929
|
+
"primaryBackground": "#ece8ef",
|
|
930
930
|
"success": "#017d6d",
|
|
931
931
|
"successBackground": "#f0fef4",
|
|
932
932
|
"text": "#001f23",
|
|
@@ -6,8 +6,8 @@ const getTagTheme = (theme: GlobalTheme) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
const colors = {
|
|
9
|
-
primary: theme.colors.
|
|
10
|
-
primaryBackground:
|
|
9
|
+
primary: theme.colors.primary,
|
|
10
|
+
primaryBackground: theme.colors.highlightedSurface,
|
|
11
11
|
info: theme.colors.onInfoSurface,
|
|
12
12
|
infoBackground: theme.colors.infoSurface,
|
|
13
13
|
success: theme.colors.onSuccessSurface,
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
type ThemeIntent = 'primary' | 'info' | 'success' | 'warning' | 'danger' | 'archived';
|
|
4
|
-
type ThemeVariant = 'filled' | 'outlined';
|
|
5
4
|
declare const StyledView: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
|
|
6
5
|
theme?: import("@emotion/react").Theme | undefined;
|
|
7
6
|
as?: import("react").ElementType<any> | undefined;
|
|
8
7
|
} & {
|
|
9
8
|
themeIntent: ThemeIntent;
|
|
10
|
-
themeVariant: ThemeVariant;
|
|
11
9
|
}, {}, {
|
|
12
10
|
ref?: import("react").Ref<View> | undefined;
|
|
13
11
|
}>;
|
|
@@ -16,6 +14,5 @@ declare const StyledText: import("@emotion/native").StyledComponent<import("../T
|
|
|
16
14
|
as?: import("react").ElementType<any> | undefined;
|
|
17
15
|
} & {
|
|
18
16
|
themeIntent: ThemeIntent;
|
|
19
|
-
themeVariant: ThemeVariant;
|
|
20
17
|
}, {}, {}>;
|
|
21
|
-
export {
|
|
18
|
+
export { StyledText, StyledView };
|
|
@@ -10,6 +10,7 @@ interface TagProps extends ViewProps {
|
|
|
10
10
|
*/
|
|
11
11
|
intent?: 'primary' | 'info' | 'success' | 'warning' | 'danger' | 'archived';
|
|
12
12
|
/**
|
|
13
|
+
* @deprecated Tag variant prop is deprecated and will be removed in the next major release. Please remove it.
|
|
13
14
|
* Tag variant.
|
|
14
15
|
*/
|
|
15
16
|
variant?: 'filled' | 'outlined';
|