@hero-design/rn 8.128.0 → 8.128.2
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 +21 -0
- package/CLAUDE.md +1 -1
- package/es/index.js +196 -288
- package/lib/index.js +196 -288
- package/package.json +8 -1
- package/src/components/DatePicker/DatePicker.tsx +5 -24
- package/src/components/DatePicker/DatePickerAndroid.tsx +8 -17
- package/src/components/DatePicker/DatePickerCalendar.tsx +8 -17
- package/src/components/DatePicker/DatePickerIOS.tsx +8 -17
- package/src/components/DatePicker/StyledDatePicker.tsx +2 -19
- package/src/components/DatePicker/types.ts +0 -17
- package/src/components/FAB/FAB.tsx +37 -5
- package/src/components/FAB/Pair/StyledFAB.tsx +2 -2
- package/src/components/FAB/Pair/index.tsx +6 -0
- package/src/components/FAB/StyledFAB.tsx +3 -1
- package/src/components/Select/MultiSelect/index.tsx +9 -23
- package/src/components/Select/SingleSelect/index.tsx +9 -23
- package/src/components/Select/StyledSelect.tsx +2 -25
- package/src/components/Select/index.tsx +2 -8
- package/src/components/Select/types.ts +0 -4
- package/src/components/StatusScreens/Error/StyledError.tsx +0 -6
- package/src/components/StatusScreens/Error/index.tsx +2 -6
- package/src/components/StatusScreens/Success/StyledSuccess.tsx +0 -6
- package/src/components/StatusScreens/Success/index.tsx +2 -2
- package/src/components/TimePicker/StyledTimePicker.tsx +2 -19
- package/src/components/TimePicker/TimePicker.tsx +2 -2
- package/src/components/TimePicker/TimePickerAndroid.tsx +6 -15
- package/src/components/TimePicker/TimePickerIOS.tsx +7 -18
- package/src/components/TimePicker/types.ts +0 -17
- package/src/theme/components/fab.ts +12 -11
- package/src/theme/global/colors/ehJobs.ts +1 -0
- package/src/theme/global/colors/ehWork.ts +1 -1
- package/types/components/Checkbox/StyledInlineCheckBox.d.ts +1 -1
- package/types/components/Checkbox/utils.d.ts +1 -1
- package/types/components/DatePicker/DatePicker.d.ts +2 -2
- package/types/components/DatePicker/DatePickerAndroid.d.ts +3 -3
- package/types/components/DatePicker/DatePickerCalendar.d.ts +2 -2
- package/types/components/DatePicker/DatePickerIOS.d.ts +3 -3
- package/types/components/DatePicker/StyledDatePicker.d.ts +1 -8
- package/types/components/DatePicker/types.d.ts +0 -15
- package/types/components/FAB/FAB.d.ts +5 -1
- package/types/components/FAB/Pair/StyledFAB.d.ts +3 -1
- package/types/components/FAB/StyledFAB.d.ts +1 -0
- package/types/components/Select/MultiSelect/index.d.ts +1 -6
- package/types/components/Select/SingleSelect/index.d.ts +1 -6
- package/types/components/Select/StyledSelect.d.ts +1 -8
- package/types/components/Select/index.d.ts +2 -2
- package/types/components/Select/types.d.ts +0 -4
- package/types/components/StatusScreens/Error/StyledError.d.ts +1 -5
- package/types/components/StatusScreens/Success/StyledSuccess.d.ts +1 -5
- package/types/components/TextInput/index.d.ts +1 -1
- package/types/components/TimePicker/StyledTimePicker.d.ts +1 -8
- package/types/components/TimePicker/TimePicker.d.ts +2 -2
- package/types/components/TimePicker/TimePickerAndroid.d.ts +2 -2
- package/types/components/TimePicker/TimePickerIOS.d.ts +2 -2
- package/types/components/TimePicker/types.d.ts +0 -15
- package/src/components/DatePicker/index.internal.tsx +0 -10
- package/src/components/Select/index.internal.tsx +0 -26
- package/src/components/TimePicker/index.internal.tsx +0 -9
- package/src/index.internal.ts +0 -26
- package/src/types.internal.ts +0 -28
- package/types/components/DatePicker/index.internal.d.ts +0 -7
- package/types/components/Select/index.internal.d.ts +0 -21
- package/types/components/TimePicker/index.internal.d.ts +0 -5
- package/types/index.internal.d.ts +0 -19
- package/types/types.internal.d.ts +0 -18
package/package.json
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.128.
|
|
3
|
+
"version": "8.128.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
"*": {
|
|
10
|
+
"locales/*": [
|
|
11
|
+
"types/locales/*"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
8
15
|
"react-native": "src/index.ts",
|
|
9
16
|
"scripts": {
|
|
10
17
|
"lint": "eslint src --quiet",
|
|
@@ -3,36 +3,17 @@ import { Platform } from 'react-native';
|
|
|
3
3
|
import DatePickerAndroid from './DatePickerAndroid';
|
|
4
4
|
import DatePickerCalendar from './DatePickerCalendar';
|
|
5
5
|
import DatePickerIOS from './DatePickerIOS';
|
|
6
|
-
import type {
|
|
7
|
-
import TextInput from '../TextInput';
|
|
6
|
+
import type { DatePickerProps } from './types';
|
|
8
7
|
|
|
9
|
-
const DatePicker = ({
|
|
10
|
-
variant = 'default',
|
|
11
|
-
TextInputComponent = TextInput,
|
|
12
|
-
...props
|
|
13
|
-
}: InternalDatePickerProps) => {
|
|
8
|
+
const DatePicker = ({ variant = 'default', ...props }: DatePickerProps) => {
|
|
14
9
|
if (variant === 'calendar') {
|
|
15
|
-
return
|
|
16
|
-
<DatePickerCalendar {...props} TextInputComponent={TextInputComponent} />
|
|
17
|
-
);
|
|
10
|
+
return <DatePickerCalendar {...props} />;
|
|
18
11
|
}
|
|
19
12
|
if (Platform.OS === 'ios') {
|
|
20
|
-
return
|
|
21
|
-
<DatePickerIOS
|
|
22
|
-
{...props}
|
|
23
|
-
variant={variant}
|
|
24
|
-
TextInputComponent={TextInputComponent}
|
|
25
|
-
/>
|
|
26
|
-
);
|
|
13
|
+
return <DatePickerIOS {...props} variant={variant} />;
|
|
27
14
|
}
|
|
28
15
|
|
|
29
|
-
return
|
|
30
|
-
<DatePickerAndroid
|
|
31
|
-
{...props}
|
|
32
|
-
variant={variant}
|
|
33
|
-
TextInputComponent={TextInputComponent}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
16
|
+
return <DatePickerAndroid {...props} variant={variant} />;
|
|
36
17
|
};
|
|
37
18
|
|
|
38
19
|
export default DatePicker;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import TextInput from '../TextInput';
|
|
5
5
|
import AndroidDatePickerDialog from './Dialog/AndroidDialog';
|
|
6
6
|
import useCalculateDate from './hooks/useCalculateDate';
|
|
7
7
|
import useFormatDate from './hooks/useFormatDate';
|
|
8
|
-
import {
|
|
9
|
-
import type { InternalDatePickerProps } from './types';
|
|
8
|
+
import type { DatePickerProps } from './types';
|
|
10
9
|
|
|
11
10
|
type DatePickerAndroidProps = Omit<
|
|
12
|
-
|
|
11
|
+
DatePickerProps,
|
|
13
12
|
'variant' | 'monthPickerConfirmLabel' | 'monthPickerCancelLabel'
|
|
14
13
|
> & {
|
|
15
14
|
variant?: 'default' | 'month-year';
|
|
@@ -31,9 +30,6 @@ const DatePickerAndroid = ({
|
|
|
31
30
|
variant = 'default',
|
|
32
31
|
renderSelectedValue,
|
|
33
32
|
locale,
|
|
34
|
-
TextInputComponent,
|
|
35
|
-
inputProps,
|
|
36
|
-
groupStyleEnabled = false,
|
|
37
33
|
}: DatePickerAndroidProps) => {
|
|
38
34
|
const [open, setOpen] = useState(false);
|
|
39
35
|
|
|
@@ -45,23 +41,18 @@ const DatePickerAndroid = ({
|
|
|
45
41
|
|
|
46
42
|
useCalculateDate({ minDate, maxDate, onChange, value });
|
|
47
43
|
|
|
48
|
-
const InputComponent = TextInputComponent || TextInput;
|
|
49
|
-
|
|
50
44
|
const onPress = useCallback(() => {
|
|
51
45
|
setOpen(true);
|
|
52
46
|
}, []);
|
|
53
47
|
|
|
54
48
|
return (
|
|
55
|
-
<
|
|
49
|
+
<TouchableOpacity
|
|
56
50
|
onPress={onPress}
|
|
57
51
|
disabled={disabled}
|
|
58
|
-
themeGroupStyleEnabled={groupStyleEnabled}
|
|
59
|
-
themeHasError={!!error}
|
|
60
52
|
testID="date-picker-android-touchable-opacity"
|
|
61
53
|
>
|
|
62
54
|
<View pointerEvents="none" testID="datePickerInputAndroid">
|
|
63
|
-
<
|
|
64
|
-
{...inputProps}
|
|
55
|
+
<TextInput
|
|
65
56
|
label={label}
|
|
66
57
|
value={displayValue}
|
|
67
58
|
suffix="calendar-dates-outlined"
|
|
@@ -74,13 +65,13 @@ const DatePickerAndroid = ({
|
|
|
74
65
|
testID={testID}
|
|
75
66
|
renderInputValue={
|
|
76
67
|
renderSelectedValue !== undefined && !!value
|
|
77
|
-
? (
|
|
68
|
+
? (inputProps) =>
|
|
78
69
|
renderSelectedValue(
|
|
79
70
|
{
|
|
80
71
|
date: value,
|
|
81
72
|
formattedDateString: displayValue,
|
|
82
73
|
},
|
|
83
|
-
|
|
74
|
+
inputProps
|
|
84
75
|
)
|
|
85
76
|
: undefined
|
|
86
77
|
}
|
|
@@ -95,7 +86,7 @@ const DatePickerAndroid = ({
|
|
|
95
86
|
onChange={onChange}
|
|
96
87
|
variant={variant}
|
|
97
88
|
/>
|
|
98
|
-
</
|
|
89
|
+
</TouchableOpacity>
|
|
99
90
|
);
|
|
100
91
|
};
|
|
101
92
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
|
-
import { Platform, ScrollView, View } from 'react-native';
|
|
2
|
+
import { Platform, ScrollView, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import BottomSheet from '../BottomSheet';
|
|
5
5
|
import Button from '../Button';
|
|
@@ -8,8 +8,7 @@ import type { CalendarProps } from '../Calendar/types';
|
|
|
8
8
|
import TextInput from '../TextInput';
|
|
9
9
|
import useCalculateDate from './hooks/useCalculateDate';
|
|
10
10
|
import useFormatDate from './hooks/useFormatDate';
|
|
11
|
-
import {
|
|
12
|
-
import type { InternalDatePickerProps } from './types';
|
|
11
|
+
import type { DatePickerProps } from './types';
|
|
13
12
|
|
|
14
13
|
const InternalCalendar = ({
|
|
15
14
|
minDate,
|
|
@@ -82,10 +81,7 @@ const DatePickerCalendar = ({
|
|
|
82
81
|
supportedOrientations = ['portrait'],
|
|
83
82
|
renderSelectedValue,
|
|
84
83
|
locale,
|
|
85
|
-
|
|
86
|
-
inputProps,
|
|
87
|
-
groupStyleEnabled = false,
|
|
88
|
-
}: Omit<InternalDatePickerProps, 'variant'>) => {
|
|
84
|
+
}: Omit<DatePickerProps, 'variant'>) => {
|
|
89
85
|
const [open, setOpen] = useState(false);
|
|
90
86
|
const [monthPickerVisible, setMonthPickerVisible] = useState(false);
|
|
91
87
|
const shouldHideToolbar = Platform.OS === 'ios' && monthPickerVisible;
|
|
@@ -100,23 +96,18 @@ const DatePickerCalendar = ({
|
|
|
100
96
|
|
|
101
97
|
useCalculateDate({ minDate, maxDate, onChange, value });
|
|
102
98
|
|
|
103
|
-
const InputComponent = TextInputComponent || TextInput;
|
|
104
|
-
|
|
105
99
|
const onPress = useCallback(() => {
|
|
106
100
|
setOpen(true);
|
|
107
101
|
}, []);
|
|
108
102
|
|
|
109
103
|
return (
|
|
110
|
-
<
|
|
104
|
+
<TouchableOpacity
|
|
111
105
|
onPress={onPress}
|
|
112
106
|
disabled={disabled}
|
|
113
|
-
themeGroupStyleEnabled={groupStyleEnabled}
|
|
114
|
-
themeHasError={!!error}
|
|
115
107
|
testID="date-picker-calendar-touchable-opacity"
|
|
116
108
|
>
|
|
117
109
|
<View pointerEvents="none" testID="datePickerCalendar">
|
|
118
|
-
<
|
|
119
|
-
{...inputProps}
|
|
110
|
+
<TextInput
|
|
120
111
|
label={label}
|
|
121
112
|
value={displayValue}
|
|
122
113
|
suffix="calendar-dates-outlined"
|
|
@@ -129,13 +120,13 @@ const DatePickerCalendar = ({
|
|
|
129
120
|
style={style}
|
|
130
121
|
renderInputValue={
|
|
131
122
|
renderSelectedValue !== undefined && !!value
|
|
132
|
-
? (
|
|
123
|
+
? (inputProps) =>
|
|
133
124
|
renderSelectedValue(
|
|
134
125
|
{
|
|
135
126
|
date: value,
|
|
136
127
|
formattedDateString: displayValue,
|
|
137
128
|
},
|
|
138
|
-
|
|
129
|
+
inputProps
|
|
139
130
|
)
|
|
140
131
|
: undefined
|
|
141
132
|
}
|
|
@@ -173,7 +164,7 @@ const DatePickerCalendar = ({
|
|
|
173
164
|
/>
|
|
174
165
|
</ScrollView>
|
|
175
166
|
</BottomSheet>
|
|
176
|
-
</
|
|
167
|
+
</TouchableOpacity>
|
|
177
168
|
);
|
|
178
169
|
};
|
|
179
170
|
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
2
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useLocale } from '../LocaleProvider/hooks';
|
|
5
5
|
import TextInput from '../TextInput';
|
|
6
6
|
import IOSDatePickerDialog from './Dialog/IOSDialog';
|
|
7
7
|
import useCalculateDate from './hooks/useCalculateDate';
|
|
8
8
|
import useFormatDate from './hooks/useFormatDate';
|
|
9
|
-
import {
|
|
10
|
-
import type { InternalDatePickerProps } from './types';
|
|
9
|
+
import type { DatePickerProps } from './types';
|
|
11
10
|
|
|
12
11
|
type DatePickerIOSProps = Omit<
|
|
13
|
-
|
|
12
|
+
DatePickerProps,
|
|
14
13
|
'variant' | 'monthPickerConfirmLabel' | 'monthPickerCancelLabel'
|
|
15
14
|
> & {
|
|
16
15
|
variant?: 'default' | 'month-year';
|
|
@@ -34,9 +33,6 @@ const DatePickerIOS = ({
|
|
|
34
33
|
variant = 'default',
|
|
35
34
|
locale,
|
|
36
35
|
renderSelectedValue,
|
|
37
|
-
TextInputComponent,
|
|
38
|
-
inputProps,
|
|
39
|
-
groupStyleEnabled = false,
|
|
40
36
|
}: DatePickerIOSProps) => {
|
|
41
37
|
const [open, setOpen] = useState(false);
|
|
42
38
|
const { lang: defaultLocale } = useLocale();
|
|
@@ -48,23 +44,18 @@ const DatePickerIOS = ({
|
|
|
48
44
|
|
|
49
45
|
useCalculateDate({ minDate, maxDate, onChange, value });
|
|
50
46
|
|
|
51
|
-
const InputComponent = TextInputComponent || TextInput;
|
|
52
|
-
|
|
53
47
|
const onPress = useCallback(() => {
|
|
54
48
|
setOpen(true);
|
|
55
49
|
}, []);
|
|
56
50
|
|
|
57
51
|
return (
|
|
58
|
-
<
|
|
52
|
+
<TouchableOpacity
|
|
59
53
|
onPress={onPress}
|
|
60
54
|
disabled={disabled}
|
|
61
|
-
themeGroupStyleEnabled={groupStyleEnabled}
|
|
62
|
-
themeHasError={!!error}
|
|
63
55
|
testID="date-picker-ios-touchable-opacity"
|
|
64
56
|
>
|
|
65
57
|
<View pointerEvents="none" testID="datePickerInputIOS">
|
|
66
|
-
<
|
|
67
|
-
{...inputProps}
|
|
58
|
+
<TextInput
|
|
68
59
|
label={label}
|
|
69
60
|
value={displayValue}
|
|
70
61
|
suffix="calendar-dates-outlined"
|
|
@@ -77,13 +68,13 @@ const DatePickerIOS = ({
|
|
|
77
68
|
style={style}
|
|
78
69
|
renderInputValue={
|
|
79
70
|
renderSelectedValue !== undefined && !!value
|
|
80
|
-
? (
|
|
71
|
+
? (inputProps) =>
|
|
81
72
|
renderSelectedValue(
|
|
82
73
|
{
|
|
83
74
|
date: value,
|
|
84
75
|
formattedDateString: displayValue,
|
|
85
76
|
},
|
|
86
|
-
|
|
77
|
+
inputProps
|
|
87
78
|
)
|
|
88
79
|
: undefined
|
|
89
80
|
}
|
|
@@ -102,7 +93,7 @@ const DatePickerIOS = ({
|
|
|
102
93
|
minDate={minDate}
|
|
103
94
|
maxDate={maxDate}
|
|
104
95
|
/>
|
|
105
|
-
</
|
|
96
|
+
</TouchableOpacity>
|
|
106
97
|
);
|
|
107
98
|
};
|
|
108
99
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
|
-
import { View
|
|
2
|
+
import { View } from 'react-native';
|
|
3
3
|
import type { ViewProps } from 'react-native';
|
|
4
4
|
|
|
5
5
|
const StyledPickerWrapper = styled(View)<ViewProps>(({ theme }) => ({
|
|
@@ -7,21 +7,4 @@ const StyledPickerWrapper = styled(View)<ViewProps>(({ theme }) => ({
|
|
|
7
7
|
alignItems: 'center',
|
|
8
8
|
}));
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
if (themeHasError) {
|
|
12
|
-
return 1;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return 0;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const StyledTouchableOpacity = styled(TouchableOpacity)<{
|
|
19
|
-
themeGroupStyleEnabled: boolean;
|
|
20
|
-
themeHasError: boolean;
|
|
21
|
-
}>(({ themeGroupStyleEnabled, themeHasError }) => ({
|
|
22
|
-
...(themeGroupStyleEnabled && {
|
|
23
|
-
zIndex: getZIndexByState({ themeHasError }),
|
|
24
|
-
}),
|
|
25
|
-
}));
|
|
26
|
-
|
|
27
|
-
export { StyledPickerWrapper, StyledTouchableOpacity };
|
|
10
|
+
export { StyledPickerWrapper };
|
|
@@ -3,7 +3,6 @@ import type {
|
|
|
3
3
|
StyleProp,
|
|
4
4
|
ViewStyle,
|
|
5
5
|
} from 'react-native';
|
|
6
|
-
import type { TextInputProps } from '../TextInput';
|
|
7
6
|
|
|
8
7
|
export interface DatePickerProps {
|
|
9
8
|
/**
|
|
@@ -101,19 +100,3 @@ export interface DatePickerProps {
|
|
|
101
100
|
props?: NativeTextInputProps
|
|
102
101
|
) => React.ReactNode;
|
|
103
102
|
}
|
|
104
|
-
|
|
105
|
-
// Add an internal prop type for TextInputComponent, not exported
|
|
106
|
-
export interface InternalDatePickerProps extends DatePickerProps {
|
|
107
|
-
/**
|
|
108
|
-
* Props that are passed to TextInput.
|
|
109
|
-
*/
|
|
110
|
-
inputProps?: Pick<TextInputProps, 'loading' | 'numberOfLines'>;
|
|
111
|
-
/**
|
|
112
|
-
* Whether the component is used within a FormGroup for styling purposes.
|
|
113
|
-
*/
|
|
114
|
-
groupStyleEnabled?: boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Input component to use instead of the default TextInput.
|
|
117
|
-
*/
|
|
118
|
-
TextInputComponent?: React.ComponentType<TextInputProps>;
|
|
119
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
-
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
import {
|
|
4
4
|
Animated,
|
|
5
5
|
LayoutAnimation,
|
|
@@ -67,6 +67,11 @@ export interface FABProps {
|
|
|
67
67
|
testID?: string;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
// Extends FABProps with internal-only props. Not part of the public API.
|
|
71
|
+
type InternalFABProps = FABProps & {
|
|
72
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
73
|
+
};
|
|
74
|
+
|
|
70
75
|
const IconOnlyContent = ({
|
|
71
76
|
icon,
|
|
72
77
|
animated,
|
|
@@ -98,15 +103,17 @@ const IconOnlyContent = ({
|
|
|
98
103
|
const IconWithTextContent = ({
|
|
99
104
|
icon,
|
|
100
105
|
title,
|
|
106
|
+
titleStyle,
|
|
101
107
|
}: {
|
|
102
108
|
icon: IconName;
|
|
103
109
|
title?: string;
|
|
110
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
104
111
|
}) => (
|
|
105
112
|
<>
|
|
106
113
|
<StyledIconContainer>
|
|
107
114
|
<StyledFABIcon size="xsmall" icon={icon} testID="styled-fab-icon" />
|
|
108
115
|
</StyledIconContainer>
|
|
109
|
-
<StyledFABText>{title}</StyledFABText>
|
|
116
|
+
<StyledFABText style={titleStyle}>{title}</StyledFABText>
|
|
110
117
|
</>
|
|
111
118
|
);
|
|
112
119
|
|
|
@@ -120,9 +127,20 @@ const animateWidth = () => {
|
|
|
120
127
|
});
|
|
121
128
|
};
|
|
122
129
|
|
|
123
|
-
|
|
130
|
+
// Full implementation — accepts InternalFABProps including titleStyle.
|
|
131
|
+
// Exported as FABInternal for use by sibling HD components (e.g. FAB.Pair).
|
|
132
|
+
const FABWithTitleStyle = forwardRef<FABHandles, InternalFABProps>(
|
|
124
133
|
(
|
|
125
|
-
{
|
|
134
|
+
{
|
|
135
|
+
onPress,
|
|
136
|
+
title,
|
|
137
|
+
icon,
|
|
138
|
+
animated: iconAnimated,
|
|
139
|
+
testID,
|
|
140
|
+
active,
|
|
141
|
+
style,
|
|
142
|
+
titleStyle,
|
|
143
|
+
},
|
|
126
144
|
ref
|
|
127
145
|
) => {
|
|
128
146
|
const theme = useTheme();
|
|
@@ -237,6 +255,7 @@ const FAB = forwardRef<FABHandles, FABProps>(
|
|
|
237
255
|
}
|
|
238
256
|
activeOpacity={0.8}
|
|
239
257
|
onPress={onPress}
|
|
258
|
+
themeIconOnly={isIconOnly}
|
|
240
259
|
style={[
|
|
241
260
|
style,
|
|
242
261
|
{
|
|
@@ -276,7 +295,11 @@ const FAB = forwardRef<FABHandles, FABProps>(
|
|
|
276
295
|
icon={active ? 'add' : icon}
|
|
277
296
|
/>
|
|
278
297
|
) : (
|
|
279
|
-
<IconWithTextContent
|
|
298
|
+
<IconWithTextContent
|
|
299
|
+
icon={icon}
|
|
300
|
+
title={title}
|
|
301
|
+
titleStyle={titleStyle}
|
|
302
|
+
/>
|
|
280
303
|
)}
|
|
281
304
|
</Animated.View>
|
|
282
305
|
</StyledFAB>
|
|
@@ -284,6 +307,15 @@ const FAB = forwardRef<FABHandles, FABProps>(
|
|
|
284
307
|
}
|
|
285
308
|
);
|
|
286
309
|
|
|
310
|
+
FABWithTitleStyle.displayName = 'FAB';
|
|
311
|
+
|
|
312
|
+
// Public export — clean FABProps, no internal props exposed.
|
|
313
|
+
// Docgen reads this component and sees only FABProps.
|
|
314
|
+
const FAB = forwardRef<FABHandles, FABProps>((props, ref) => (
|
|
315
|
+
<FABWithTitleStyle {...props} ref={ref} />
|
|
316
|
+
));
|
|
317
|
+
|
|
287
318
|
FAB.displayName = 'FAB';
|
|
288
319
|
|
|
320
|
+
export { FABWithTitleStyle as FABInternal };
|
|
289
321
|
export default FAB;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
|
-
import
|
|
2
|
+
import { FABInternal } from '../FAB';
|
|
3
3
|
import Box from '../../Box';
|
|
4
4
|
|
|
5
5
|
const StyledFABPairWrapper = styled(Box)({
|
|
@@ -8,7 +8,7 @@ const StyledFABPairWrapper = styled(Box)({
|
|
|
8
8
|
alignItems: 'center',
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
const StyledFAB = styled(
|
|
11
|
+
const StyledFAB = styled(FABInternal)<{ iconOnly?: boolean; isLast?: boolean }>(
|
|
12
12
|
({ theme, iconOnly = false, isLast = false }) => ({
|
|
13
13
|
height: theme.__hd__.fab.sizes.fabPairHeight,
|
|
14
14
|
width: iconOnly ? theme.__hd__.fab.sizes.fabPairIconOnlyWidth : undefined,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ViewProps } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../theme';
|
|
3
4
|
import type { FABProps } from '../FAB';
|
|
4
5
|
import { StyledFAB, StyledFABPairWrapper } from './StyledFAB';
|
|
5
6
|
|
|
@@ -21,6 +22,7 @@ export interface FABPairProps extends ViewProps {
|
|
|
21
22
|
|
|
22
23
|
const Pair = ({ fabConfig, onCancel, ...props }: FABPairProps) => {
|
|
23
24
|
const { icon, title, onPress, testID } = fabConfig;
|
|
25
|
+
const theme = useTheme();
|
|
24
26
|
|
|
25
27
|
return (
|
|
26
28
|
<StyledFABPairWrapper {...props}>
|
|
@@ -38,6 +40,10 @@ const Pair = ({ fabConfig, onCancel, ...props }: FABPairProps) => {
|
|
|
38
40
|
testID={testID}
|
|
39
41
|
iconOnly={!title}
|
|
40
42
|
isLast
|
|
43
|
+
titleStyle={{
|
|
44
|
+
fontSize: theme.fontSizes.medium,
|
|
45
|
+
fontFamily: theme.fonts.neutral.regular,
|
|
46
|
+
}}
|
|
41
47
|
/>
|
|
42
48
|
</StyledFABPairWrapper>
|
|
43
49
|
);
|
|
@@ -11,7 +11,8 @@ const AnimatedTouchableHighlight =
|
|
|
11
11
|
|
|
12
12
|
const StyledFAB = styled(AnimatedTouchableHighlight)<{
|
|
13
13
|
themeActive?: boolean;
|
|
14
|
-
|
|
14
|
+
themeIconOnly?: boolean;
|
|
15
|
+
}>(({ theme, themeActive, themeIconOnly }) => ({
|
|
15
16
|
backgroundColor: themeActive
|
|
16
17
|
? theme.__hd__.fab.colors.buttonActiveBackground
|
|
17
18
|
: theme.__hd__.fab.colors.buttonBackground,
|
|
@@ -22,6 +23,7 @@ const StyledFAB = styled(AnimatedTouchableHighlight)<{
|
|
|
22
23
|
padding: theme.__hd__.fab.space.containerPadding,
|
|
23
24
|
flexDirection: 'row',
|
|
24
25
|
height: theme.__hd__.fab.sizes.height,
|
|
26
|
+
...(themeIconOnly && { width: theme.__hd__.fab.sizes.width }),
|
|
25
27
|
...theme.__hd__.fab.shadows.default,
|
|
26
28
|
}));
|
|
27
29
|
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
TextInputProps as NativeTextInputProps,
|
|
4
4
|
SectionList,
|
|
5
5
|
} from 'react-native';
|
|
6
|
-
import { View } from 'react-native';
|
|
6
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
7
7
|
import { useKeyboard } from '../../../utils/helpers';
|
|
8
8
|
import BottomSheet from '../../BottomSheet';
|
|
9
9
|
import Box from '../../Box';
|
|
@@ -11,7 +11,7 @@ import type { TextInputProps } from '../../TextInput';
|
|
|
11
11
|
import TextInput from '../../TextInput';
|
|
12
12
|
import Footer from '../Footer';
|
|
13
13
|
import { getScrollParams, toFlatOptions, toSections } from '../helpers';
|
|
14
|
-
import { StyledSearchBar
|
|
14
|
+
import { StyledSearchBar } from '../StyledSelect';
|
|
15
15
|
import type { SectionType, SelectOptionType, SelectProps } from '../types';
|
|
16
16
|
import OptionList from './OptionList';
|
|
17
17
|
import { isOptionSelected } from './utils';
|
|
@@ -53,15 +53,6 @@ export interface MultiSelectProps<
|
|
|
53
53
|
supportedOrientations?: ('portrait' | 'landscape')[];
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
// Add an internal prop type for TextInputComponent, not exported
|
|
57
|
-
export interface InternalMultiSelectProps<
|
|
58
|
-
V,
|
|
59
|
-
T extends SelectOptionType<V> = SelectOptionType<V>
|
|
60
|
-
> extends MultiSelectProps<V, T> {
|
|
61
|
-
TextInputComponent?: React.ComponentType<TextInputProps>;
|
|
62
|
-
groupStyleEnabled?: boolean;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
56
|
function MultiSelect<V, T extends SelectOptionType<V>>({
|
|
66
57
|
footerLabel,
|
|
67
58
|
label,
|
|
@@ -84,9 +75,7 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
|
|
|
84
75
|
value,
|
|
85
76
|
supportedOrientations = ['portrait'],
|
|
86
77
|
bottomSheetConfig = {},
|
|
87
|
-
|
|
88
|
-
...rest
|
|
89
|
-
}: InternalMultiSelectProps<V, T>) {
|
|
78
|
+
}: MultiSelectProps<V, T>) {
|
|
90
79
|
const { isKeyboardVisible, keyboardHeight } = useKeyboard();
|
|
91
80
|
const [open, setOpen] = useState(false);
|
|
92
81
|
const [selectingValue, setSelectingValue] = useState(value);
|
|
@@ -101,8 +90,6 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
|
|
|
101
90
|
const { variant: bottomSheetVariant, header: bottomSheetHeader } =
|
|
102
91
|
bottomSheetConfig;
|
|
103
92
|
|
|
104
|
-
const TextInputComponent = rest.TextInputComponent || TextInput;
|
|
105
|
-
|
|
106
93
|
const onPress = useCallback(() => {
|
|
107
94
|
setOpen(true);
|
|
108
95
|
}, []);
|
|
@@ -122,17 +109,15 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
|
|
|
122
109
|
!editable || disabled || inputProps?.loading ? 'none' : 'auto'
|
|
123
110
|
}
|
|
124
111
|
>
|
|
125
|
-
<
|
|
112
|
+
<TouchableOpacity
|
|
126
113
|
onPress={onPress}
|
|
127
|
-
themeGroupStyleEnabled={groupStyleEnabled}
|
|
128
|
-
themeHasError={!!error}
|
|
129
114
|
testID="multi-select-touchable-opacity"
|
|
130
115
|
>
|
|
131
116
|
{
|
|
132
117
|
// prevent users from focusing TextInput
|
|
133
118
|
}
|
|
134
119
|
<View pointerEvents="none">
|
|
135
|
-
<
|
|
120
|
+
<TextInput
|
|
136
121
|
{...inputProps}
|
|
137
122
|
label={label}
|
|
138
123
|
value={renderSelectedValue ? rawValue : displayedValue}
|
|
@@ -147,12 +132,13 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
|
|
|
147
132
|
testID={testID}
|
|
148
133
|
renderInputValue={
|
|
149
134
|
renderSelectedValue !== undefined && rawValue?.length > 0
|
|
150
|
-
? (
|
|
135
|
+
? (nativeInputProps) =>
|
|
136
|
+
renderSelectedValue(value, nativeInputProps)
|
|
151
137
|
: undefined
|
|
152
138
|
}
|
|
153
139
|
/>
|
|
154
140
|
</View>
|
|
155
|
-
</
|
|
141
|
+
</TouchableOpacity>
|
|
156
142
|
</View>
|
|
157
143
|
<BottomSheet
|
|
158
144
|
variant={bottomSheetVariant || 'fixed'}
|
|
@@ -193,7 +179,7 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
|
|
|
193
179
|
>
|
|
194
180
|
{onQueryChange && (
|
|
195
181
|
<StyledSearchBar>
|
|
196
|
-
<
|
|
182
|
+
<TextInput
|
|
197
183
|
editable
|
|
198
184
|
placeholder="Search"
|
|
199
185
|
suffix="search-outlined"
|