@hero-design/rn 8.103.2 → 8.103.3
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 +3 -3
- package/CHANGELOG.md +7 -0
- package/es/index.js +102 -86
- package/eslint.config.js +1 -0
- package/lib/index.js +102 -86
- package/package.json +1 -1
- package/src/components/DatePicker/StyledDatePicker.tsx +1 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +2 -0
- package/src/components/PinInput/PinCell.tsx +6 -1
- package/src/components/PinInput/StyledPinInput.tsx +2 -2
- package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +30 -0
- package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +287 -5
- package/src/components/PinInput/__tests__/index.spec.tsx +33 -0
- package/src/components/PinInput/index.tsx +6 -2
- package/src/components/Select/MultiSelect/index.tsx +15 -4
- package/src/components/Select/SingleSelect/index.tsx +15 -4
- package/src/components/Select/index.internal.tsx +13 -0
- package/src/components/Select/index.tsx +14 -2
- package/src/components/Select/types.ts +4 -0
- package/src/components/TimePicker/StyledTimePicker.tsx +1 -0
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +1 -0
- package/src/index.internal.ts +5 -0
- package/src/types.internal.ts +8 -0
- package/stats/8.103.2/rn-stats.html +3 -1
- package/stats/8.103.3/rn-stats.html +4844 -0
- package/types/components/Checkbox/index.d.ts +1 -1
- package/types/components/PinInput/StyledPinInput.d.ts +2 -4
- package/types/components/Select/MultiSelect/index.d.ts +5 -1
- package/types/components/Select/SingleSelect/index.d.ts +5 -1
- package/types/components/Select/index.d.ts +5 -3
- package/types/components/Select/index.internal.d.ts +8 -0
- package/types/components/Select/types.d.ts +4 -0
- package/types/components/TextInput/index.d.ts +1 -1
- package/types/index.internal.d.ts +4 -0
- package/types/types.internal.d.ts +3 -0
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
import { TouchableOpacity, View } from 'react-native';
|
|
7
7
|
import BottomSheet from '../../BottomSheet';
|
|
8
8
|
import Box from '../../Box';
|
|
9
|
-
import TextInput from '../../TextInput';
|
|
9
|
+
import TextInput, { TextInputProps } from '../../TextInput';
|
|
10
10
|
import Footer from '../Footer';
|
|
11
11
|
import { getScrollParams, toFlatOptions, toSections } from '../helpers';
|
|
12
12
|
import { StyledSearchBar } from '../StyledSelect';
|
|
@@ -52,6 +52,14 @@ export interface MultiSelectProps<
|
|
|
52
52
|
supportedOrientations?: ('portrait' | 'landscape')[];
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
// Add an internal prop type for TextInputComponent, not exported
|
|
56
|
+
export interface InternalMultiSelectProps<
|
|
57
|
+
V,
|
|
58
|
+
T extends SelectOptionType<V> = SelectOptionType<V>
|
|
59
|
+
> extends MultiSelectProps<V, T> {
|
|
60
|
+
TextInputComponent?: React.ComponentType<TextInputProps>;
|
|
61
|
+
}
|
|
62
|
+
|
|
55
63
|
function MultiSelect<V, T extends SelectOptionType<V>>({
|
|
56
64
|
footerLabel,
|
|
57
65
|
label,
|
|
@@ -74,7 +82,8 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
|
|
|
74
82
|
value,
|
|
75
83
|
supportedOrientations = ['portrait'],
|
|
76
84
|
bottomSheetConfig = {},
|
|
77
|
-
|
|
85
|
+
...rest
|
|
86
|
+
}: InternalMultiSelectProps<V, T>) {
|
|
78
87
|
const { isKeyboardVisible, keyboardHeight } = useKeyboard();
|
|
79
88
|
const [open, setOpen] = useState(false);
|
|
80
89
|
const [selectingValue, setSelectingValue] = useState(value);
|
|
@@ -89,6 +98,8 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
|
|
|
89
98
|
const { variant: bottomSheetVariant, header: bottomSheetHeader } =
|
|
90
99
|
bottomSheetConfig;
|
|
91
100
|
|
|
101
|
+
const TextInputComponent = rest.TextInputComponent || TextInput;
|
|
102
|
+
|
|
92
103
|
useEffect(() => {
|
|
93
104
|
setSelectingValue(value);
|
|
94
105
|
}, [open, value]);
|
|
@@ -105,7 +116,7 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
|
|
|
105
116
|
// prevent users from focusing TextInput
|
|
106
117
|
}
|
|
107
118
|
<View pointerEvents="none">
|
|
108
|
-
<
|
|
119
|
+
<TextInputComponent
|
|
109
120
|
{...inputProps}
|
|
110
121
|
label={label}
|
|
111
122
|
value={renderSelectedValue ? rawValue : displayedValue}
|
|
@@ -166,7 +177,7 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
|
|
|
166
177
|
>
|
|
167
178
|
{onQueryChange && (
|
|
168
179
|
<StyledSearchBar>
|
|
169
|
-
<
|
|
180
|
+
<TextInputComponent
|
|
170
181
|
editable
|
|
171
182
|
placeholder="Search"
|
|
172
183
|
suffix="search-outlined"
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
} from 'react-native';
|
|
6
6
|
import { TouchableOpacity, View } from 'react-native';
|
|
7
7
|
import BottomSheet from '../../BottomSheet';
|
|
8
|
-
import TextInput from '../../TextInput';
|
|
8
|
+
import TextInput, { TextInputProps } from '../../TextInput';
|
|
9
9
|
import { getScrollParams, toFlatOptions, toSections } from '../helpers';
|
|
10
10
|
import { StyledSearchBar } from '../StyledSelect';
|
|
11
11
|
import type { SelectOptionType, SectionType, SelectProps } from '../types';
|
|
@@ -37,6 +37,14 @@ export interface SingleSelectProps<
|
|
|
37
37
|
supportedOrientations?: ('portrait' | 'landscape')[];
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
// Add an internal prop type for TextInputComponent, not exported
|
|
41
|
+
export interface InternalSingleSelectProps<
|
|
42
|
+
V,
|
|
43
|
+
T extends SelectOptionType<V> = SelectOptionType<V>
|
|
44
|
+
> extends SingleSelectProps<V, T> {
|
|
45
|
+
TextInputComponent?: React.ComponentType<TextInputProps>;
|
|
46
|
+
}
|
|
47
|
+
|
|
40
48
|
const SingleSelect = <V, T extends SelectOptionType<V>>({
|
|
41
49
|
label,
|
|
42
50
|
loading = false,
|
|
@@ -58,7 +66,8 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
|
|
|
58
66
|
value,
|
|
59
67
|
supportedOrientations = ['portrait'],
|
|
60
68
|
bottomSheetConfig = {},
|
|
61
|
-
|
|
69
|
+
...rest
|
|
70
|
+
}: InternalSingleSelectProps<V, T>) => {
|
|
62
71
|
const { isKeyboardVisible, keyboardHeight } = useKeyboard();
|
|
63
72
|
const [open, setOpen] = useState(false);
|
|
64
73
|
const sectionListRef = useRef<SectionList<T, SectionType>>(null);
|
|
@@ -72,6 +81,8 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
|
|
|
72
81
|
const { variant: bottomSheetVariant, header: bottomSheetHeader } =
|
|
73
82
|
bottomSheetConfig;
|
|
74
83
|
|
|
84
|
+
const TextInputComponent = rest.TextInputComponent || TextInput;
|
|
85
|
+
|
|
75
86
|
return (
|
|
76
87
|
<>
|
|
77
88
|
<View
|
|
@@ -84,7 +95,7 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
|
|
|
84
95
|
// prevent users from focusing TextInput
|
|
85
96
|
}
|
|
86
97
|
<View pointerEvents="none">
|
|
87
|
-
<
|
|
98
|
+
<TextInputComponent
|
|
88
99
|
{...inputProps}
|
|
89
100
|
label={label}
|
|
90
101
|
value={renderSelectedValue ? rawValue : displayedValue}
|
|
@@ -127,7 +138,7 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
|
|
|
127
138
|
>
|
|
128
139
|
{onQueryChange && (
|
|
129
140
|
<StyledSearchBar>
|
|
130
|
-
<
|
|
141
|
+
<TextInputComponent
|
|
131
142
|
editable
|
|
132
143
|
placeholder="Search"
|
|
133
144
|
suffix="search-outlined"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import MultiSelect from './MultiSelect';
|
|
2
|
+
import SingleSelect from './SingleSelect';
|
|
3
|
+
import type { InternalMultiSelectProps } from './MultiSelect';
|
|
4
|
+
import type { InternalSingleSelectProps } from './SingleSelect';
|
|
5
|
+
|
|
6
|
+
export type {
|
|
7
|
+
InternalMultiSelectProps as MultiSelectProps,
|
|
8
|
+
InternalSingleSelectProps as SingleSelectProps,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default Object.assign(SingleSelect, {
|
|
12
|
+
Multi: MultiSelect,
|
|
13
|
+
});
|
|
@@ -2,9 +2,21 @@ import MultiSelect from './MultiSelect';
|
|
|
2
2
|
import SingleSelect from './SingleSelect';
|
|
3
3
|
import type { MultiSelectProps } from './MultiSelect';
|
|
4
4
|
import type { SingleSelectProps } from './SingleSelect';
|
|
5
|
+
import { SelectOptionType } from './types';
|
|
5
6
|
|
|
6
7
|
export type { MultiSelectProps, SingleSelectProps };
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
type SingleSelectType = <
|
|
10
|
+
V,
|
|
11
|
+
T extends SelectOptionType<V> = SelectOptionType<V>
|
|
12
|
+
>(
|
|
13
|
+
props: Omit<SingleSelectProps<V, T>, 'TextInputComponent'>
|
|
14
|
+
) => React.ReactElement;
|
|
15
|
+
|
|
16
|
+
type MultiSelectType = <V, T extends SelectOptionType<V> = SelectOptionType<V>>(
|
|
17
|
+
props: Omit<MultiSelectProps<V, T>, 'TextInputComponent'>
|
|
18
|
+
) => React.ReactElement;
|
|
19
|
+
|
|
20
|
+
export default Object.assign(SingleSelect as SingleSelectType, {
|
|
21
|
+
Multi: MultiSelect as MultiSelectType,
|
|
10
22
|
});
|
|
@@ -102,4 +102,8 @@ export interface SelectProps<V, T extends SelectOptionType<V>>
|
|
|
102
102
|
variant?: BottomSheetProps['variant'];
|
|
103
103
|
header?: BottomSheetProps['header'];
|
|
104
104
|
};
|
|
105
|
+
/**
|
|
106
|
+
* Inject a custom TextInput component (e.g., from rn-work-uikit). Defaults to local TextInput.
|
|
107
|
+
*/
|
|
108
|
+
TextInputComponent?: React.ComponentType<TextInputProps>;
|
|
105
109
|
}
|