@hero-design/rn 8.119.0 → 8.120.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.120.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#4874](https://github.com/Thinkei/hero-design/pull/4874) [`c3c35f0c8d2825138330aaae0ae383b624b8e067`](https://github.com/Thinkei/hero-design/commit/c3c35f0c8d2825138330aaae0ae383b624b8e067) Thanks [@ttkien](https://github.com/ttkien)! - [BottomNavigation] add badge count
8
+
9
+ ## 8.119.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#4871](https://github.com/Thinkei/hero-design/pull/4871) [`bc9741dbf1dcb5a8176a14bfe85c19a70c50d283`](https://github.com/Thinkei/hero-design/commit/bc9741dbf1dcb5a8176a14bfe85c19a70c50d283) Thanks [@ngvuthanhnhan-eh-hi](https://github.com/ngvuthanhnhan-eh-hi)! - [Tag] Update border-radius from 4px (`radii.base`) to 12px (`radii.large`)
14
+
15
+ - [#4872](https://github.com/Thinkei/hero-design/pull/4872) [`611662ff1d9a1ebe799a6c4a06935b51d6795da2`](https://github.com/Thinkei/hero-design/commit/611662ff1d9a1ebe799a6c4a06935b51d6795da2) Thanks [@ngvuthanhnhan-eh-hi](https://github.com/ngvuthanhnhan-eh-hi)! - [Badge] Align string-Badge intent colors with surface-based token
16
+
3
17
  ## 8.119.0
4
18
 
5
19
  ### Minor Changes
package/es/index.js CHANGED
@@ -5604,7 +5604,23 @@ var getBadgeTheme = function getBadgeTheme(theme) {
5604
5604
  archived: theme.colors.onArchivedSurface,
5605
5605
  text: theme.colors.onDarkGlobalSurface,
5606
5606
  border: theme.colors.defaultGlobalSurface,
5607
- countText: theme.colors.onDarkGlobalSurface
5607
+ countText: theme.colors.onDarkGlobalSurface,
5608
+ stringBackground: {
5609
+ primary: theme.colors.highlightedSurface,
5610
+ danger: theme.colors.errorSurface,
5611
+ info: theme.colors.infoSurface,
5612
+ success: theme.colors.successSurface,
5613
+ warning: theme.colors.warningSurface,
5614
+ archived: theme.colors.archivedSurface
5615
+ },
5616
+ stringText: {
5617
+ primary: theme.colors.primary,
5618
+ danger: theme.colors.onErrorSurface,
5619
+ info: theme.colors.onInfoSurface,
5620
+ success: theme.colors.onSuccessSurface,
5621
+ warning: theme.colors.onWarningSurface,
5622
+ archived: theme.colors.onArchivedSurface
5623
+ }
5608
5624
  };
5609
5625
  var fonts = {
5610
5626
  medium: theme.fonts.neutral.regular,
@@ -7098,7 +7114,7 @@ var getTagTheme = function getTagTheme(theme) {
7098
7114
  verticalPadding: theme.space.xsmall
7099
7115
  };
7100
7116
  var radii = {
7101
- "default": theme.radii.base
7117
+ "default": theme.radii.large
7102
7118
  };
7103
7119
  return {
7104
7120
  borderWidths: borderWidths,
@@ -10046,27 +10062,31 @@ var StyledView$2 = index$c(Animated.View)(function (_ref) {
10046
10062
  themePadding = _ref.themePadding,
10047
10063
  themeSize = _ref.themeSize,
10048
10064
  themeVariant = _ref.themeVariant,
10065
+ themeIsStringBadge = _ref.themeIsStringBadge,
10049
10066
  theme = _ref.theme;
10067
+ var backgroundColor = themeIsStringBadge ? theme.__hd__.badge.colors.stringBackground[themeIntent] : theme.__hd__.badge.colors[themeIntent];
10050
10068
  return {
10051
10069
  height: theme.__hd__.badge.sizes[themeSize].height,
10052
10070
  minWidth: theme.__hd__.badge.sizes[themeSize].minWidth,
10053
10071
  alignItems: 'center',
10054
10072
  justifyContent: 'center',
10055
- backgroundColor: theme.__hd__.badge.colors[themeIntent],
10073
+ backgroundColor: backgroundColor,
10056
10074
  borderRadius: theme.radii.rounded,
10057
10075
  paddingHorizontal: themePadding === 'wideContent' ? theme.__hd__.badge.space[themeSize].horizontalPadding : undefined,
10058
10076
  borderWidth: theme.__hd__.badge.borderWidths["default"],
10059
- borderColor: themeVariant === 'outlined' ? theme.__hd__.badge.colors.border : theme.__hd__.badge.colors[themeIntent]
10077
+ borderColor: themeVariant === 'outlined' ? theme.__hd__.badge.colors.border : backgroundColor
10060
10078
  };
10061
10079
  });
10062
10080
  var StyledText$2 = index$c(Typography.Caption)(function (_ref2) {
10063
10081
  var theme = _ref2.theme,
10064
- themeSize = _ref2.themeSize;
10082
+ themeSize = _ref2.themeSize,
10083
+ themeIntent = _ref2.themeIntent,
10084
+ themeIsStringBadge = _ref2.themeIsStringBadge;
10065
10085
  return {
10066
10086
  fontSize: theme.__hd__.badge.fontSizes[themeSize],
10067
10087
  lineHeight: theme.__hd__.badge.lineHeights[themeSize],
10068
10088
  fontFamily: theme.__hd__.badge.fonts[themeSize],
10069
- color: theme.__hd__.badge.colors.text,
10089
+ color: themeIsStringBadge ? theme.__hd__.badge.colors.stringText[themeIntent] : theme.__hd__.badge.colors.text,
10070
10090
  includeFontPadding: false,
10071
10091
  textAlignVertical: 'center',
10072
10092
  textAlign: 'center'
@@ -10224,6 +10244,7 @@ var Badge$1 = function Badge(_ref) {
10224
10244
  }).start();
10225
10245
  }, [visible, opacity]);
10226
10246
  var isIconBadge = !!icon;
10247
+ var isStringBadge = !isIconBadge && typeof originalContent === 'string';
10227
10248
  var content = useMemo(function () {
10228
10249
  if (isIconBadge) {
10229
10250
  return '';
@@ -10235,6 +10256,7 @@ var Badge$1 = function Badge(_ref) {
10235
10256
  themePadding: getPaddingState(content),
10236
10257
  themeSize: size,
10237
10258
  themeVariant: variant,
10259
+ themeIsStringBadge: isStringBadge,
10238
10260
  style: [{
10239
10261
  opacity: opacity,
10240
10262
  transform: [{
@@ -10250,7 +10272,9 @@ var Badge$1 = function Badge(_ref) {
10250
10272
  themeSize: size,
10251
10273
  intent: "text-inverted"
10252
10274
  }) : /*#__PURE__*/React__default.createElement(StyledText$2, {
10253
- themeSize: size
10275
+ themeSize: size,
10276
+ themeIntent: intent,
10277
+ themeIsStringBadge: isStringBadge
10254
10278
  }, content));
10255
10279
  };
10256
10280
  var Badge = Object.assign(Badge$1, {
@@ -10375,10 +10399,12 @@ var BottomNavigation = function BottomNavigation(_ref) {
10375
10399
  })), /*#__PURE__*/React__default.createElement(BottomBarWrapper, {
10376
10400
  themeInsets: insets
10377
10401
  }, /*#__PURE__*/React__default.createElement(BottomBar, null, tabs.map(function (tab) {
10402
+ var _badge$count, _badge$testID;
10378
10403
  var key = tab.key,
10379
10404
  icon = tab.icon,
10380
10405
  title = tab.title,
10381
- testID = tab.testID;
10406
+ testID = tab.testID,
10407
+ badge = tab.badge;
10382
10408
  var active = selectedTabKey === key;
10383
10409
  var inactiveIcon = getInactiveIcon(icon);
10384
10410
  return /*#__PURE__*/React__default.createElement(TouchableWithoutFeedback, {
@@ -10387,11 +10413,16 @@ var BottomNavigation = function BottomNavigation(_ref) {
10387
10413
  return onTabPress(key);
10388
10414
  },
10389
10415
  testID: testID
10390
- }, /*#__PURE__*/React__default.createElement(BottomBarItem, null, /*#__PURE__*/React__default.createElement(Icon, {
10416
+ }, /*#__PURE__*/React__default.createElement(BottomBarItem, null, /*#__PURE__*/React__default.createElement(Status, {
10417
+ content: (_badge$count = badge === null || badge === void 0 ? void 0 : badge.count) !== null && _badge$count !== void 0 ? _badge$count : 0,
10418
+ visible: !!badge && badge.count > 0,
10419
+ max: badge === null || badge === void 0 ? void 0 : badge.max,
10420
+ testID: (_badge$testID = badge === null || badge === void 0 ? void 0 : badge.testID) !== null && _badge$testID !== void 0 ? _badge$testID : "bottom-nav-badge-".concat(key)
10421
+ }, /*#__PURE__*/React__default.createElement(Icon, {
10391
10422
  icon: active ? icon : inactiveIcon,
10392
10423
  intent: active ? 'primary' : 'muted',
10393
10424
  testID: "hero-icon-".concat(icon)
10394
- }), !!title && /*#__PURE__*/React__default.createElement(StyledBottomBarText, {
10425
+ })), !!title && /*#__PURE__*/React__default.createElement(StyledBottomBarText, {
10395
10426
  intent: active ? 'primary' : 'muted',
10396
10427
  numberOfLines: 1
10397
10428
  }, title)));
package/lib/index.js CHANGED
@@ -5633,7 +5633,23 @@ var getBadgeTheme = function getBadgeTheme(theme) {
5633
5633
  archived: theme.colors.onArchivedSurface,
5634
5634
  text: theme.colors.onDarkGlobalSurface,
5635
5635
  border: theme.colors.defaultGlobalSurface,
5636
- countText: theme.colors.onDarkGlobalSurface
5636
+ countText: theme.colors.onDarkGlobalSurface,
5637
+ stringBackground: {
5638
+ primary: theme.colors.highlightedSurface,
5639
+ danger: theme.colors.errorSurface,
5640
+ info: theme.colors.infoSurface,
5641
+ success: theme.colors.successSurface,
5642
+ warning: theme.colors.warningSurface,
5643
+ archived: theme.colors.archivedSurface
5644
+ },
5645
+ stringText: {
5646
+ primary: theme.colors.primary,
5647
+ danger: theme.colors.onErrorSurface,
5648
+ info: theme.colors.onInfoSurface,
5649
+ success: theme.colors.onSuccessSurface,
5650
+ warning: theme.colors.onWarningSurface,
5651
+ archived: theme.colors.onArchivedSurface
5652
+ }
5637
5653
  };
5638
5654
  var fonts = {
5639
5655
  medium: theme.fonts.neutral.regular,
@@ -7127,7 +7143,7 @@ var getTagTheme = function getTagTheme(theme) {
7127
7143
  verticalPadding: theme.space.xsmall
7128
7144
  };
7129
7145
  var radii = {
7130
- "default": theme.radii.base
7146
+ "default": theme.radii.large
7131
7147
  };
7132
7148
  return {
7133
7149
  borderWidths: borderWidths,
@@ -10075,27 +10091,31 @@ var StyledView$2 = index$c(reactNative.Animated.View)(function (_ref) {
10075
10091
  themePadding = _ref.themePadding,
10076
10092
  themeSize = _ref.themeSize,
10077
10093
  themeVariant = _ref.themeVariant,
10094
+ themeIsStringBadge = _ref.themeIsStringBadge,
10078
10095
  theme = _ref.theme;
10096
+ var backgroundColor = themeIsStringBadge ? theme.__hd__.badge.colors.stringBackground[themeIntent] : theme.__hd__.badge.colors[themeIntent];
10079
10097
  return {
10080
10098
  height: theme.__hd__.badge.sizes[themeSize].height,
10081
10099
  minWidth: theme.__hd__.badge.sizes[themeSize].minWidth,
10082
10100
  alignItems: 'center',
10083
10101
  justifyContent: 'center',
10084
- backgroundColor: theme.__hd__.badge.colors[themeIntent],
10102
+ backgroundColor: backgroundColor,
10085
10103
  borderRadius: theme.radii.rounded,
10086
10104
  paddingHorizontal: themePadding === 'wideContent' ? theme.__hd__.badge.space[themeSize].horizontalPadding : undefined,
10087
10105
  borderWidth: theme.__hd__.badge.borderWidths["default"],
10088
- borderColor: themeVariant === 'outlined' ? theme.__hd__.badge.colors.border : theme.__hd__.badge.colors[themeIntent]
10106
+ borderColor: themeVariant === 'outlined' ? theme.__hd__.badge.colors.border : backgroundColor
10089
10107
  };
10090
10108
  });
10091
10109
  var StyledText$2 = index$c(Typography.Caption)(function (_ref2) {
10092
10110
  var theme = _ref2.theme,
10093
- themeSize = _ref2.themeSize;
10111
+ themeSize = _ref2.themeSize,
10112
+ themeIntent = _ref2.themeIntent,
10113
+ themeIsStringBadge = _ref2.themeIsStringBadge;
10094
10114
  return {
10095
10115
  fontSize: theme.__hd__.badge.fontSizes[themeSize],
10096
10116
  lineHeight: theme.__hd__.badge.lineHeights[themeSize],
10097
10117
  fontFamily: theme.__hd__.badge.fonts[themeSize],
10098
- color: theme.__hd__.badge.colors.text,
10118
+ color: themeIsStringBadge ? theme.__hd__.badge.colors.stringText[themeIntent] : theme.__hd__.badge.colors.text,
10099
10119
  includeFontPadding: false,
10100
10120
  textAlignVertical: 'center',
10101
10121
  textAlign: 'center'
@@ -10253,6 +10273,7 @@ var Badge = function Badge(_ref) {
10253
10273
  }).start();
10254
10274
  }, [visible, opacity]);
10255
10275
  var isIconBadge = !!icon;
10276
+ var isStringBadge = !isIconBadge && typeof originalContent === 'string';
10256
10277
  var content = React.useMemo(function () {
10257
10278
  if (isIconBadge) {
10258
10279
  return '';
@@ -10264,6 +10285,7 @@ var Badge = function Badge(_ref) {
10264
10285
  themePadding: getPaddingState(content),
10265
10286
  themeSize: size,
10266
10287
  themeVariant: variant,
10288
+ themeIsStringBadge: isStringBadge,
10267
10289
  style: [{
10268
10290
  opacity: opacity,
10269
10291
  transform: [{
@@ -10279,7 +10301,9 @@ var Badge = function Badge(_ref) {
10279
10301
  themeSize: size,
10280
10302
  intent: "text-inverted"
10281
10303
  }) : /*#__PURE__*/React__namespace.default.createElement(StyledText$2, {
10282
- themeSize: size
10304
+ themeSize: size,
10305
+ themeIntent: intent,
10306
+ themeIsStringBadge: isStringBadge
10283
10307
  }, content));
10284
10308
  };
10285
10309
  var Badge$1 = Object.assign(Badge, {
@@ -10404,10 +10428,12 @@ var BottomNavigation = function BottomNavigation(_ref) {
10404
10428
  })), /*#__PURE__*/React__namespace.default.createElement(BottomBarWrapper, {
10405
10429
  themeInsets: insets
10406
10430
  }, /*#__PURE__*/React__namespace.default.createElement(BottomBar, null, tabs.map(function (tab) {
10431
+ var _badge$count, _badge$testID;
10407
10432
  var key = tab.key,
10408
10433
  icon = tab.icon,
10409
10434
  title = tab.title,
10410
- testID = tab.testID;
10435
+ testID = tab.testID,
10436
+ badge = tab.badge;
10411
10437
  var active = selectedTabKey === key;
10412
10438
  var inactiveIcon = getInactiveIcon(icon);
10413
10439
  return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableWithoutFeedback, {
@@ -10416,11 +10442,16 @@ var BottomNavigation = function BottomNavigation(_ref) {
10416
10442
  return onTabPress(key);
10417
10443
  },
10418
10444
  testID: testID
10419
- }, /*#__PURE__*/React__namespace.default.createElement(BottomBarItem, null, /*#__PURE__*/React__namespace.default.createElement(Icon, {
10445
+ }, /*#__PURE__*/React__namespace.default.createElement(BottomBarItem, null, /*#__PURE__*/React__namespace.default.createElement(Status, {
10446
+ content: (_badge$count = badge === null || badge === void 0 ? void 0 : badge.count) !== null && _badge$count !== void 0 ? _badge$count : 0,
10447
+ visible: !!badge && badge.count > 0,
10448
+ max: badge === null || badge === void 0 ? void 0 : badge.max,
10449
+ testID: (_badge$testID = badge === null || badge === void 0 ? void 0 : badge.testID) !== null && _badge$testID !== void 0 ? _badge$testID : "bottom-nav-badge-".concat(key)
10450
+ }, /*#__PURE__*/React__namespace.default.createElement(Icon, {
10420
10451
  icon: active ? icon : inactiveIcon,
10421
10452
  intent: active ? 'primary' : 'muted',
10422
10453
  testID: "hero-icon-".concat(icon)
10423
- }), !!title && /*#__PURE__*/React__namespace.default.createElement(StyledBottomBarText, {
10454
+ })), !!title && /*#__PURE__*/React__namespace.default.createElement(StyledBottomBarText, {
10424
10455
  intent: active ? 'primary' : 'muted',
10425
10456
  numberOfLines: 1
10426
10457
  }, title)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.119.0",
3
+ "version": "8.120.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -22,31 +22,50 @@ const StyledView = styled(Animated.View)<{
22
22
  themePadding: ThemePadding;
23
23
  themeSize: ThemeSize;
24
24
  themeVariant: ThemeVariant;
25
- }>(({ themeIntent, themePadding, themeSize, themeVariant, theme }) => ({
26
- height: theme.__hd__.badge.sizes[themeSize].height,
27
- minWidth: theme.__hd__.badge.sizes[themeSize].minWidth,
28
- alignItems: 'center',
29
- justifyContent: 'center',
30
- backgroundColor: theme.__hd__.badge.colors[themeIntent],
31
- borderRadius: theme.radii.rounded,
32
- paddingHorizontal:
33
- themePadding === 'wideContent'
34
- ? theme.__hd__.badge.space[themeSize].horizontalPadding
35
- : undefined,
36
- borderWidth: theme.__hd__.badge.borderWidths.default,
37
- borderColor:
38
- themeVariant === 'outlined'
39
- ? theme.__hd__.badge.colors.border
40
- : theme.__hd__.badge.colors[themeIntent],
41
- }));
25
+ themeIsStringBadge: boolean;
26
+ }>(
27
+ ({
28
+ themeIntent,
29
+ themePadding,
30
+ themeSize,
31
+ themeVariant,
32
+ themeIsStringBadge,
33
+ theme,
34
+ }) => {
35
+ const backgroundColor = themeIsStringBadge
36
+ ? theme.__hd__.badge.colors.stringBackground[themeIntent]
37
+ : theme.__hd__.badge.colors[themeIntent];
38
+ return {
39
+ height: theme.__hd__.badge.sizes[themeSize].height,
40
+ minWidth: theme.__hd__.badge.sizes[themeSize].minWidth,
41
+ alignItems: 'center',
42
+ justifyContent: 'center',
43
+ backgroundColor,
44
+ borderRadius: theme.radii.rounded,
45
+ paddingHorizontal:
46
+ themePadding === 'wideContent'
47
+ ? theme.__hd__.badge.space[themeSize].horizontalPadding
48
+ : undefined,
49
+ borderWidth: theme.__hd__.badge.borderWidths.default,
50
+ borderColor:
51
+ themeVariant === 'outlined'
52
+ ? theme.__hd__.badge.colors.border
53
+ : backgroundColor,
54
+ };
55
+ }
56
+ );
42
57
 
43
58
  const StyledText = styled(Typography.Caption)<{
44
59
  themeSize: ThemeSize;
45
- }>(({ theme, themeSize }) => ({
60
+ themeIntent: ThemeIntent;
61
+ themeIsStringBadge: boolean;
62
+ }>(({ theme, themeSize, themeIntent, themeIsStringBadge }) => ({
46
63
  fontSize: theme.__hd__.badge.fontSizes[themeSize],
47
64
  lineHeight: theme.__hd__.badge.lineHeights[themeSize],
48
65
  fontFamily: theme.__hd__.badge.fonts[themeSize],
49
- color: theme.__hd__.badge.colors.text,
66
+ color: themeIsStringBadge
67
+ ? theme.__hd__.badge.colors.stringText[themeIntent]
68
+ : theme.__hd__.badge.colors.text,
50
69
  includeFontPadding: false,
51
70
  textAlignVertical: 'center',
52
71
  textAlign: 'center',
@@ -44,6 +44,7 @@ const Badge = ({
44
44
  }, [visible, opacity]);
45
45
 
46
46
  const isIconBadge = !!icon;
47
+ const isStringBadge = !isIconBadge && typeof originalContent === 'string';
47
48
 
48
49
  const content = useMemo(() => {
49
50
  if (isIconBadge) {
@@ -61,6 +62,7 @@ const Badge = ({
61
62
  themePadding={getPaddingState(content)}
62
63
  themeSize={size}
63
64
  themeVariant={variant}
65
+ themeIsStringBadge={isStringBadge}
64
66
  style={[
65
67
  {
66
68
  opacity,
@@ -80,7 +82,13 @@ const Badge = ({
80
82
  {isIconBadge ? (
81
83
  <StyledIcon icon={icon} themeSize={size} intent="text-inverted" />
82
84
  ) : (
83
- <StyledText themeSize={size}>{content}</StyledText>
85
+ <StyledText
86
+ themeSize={size}
87
+ themeIntent={intent}
88
+ themeIsStringBadge={isStringBadge}
89
+ >
90
+ {content}
91
+ </StyledText>
84
92
  )}
85
93
  </StyledView>
86
94
  );
@@ -16,6 +16,7 @@ import {
16
16
  } from './StyledBottomNavigation';
17
17
  import { isIOS } from '../../utils/helpers';
18
18
  import type { IconName } from '../Icon';
19
+ import Count from '../Badge/Count';
19
20
 
20
21
  export type BottomNavigationTabType = {
21
22
  key: string;
@@ -23,8 +24,18 @@ export type BottomNavigationTabType = {
23
24
  icon: IconName;
24
25
  component: ReactNode;
25
26
  testID?: string;
27
+ /**
28
+ * Badge to display on the tab icon.
29
+ */
30
+ badge?: {
31
+ /** The number to display on the badge. */
32
+ count: number;
33
+ /** Maximum number before showing `${max}+`. Defaults to 99. */
34
+ max?: number;
35
+ /** Testing id for the badge wrapper. */
36
+ testID?: string;
37
+ };
26
38
  };
27
-
28
39
  interface BottomNavigationProps extends ViewProps {
29
40
  /**
30
41
  * Callback which is called on tab press, receiving key of upcoming active Tab.
@@ -42,13 +53,7 @@ interface BottomNavigationProps extends ViewProps {
42
53
  /**
43
54
  * List of Tabs to be rendered. Each Tab must have an unique key.
44
55
  */
45
- tabs: {
46
- key: string;
47
- title?: string;
48
- icon: IconName;
49
- component: ReactNode;
50
- testID?: string;
51
- }[];
56
+ tabs: BottomNavigationTabType[];
52
57
  /**
53
58
  * Additional style.
54
59
  */
@@ -124,7 +129,7 @@ const BottomNavigation = ({
124
129
  <BottomBarWrapper themeInsets={insets}>
125
130
  <BottomBar>
126
131
  {tabs.map((tab) => {
127
- const { key, icon, title, testID } = tab;
132
+ const { key, icon, title, testID, badge } = tab;
128
133
  const active = selectedTabKey === key;
129
134
  const inactiveIcon = getInactiveIcon(icon);
130
135
 
@@ -135,11 +140,18 @@ const BottomNavigation = ({
135
140
  testID={testID}
136
141
  >
137
142
  <BottomBarItem>
138
- <Icon
139
- icon={active ? icon : inactiveIcon}
140
- intent={active ? 'primary' : 'muted'}
141
- testID={`hero-icon-${icon}`}
142
- />
143
+ <Count
144
+ content={badge?.count ?? 0}
145
+ visible={!!badge && badge.count > 0}
146
+ max={badge?.max}
147
+ testID={badge?.testID ?? `bottom-nav-badge-${key}`}
148
+ >
149
+ <Icon
150
+ icon={active ? icon : inactiveIcon}
151
+ intent={active ? 'primary' : 'muted'}
152
+ testID={`hero-icon-${icon}`}
153
+ />
154
+ </Count>
143
155
  {!!title && (
144
156
  <StyledBottomBarText
145
157
  intent={active ? 'primary' : 'muted'}
@@ -12,6 +12,22 @@ const getBadgeTheme = (theme: GlobalTheme) => {
12
12
  text: theme.colors.onDarkGlobalSurface,
13
13
  border: theme.colors.defaultGlobalSurface,
14
14
  countText: theme.colors.onDarkGlobalSurface,
15
+ stringBackground: {
16
+ primary: theme.colors.highlightedSurface,
17
+ danger: theme.colors.errorSurface,
18
+ info: theme.colors.infoSurface,
19
+ success: theme.colors.successSurface,
20
+ warning: theme.colors.warningSurface,
21
+ archived: theme.colors.archivedSurface,
22
+ },
23
+ stringText: {
24
+ primary: theme.colors.primary,
25
+ danger: theme.colors.onErrorSurface,
26
+ info: theme.colors.onInfoSurface,
27
+ success: theme.colors.onSuccessSurface,
28
+ warning: theme.colors.onWarningSurface,
29
+ archived: theme.colors.onArchivedSurface,
30
+ },
15
31
  };
16
32
 
17
33
  const fonts = {
@@ -38,7 +38,7 @@ const getTagTheme = (theme: GlobalTheme) => {
38
38
  };
39
39
 
40
40
  const radii = {
41
- default: theme.radii.base,
41
+ default: theme.radii.large,
42
42
  };
43
43
 
44
44
  return { borderWidths, colors, fonts, fontSizes, space, radii, lineHeights };
@@ -11,12 +11,15 @@ declare const StyledView: import("@emotion/native").StyledComponent<Animated.Ani
11
11
  themePadding: ThemePadding;
12
12
  themeSize: ThemeSize;
13
13
  themeVariant: ThemeVariant;
14
+ themeIsStringBadge: boolean;
14
15
  }, {}, {}>;
15
16
  declare const StyledText: import("@emotion/native").StyledComponent<import("../..").CaptionProps & {
16
17
  theme?: import("@emotion/react").Theme;
17
18
  as?: React.ElementType;
18
19
  } & {
19
20
  themeSize: ThemeSize;
21
+ themeIntent: ThemeIntent;
22
+ themeIsStringBadge: boolean;
20
23
  }, {}, {}>;
21
24
  declare const StyledStatus: import("@emotion/native").StyledComponent<Animated.AnimatedProps<import("react-native").ViewProps & import("react").RefAttributes<View>> & {
22
25
  theme?: import("@emotion/react").Theme;
@@ -7,6 +7,17 @@ export type BottomNavigationTabType = {
7
7
  icon: IconName;
8
8
  component: ReactNode;
9
9
  testID?: string;
10
+ /**
11
+ * Badge to display on the tab icon.
12
+ */
13
+ badge?: {
14
+ /** The number to display on the badge. */
15
+ count: number;
16
+ /** Maximum number before showing `${max}+`. Defaults to 99. */
17
+ max?: number;
18
+ /** Testing id for the badge wrapper. */
19
+ testID?: string;
20
+ };
10
21
  };
11
22
  interface BottomNavigationProps extends ViewProps {
12
23
  /**
@@ -25,13 +36,7 @@ interface BottomNavigationProps extends ViewProps {
25
36
  /**
26
37
  * List of Tabs to be rendered. Each Tab must have an unique key.
27
38
  */
28
- tabs: {
29
- key: string;
30
- title?: string;
31
- icon: IconName;
32
- component: ReactNode;
33
- testID?: string;
34
- }[];
39
+ tabs: BottomNavigationTabType[];
35
40
  /**
36
41
  * Additional style.
37
42
  */
@@ -10,6 +10,22 @@ declare const getBadgeTheme: (theme: GlobalTheme) => {
10
10
  text: string;
11
11
  border: string;
12
12
  countText: string;
13
+ stringBackground: {
14
+ primary: string;
15
+ danger: string;
16
+ info: string;
17
+ success: string;
18
+ warning: string;
19
+ archived: string;
20
+ };
21
+ stringText: {
22
+ primary: string;
23
+ danger: string;
24
+ info: string;
25
+ success: string;
26
+ warning: string;
27
+ archived: string;
28
+ };
13
29
  };
14
30
  fonts: {
15
31
  medium: string;