@hero-design/rn 8.119.1 → 8.120.1-test-auto-workflow.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 +16 -0
- package/es/index.js +10 -3
- package/lib/index.js +10 -3
- package/package.json +8 -5
- package/src/components/BottomNavigation/index.tsx +26 -14
- package/types/components/BottomNavigation/index.d.ts +12 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @hero-design/rn
|
|
2
2
|
|
|
3
|
+
## 8.120.1-test-auto-workflow.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4880](https://github.com/Thinkei/hero-design/pull/4880) [`58e5d24cb3a296fee8b4192594656a08bf983ab5`](https://github.com/Thinkei/hero-design/commit/58e5d24cb3a296fee8b4192594656a08bf983ab5) Thanks [@tqdungit](https://github.com/tqdungit)! - Update `engines.node` to enforce Node.js 20/22 support. Published packages now require `^20.0.0 || ^22.0.0`, dropping support for Node 14/16/18 and older ranges. Internal packages are set to `^22.0.0`.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`58e5d24cb3a296fee8b4192594656a08bf983ab5`](https://github.com/Thinkei/hero-design/commit/58e5d24cb3a296fee8b4192594656a08bf983ab5)]:
|
|
10
|
+
- @hero-design/react-native-month-year-picker@8.45.2-test-auto-workflow.0
|
|
11
|
+
- @hero-design/colors@8.47.3-test-auto-workflow.0
|
|
12
|
+
|
|
13
|
+
## 8.120.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#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
|
|
18
|
+
|
|
3
19
|
## 8.119.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/es/index.js
CHANGED
|
@@ -10399,10 +10399,12 @@ var BottomNavigation = function BottomNavigation(_ref) {
|
|
|
10399
10399
|
})), /*#__PURE__*/React__default.createElement(BottomBarWrapper, {
|
|
10400
10400
|
themeInsets: insets
|
|
10401
10401
|
}, /*#__PURE__*/React__default.createElement(BottomBar, null, tabs.map(function (tab) {
|
|
10402
|
+
var _badge$count, _badge$testID;
|
|
10402
10403
|
var key = tab.key,
|
|
10403
10404
|
icon = tab.icon,
|
|
10404
10405
|
title = tab.title,
|
|
10405
|
-
testID = tab.testID
|
|
10406
|
+
testID = tab.testID,
|
|
10407
|
+
badge = tab.badge;
|
|
10406
10408
|
var active = selectedTabKey === key;
|
|
10407
10409
|
var inactiveIcon = getInactiveIcon(icon);
|
|
10408
10410
|
return /*#__PURE__*/React__default.createElement(TouchableWithoutFeedback, {
|
|
@@ -10411,11 +10413,16 @@ var BottomNavigation = function BottomNavigation(_ref) {
|
|
|
10411
10413
|
return onTabPress(key);
|
|
10412
10414
|
},
|
|
10413
10415
|
testID: testID
|
|
10414
|
-
}, /*#__PURE__*/React__default.createElement(BottomBarItem, null, /*#__PURE__*/React__default.createElement(
|
|
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, {
|
|
10415
10422
|
icon: active ? icon : inactiveIcon,
|
|
10416
10423
|
intent: active ? 'primary' : 'muted',
|
|
10417
10424
|
testID: "hero-icon-".concat(icon)
|
|
10418
|
-
}), !!title && /*#__PURE__*/React__default.createElement(StyledBottomBarText, {
|
|
10425
|
+
})), !!title && /*#__PURE__*/React__default.createElement(StyledBottomBarText, {
|
|
10419
10426
|
intent: active ? 'primary' : 'muted',
|
|
10420
10427
|
numberOfLines: 1
|
|
10421
10428
|
}, title)));
|
package/lib/index.js
CHANGED
|
@@ -10428,10 +10428,12 @@ var BottomNavigation = function BottomNavigation(_ref) {
|
|
|
10428
10428
|
})), /*#__PURE__*/React__namespace.default.createElement(BottomBarWrapper, {
|
|
10429
10429
|
themeInsets: insets
|
|
10430
10430
|
}, /*#__PURE__*/React__namespace.default.createElement(BottomBar, null, tabs.map(function (tab) {
|
|
10431
|
+
var _badge$count, _badge$testID;
|
|
10431
10432
|
var key = tab.key,
|
|
10432
10433
|
icon = tab.icon,
|
|
10433
10434
|
title = tab.title,
|
|
10434
|
-
testID = tab.testID
|
|
10435
|
+
testID = tab.testID,
|
|
10436
|
+
badge = tab.badge;
|
|
10435
10437
|
var active = selectedTabKey === key;
|
|
10436
10438
|
var inactiveIcon = getInactiveIcon(icon);
|
|
10437
10439
|
return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableWithoutFeedback, {
|
|
@@ -10440,11 +10442,16 @@ var BottomNavigation = function BottomNavigation(_ref) {
|
|
|
10440
10442
|
return onTabPress(key);
|
|
10441
10443
|
},
|
|
10442
10444
|
testID: testID
|
|
10443
|
-
}, /*#__PURE__*/React__namespace.default.createElement(BottomBarItem, null, /*#__PURE__*/React__namespace.default.createElement(
|
|
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, {
|
|
10444
10451
|
icon: active ? icon : inactiveIcon,
|
|
10445
10452
|
intent: active ? 'primary' : 'muted',
|
|
10446
10453
|
testID: "hero-icon-".concat(icon)
|
|
10447
|
-
}), !!title && /*#__PURE__*/React__namespace.default.createElement(StyledBottomBarText, {
|
|
10454
|
+
})), !!title && /*#__PURE__*/React__namespace.default.createElement(StyledBottomBarText, {
|
|
10448
10455
|
intent: active ? 'primary' : 'muted',
|
|
10449
10456
|
numberOfLines: 1
|
|
10450
10457
|
}, title)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.120.1-test-auto-workflow.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@emotion/native": "^11.9.3",
|
|
24
24
|
"@emotion/react": "^11.9.3",
|
|
25
|
-
"@hero-design/colors": "8.47.
|
|
25
|
+
"@hero-design/colors": "8.47.3-test-auto-workflow.0",
|
|
26
26
|
"d3": "^7.8.5",
|
|
27
27
|
"date-fns": "^2.30.0",
|
|
28
28
|
"hero-editor": "^1.17.0",
|
|
29
29
|
"nanoid": "^5.0.9"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@hero-design/react-native-month-year-picker": "^8.45.
|
|
32
|
+
"@hero-design/react-native-month-year-picker": "^8.45.2-test-auto-workflow.0",
|
|
33
33
|
"@ptomasroos/react-native-multi-slider": "^2.2.2",
|
|
34
34
|
"@react-native-community/datetimepicker": "^8.4.4",
|
|
35
35
|
"@react-native-community/slider": "^5.0.1",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"@eslint/compat": "^1.1.1",
|
|
57
57
|
"@eslint/eslintrc": "^3.1.0",
|
|
58
58
|
"@eslint/js": "^9.8.0",
|
|
59
|
-
"@hero-design/eslint-plugin": "9.2.
|
|
60
|
-
"@hero-design/react-native-month-year-picker": "^8.45.
|
|
59
|
+
"@hero-design/eslint-plugin": "9.2.3-test-auto-workflow.0",
|
|
60
|
+
"@hero-design/react-native-month-year-picker": "^8.45.2-test-auto-workflow.0",
|
|
61
61
|
"@ptomasroos/react-native-multi-slider": "^2.2.2",
|
|
62
62
|
"@react-native-community/datetimepicker": "8.4.4",
|
|
63
63
|
"@react-native-community/slider": "^5.0.1",
|
|
@@ -103,5 +103,8 @@
|
|
|
103
103
|
"ts-jest": "^29.1.1",
|
|
104
104
|
"typescript": "^5.7.3"
|
|
105
105
|
},
|
|
106
|
+
"engines": {
|
|
107
|
+
"node": "^20.0.0 || ^22.0.0"
|
|
108
|
+
},
|
|
106
109
|
"prettier": "prettier-config-hd"
|
|
107
110
|
}
|
|
@@ -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
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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'}
|
|
@@ -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
|
*/
|