@hero-design/rn-work-uikit 1.2.3 → 1.3.1
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 +15 -0
- package/babel.config.js +6 -0
- package/lib/index.js +46464 -1337
- package/package.json +8 -5
- package/rollup.config.mjs +20 -5
- package/src/__tests__/index-export.spec.ts +64 -0
- package/src/__tests__/index.spec.tsx +0 -19
- package/src/components/DatePicker/__tests__/__snapshots__/index.spec.tsx.snap +1602 -0
- package/src/components/DatePicker/__tests__/index.spec.tsx +56 -0
- package/src/components/DatePicker/index.tsx +12 -0
- package/src/components/Select/__tests__/__snapshots__/index.spec.tsx.snap +1293 -0
- package/src/components/Select/__tests__/index.spec.tsx +43 -0
- package/src/components/Select/index.tsx +23 -0
- package/src/components/TextInput/Group/__tests__/__snapshots__/index.spec.tsx.snap +0 -6
- package/src/components/TextInput/PrefixComponent.tsx +4 -4
- package/src/components/TextInput/StyledTextInput.tsx +6 -3
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +130 -34
- package/src/components/TimePicker/__tests__/index.spec.tsx +34 -0
- package/src/components/TimePicker/index.tsx +12 -0
- package/src/hero-editor.d.ts +8 -0
- package/src/index.ts +4 -1
- package/src/utils/functions.ts +2 -0
- package/stats/1.3.0/rn-work-uikit-stats.html +4842 -0
- package/stats/1.3.1/rn-work-uikit-stats.html +4844 -0
- package/tsconfig.json +9 -3
- package/tsconfig.rollup.json +8 -2
- package/src/__tests__/__snapshots__/index.spec.tsx.snap +0 -172
- package/src/__tests__/theme-export-override.spec.ts +0 -96
- package/stats/1.2.3/rn-work-uikit-stats.html +0 -4842
package/tsconfig.json
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"types": ["jest"],
|
|
15
15
|
"paths": {
|
|
16
16
|
"react": ["./node_modules/@types/react"],
|
|
17
|
-
"react-native": ["./node_modules/react-native/types"]
|
|
17
|
+
"react-native": ["./node_modules/react-native/types"],
|
|
18
|
+
"@hero-design/rn": ["../rn/src/index.internal"]
|
|
18
19
|
},
|
|
19
20
|
"allowJs": true,
|
|
20
21
|
"esModuleInterop": true,
|
|
@@ -25,5 +26,10 @@
|
|
|
25
26
|
"skipLibCheck": true
|
|
26
27
|
},
|
|
27
28
|
"include": ["src"],
|
|
28
|
-
"exclude": [
|
|
29
|
-
|
|
29
|
+
"exclude": [
|
|
30
|
+
"node_modules",
|
|
31
|
+
"babel.config.js",
|
|
32
|
+
"metro.config.js",
|
|
33
|
+
"jest.config.js"
|
|
34
|
+
]
|
|
35
|
+
}
|
package/tsconfig.rollup.json
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"types": ["jest"],
|
|
13
13
|
"paths": {
|
|
14
14
|
"react": ["./node_modules/@types/react"],
|
|
15
|
-
"react-native": ["./node_modules/react-native/types"]
|
|
15
|
+
"react-native": ["./node_modules/react-native/types"],
|
|
16
|
+
"@hero-design/rn": ["../rn/src/index.internal"]
|
|
16
17
|
},
|
|
17
18
|
"allowJs": true,
|
|
18
19
|
"esModuleInterop": true,
|
|
@@ -23,5 +24,10 @@
|
|
|
23
24
|
"skipLibCheck": true
|
|
24
25
|
},
|
|
25
26
|
"include": ["src"],
|
|
26
|
-
"exclude": [
|
|
27
|
+
"exclude": [
|
|
28
|
+
"node_modules",
|
|
29
|
+
"babel.config.js",
|
|
30
|
+
"metro.config.js",
|
|
31
|
+
"jest.config.js"
|
|
32
|
+
]
|
|
27
33
|
}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`first test to ensure configure correctly should render TextInput with props in snapshot 1`] = `
|
|
4
|
-
<Pressable
|
|
5
|
-
accessibilityState={
|
|
6
|
-
{
|
|
7
|
-
"disabled": false,
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
disabled={false}
|
|
11
|
-
onPress={[Function]}
|
|
12
|
-
style={
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
{
|
|
16
|
-
"flexDirection": "row",
|
|
17
|
-
"marginTop": 7.846153846153847,
|
|
18
|
-
"minHeight": 54.92307692307692,
|
|
19
|
-
"paddingHorizontal": 15.692307692307693,
|
|
20
|
-
"width": "100%",
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
{},
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
testID="text-input"
|
|
27
|
-
themeFocused={false}
|
|
28
|
-
themeHasError={false}
|
|
29
|
-
themeUseGroupStyleEnabled={false}
|
|
30
|
-
>
|
|
31
|
-
<View
|
|
32
|
-
pointerEvents="none"
|
|
33
|
-
style={
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
{
|
|
37
|
-
"borderColor": "#e8e9ea",
|
|
38
|
-
"borderRadius": 8,
|
|
39
|
-
"borderWidth": 2,
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
[
|
|
43
|
-
{
|
|
44
|
-
"backgroundColor": "#ffffff",
|
|
45
|
-
},
|
|
46
|
-
{},
|
|
47
|
-
],
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
testID="text-input-border"
|
|
51
|
-
themeFocused={false}
|
|
52
|
-
themeState="filled"
|
|
53
|
-
/>
|
|
54
|
-
<View
|
|
55
|
-
style={
|
|
56
|
-
[
|
|
57
|
-
[
|
|
58
|
-
{
|
|
59
|
-
"backgroundColor": "transparent",
|
|
60
|
-
"borderRadius": 8,
|
|
61
|
-
"flex": 1,
|
|
62
|
-
"flexDirection": "column",
|
|
63
|
-
"marginBottom": 7.846153846153847,
|
|
64
|
-
"marginTop": 7.846153846153847,
|
|
65
|
-
"overflow": "hidden",
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
undefined,
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
>
|
|
72
|
-
<Pressable
|
|
73
|
-
style={
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
{
|
|
77
|
-
"alignItems": "center",
|
|
78
|
-
"flexDirection": "row",
|
|
79
|
-
"flexGrow": 2,
|
|
80
|
-
"flexShrink": 1,
|
|
81
|
-
"gap": 3.9230769230769234,
|
|
82
|
-
"opacity": 1,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
undefined,
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
themeOpacity={1}
|
|
89
|
-
>
|
|
90
|
-
<View />
|
|
91
|
-
<View
|
|
92
|
-
accessibilityLabel="Text input field"
|
|
93
|
-
style={
|
|
94
|
-
{
|
|
95
|
-
"flex": 1,
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
testID="input-row-input-wrapper"
|
|
99
|
-
>
|
|
100
|
-
<TextInput
|
|
101
|
-
accessibilityState={
|
|
102
|
-
{
|
|
103
|
-
"disabled": false,
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
allowFontScaling={false}
|
|
107
|
-
editable={true}
|
|
108
|
-
onBlur={[Function]}
|
|
109
|
-
onChangeText={[Function]}
|
|
110
|
-
onFocus={[Function]}
|
|
111
|
-
placeholder="Enter text here"
|
|
112
|
-
placeholderTextColor="#4d6265"
|
|
113
|
-
style={
|
|
114
|
-
[
|
|
115
|
-
[
|
|
116
|
-
{
|
|
117
|
-
"flexGrow": 2,
|
|
118
|
-
"fontFamily": "BeVietnamPro-Regular",
|
|
119
|
-
"fontSize": 15.692307692307693,
|
|
120
|
-
"height": undefined,
|
|
121
|
-
"maxHeight": 141.23076923076923,
|
|
122
|
-
"minHeight": 23.53846153846154,
|
|
123
|
-
"paddingVertical": 0,
|
|
124
|
-
"textAlignVertical": "center",
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
[
|
|
128
|
-
{
|
|
129
|
-
"backgroundColor": "#ffffff",
|
|
130
|
-
"color": "#001f23",
|
|
131
|
-
},
|
|
132
|
-
{},
|
|
133
|
-
],
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
testID="text-input-text-input"
|
|
137
|
-
themeVariant="text"
|
|
138
|
-
value="test value"
|
|
139
|
-
/>
|
|
140
|
-
</View>
|
|
141
|
-
</Pressable>
|
|
142
|
-
<View
|
|
143
|
-
style={
|
|
144
|
-
[
|
|
145
|
-
[
|
|
146
|
-
{
|
|
147
|
-
"alignItems": "flex-start",
|
|
148
|
-
"flexDirection": "row",
|
|
149
|
-
"justifyContent": "space-between",
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
undefined,
|
|
153
|
-
]
|
|
154
|
-
}
|
|
155
|
-
/>
|
|
156
|
-
</View>
|
|
157
|
-
<View
|
|
158
|
-
style={
|
|
159
|
-
[
|
|
160
|
-
[
|
|
161
|
-
{
|
|
162
|
-
"alignItems": "center",
|
|
163
|
-
"flexDirection": "row",
|
|
164
|
-
"justifyContent": "flex-end",
|
|
165
|
-
},
|
|
166
|
-
],
|
|
167
|
-
undefined,
|
|
168
|
-
]
|
|
169
|
-
}
|
|
170
|
-
/>
|
|
171
|
-
</Pressable>
|
|
172
|
-
`;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// Mock the entire theme module to avoid import resolution issues
|
|
2
|
-
jest.mock('../theme', () => {
|
|
3
|
-
const mockWorkTheme = {
|
|
4
|
-
colors: { text: 'work-color' },
|
|
5
|
-
fonts: { base: 'work-font' },
|
|
6
|
-
space: { base: 'work-space' },
|
|
7
|
-
__hd__: {
|
|
8
|
-
textInput: {
|
|
9
|
-
colors: {
|
|
10
|
-
text: '#WORK_THEME_COLOR',
|
|
11
|
-
background: '#WORK_BACKGROUND',
|
|
12
|
-
},
|
|
13
|
-
space: { containerPadding: 'WORK_PADDING' },
|
|
14
|
-
fonts: { text: 'WORK_FONT' },
|
|
15
|
-
},
|
|
16
|
-
button: { base: 'button' },
|
|
17
|
-
accordion: { base: 'accordion' },
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const mockGetTheme = jest.fn(() => mockWorkTheme);
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
__esModule: true,
|
|
25
|
-
default: mockWorkTheme,
|
|
26
|
-
getTheme: mockGetTheme,
|
|
27
|
-
Theme: {},
|
|
28
|
-
CustomTheme: {},
|
|
29
|
-
ThemeProvider: jest.fn(),
|
|
30
|
-
ThemeSwitcher: jest.fn(),
|
|
31
|
-
useTheme: jest.fn(),
|
|
32
|
-
withTheme: jest.fn(),
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// Mock the base @hero-design/rn
|
|
37
|
-
jest.mock('@hero-design/rn', () => ({
|
|
38
|
-
getTheme: jest.fn(() => ({
|
|
39
|
-
colors: { text: 'base-color' },
|
|
40
|
-
__hd__: {
|
|
41
|
-
textInput: {
|
|
42
|
-
colors: { text: 'BASE_THEME_COLOR' },
|
|
43
|
-
space: { containerPadding: 'BASE_PADDING' },
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
})),
|
|
47
|
-
// Mock styled function
|
|
48
|
-
styled: jest.fn(() => jest.fn(() => 'MockStyledComponent')),
|
|
49
|
-
// Mock Typography component
|
|
50
|
-
Typography: {
|
|
51
|
-
Caption: 'MockCaption',
|
|
52
|
-
},
|
|
53
|
-
// Re-export everything else as is
|
|
54
|
-
Button: 'MockButton',
|
|
55
|
-
TextInput: 'MockTextInput',
|
|
56
|
-
ThemeProvider: 'MockBaseThemeProvider',
|
|
57
|
-
useTheme: jest.fn(),
|
|
58
|
-
}));
|
|
59
|
-
|
|
60
|
-
describe('Theme Export Override', () => {
|
|
61
|
-
beforeEach(() => {
|
|
62
|
-
// Clear module cache to ensure fresh imports
|
|
63
|
-
jest.resetModules();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('should export work-specific theme with overridden textInput from index', () => {
|
|
67
|
-
// Re-import to get the mocked version
|
|
68
|
-
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
69
|
-
const { theme: workTheme } = require('../index');
|
|
70
|
-
|
|
71
|
-
// Verify that the theme has the work-specific textInput overrides
|
|
72
|
-
expect(workTheme.__hd__.textInput.colors.text).toBe('#WORK_THEME_COLOR');
|
|
73
|
-
expect(workTheme.__hd__.textInput.colors.background).toBe(
|
|
74
|
-
'#WORK_BACKGROUND'
|
|
75
|
-
);
|
|
76
|
-
expect(workTheme.__hd__.textInput.space.containerPadding).toBe(
|
|
77
|
-
'WORK_PADDING'
|
|
78
|
-
);
|
|
79
|
-
expect(workTheme.__hd__.textInput.fonts.text).toBe('WORK_FONT');
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('should export work-specific getTheme function with overridden textInput', () => {
|
|
83
|
-
// Re-import to get the mocked version
|
|
84
|
-
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
85
|
-
const { getTheme: workGetTheme } = require('../index');
|
|
86
|
-
|
|
87
|
-
const workTheme = workGetTheme();
|
|
88
|
-
|
|
89
|
-
// Verify that getTheme returns work-specific textInput theme
|
|
90
|
-
expect(workTheme.__hd__.textInput.colors.text).toBe('#WORK_THEME_COLOR');
|
|
91
|
-
expect(workTheme.__hd__.textInput.space.containerPadding).toBe(
|
|
92
|
-
'WORK_PADDING'
|
|
93
|
-
);
|
|
94
|
-
expect(workTheme.__hd__.textInput.fonts.text).toBe('WORK_FONT');
|
|
95
|
-
});
|
|
96
|
-
});
|