@hero-design/rn 7.10.2 → 7.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +8 -8
- package/assets/fonts/hero-icons.ttf +0 -0
- package/es/index.js +3778 -728
- package/global-setup.js +3 -0
- package/jest.config.js +1 -0
- package/lib/assets/fonts/hero-icons.ttf +0 -0
- package/lib/index.js +3779 -726
- package/package.json +7 -3
- package/rollup.config.js +8 -1
- package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +2 -0
- package/src/components/ContentNavigator/__tests__/index.spec.tsx +19 -2
- package/src/components/ContentNavigator/index.tsx +12 -1
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/FAB/ActionGroup/index.tsx +16 -5
- package/src/components/Icon/HeroIcon/selection.json +1 -1
- package/src/components/Icon/IconList.ts +1 -0
- package/src/components/PinInput/PinCell.tsx +34 -0
- package/src/components/PinInput/StyledPinInput.tsx +88 -0
- package/src/components/PinInput/__tests__/PinCell.spec.tsx +48 -0
- package/src/components/PinInput/__tests__/StyledPinInput.spec.tsx +22 -0
- package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +186 -0
- package/src/components/PinInput/__tests__/__snapshots__/StyledPinInput.spec.tsx.snap +58 -0
- package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +1028 -0
- package/src/components/PinInput/__tests__/index.spec.tsx +91 -0
- package/src/components/PinInput/index.tsx +173 -0
- package/src/components/Select/MultiSelect/Option.tsx +1 -1
- package/src/components/Select/MultiSelect/OptionList.tsx +48 -26
- package/src/components/Select/MultiSelect/__tests__/OptionList.spec.tsx +13 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +1062 -556
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +983 -889
- package/src/components/Select/MultiSelect/index.tsx +59 -31
- package/src/components/Select/SingleSelect/OptionList.tsx +45 -26
- package/src/components/Select/SingleSelect/__tests__/OptionList.spec.tsx +8 -0
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +992 -500
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +880 -786
- package/src/components/Select/SingleSelect/index.tsx +60 -31
- package/src/components/Select/StyledOptionList.tsx +88 -0
- package/src/components/Select/StyledSelect.tsx +18 -16
- package/src/components/Select/__tests__/StyledSelect.spec.tsx +1 -14
- package/src/components/Select/__tests__/__snapshots__/StyledSelect.spec.tsx.snap +0 -13
- package/src/components/Select/types.tsx +47 -0
- package/src/components/TextInput/__tests__/index.spec.tsx +15 -0
- package/src/components/TextInput/index.tsx +20 -16
- package/src/components/TimePicker/StyledTimePicker.tsx +8 -0
- package/src/components/TimePicker/TimePickerAndroid.tsx +61 -0
- package/src/components/TimePicker/TimePickerIOS.tsx +91 -0
- package/src/components/TimePicker/__tests__/TimePicker.spec.tsx +34 -0
- package/src/components/TimePicker/__tests__/TimePickerAndroid.spec.tsx +39 -0
- package/src/components/TimePicker/__tests__/TimePickerIOS.spec.tsx +46 -0
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +200 -0
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +513 -0
- package/src/components/TimePicker/index.tsx +15 -0
- package/src/components/TimePicker/types.ts +50 -0
- package/src/components/Typography/Text/StyledText.tsx +1 -1
- package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +1 -0
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +22 -0
- package/src/components/Typography/Text/index.tsx +1 -1
- package/src/index.ts +4 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +44 -0
- package/src/theme/components/pinInput.ts +45 -0
- package/src/theme/components/select.ts +4 -0
- package/src/theme/components/timePicker.ts +11 -0
- package/src/theme/components/typography.ts +2 -0
- package/src/theme/global/colors.ts +1 -1
- package/src/theme/global/space.ts +10 -10
- package/src/theme/index.ts +9 -3
- package/testUtils/setup.tsx +10 -0
- package/types/components/ContentNavigator/index.d.ts +5 -1
- package/types/components/Icon/IconList.d.ts +1 -1
- package/types/components/Icon/utils.d.ts +1 -1
- package/types/components/PinInput/PinCell.d.ts +8 -0
- package/types/components/PinInput/StyledPinInput.d.ts +73 -0
- package/types/components/PinInput/__tests__/PinCell.spec.d.ts +1 -0
- package/types/components/PinInput/__tests__/StyledPinInput.spec.d.ts +1 -0
- package/types/components/PinInput/__tests__/index.spec.d.ts +1 -0
- package/types/components/PinInput/index.d.ts +48 -0
- package/types/components/Select/MultiSelect/OptionList.d.ts +1 -1
- package/types/components/Select/MultiSelect/index.d.ts +3 -25
- package/types/components/Select/SingleSelect/OptionList.d.ts +1 -1
- package/types/components/Select/SingleSelect/index.d.ts +4 -26
- package/types/components/Select/StyledOptionList.d.ts +17 -0
- package/types/components/Select/StyledSelect.d.ts +7 -7
- package/types/components/Select/index.d.ts +1 -1
- package/types/components/Select/types.d.ts +44 -0
- package/types/components/TimePicker/StyledTimePicker.d.ts +8 -0
- package/types/components/TimePicker/TimePickerAndroid.d.ts +3 -0
- package/types/components/TimePicker/TimePickerIOS.d.ts +3 -0
- package/types/components/TimePicker/__tests__/TimePicker.spec.d.ts +1 -0
- package/types/components/TimePicker/__tests__/TimePickerAndroid.spec.d.ts +1 -0
- package/types/components/TimePicker/__tests__/TimePickerIOS.spec.d.ts +1 -0
- package/types/components/TimePicker/index.d.ts +3 -0
- package/types/components/TimePicker/types.d.ts +49 -0
- package/types/components/Typography/Text/StyledText.d.ts +1 -1
- package/types/components/Typography/Text/index.d.ts +1 -1
- package/types/index.d.ts +3 -1
- package/types/theme/components/pinInput.d.ts +35 -0
- package/types/theme/components/select.d.ts +4 -0
- package/types/theme/components/timePicker.d.ts +6 -0
- package/types/theme/components/typography.d.ts +2 -0
- package/types/theme/index.d.ts +6 -2
- package/src/components/Select/types.ts +0 -1
- package/src/components/TextInput/__tests__/.log/ti-10343.log +0 -62
- package/src/components/TextInput/__tests__/.log/tsserver.log +0 -15584
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.12.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -21,14 +21,16 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@emotion/native": "^11.9.3",
|
|
23
23
|
"@emotion/react": "^11.9.3",
|
|
24
|
-
"@hero-design/colors": "7.
|
|
24
|
+
"@hero-design/colors": "7.12.0",
|
|
25
|
+
"date-fns": "^2.16.1"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
27
28
|
"react": "17.0.2",
|
|
28
29
|
"react-native": "0.65.1",
|
|
29
30
|
"react-native-pager-view": "^5.4.25",
|
|
30
31
|
"react-native-safe-area-context": "^4.2.5",
|
|
31
|
-
"react-native-vector-icons": "^9.1.0"
|
|
32
|
+
"react-native-vector-icons": "^9.1.0",
|
|
33
|
+
"@react-native-community/datetimepicker": "^3.5.2"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
36
|
"@babel/core": "^7.17.5",
|
|
@@ -37,6 +39,7 @@
|
|
|
37
39
|
"@babel/preset-typescript": "^7.17.12",
|
|
38
40
|
"@babel/runtime": "^7.18.9",
|
|
39
41
|
"@emotion/jest": "^11.9.3",
|
|
42
|
+
"@react-native-community/datetimepicker": "^3.5.2",
|
|
40
43
|
"@rollup/plugin-babel": "^5.3.1",
|
|
41
44
|
"@rollup/plugin-commonjs": "^21.0.1",
|
|
42
45
|
"@rollup/plugin-json": "^4.1.0",
|
|
@@ -68,6 +71,7 @@
|
|
|
68
71
|
"react-test-renderer": "17.0.2",
|
|
69
72
|
"rollup": "^2.68.0",
|
|
70
73
|
"rollup-plugin-copy": "^3.4.0",
|
|
74
|
+
"rollup-plugin-flow": "^1.1.1",
|
|
71
75
|
"ts-jest": "^27.0.7",
|
|
72
76
|
"typescript": "^4.5.5"
|
|
73
77
|
}
|
package/rollup.config.js
CHANGED
|
@@ -5,6 +5,7 @@ import typescript from '@rollup/plugin-typescript';
|
|
|
5
5
|
import json from '@rollup/plugin-json';
|
|
6
6
|
import replace from '@rollup/plugin-replace';
|
|
7
7
|
import copy from 'rollup-plugin-copy';
|
|
8
|
+
import flow from 'rollup-plugin-flow';
|
|
8
9
|
|
|
9
10
|
import pkg from './package.json';
|
|
10
11
|
|
|
@@ -22,12 +23,18 @@ export default {
|
|
|
22
23
|
format: 'esm',
|
|
23
24
|
},
|
|
24
25
|
],
|
|
25
|
-
external: [
|
|
26
|
+
external: [
|
|
27
|
+
'react',
|
|
28
|
+
'react-native',
|
|
29
|
+
'react-native-safe-area-context',
|
|
30
|
+
'@react-native-community/datetimepicker',
|
|
31
|
+
],
|
|
26
32
|
plugins: [
|
|
27
33
|
replace({
|
|
28
34
|
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
29
35
|
}),
|
|
30
36
|
nodeResolve({ extensions, browser: true }),
|
|
37
|
+
flow(),
|
|
31
38
|
commonjs(),
|
|
32
39
|
json(),
|
|
33
40
|
typescript(),
|
|
@@ -65,6 +65,7 @@ exports[`rendering renders correctly 1`] = `
|
|
|
65
65
|
],
|
|
66
66
|
]
|
|
67
67
|
}
|
|
68
|
+
testID="content-navigator-value"
|
|
68
69
|
themeFontSize="medium"
|
|
69
70
|
themeFontWeight="semi-bold"
|
|
70
71
|
themeIntent="body"
|
|
@@ -173,6 +174,7 @@ exports[`rendering renders correctly when icon buttons are disabled 1`] = `
|
|
|
173
174
|
],
|
|
174
175
|
]
|
|
175
176
|
}
|
|
177
|
+
testID="content-navigator-value"
|
|
176
178
|
themeFontSize="medium"
|
|
177
179
|
themeFontWeight="semi-bold"
|
|
178
180
|
themeIntent="body"
|
|
@@ -36,7 +36,7 @@ describe('rendering', () => {
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
describe('behavior', () => {
|
|
39
|
-
it('calls press handlers', () => {
|
|
39
|
+
it('calls press handlers of prev and next buttons', () => {
|
|
40
40
|
const prevHandler = jest.fn();
|
|
41
41
|
const nextHandler = jest.fn();
|
|
42
42
|
const { getByTestId } = renderWithTheme(
|
|
@@ -53,7 +53,7 @@ describe('behavior', () => {
|
|
|
53
53
|
expect(prevHandler).toBeCalledTimes(1);
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
it('does NOT call press handlers when icon buttons are disabled', () => {
|
|
56
|
+
it('does NOT call press handlers of prev and next buttons when icon buttons are disabled', () => {
|
|
57
57
|
const prevHandler = jest.fn();
|
|
58
58
|
const nextHandler = jest.fn();
|
|
59
59
|
const { getByTestId } = renderWithTheme(
|
|
@@ -71,4 +71,21 @@ describe('behavior', () => {
|
|
|
71
71
|
fireEvent.press(getByTestId('next-icon-button'));
|
|
72
72
|
expect(prevHandler).toBeCalledTimes(0);
|
|
73
73
|
});
|
|
74
|
+
|
|
75
|
+
it('calls press handler of content navigator value', () => {
|
|
76
|
+
const prevHandler = jest.fn();
|
|
77
|
+
const nextHandler = jest.fn();
|
|
78
|
+
const pressHandler = jest.fn();
|
|
79
|
+
const { getByTestId } = renderWithTheme(
|
|
80
|
+
<ContentNavigator
|
|
81
|
+
value={20}
|
|
82
|
+
onPreviousPress={prevHandler}
|
|
83
|
+
onNextPress={nextHandler}
|
|
84
|
+
onPress={pressHandler}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
fireEvent.press(getByTestId('content-navigator-value'));
|
|
89
|
+
expect(pressHandler).toBeCalledTimes(1);
|
|
90
|
+
});
|
|
74
91
|
});
|
|
@@ -16,6 +16,10 @@ interface ContentNavigatorProps {
|
|
|
16
16
|
* Handler to handle press event of next icon.
|
|
17
17
|
*/
|
|
18
18
|
onNextPress: () => void;
|
|
19
|
+
/**
|
|
20
|
+
* Handler to handle press event of content navigator value.
|
|
21
|
+
*/
|
|
22
|
+
onPress?: () => void;
|
|
19
23
|
/**
|
|
20
24
|
* Whether the previous icon is disabled.
|
|
21
25
|
*/
|
|
@@ -37,6 +41,7 @@ interface ContentNavigatorProps {
|
|
|
37
41
|
function ContentNavigator({
|
|
38
42
|
onPreviousPress,
|
|
39
43
|
onNextPress,
|
|
44
|
+
onPress,
|
|
40
45
|
value,
|
|
41
46
|
previousDisabled = false,
|
|
42
47
|
nextDisabled = false,
|
|
@@ -51,7 +56,13 @@ function ContentNavigator({
|
|
|
51
56
|
disabled={previousDisabled}
|
|
52
57
|
testID="previous-icon-button"
|
|
53
58
|
/>
|
|
54
|
-
<Value
|
|
59
|
+
<Value
|
|
60
|
+
fontWeight="semi-bold"
|
|
61
|
+
onPress={onPress}
|
|
62
|
+
testID="content-navigator-value"
|
|
63
|
+
>
|
|
64
|
+
{value}
|
|
65
|
+
</Value>
|
|
55
66
|
<Button.Icon
|
|
56
67
|
icon="arrow-right"
|
|
57
68
|
onPress={onNextPress}
|
|
@@ -38,10 +38,12 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
38
38
|
<View
|
|
39
39
|
collapsable={false}
|
|
40
40
|
nativeID="animatedComponent"
|
|
41
|
+
pointerEvents="none"
|
|
41
42
|
style={
|
|
42
43
|
Object {
|
|
43
44
|
"alignItems": "flex-end",
|
|
44
45
|
"justifyContent": "flex-end",
|
|
46
|
+
"opacity": 0,
|
|
45
47
|
"transform": Array [
|
|
46
48
|
Object {
|
|
47
49
|
"translateX": 400,
|
|
@@ -568,10 +570,12 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
568
570
|
<View
|
|
569
571
|
collapsable={false}
|
|
570
572
|
nativeID="animatedComponent"
|
|
573
|
+
pointerEvents="auto"
|
|
571
574
|
style={
|
|
572
575
|
Object {
|
|
573
576
|
"alignItems": "flex-end",
|
|
574
577
|
"justifyContent": "flex-end",
|
|
578
|
+
"opacity": 1,
|
|
575
579
|
"transform": Array [
|
|
576
580
|
Object {
|
|
577
581
|
"translateX": 0,
|
|
@@ -88,21 +88,32 @@ const ActionGroup = ({
|
|
|
88
88
|
outputRange: [400, 0],
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
const interpolatedBackdropOpacityAnimation = tranlateXAnimation.current.interpolate(
|
|
92
|
+
{
|
|
93
|
+
inputRange: [0, 1],
|
|
94
|
+
outputRange: [0, 0.9],
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
const interpolatedActionGroupOpacityAnimation = tranlateXAnimation.current.interpolate(
|
|
99
|
+
{
|
|
100
|
+
inputRange: [0, 1],
|
|
101
|
+
outputRange: [0, 1],
|
|
102
|
+
}
|
|
103
|
+
);
|
|
95
104
|
|
|
96
105
|
return (
|
|
97
106
|
<StyledContainer testID={testID} pointerEvents="box-none" style={style}>
|
|
98
107
|
<StyledBackdrop
|
|
99
108
|
pointerEvents={active ? 'auto' : 'box-none'}
|
|
100
109
|
testID="back-drop"
|
|
101
|
-
style={{ opacity:
|
|
110
|
+
style={{ opacity: interpolatedBackdropOpacityAnimation }}
|
|
102
111
|
/>
|
|
103
112
|
<StyledActionGroupContainer
|
|
113
|
+
pointerEvents={active ? 'auto' : 'none'}
|
|
104
114
|
testID="action-group"
|
|
105
115
|
style={{
|
|
116
|
+
opacity: interpolatedActionGroupOpacityAnimation,
|
|
106
117
|
transform: [{ translateX: interpolatedTranlateXAnimation }],
|
|
107
118
|
}}
|
|
108
119
|
>
|