@hero-design/rn-work-uikit 1.11.3 → 1.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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/es/index.js +4113 -18624
- package/lib/index.js +5872 -20383
- package/locales/index.mjs +4 -4
- package/package.json +27 -26
- package/rollup.config.mjs +1 -1
- package/src/components/FormGroup/index.tsx +21 -10
- package/src/components/FormGroup/utils.ts +3 -3
- package/src/components/TextInput/InputRow.tsx +3 -6
- package/src/components/TextInput/index.tsx +4 -4
- package/src/components/TextInput/types.ts +4 -8
- package/types/index.d.ts +3 -3
package/locales/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import locale from './en_AU.mjs';
|
|
2
|
-
import locale
|
|
1
|
+
import locale$1 from './en_AU.mjs';
|
|
2
|
+
import locale from './en_CA.mjs';
|
|
3
3
|
|
|
4
4
|
var index = {
|
|
5
|
-
'en-AU': locale,
|
|
6
|
-
'en-CA': locale
|
|
5
|
+
'en-AU': locale$1,
|
|
6
|
+
'en-CA': locale,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export { index as default };
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn-work-uikit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
|
+
"react-native": "src/index.ts",
|
|
7
8
|
"types": "types/index.d.ts",
|
|
8
9
|
"description": "EH Work specific UI components built on top of @hero-design/rn",
|
|
9
10
|
"scripts": {
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
"test:watch": "jest --runInBand --watch",
|
|
14
15
|
"test:ci": "jest --c=jest-ci.config.js --i --logHeapUsage --coverage",
|
|
15
16
|
"build:js": "rollup -c",
|
|
16
|
-
"build:types": "rollup -c rollup.config.mjs --configPlugin dts",
|
|
17
|
+
"build:types": "rollup -c rollup.config.mjs --configImportAttributesKey with --configPlugin dts",
|
|
17
18
|
"build": "yarn build:js && yarn build:types",
|
|
18
19
|
"build:watch": "yarn build:js -w & yarn build:types -w",
|
|
19
20
|
"publish:npm": "yarn publish --access public",
|
|
@@ -22,20 +23,20 @@
|
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"@emotion/native": "^11.9.3",
|
|
24
25
|
"@emotion/react": "^11.9.3",
|
|
25
|
-
"@hero-design/rn": "8.
|
|
26
|
+
"@hero-design/rn": "8.119.0",
|
|
26
27
|
"hero-editor": "^1.17.0"
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|
|
29
|
-
"@hero-design/react-native-month-year-picker": "^8.45.
|
|
30
|
+
"@hero-design/react-native-month-year-picker": "^8.45.1",
|
|
30
31
|
"@ptomasroos/react-native-multi-slider": "^2.2.2",
|
|
31
|
-
"@react-native-community/datetimepicker": "^
|
|
32
|
-
"@react-native-community/slider": "^
|
|
33
|
-
"react": "
|
|
34
|
-
"react-native": "0.
|
|
35
|
-
"react-native-gesture-handler": "~2.
|
|
32
|
+
"@react-native-community/datetimepicker": "^8.4.4",
|
|
33
|
+
"@react-native-community/slider": " ^5.0.1",
|
|
34
|
+
"react": "19.1.0",
|
|
35
|
+
"react-native": "0.81.5",
|
|
36
|
+
"react-native-gesture-handler": "~2.28.0",
|
|
36
37
|
"react-native-linear-gradient": "^2.8.3",
|
|
37
38
|
"react-native-pager-view": "^6.7.0",
|
|
38
|
-
"react-native-safe-area-context": "
|
|
39
|
+
"react-native-safe-area-context": "~5.6.0",
|
|
39
40
|
"react-native-svg": "^15.11.2",
|
|
40
41
|
"react-native-vector-icons": "^9.1.0",
|
|
41
42
|
"react-native-webview": "^13.10.2"
|
|
@@ -52,12 +53,12 @@
|
|
|
52
53
|
"@eslint/compat": "^1.1.1",
|
|
53
54
|
"@eslint/eslintrc": "^3.1.0",
|
|
54
55
|
"@eslint/js": "^9.8.0",
|
|
55
|
-
"@hero-design/eslint-plugin": "9.2.
|
|
56
|
-
"@hero-design/react-native-month-year-picker": "^8.45.
|
|
56
|
+
"@hero-design/eslint-plugin": "9.2.2",
|
|
57
|
+
"@hero-design/react-native-month-year-picker": "^8.45.1",
|
|
57
58
|
"@ptomasroos/react-native-multi-slider": "^2.2.2",
|
|
58
|
-
"@react-native-community/datetimepicker": "8.
|
|
59
|
-
"@react-native-community/slider": "^
|
|
60
|
-
"@react-native/babel-preset": "0.
|
|
59
|
+
"@react-native-community/datetimepicker": "8.4.4",
|
|
60
|
+
"@react-native-community/slider": "^5.0.1",
|
|
61
|
+
"@react-native/babel-preset": "0.81.5",
|
|
61
62
|
"@rollup/plugin-alias": "^5.1.1",
|
|
62
63
|
"@rollup/plugin-babel": "^6.0.4",
|
|
63
64
|
"@rollup/plugin-commonjs": "^28.0.1",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"@testing-library/jest-native": "^5.4.2",
|
|
69
70
|
"@testing-library/react-native": "^13.0.0",
|
|
70
71
|
"@types/jest": "^29.5.3",
|
|
71
|
-
"@types/react": "^
|
|
72
|
+
"@types/react": "^19.0.0",
|
|
72
73
|
"@types/react-native-vector-icons": "^6.4.10",
|
|
73
74
|
"@types/react-test-renderer": "^19.1.0",
|
|
74
75
|
"@typescript-eslint/eslint-plugin": "^5.12.1",
|
|
@@ -81,21 +82,21 @@
|
|
|
81
82
|
"jest-environment-jsdom": "^29.2.1",
|
|
82
83
|
"jest-junit": "^16.0.0",
|
|
83
84
|
"prettier-config-hd": "8.42.4",
|
|
84
|
-
"react": "
|
|
85
|
-
"react-dom": "
|
|
86
|
-
"react-native": "0.
|
|
87
|
-
"react-native-gesture-handler": "~2.
|
|
85
|
+
"react": "19.1.0",
|
|
86
|
+
"react-dom": "19.1.0",
|
|
87
|
+
"react-native": "0.81.5",
|
|
88
|
+
"react-native-gesture-handler": "~2.28.0",
|
|
88
89
|
"react-native-linear-gradient": "2.8.3",
|
|
89
|
-
"react-native-pager-view": "6.
|
|
90
|
-
"react-native-safe-area-context": "
|
|
91
|
-
"react-native-svg": "15.
|
|
90
|
+
"react-native-pager-view": "6.9.1",
|
|
91
|
+
"react-native-safe-area-context": "~5.6.0",
|
|
92
|
+
"react-native-svg": "15.12.1",
|
|
92
93
|
"react-native-vector-icons": "^9.1.0",
|
|
93
94
|
"react-native-webview": "^13.16.0",
|
|
94
|
-
"react-test-renderer": "
|
|
95
|
-
"rollup": "^4.
|
|
95
|
+
"react-test-renderer": "19.1.0",
|
|
96
|
+
"rollup": "^4.57.1",
|
|
96
97
|
"rollup-plugin-copy": "^3.5.0",
|
|
97
98
|
"rollup-plugin-delete": "^3.0.1",
|
|
98
|
-
"rollup-plugin-dts": "^6.
|
|
99
|
+
"rollup-plugin-dts": "^6.3.0",
|
|
99
100
|
"rollup-plugin-flow": "^1.1.1",
|
|
100
101
|
"rollup-plugin-visualizer": "^5.12.0",
|
|
101
102
|
"ts-jest": "^29.1.1",
|
package/rollup.config.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import json from '@rollup/plugin-json';
|
|
|
6
6
|
import replace from '@rollup/plugin-replace';
|
|
7
7
|
import flow from 'rollup-plugin-flow';
|
|
8
8
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
9
|
-
import pkg from './package.json'
|
|
9
|
+
import pkg from './package.json' with { type: 'json' };
|
|
10
10
|
import copy from 'rollup-plugin-copy';
|
|
11
11
|
import del from 'rollup-plugin-delete';
|
|
12
12
|
import alias from '@rollup/plugin-alias';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
-
import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
import type { StyleProp, ViewProps, ViewStyle, TextStyle } from 'react-native';
|
|
4
4
|
import { StyleSheet } from 'react-native';
|
|
5
5
|
import { Box, useTheme } from '@hero-design/rn';
|
|
6
6
|
import { generateBorderStyle, generateMarginStyle } from './utils';
|
|
@@ -32,22 +32,33 @@ interface FormGroupProps extends ViewProps {
|
|
|
32
32
|
testID?: string;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
interface ChildProps extends ViewProps {
|
|
36
|
+
textStyle?: TextStyle;
|
|
37
|
+
groupStyleEnabled?: boolean;
|
|
38
|
+
inputProps?: {
|
|
39
|
+
textStyle?: TextStyle;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
35
44
|
const FormGroup = ({ children, style, testID, ...props }: FormGroupProps) => {
|
|
36
45
|
const theme = useTheme();
|
|
46
|
+
|
|
37
47
|
const childrenArray = React.Children.toArray(children).filter(
|
|
38
|
-
(child): child is ReactElement => React.isValidElement(child)
|
|
48
|
+
(child): child is ReactElement<ChildProps> => React.isValidElement(child)
|
|
39
49
|
);
|
|
40
50
|
|
|
41
51
|
// If there are multiple children, inject styles to group them together.
|
|
42
52
|
const groupedChildren = useMemo(
|
|
43
53
|
() =>
|
|
44
54
|
childrenArray.map((child, index) => {
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
55
|
+
// Flatten styles to handle array styles
|
|
56
|
+
const childStyle = child.props.style
|
|
57
|
+
? StyleSheet.flatten(child.props.style)
|
|
58
|
+
: undefined;
|
|
59
|
+
const childTextStyle = child.props.textStyle
|
|
60
|
+
? StyleSheet.flatten(child.props.textStyle)
|
|
61
|
+
: undefined;
|
|
51
62
|
|
|
52
63
|
/**
|
|
53
64
|
* Merge the child style with the group injected style.
|
|
@@ -56,7 +67,7 @@ const FormGroup = ({ children, style, testID, ...props }: FormGroupProps) => {
|
|
|
56
67
|
* 2. Group injected style.
|
|
57
68
|
*/
|
|
58
69
|
const mergedStyle = {
|
|
59
|
-
...childStyle,
|
|
70
|
+
...(childStyle || {}),
|
|
60
71
|
...generateMarginStyle({
|
|
61
72
|
index,
|
|
62
73
|
length: childrenArray.length,
|
|
@@ -72,7 +83,7 @@ const FormGroup = ({ children, style, testID, ...props }: FormGroupProps) => {
|
|
|
72
83
|
* 3. Group injected border style.
|
|
73
84
|
*/
|
|
74
85
|
const mergedTextStyle = {
|
|
75
|
-
...childTextStyle,
|
|
86
|
+
...(childTextStyle || {}),
|
|
76
87
|
...generateBorderStyle({
|
|
77
88
|
index,
|
|
78
89
|
length: childrenArray.length,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TextStyle, ViewStyle } from 'react-native';
|
|
2
2
|
import type { Theme } from '@hero-design/rn';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -13,7 +13,7 @@ const generateBorderStyle = ({
|
|
|
13
13
|
}: {
|
|
14
14
|
index: number;
|
|
15
15
|
length: number;
|
|
16
|
-
}):
|
|
16
|
+
}): TextStyle => {
|
|
17
17
|
const isFirst = index === 0;
|
|
18
18
|
const isLast = index === length - 1;
|
|
19
19
|
|
|
@@ -48,7 +48,7 @@ const generateMarginStyle = ({
|
|
|
48
48
|
index: number;
|
|
49
49
|
length: number;
|
|
50
50
|
theme: Theme;
|
|
51
|
-
}) => {
|
|
51
|
+
}): ViewStyle => {
|
|
52
52
|
if (length === 1) {
|
|
53
53
|
return {};
|
|
54
54
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import type {
|
|
4
|
-
NativeSyntheticEvent,
|
|
5
|
-
TextInputFocusEventData,
|
|
6
|
-
} from 'react-native';
|
|
3
|
+
import type { BlurEvent, FocusEvent } from 'react-native';
|
|
7
4
|
import type { IconName } from '@hero-design/rn';
|
|
8
5
|
import { StyledInputRow } from './StyledTextInput';
|
|
9
6
|
import PrefixComponent from './PrefixComponent';
|
|
@@ -81,7 +78,7 @@ const InputRow = React.forwardRef<TextInputRef, InputRowProps>(
|
|
|
81
78
|
|
|
82
79
|
// Simplified callback functions (removed unnecessary memoization for simple cases)
|
|
83
80
|
const handleFocus = useCallback(
|
|
84
|
-
(event?:
|
|
81
|
+
(event?: FocusEvent) => {
|
|
85
82
|
setIsFocused(true);
|
|
86
83
|
nativeInputProps.onFocus?.(event);
|
|
87
84
|
},
|
|
@@ -89,7 +86,7 @@ const InputRow = React.forwardRef<TextInputRef, InputRowProps>(
|
|
|
89
86
|
);
|
|
90
87
|
|
|
91
88
|
const handleBlur = useCallback(
|
|
92
|
-
(event?:
|
|
89
|
+
(event?: BlurEvent) => {
|
|
93
90
|
setIsFocused(false);
|
|
94
91
|
nativeInputProps.onBlur?.(event);
|
|
95
92
|
},
|
|
@@ -3,9 +3,9 @@ import { StyleSheet } from 'react-native';
|
|
|
3
3
|
import type {
|
|
4
4
|
StyleProp,
|
|
5
5
|
ViewStyle,
|
|
6
|
-
NativeSyntheticEvent,
|
|
7
|
-
TextInputFocusEventData,
|
|
8
6
|
ColorValue,
|
|
7
|
+
BlurEvent,
|
|
8
|
+
FocusEvent,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
import {
|
|
11
11
|
StyledInputWrapper,
|
|
@@ -210,7 +210,7 @@ export const InternalTextInput = forwardRef<
|
|
|
210
210
|
|
|
211
211
|
// Simplified callback functions (removed unnecessary memoization for simple cases)
|
|
212
212
|
const handleFocus = useCallback(
|
|
213
|
-
(event?:
|
|
213
|
+
(event?: FocusEvent) => {
|
|
214
214
|
setIsFocused(true);
|
|
215
215
|
onFocus?.(event);
|
|
216
216
|
},
|
|
@@ -218,7 +218,7 @@ export const InternalTextInput = forwardRef<
|
|
|
218
218
|
);
|
|
219
219
|
|
|
220
220
|
const handleBlur = useCallback(
|
|
221
|
-
(event?:
|
|
221
|
+
(event?: BlurEvent) => {
|
|
222
222
|
setIsFocused(false);
|
|
223
223
|
onBlur?.(event);
|
|
224
224
|
},
|
|
@@ -4,8 +4,8 @@ import type {
|
|
|
4
4
|
ViewStyle,
|
|
5
5
|
TextStyle,
|
|
6
6
|
TextInput as RNTextInput,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
FocusEvent,
|
|
8
|
+
BlurEvent,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
import type { IconName } from '@hero-design/rn';
|
|
11
11
|
|
|
@@ -20,12 +20,8 @@ export type NativeTextInputProps = Omit<
|
|
|
20
20
|
RNTextInputProps,
|
|
21
21
|
'onFocus' | 'onBlur'
|
|
22
22
|
> & {
|
|
23
|
-
onFocus?: (
|
|
24
|
-
|
|
25
|
-
) => void | undefined;
|
|
26
|
-
onBlur?: (
|
|
27
|
-
event?: NativeSyntheticEvent<TextInputFocusEventData>
|
|
28
|
-
) => void | undefined;
|
|
23
|
+
onFocus?: (event?: FocusEvent) => void | undefined;
|
|
24
|
+
onBlur?: (event?: BlurEvent) => void | undefined;
|
|
29
25
|
};
|
|
30
26
|
|
|
31
27
|
export interface TextInputRef {
|
package/types/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React$1, { ReactNode, Ref, ReactElement, PropsWithChildren } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { TextInputProps as TextInputProps$1, FocusEvent, BlurEvent, StyleProp, ViewStyle, TextStyle, TextInput as TextInput$1, ViewProps } from 'react-native';
|
|
3
3
|
import { IconName, SelectOptionType, SingleSelectProps, MultiSelectProps, DatePickerProps, TimePickerProps, Theme as Theme$1, Scale, SystemPalette } from '@hero-design/rn';
|
|
4
4
|
export * from '@hero-design/rn';
|
|
5
5
|
|
|
6
6
|
type TextInputHandles = Pick<TextInput$1, 'focus' | 'clear' | 'blur' | 'isFocused' | 'setNativeProps'>;
|
|
7
7
|
type TextInputVariant = 'text' | 'textarea';
|
|
8
8
|
type NativeTextInputProps = Omit<TextInputProps$1, 'onFocus' | 'onBlur'> & {
|
|
9
|
-
onFocus?: (event?:
|
|
10
|
-
onBlur?: (event?:
|
|
9
|
+
onFocus?: (event?: FocusEvent) => void | undefined;
|
|
10
|
+
onBlur?: (event?: BlurEvent) => void | undefined;
|
|
11
11
|
};
|
|
12
12
|
interface TextInputRef {
|
|
13
13
|
focus: () => void;
|