@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn-work-uikit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"test:watch": "jest --runInBand --watch",
|
|
14
14
|
"test:ci": "jest --c=jest-ci.config.js --i --logHeapUsage --coverage && cat ./coverage/lcov.info",
|
|
15
15
|
"build:js": "rollup -c",
|
|
16
|
-
"build:types": "
|
|
16
|
+
"build:types": "rollup -c rollup.config.mjs --configPlugin dts",
|
|
17
17
|
"build": "yarn build:js && yarn build:types",
|
|
18
18
|
"build:watch": "yarn build:js -w & yarn build:types -w",
|
|
19
19
|
"publish:npm": "yarn publish --access public",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@emotion/native": "^11.9.3",
|
|
24
24
|
"@emotion/primitives-core": "11.0.0",
|
|
25
25
|
"@emotion/react": "^11.9.3",
|
|
26
|
-
"@hero-design/rn": "^8.103.
|
|
26
|
+
"@hero-design/rn": "^8.103.4"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@hero-design/react-native-month-year-picker": "^8.43.1",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"@react-native/eslint-config": "0.76.9",
|
|
65
65
|
"@react-native/metro-config": "0.76.9",
|
|
66
66
|
"@react-native/typescript-config": "0.76.9",
|
|
67
|
+
"@rollup/plugin-alias": "^5.1.1",
|
|
67
68
|
"@rollup/plugin-babel": "^6.0.4",
|
|
68
69
|
"@rollup/plugin-commonjs": "^28.0.1",
|
|
69
70
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -80,6 +81,7 @@
|
|
|
80
81
|
"@typescript-eslint/eslint-plugin": "^5.12.1",
|
|
81
82
|
"@typescript-eslint/parser": "^5.12.1",
|
|
82
83
|
"babel-plugin-inline-import": "^3.0.0",
|
|
84
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
83
85
|
"config-tsconfig": "8.42.5",
|
|
84
86
|
"core-js": "^3.33.0",
|
|
85
87
|
"eslint": "^8.56.0",
|
|
@@ -87,10 +89,10 @@
|
|
|
87
89
|
"eslint-config-hd": "8.42.5",
|
|
88
90
|
"eslint-config-prettier": "^8.5.0",
|
|
89
91
|
"eslint-import-resolver-typescript": "^3.5.2",
|
|
90
|
-
"eslint-plugin-import": "^2.
|
|
92
|
+
"eslint-plugin-import": "^2.32.0",
|
|
91
93
|
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
92
94
|
"eslint-plugin-prettier": "^4.0.0",
|
|
93
|
-
"eslint-plugin-react": "^7.37.
|
|
95
|
+
"eslint-plugin-react": "^7.37.5",
|
|
94
96
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
95
97
|
"jest": "^29.2.1",
|
|
96
98
|
"jest-environment-jsdom": "^29.2.1",
|
|
@@ -111,6 +113,7 @@
|
|
|
111
113
|
"rollup": "^4.24.3",
|
|
112
114
|
"rollup-plugin-copy": "^3.5.0",
|
|
113
115
|
"rollup-plugin-delete": "^3.0.1",
|
|
116
|
+
"rollup-plugin-dts": "^6.2.1",
|
|
114
117
|
"rollup-plugin-flow": "^1.1.1",
|
|
115
118
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
116
119
|
"ts-jest": "^29.1.1",
|
package/rollup.config.mjs
CHANGED
|
@@ -9,6 +9,8 @@ import { visualizer } from 'rollup-plugin-visualizer';
|
|
|
9
9
|
import pkg from './package.json' assert { type: 'json' };
|
|
10
10
|
import copy from 'rollup-plugin-copy';
|
|
11
11
|
import del from 'rollup-plugin-delete';
|
|
12
|
+
import alias from '@rollup/plugin-alias';
|
|
13
|
+
import dts from 'rollup-plugin-dts';
|
|
12
14
|
|
|
13
15
|
const extensions = ['.js', '.jsx', '.ts', '.tsx'];
|
|
14
16
|
|
|
@@ -48,6 +50,11 @@ export default [
|
|
|
48
50
|
'@ptomasroos/react-native-multi-slider',
|
|
49
51
|
],
|
|
50
52
|
plugins: [
|
|
53
|
+
alias({
|
|
54
|
+
entries: [
|
|
55
|
+
{ find: '@hero-design/rn', replacement: '../rn/src/index.internal.ts' }
|
|
56
|
+
]
|
|
57
|
+
}),
|
|
51
58
|
replace({
|
|
52
59
|
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
53
60
|
}),
|
|
@@ -59,11 +66,11 @@ export default [
|
|
|
59
66
|
babel({ extensions, babelHelpers: 'bundled' }),
|
|
60
67
|
...(generateBuildStats
|
|
61
68
|
? [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
visualizer({
|
|
70
|
+
filename: fileName,
|
|
71
|
+
template: bundleTemplate,
|
|
72
|
+
}),
|
|
73
|
+
]
|
|
67
74
|
: []),
|
|
68
75
|
del({ targets: ['locales', 'assets'] }),
|
|
69
76
|
copy({
|
|
@@ -80,4 +87,12 @@ export default [
|
|
|
80
87
|
}),
|
|
81
88
|
],
|
|
82
89
|
},
|
|
90
|
+
{
|
|
91
|
+
input: 'src/index.ts',
|
|
92
|
+
output: {
|
|
93
|
+
file: 'types/index.d.ts',
|
|
94
|
+
format: 'es',
|
|
95
|
+
},
|
|
96
|
+
plugins: [dts()],
|
|
97
|
+
},
|
|
83
98
|
];
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as Base from '@hero-design/rn';
|
|
2
|
+
import * as HD from '../index';
|
|
3
|
+
import TextInput from '../components/TextInput';
|
|
4
|
+
import Select from '../components/Select';
|
|
5
|
+
import DatePicker from '../components/DatePicker';
|
|
6
|
+
import TimePicker from '../components/TimePicker';
|
|
7
|
+
import { getTheme, theme } from '../index';
|
|
8
|
+
|
|
9
|
+
describe('index.ts exports', () => {
|
|
10
|
+
it('TextInput, Select, DatePicker, TimePicker should be custom rn-work-uikit versions', () => {
|
|
11
|
+
// Check that the exported components are not the same as the base ones
|
|
12
|
+
expect(HD.TextInput).not.toBe(Base.TextInput);
|
|
13
|
+
expect(HD.Select).not.toBe(Base.Select);
|
|
14
|
+
expect(HD.DatePicker).not.toBe(Base.DatePicker);
|
|
15
|
+
expect(HD.TimePicker).not.toBe(Base.TimePicker);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('TextInput, Select, DatePicker, TimePicker should use the custom TextInput', () => {
|
|
19
|
+
// For TextInput, it's a direct export
|
|
20
|
+
expect(HD.TextInput).toBe(TextInput);
|
|
21
|
+
// For Select, DatePicker, TimePicker, check that they use the custom TextInput
|
|
22
|
+
// We can check the displayName or inspect the rendered output
|
|
23
|
+
// For DatePicker and TimePicker, check the TextInputComponent prop
|
|
24
|
+
// (We can't fully render without React Native, but we can check the implementation)
|
|
25
|
+
// These checks are mostly structural
|
|
26
|
+
expect(Select).toBe(HD.Select);
|
|
27
|
+
expect(DatePicker).toBe(HD.DatePicker);
|
|
28
|
+
expect(TimePicker).toBe(HD.TimePicker);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('Theme Export Override', () => {
|
|
33
|
+
it('should export work-specific theme with overridden textInput from index', () => {
|
|
34
|
+
// Check a few key values from the textInput override
|
|
35
|
+
expect(theme.__hd__.textInput.sizes.containerMinHeight).toBe(
|
|
36
|
+
54.92307692307692
|
|
37
|
+
);
|
|
38
|
+
expect(theme.__hd__.textInput.sizes.errorAndHelpTextContainerHeight).toBe(
|
|
39
|
+
0
|
|
40
|
+
);
|
|
41
|
+
expect(theme.__hd__.textInput.space.prefixAndInputContainerGap).toBe(
|
|
42
|
+
3.9230769230769234
|
|
43
|
+
);
|
|
44
|
+
// Check that borderWidths.container.normal is overridden
|
|
45
|
+
expect(theme.__hd__.textInput.borderWidths.container.normal).toBe(2);
|
|
46
|
+
// Check that colors.borders.default is overridden
|
|
47
|
+
expect(theme.__hd__.textInput.colors.borders.default).toBe('#e8e9ea');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should export work-specific getTheme function with overridden textInput', () => {
|
|
51
|
+
const workTheme = getTheme();
|
|
52
|
+
expect(workTheme.__hd__.textInput.sizes.containerMinHeight).toBe(
|
|
53
|
+
54.92307692307692
|
|
54
|
+
);
|
|
55
|
+
expect(
|
|
56
|
+
workTheme.__hd__.textInput.sizes.errorAndHelpTextContainerHeight
|
|
57
|
+
).toBe(0);
|
|
58
|
+
expect(workTheme.__hd__.textInput.space.prefixAndInputContainerGap).toBe(
|
|
59
|
+
3.9230769230769234
|
|
60
|
+
);
|
|
61
|
+
expect(workTheme.__hd__.textInput.borderWidths.container.normal).toBe(2);
|
|
62
|
+
expect(workTheme.__hd__.textInput.colors.borders.default).toBe('#e8e9ea');
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import renderWithTheme from '../../testUtils/renderWithTheme';
|
|
3
|
-
import { TextInput } from '..';
|
|
4
|
-
|
|
5
|
-
describe('first test to ensure configure correctly', () => {
|
|
6
|
-
it('should render TextInput with props in snapshot', () => {
|
|
7
|
-
const onChangeTextSpy = jest.fn();
|
|
8
|
-
const { toJSON } = renderWithTheme(
|
|
9
|
-
<TextInput
|
|
10
|
-
placeholder="Enter text here"
|
|
11
|
-
value="test value"
|
|
12
|
-
onChangeText={onChangeTextSpy}
|
|
13
|
-
testID="text-input"
|
|
14
|
-
/>
|
|
15
|
-
);
|
|
16
|
-
expect(toJSON()).toMatchSnapshot();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
|
|
20
1
|
describe('Export Completeness', () => {
|
|
21
2
|
it('should include all exports from @hero-design/rn', () => {
|
|
22
3
|
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|