@hero-design/rn 8.34.4 → 8.34.6

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 CHANGED
@@ -9,5 +9,6 @@ module.exports = {
9
9
  rules: {
10
10
  'no-underscore-dangle': [2, { allow: ['__hd__'] }],
11
11
  'import/no-cycle': 2,
12
+ '@hero-design/no-invalid-theme-access': 0,
12
13
  },
13
14
  };
@@ -4,5 +4,5 @@ $ rollup -c
4
4
  src/index.ts → lib/index.js, es/index.js...
5
5
  (!) 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`.
6
6
  (!) 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
7
- created lib/index.js, es/index.js in 24.7s
7
+ created lib/index.js, es/index.js in 23.8s
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.onDefaultGlobalSurface,
2878
- primaryBackground: undefined,
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,
@@ -11886,7 +11886,7 @@ var Carousel = function Carousel(_ref) {
11886
11886
  _ref$shouldShowPagina = _ref.shouldShowPagination,
11887
11887
  shouldShowPagination = _ref$shouldShowPagina === void 0 ? noop : _ref$shouldShowPagina,
11888
11888
  _ref$pageControlPosit = _ref.pageControlPosition,
11889
- pageControlPosition = _ref$pageControlPosit === void 0 ? 'bottom' : _ref$pageControlPosit,
11889
+ pageControlPosition = _ref$pageControlPosit === void 0 ? 'top' : _ref$pageControlPosit,
11890
11890
  nativeProps = _objectWithoutProperties(_ref, _excluded$h);
11891
11891
  useDeprecation("shouldShowPagination prop has been deprecated", shouldShowPagination !== noop);
11892
11892
  useDeprecation("The use of 'pageControlPosition == bottom' has been deprecated", pageControlPosition === 'bottom');
@@ -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
- borderWidth: theme.__hd__.tag.borderWidths["default"],
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 (_ref3) {
16628
- var themeIntent = _ref3.themeIntent,
16629
- themeVariant = _ref3.themeVariant,
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: textColor,
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.onDefaultGlobalSurface,
2909
- primaryBackground: undefined,
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,
@@ -11917,7 +11917,7 @@ var Carousel = function Carousel(_ref) {
11917
11917
  _ref$shouldShowPagina = _ref.shouldShowPagination,
11918
11918
  shouldShowPagination = _ref$shouldShowPagina === void 0 ? noop : _ref$shouldShowPagina,
11919
11919
  _ref$pageControlPosit = _ref.pageControlPosition,
11920
- pageControlPosition = _ref$pageControlPosit === void 0 ? 'bottom' : _ref$pageControlPosit,
11920
+ pageControlPosition = _ref$pageControlPosit === void 0 ? 'top' : _ref$pageControlPosit,
11921
11921
  nativeProps = _objectWithoutProperties(_ref, _excluded$h);
11922
11922
  useDeprecation("shouldShowPagination prop has been deprecated", shouldShowPagination !== noop);
11923
11923
  useDeprecation("The use of 'pageControlPosition == bottom' has been deprecated", pageControlPosition === 'bottom');
@@ -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
- borderWidth: theme.__hd__.tag.borderWidths["default"],
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 (_ref3) {
16659
- var themeIntent = _ref3.themeIntent,
16660
- themeVariant = _ref3.themeVariant,
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: textColor,
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.4",
3
+ "version": "8.34.6",
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.4",
24
+ "@hero-design/colors": "8.34.6",
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.4",
30
+ "@hero-design/react-native-month-year-picker": "^8.34.6",
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.4",
51
- "@hero-design/react-native-month-year-picker": "^8.34.4",
50
+ "@hero-design/eslint-plugin": "8.34.6",
51
+ "@hero-design/react-native-month-year-picker": "^8.34.6",
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.4",
67
+ "eslint-config-hd": "8.34.6",
68
68
  "eslint-plugin-import": "^2.27.5",
69
69
  "jest": "^27.3.1",
70
- "prettier-config-hd": "8.34.4",
70
+ "prettier-config-hd": "8.34.6",
71
71
  "react": "18.0.0",
72
72
  "react-native": "0.69.7",
73
73
  "react-native-gesture-handler": "~2.5.0",
@@ -1488,7 +1488,81 @@ exports[`Carousel should call skip call back when press skip 1`] = `
1488
1488
  undefined,
1489
1489
  ]
1490
1490
  }
1491
- />
1491
+ >
1492
+ <View
1493
+ style={
1494
+ Array [
1495
+ Object {
1496
+ "alignItems": "center",
1497
+ "flexDirection": "row",
1498
+ },
1499
+ Array [
1500
+ Object {
1501
+ "paddingVertical": 8,
1502
+ },
1503
+ undefined,
1504
+ ],
1505
+ ]
1506
+ }
1507
+ >
1508
+ <View
1509
+ collapsable={false}
1510
+ style={
1511
+ Object {
1512
+ "backgroundColor": "#401960",
1513
+ "borderRadius": 999,
1514
+ "height": 8,
1515
+ "marginHorizontal": 8,
1516
+ "opacity": 1,
1517
+ "width": 24,
1518
+ }
1519
+ }
1520
+ testID="page-control-indicator0"
1521
+ />
1522
+ <View
1523
+ collapsable={false}
1524
+ style={
1525
+ Object {
1526
+ "backgroundColor": "#401960",
1527
+ "borderRadius": 999,
1528
+ "height": 8,
1529
+ "marginHorizontal": 8,
1530
+ "opacity": 0.5,
1531
+ "width": 8,
1532
+ }
1533
+ }
1534
+ testID="page-control-indicator1"
1535
+ />
1536
+ <View
1537
+ collapsable={false}
1538
+ style={
1539
+ Object {
1540
+ "backgroundColor": "#401960",
1541
+ "borderRadius": 999,
1542
+ "height": 8,
1543
+ "marginHorizontal": 8,
1544
+ "opacity": 0.5,
1545
+ "width": 8,
1546
+ }
1547
+ }
1548
+ testID="page-control-indicator2"
1549
+ />
1550
+ <View
1551
+ collapsable={false}
1552
+ style={
1553
+ Object {
1554
+ "backgroundColor": "#401960",
1555
+ "borderRadius": 999,
1556
+ "height": 8,
1557
+ "marginHorizontal": 8,
1558
+ "opacity": 0.5,
1559
+ "width": 8,
1560
+ }
1561
+ }
1562
+ testID="page-control-indicator3"
1563
+ />
1564
+ </View>
1565
+ </View>
1492
1566
  <View
1493
1567
  style={
1494
1568
  Array [
@@ -2107,79 +2181,6 @@ exports[`Carousel should call skip call back when press skip 1`] = `
2107
2181
  Skip
2108
2182
  </Text>
2109
2183
  </View>
2110
- <View
2111
- style={
2112
- Array [
2113
- Object {
2114
- "alignItems": "center",
2115
- "flexDirection": "row",
2116
- },
2117
- Array [
2118
- Object {
2119
- "paddingVertical": 8,
2120
- },
2121
- undefined,
2122
- ],
2123
- ]
2124
- }
2125
- >
2126
- <View
2127
- collapsable={false}
2128
- style={
2129
- Object {
2130
- "backgroundColor": "#401960",
2131
- "borderRadius": 999,
2132
- "height": 8,
2133
- "marginHorizontal": 8,
2134
- "opacity": 1,
2135
- "width": 24,
2136
- }
2137
- }
2138
- testID="page-control-indicator0"
2139
- />
2140
- <View
2141
- collapsable={false}
2142
- style={
2143
- Object {
2144
- "backgroundColor": "#401960",
2145
- "borderRadius": 999,
2146
- "height": 8,
2147
- "marginHorizontal": 8,
2148
- "opacity": 0.5,
2149
- "width": 8,
2150
- }
2151
- }
2152
- testID="page-control-indicator1"
2153
- />
2154
- <View
2155
- collapsable={false}
2156
- style={
2157
- Object {
2158
- "backgroundColor": "#401960",
2159
- "borderRadius": 999,
2160
- "height": 8,
2161
- "marginHorizontal": 8,
2162
- "opacity": 0.5,
2163
- "width": 8,
2164
- }
2165
- }
2166
- testID="page-control-indicator2"
2167
- />
2168
- <View
2169
- collapsable={false}
2170
- style={
2171
- Object {
2172
- "backgroundColor": "#401960",
2173
- "borderRadius": 999,
2174
- "height": 8,
2175
- "marginHorizontal": 8,
2176
- "opacity": 0.5,
2177
- "width": 8,
2178
- }
2179
- }
2180
- testID="page-control-indicator3"
2181
- />
2182
- </View>
2183
2184
  </View>
2184
2185
  </View>
2185
2186
  </View>
@@ -87,7 +87,7 @@ const Carousel = ({
87
87
  selectedItemIndex = 0,
88
88
  style,
89
89
  shouldShowPagination = noop,
90
- pageControlPosition = 'bottom',
90
+ pageControlPosition = 'top',
91
91
  ...nativeProps
92
92
  }: CarouselProps) => {
93
93
  useDeprecation(
@@ -1,6 +1,5 @@
1
- import { View } from 'react-native';
2
1
  import styled from '@emotion/native';
3
- import { Theme } from '../../theme';
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
- themeVariant: ThemeVariant;
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
- borderWidth: theme.__hd__.tag.borderWidths.default,
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
- themeVariant: ThemeVariant;
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: textColor,
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 { StyledView, StyledText };
35
+ export { StyledText, StyledView };
@@ -5,21 +5,21 @@ import Typography from '../../Typography';
5
5
 
6
6
  describe('Tag', () => {
7
7
  it.each`
8
- variant | intent | content | expected
9
- ${'outlined'} | ${'success'} | ${'SUCCESS'} | ${'SUCCESS'}
10
- ${'outlined'} | ${'warning'} | ${'WARNING'} | ${'WARNING'}
11
- ${'outlined'} | ${'danger'} | ${'DANGER'} | ${'DANGER'}
12
- ${'outlined'} | ${'info'} | ${'INFO'} | ${'INFO'}
13
- ${'outlined'} | ${'primary'} | ${'PRIMARY'} | ${'PRIMARY'}
14
- ${'filled'} | ${'warning'} | ${'WARNING'} | ${'WARNING'}
15
- ${'filled'} | ${'danger'} | ${'DANGER'} | ${'DANGER'}
16
- ${'filled'} | ${'info'} | ${'INFO'} | ${'INFO'}
17
- ${'filled'} | ${'primary'} | ${'PRIMARY'} | ${'PRIMARY'}
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 variant is $variant and intent is $intent',
20
- ({ variant, intent, content, expected }) => {
19
+ 'renders correctly when intent is $intent',
20
+ ({ intent, content, expected }) => {
21
21
  const { getByText, toJSON } = renderWithTheme(
22
- <Tag content={content} intent={intent} variant={variant} />
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 variant is filled and intent is danger 1`] = `
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 variant is filled and intent is info 1`] = `
48
+ exports[`Tag renders correctly when intent is danger 2`] = `
53
49
  <View
54
50
  style={
55
51
  Array [
56
52
  Object {
57
- "backgroundColor": "#ecf0ff",
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="info"
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": "#355bfb",
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
- INFO
88
+ DANGER
97
89
  </Text>
98
90
  </View>
99
91
  `;
100
92
 
101
- exports[`Tag renders correctly when variant is filled and intent is primary 1`] = `
93
+ exports[`Tag renders correctly when intent is info 1`] = `
102
94
  <View
103
95
  style={
104
96
  Array [
105
97
  Object {
106
- "backgroundColor": undefined,
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="primary"
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": "#001f23",
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
- PRIMARY
133
+ INFO
146
134
  </Text>
147
135
  </View>
148
136
  `;
149
137
 
150
- exports[`Tag renders correctly when variant is filled and intent is warning 1`] = `
138
+ exports[`Tag renders correctly when intent is info 2`] = `
151
139
  <View
152
140
  style={
153
141
  Array [
154
142
  Object {
155
- "backgroundColor": "#fff6eb",
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="warning"
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": "#ac5d00",
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
- WARNING
178
+ INFO
195
179
  </Text>
196
180
  </View>
197
181
  `;
198
182
 
199
- exports[`Tag renders correctly when variant is outlined and intent is danger 1`] = `
183
+ exports[`Tag renders correctly when intent is primary 1`] = `
200
184
  <View
201
185
  style={
202
186
  Array [
203
187
  Object {
204
- "backgroundColor": "#fcebe7",
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="danger"
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": "#cb300a",
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
- DANGER
223
+ PRIMARY
244
224
  </Text>
245
225
  </View>
246
226
  `;
247
227
 
248
- exports[`Tag renders correctly when variant is outlined and intent is info 1`] = `
228
+ exports[`Tag renders correctly when intent is primary 2`] = `
249
229
  <View
250
230
  style={
251
231
  Array [
252
232
  Object {
253
- "backgroundColor": "#ecf0ff",
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="info"
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": "#355bfb",
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
- INFO
268
+ PRIMARY
293
269
  </Text>
294
270
  </View>
295
271
  `;
296
272
 
297
- exports[`Tag renders correctly when variant is outlined and intent is primary 1`] = `
273
+ exports[`Tag renders correctly when intent is success 1`] = `
298
274
  <View
299
275
  style={
300
276
  Array [
301
277
  Object {
302
- "backgroundColor": undefined,
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="primary"
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": "#001f23",
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
- PRIMARY
313
+ SUCCESS
342
314
  </Text>
343
315
  </View>
344
316
  `;
345
317
 
346
- exports[`Tag renders correctly when variant is outlined and intent is success 1`] = `
318
+ exports[`Tag renders correctly when intent is warning 1`] = `
347
319
  <View
348
320
  style={
349
321
  Array [
350
322
  Object {
351
- "backgroundColor": "#f0fef4",
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="success"
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": "#017d6d",
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
- SUCCESS
358
+ WARNING
391
359
  </Text>
392
360
  </View>
393
361
  `;
394
362
 
395
- exports[`Tag renders correctly when variant is outlined and intent is warning 1`] = `
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": undefined,
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": "#001f23",
929
- "primaryBackground": undefined,
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.onDefaultGlobalSurface,
10
- primaryBackground: undefined,
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 { StyledView, StyledText };
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';
@@ -5,7 +5,7 @@ declare const getTagTheme: (theme: GlobalTheme) => {
5
5
  };
6
6
  colors: {
7
7
  primary: string;
8
- primaryBackground: undefined;
8
+ primaryBackground: string;
9
9
  info: string;
10
10
  infoBackground: string;
11
11
  success: string;