@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
|
@@ -3,13 +3,13 @@ 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 { deepCompareValue, useKeyboard } from '../../../utils/helpers';
|
|
8
8
|
import BottomSheet from '../../BottomSheet';
|
|
9
9
|
import type { TextInputProps } from '../../TextInput';
|
|
10
10
|
import TextInput from '../../TextInput';
|
|
11
11
|
import { getScrollParams, toFlatOptions, toSections } from '../helpers';
|
|
12
|
-
import { StyledSearchBar
|
|
12
|
+
import { StyledSearchBar } from '../StyledSelect';
|
|
13
13
|
import type { SectionType, SelectOptionType, SelectProps } from '../types';
|
|
14
14
|
import OptionList from './OptionList';
|
|
15
15
|
|
|
@@ -38,15 +38,6 @@ export interface SingleSelectProps<
|
|
|
38
38
|
supportedOrientations?: ('portrait' | 'landscape')[];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
// Add an internal prop type for TextInputComponent, not exported
|
|
42
|
-
export interface InternalSingleSelectProps<
|
|
43
|
-
V,
|
|
44
|
-
T extends SelectOptionType<V> = SelectOptionType<V>
|
|
45
|
-
> extends SingleSelectProps<V, T> {
|
|
46
|
-
TextInputComponent?: React.ComponentType<TextInputProps>;
|
|
47
|
-
groupStyleEnabled?: boolean;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
41
|
const SingleSelect = <V, T extends SelectOptionType<V>>({
|
|
51
42
|
label,
|
|
52
43
|
loading = false,
|
|
@@ -68,9 +59,7 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
|
|
|
68
59
|
value,
|
|
69
60
|
supportedOrientations = ['portrait'],
|
|
70
61
|
bottomSheetConfig = {},
|
|
71
|
-
|
|
72
|
-
...rest
|
|
73
|
-
}: InternalSingleSelectProps<V, T>) => {
|
|
62
|
+
}: SingleSelectProps<V, T>) => {
|
|
74
63
|
const { isKeyboardVisible, keyboardHeight } = useKeyboard();
|
|
75
64
|
const [open, setOpen] = useState(false);
|
|
76
65
|
const sectionListRef = useRef<SectionList<T, SectionType>>(null);
|
|
@@ -84,8 +73,6 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
|
|
|
84
73
|
const { variant: bottomSheetVariant, header: bottomSheetHeader } =
|
|
85
74
|
bottomSheetConfig;
|
|
86
75
|
|
|
87
|
-
const TextInputComponent = rest.TextInputComponent || TextInput;
|
|
88
|
-
|
|
89
76
|
const onPress = useCallback(() => {
|
|
90
77
|
setOpen(true);
|
|
91
78
|
}, []);
|
|
@@ -105,17 +92,15 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
|
|
|
105
92
|
!editable || disabled || inputProps?.loading ? 'none' : 'auto'
|
|
106
93
|
}
|
|
107
94
|
>
|
|
108
|
-
<
|
|
95
|
+
<TouchableOpacity
|
|
109
96
|
onPress={onPress}
|
|
110
|
-
themeGroupStyleEnabled={groupStyleEnabled}
|
|
111
|
-
themeHasError={!!error}
|
|
112
97
|
testID="single-select-touchable-opacity"
|
|
113
98
|
>
|
|
114
99
|
{
|
|
115
100
|
// prevent users from focusing TextInput
|
|
116
101
|
}
|
|
117
102
|
<View pointerEvents="none">
|
|
118
|
-
<
|
|
103
|
+
<TextInput
|
|
119
104
|
{...inputProps}
|
|
120
105
|
label={label}
|
|
121
106
|
value={renderSelectedValue ? rawValue : displayedValue}
|
|
@@ -130,12 +115,13 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
|
|
|
130
115
|
testID={testID}
|
|
131
116
|
renderInputValue={
|
|
132
117
|
renderSelectedValue !== undefined && !!rawValue
|
|
133
|
-
? (
|
|
118
|
+
? (nativeInputProps) =>
|
|
119
|
+
renderSelectedValue(value, nativeInputProps)
|
|
134
120
|
: undefined
|
|
135
121
|
}
|
|
136
122
|
/>
|
|
137
123
|
</View>
|
|
138
|
-
</
|
|
124
|
+
</TouchableOpacity>
|
|
139
125
|
</View>
|
|
140
126
|
<BottomSheet
|
|
141
127
|
variant={bottomSheetVariant || 'fixed'}
|
|
@@ -158,7 +144,7 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
|
|
|
158
144
|
>
|
|
159
145
|
{onQueryChange && (
|
|
160
146
|
<StyledSearchBar>
|
|
161
|
-
<
|
|
147
|
+
<TextInput
|
|
162
148
|
editable
|
|
163
149
|
placeholder="Search"
|
|
164
150
|
suffix="search-outlined"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SectionList,
|
|
1
|
+
import { SectionList, View } from 'react-native';
|
|
2
2
|
import styled from '@emotion/native';
|
|
3
3
|
|
|
4
4
|
const SectionSpacer = styled(View)(({ theme }) => ({
|
|
@@ -19,27 +19,4 @@ const StyledSectionList = styled(SectionList)(({ theme }) => ({
|
|
|
19
19
|
paddingHorizontal: theme.__hd__.select.space.optionListHorizontalPadding,
|
|
20
20
|
})) as unknown as typeof SectionList;
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
if (themeHasError) {
|
|
24
|
-
return 1;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return 0;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const StyledTouchableOpacity = styled(TouchableOpacity)<{
|
|
31
|
-
themeGroupStyleEnabled: boolean;
|
|
32
|
-
themeHasError: boolean;
|
|
33
|
-
}>(({ themeGroupStyleEnabled, themeHasError }) => ({
|
|
34
|
-
...(themeGroupStyleEnabled && {
|
|
35
|
-
zIndex: getZIndexByState({ themeHasError }),
|
|
36
|
-
}),
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
SectionSpacer,
|
|
41
|
-
OptionSpacer,
|
|
42
|
-
StyledSearchBar,
|
|
43
|
-
StyledSectionList,
|
|
44
|
-
StyledTouchableOpacity,
|
|
45
|
-
};
|
|
22
|
+
export { SectionSpacer, OptionSpacer, StyledSearchBar, StyledSectionList };
|
|
@@ -10,17 +10,11 @@ type SingleSelectType = <
|
|
|
10
10
|
V,
|
|
11
11
|
T extends SelectOptionType<V> = SelectOptionType<V>
|
|
12
12
|
>(
|
|
13
|
-
props:
|
|
14
|
-
SingleSelectProps<V, T>,
|
|
15
|
-
'TextInputComponent' | 'groupStyleEnabled'
|
|
16
|
-
>
|
|
13
|
+
props: SingleSelectProps<V, T>
|
|
17
14
|
) => React.ReactElement;
|
|
18
15
|
|
|
19
16
|
type MultiSelectType = <V, T extends SelectOptionType<V> = SelectOptionType<V>>(
|
|
20
|
-
props:
|
|
21
|
-
MultiSelectProps<V, T>,
|
|
22
|
-
'TextInputComponent' | 'groupStyleEnabled'
|
|
23
|
-
>
|
|
17
|
+
props: MultiSelectProps<V, T>
|
|
24
18
|
) => React.ReactElement;
|
|
25
19
|
|
|
26
20
|
export default Object.assign(SingleSelect as SingleSelectType, {
|
|
@@ -102,8 +102,4 @@ 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>;
|
|
109
105
|
}
|
|
@@ -42,13 +42,8 @@ const StyledErrorButtonContainer = styled(View)(({ theme }) => ({
|
|
|
42
42
|
paddingVertical: theme.__hd__.error.space.button.wrapperVerticalPadding,
|
|
43
43
|
}));
|
|
44
44
|
|
|
45
|
-
const StyledErrorButtonPrimary = styled(Button)(({ theme }) => ({
|
|
46
|
-
padding: theme.__hd__.error.space.button.padding,
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
45
|
const StyledErrorButtonSecondary = styled(Button)(({ theme }) => ({
|
|
50
46
|
marginTop: theme.__hd__.error.space.button.margin,
|
|
51
|
-
padding: theme.__hd__.error.space.button.padding,
|
|
52
47
|
}));
|
|
53
48
|
|
|
54
49
|
const StyledErrorImageContainer = styled(View)(({ theme }) => ({
|
|
@@ -88,7 +83,6 @@ export {
|
|
|
88
83
|
StyledErrorImage,
|
|
89
84
|
StyledErrorContainer,
|
|
90
85
|
StyledErrorButtonContainer,
|
|
91
|
-
StyledErrorButtonPrimary,
|
|
92
86
|
StyledErrorButtonSecondary,
|
|
93
87
|
StyledErrorContent,
|
|
94
88
|
StyledErrorTitle,
|
|
@@ -8,7 +8,6 @@ import type {
|
|
|
8
8
|
import type { ErrorVariant } from './StyledError';
|
|
9
9
|
import {
|
|
10
10
|
StyledErrorButtonContainer,
|
|
11
|
-
StyledErrorButtonPrimary,
|
|
12
11
|
StyledErrorButtonSecondary,
|
|
13
12
|
StyledErrorContainer,
|
|
14
13
|
StyledErrorContent,
|
|
@@ -23,6 +22,7 @@ import { useDeprecation } from '../../../utils/hooks';
|
|
|
23
22
|
import type { ImageProps } from '../../Image/index';
|
|
24
23
|
import Illustration from '../../Illustration';
|
|
25
24
|
import type { IllustrationName } from '../../Illustration';
|
|
25
|
+
import Button from '../../Button';
|
|
26
26
|
|
|
27
27
|
interface ErrorProps extends ViewProps {
|
|
28
28
|
/**
|
|
@@ -164,11 +164,7 @@ const ErrorPage = ({
|
|
|
164
164
|
{showButtonContainer && (
|
|
165
165
|
<StyledErrorButtonContainer>
|
|
166
166
|
{showCta && (
|
|
167
|
-
<
|
|
168
|
-
variant="filled"
|
|
169
|
-
text={ctaText}
|
|
170
|
-
onPress={onCtaPress}
|
|
171
|
-
/>
|
|
167
|
+
<Button variant="filled" text={ctaText} onPress={onCtaPress} />
|
|
172
168
|
)}
|
|
173
169
|
{showSecondaryCta && (
|
|
174
170
|
<StyledErrorButtonSecondary
|
|
@@ -69,12 +69,7 @@ const StyledSuccessButtonContainer = styled(View)(({ theme }) => ({
|
|
|
69
69
|
paddingVertical: theme.__hd__.success.space.button.wrapperVerticalPadding,
|
|
70
70
|
}));
|
|
71
71
|
|
|
72
|
-
const StyledSuccessButtonPrimary = styled(Button)(({ theme }) => ({
|
|
73
|
-
padding: theme.__hd__.success.space.button.padding,
|
|
74
|
-
}));
|
|
75
|
-
|
|
76
72
|
const StyledSuccessButtonSecondary = styled(Button)(({ theme }) => ({
|
|
77
|
-
padding: theme.__hd__.success.space.button.padding,
|
|
78
73
|
marginTop: theme.__hd__.success.space.button.secondaryCTAMarginTop,
|
|
79
74
|
}));
|
|
80
75
|
|
|
@@ -93,7 +88,6 @@ export {
|
|
|
93
88
|
StyledSuccessTitle,
|
|
94
89
|
StyledSuccessDescription,
|
|
95
90
|
StyledSuccessButtonContainer,
|
|
96
|
-
StyledSuccessButtonPrimary,
|
|
97
91
|
StyledSuccessButtonSecondary,
|
|
98
92
|
StyledSuccessModal,
|
|
99
93
|
};
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
StyledSuccessTitle,
|
|
15
15
|
StyledSuccessDescription,
|
|
16
16
|
StyledSuccessButtonContainer,
|
|
17
|
-
StyledSuccessButtonPrimary,
|
|
18
17
|
StyledSuccessModal,
|
|
19
18
|
StyledSuccessIconContainer,
|
|
20
19
|
StyledSuccessButtonSecondary,
|
|
@@ -23,6 +22,7 @@ import type { ImageProps } from '../../Image';
|
|
|
23
22
|
import { noop } from '../../../utils/functions';
|
|
24
23
|
import type { IllustrationName } from '../../Illustration';
|
|
25
24
|
import Illustration from '../../Illustration';
|
|
25
|
+
import Button from '../../Button';
|
|
26
26
|
|
|
27
27
|
interface SuccessProps extends ViewProps {
|
|
28
28
|
/**
|
|
@@ -152,7 +152,7 @@ const SuccessPage = ({
|
|
|
152
152
|
|
|
153
153
|
{!!ctaText && (
|
|
154
154
|
<StyledSuccessButtonContainer>
|
|
155
|
-
<
|
|
155
|
+
<Button text={ctaText} onPress={onCtaPress} />
|
|
156
156
|
{!!showSecondaryButton && (
|
|
157
157
|
<StyledSuccessButtonSecondary
|
|
158
158
|
variant="text"
|
|
@@ -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 };
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
import TimePickerAndroid from './TimePickerAndroid';
|
|
4
4
|
import TimePickerIOS from './TimePickerIOS';
|
|
5
|
-
import type {
|
|
5
|
+
import type { TimePickerProps } from './types';
|
|
6
6
|
|
|
7
|
-
const TimePicker = (props:
|
|
7
|
+
const TimePicker = (props: TimePickerProps) => {
|
|
8
8
|
if (Platform.OS === 'ios') {
|
|
9
9
|
return <TimePickerIOS {...props} />;
|
|
10
10
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import DateTimePicker from '@react-native-community/datetimepicker';
|
|
2
2
|
import React, { useState, useCallback } from 'react';
|
|
3
|
-
import { View } from 'react-native';
|
|
3
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
4
4
|
import formatTime from 'date-fns/fp/format';
|
|
5
5
|
|
|
6
6
|
import TextInput from '../TextInput';
|
|
7
|
-
import {
|
|
8
|
-
import type { InternalTimePickerProps } from './types';
|
|
7
|
+
import type { TimePickerProps } from './types';
|
|
9
8
|
|
|
10
9
|
const TimePickerAndroid = ({
|
|
11
10
|
value,
|
|
@@ -20,33 +19,25 @@ const TimePickerAndroid = ({
|
|
|
20
19
|
style,
|
|
21
20
|
testID,
|
|
22
21
|
showSuffix = true,
|
|
23
|
-
|
|
24
|
-
inputProps,
|
|
25
|
-
groupStyleEnabled = false,
|
|
26
|
-
}: InternalTimePickerProps) => {
|
|
22
|
+
}: TimePickerProps) => {
|
|
27
23
|
const [open, setOpen] = useState(false);
|
|
28
24
|
|
|
29
25
|
const is12Hour = displayFormat.includes('hh');
|
|
30
26
|
const displayValue = value ? formatTime(displayFormat, value) : '';
|
|
31
27
|
const pickerInitValue = value || new Date();
|
|
32
28
|
|
|
33
|
-
const InputComponent = TextInputComponent || TextInput;
|
|
34
|
-
|
|
35
29
|
const onPress = useCallback(() => {
|
|
36
30
|
setOpen(true);
|
|
37
31
|
}, []);
|
|
38
32
|
|
|
39
33
|
return (
|
|
40
|
-
<
|
|
34
|
+
<TouchableOpacity
|
|
41
35
|
onPress={onPress}
|
|
42
36
|
disabled={disabled}
|
|
43
|
-
themeGroupStyleEnabled={groupStyleEnabled}
|
|
44
|
-
themeHasError={!!error}
|
|
45
37
|
testID="time-picker-android-touchable-opacity"
|
|
46
38
|
>
|
|
47
39
|
<View pointerEvents="none" testID="timePickerInputAndroid">
|
|
48
|
-
<
|
|
49
|
-
{...inputProps}
|
|
40
|
+
<TextInput
|
|
50
41
|
label={label}
|
|
51
42
|
value={displayValue}
|
|
52
43
|
suffix={showSuffix ? 'clock-3' : undefined}
|
|
@@ -74,7 +65,7 @@ const TimePickerAndroid = ({
|
|
|
74
65
|
is24Hour={!is12Hour}
|
|
75
66
|
/>
|
|
76
67
|
) : null}
|
|
77
|
-
</
|
|
68
|
+
</TouchableOpacity>
|
|
78
69
|
);
|
|
79
70
|
};
|
|
80
71
|
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import DateTimePicker from '@react-native-community/datetimepicker';
|
|
2
2
|
import React, { useEffect, useState, useCallback } from 'react';
|
|
3
|
-
import { View } from 'react-native';
|
|
3
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
4
4
|
import formatTime from 'date-fns/fp/format';
|
|
5
5
|
|
|
6
6
|
import BottomSheet from '../BottomSheet';
|
|
7
7
|
import TextInput from '../TextInput';
|
|
8
8
|
import Button from '../Button';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
StyledTouchableOpacity,
|
|
12
|
-
} from './StyledTimePicker';
|
|
13
|
-
import type { InternalTimePickerProps } from './types';
|
|
9
|
+
import { StyledPickerWrapper } from './StyledTimePicker';
|
|
10
|
+
import type { TimePickerProps } from './types';
|
|
14
11
|
import { useTheme } from '../../theme';
|
|
15
12
|
|
|
16
13
|
const TimePickerIOS = ({
|
|
@@ -28,10 +25,7 @@ const TimePickerIOS = ({
|
|
|
28
25
|
testID,
|
|
29
26
|
showSuffix = true,
|
|
30
27
|
supportedOrientations = ['portrait'],
|
|
31
|
-
|
|
32
|
-
inputProps,
|
|
33
|
-
groupStyleEnabled = false,
|
|
34
|
-
}: InternalTimePickerProps) => {
|
|
28
|
+
}: TimePickerProps) => {
|
|
35
29
|
const [selectingDate, setSelectingDate] = useState<Date>(value || new Date());
|
|
36
30
|
const [open, setOpen] = useState(false);
|
|
37
31
|
|
|
@@ -44,8 +38,6 @@ const TimePickerIOS = ({
|
|
|
44
38
|
// For 24-hour format: use en-GB for consistent 24-hour display
|
|
45
39
|
const pickerLocale = is12Hour ? 'en-US' : 'en-GB';
|
|
46
40
|
|
|
47
|
-
const InputComponent = TextInputComponent || TextInput;
|
|
48
|
-
|
|
49
41
|
useEffect(() => {
|
|
50
42
|
setSelectingDate(value || new Date());
|
|
51
43
|
}, [value]);
|
|
@@ -55,16 +47,13 @@ const TimePickerIOS = ({
|
|
|
55
47
|
}, []);
|
|
56
48
|
|
|
57
49
|
return (
|
|
58
|
-
<
|
|
50
|
+
<TouchableOpacity
|
|
59
51
|
onPress={onPress}
|
|
60
52
|
disabled={disabled}
|
|
61
|
-
themeGroupStyleEnabled={groupStyleEnabled}
|
|
62
|
-
themeHasError={!!error}
|
|
63
53
|
testID="time-picker-ios-touchable-opacity"
|
|
64
54
|
>
|
|
65
55
|
<View pointerEvents="none" testID="timePickerInputIOS">
|
|
66
|
-
<
|
|
67
|
-
{...inputProps}
|
|
56
|
+
<TextInput
|
|
68
57
|
label={label}
|
|
69
58
|
value={displayValue}
|
|
70
59
|
suffix={showSuffix ? 'clock-3' : undefined}
|
|
@@ -112,7 +101,7 @@ const TimePickerIOS = ({
|
|
|
112
101
|
/>
|
|
113
102
|
</StyledPickerWrapper>
|
|
114
103
|
</BottomSheet>
|
|
115
|
-
</
|
|
104
|
+
</TouchableOpacity>
|
|
116
105
|
);
|
|
117
106
|
};
|
|
118
107
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
-
import type { TextInputProps } from '../TextInput';
|
|
3
2
|
|
|
4
3
|
export interface TimePickerProps {
|
|
5
4
|
/**
|
|
@@ -62,19 +61,3 @@ export interface TimePickerProps {
|
|
|
62
61
|
*/
|
|
63
62
|
supportedOrientations?: ('portrait' | 'landscape')[];
|
|
64
63
|
}
|
|
65
|
-
|
|
66
|
-
// Add an internal prop type for TextInputComponent, not exported
|
|
67
|
-
export interface InternalTimePickerProps extends TimePickerProps {
|
|
68
|
-
/**
|
|
69
|
-
* Props that are passed to TextInput.
|
|
70
|
-
*/
|
|
71
|
-
inputProps?: Pick<TextInputProps, 'loading' | 'numberOfLines'>;
|
|
72
|
-
/**
|
|
73
|
-
* Whether the component is used within a FormGroup for styling purposes.
|
|
74
|
-
*/
|
|
75
|
-
groupStyleEnabled?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Input component to use instead of the default TextInput.
|
|
78
|
-
*/
|
|
79
|
-
TextInputComponent?: React.ComponentType<TextInputProps>;
|
|
80
|
-
}
|
|
@@ -2,20 +2,20 @@ import type { GlobalTheme } from '../global';
|
|
|
2
2
|
|
|
3
3
|
const getFABTheme = (theme: GlobalTheme) => {
|
|
4
4
|
const colors = {
|
|
5
|
-
buttonBackground: theme.colors.
|
|
6
|
-
buttonPressedBackground: theme.colors.
|
|
7
|
-
buttonActiveBackground: theme.colors.
|
|
5
|
+
buttonBackground: theme.colors.primary,
|
|
6
|
+
buttonPressedBackground: theme.colors.primary,
|
|
7
|
+
buttonActiveBackground: theme.colors.primary,
|
|
8
8
|
icon: theme.colors.onDarkGlobalSurface,
|
|
9
|
-
actionItemBackground: theme.colors.
|
|
10
|
-
actionItemPressedBackground: theme.colors.
|
|
9
|
+
actionItemBackground: theme.colors.defaultGlobalSurface,
|
|
10
|
+
actionItemPressedBackground: theme.colors.defaultGlobalSurface,
|
|
11
11
|
backdropBackground: theme.colors.black,
|
|
12
12
|
titleText: theme.colors.onDarkGlobalSurface,
|
|
13
|
-
actionItemText: theme.colors.
|
|
13
|
+
actionItemText: theme.colors.onDefaultGlobalSurface,
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const sizes = {
|
|
17
|
-
width: theme.sizes.
|
|
18
|
-
height: theme.sizes.
|
|
17
|
+
width: theme.sizes.xxxlarge,
|
|
18
|
+
height: theme.sizes.xxxlarge,
|
|
19
19
|
iconContainerWidth: theme.sizes.large,
|
|
20
20
|
iconContainerHeight: theme.sizes.large,
|
|
21
21
|
fabPairHeight: theme.sizes.xxxlarge,
|
|
@@ -24,12 +24,12 @@ const getFABTheme = (theme: GlobalTheme) => {
|
|
|
24
24
|
|
|
25
25
|
const fonts = {
|
|
26
26
|
actionItemText: theme.fonts.neutral.regular,
|
|
27
|
-
title: theme.fonts.neutral.
|
|
27
|
+
title: theme.fonts.neutral.regular,
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const fontSizes = {
|
|
31
31
|
actionItemText: theme.fontSizes.large,
|
|
32
|
-
title: theme.fontSizes.
|
|
32
|
+
title: theme.fontSizes.medium,
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const lineHeights = {
|
|
@@ -49,7 +49,7 @@ const getFABTheme = (theme: GlobalTheme) => {
|
|
|
49
49
|
actionItemTextPaddingLeft: theme.space.xsmall,
|
|
50
50
|
buttonMarginTop: theme.space.large,
|
|
51
51
|
buttonMarginRight: theme.space.large,
|
|
52
|
-
containerPadding: theme.space.
|
|
52
|
+
containerPadding: theme.space.smallMedium,
|
|
53
53
|
titleMarginHorizontal: theme.space.small,
|
|
54
54
|
fabPairMarginRight: theme.space.small,
|
|
55
55
|
};
|
|
@@ -69,6 +69,7 @@ const getFABTheme = (theme: GlobalTheme) => {
|
|
|
69
69
|
space,
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
+
|
|
72
73
|
type GetFABThemeReturnType = ReturnType<typeof getFABTheme>;
|
|
73
74
|
export interface FABThemeType extends GetFABThemeReturnType {
|
|
74
75
|
/**
|
|
@@ -3,7 +3,7 @@ import type { SystemPalette, BrandSystemPalette } from './types';
|
|
|
3
3
|
import swagLightGlobalPalette from './swagLightGlobal';
|
|
4
4
|
|
|
5
5
|
const ehWorkBrandSystemPalette: BrandSystemPalette = {
|
|
6
|
-
primary: '#
|
|
6
|
+
primary: '#7622d7',
|
|
7
7
|
onPrimary: '#fdfbff',
|
|
8
8
|
secondary: '#b382fd',
|
|
9
9
|
onSecondary: palette.white,
|
|
@@ -32,7 +32,7 @@ export declare const StyledCheckMark: import("@emotion/native").StyledComponent<
|
|
|
32
32
|
as?: React.ElementType;
|
|
33
33
|
} & {
|
|
34
34
|
themeSize: "small" | "xsmall" | "medium" | "large" | "xlarge" | "xxxsmall";
|
|
35
|
-
themeIntent: "
|
|
35
|
+
themeIntent: "primary" | "secondary" | "text" | "success" | "info" | "warning" | "danger" | "muted" | "inactive" | "disabled-text" | "text-inverted";
|
|
36
36
|
} & {
|
|
37
37
|
ref?: import("react").Ref<import("react-native-vector-icons/Icon").Icon> | undefined;
|
|
38
38
|
} & {
|
|
@@ -3,5 +3,5 @@ type getStateType = {
|
|
|
3
3
|
readonly: boolean;
|
|
4
4
|
checked?: boolean;
|
|
5
5
|
};
|
|
6
|
-
export declare const getThemeState: ({ disabled, readonly, checked, }: getStateType) => "
|
|
6
|
+
export declare const getThemeState: ({ disabled, readonly, checked, }: getStateType) => "default" | "disabled" | "checked" | "readonly";
|
|
7
7
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
declare const DatePicker: ({ variant,
|
|
2
|
+
import type { DatePickerProps } from './types';
|
|
3
|
+
declare const DatePicker: ({ variant, ...props }: DatePickerProps) => React.JSX.Element;
|
|
4
4
|
export default DatePicker;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
type DatePickerAndroidProps = Omit<
|
|
2
|
+
import type { DatePickerProps } from './types';
|
|
3
|
+
type DatePickerAndroidProps = Omit<DatePickerProps, 'variant' | 'monthPickerConfirmLabel' | 'monthPickerCancelLabel'> & {
|
|
4
4
|
variant?: 'default' | 'month-year';
|
|
5
5
|
};
|
|
6
|
-
declare const DatePickerAndroid: ({ value, minDate, maxDate, label, placeholder, onChange, displayFormat, disabled, required, error, helpText, style, testID, variant, renderSelectedValue, locale,
|
|
6
|
+
declare const DatePickerAndroid: ({ value, minDate, maxDate, label, placeholder, onChange, displayFormat, disabled, required, error, helpText, style, testID, variant, renderSelectedValue, locale, }: DatePickerAndroidProps) => React.JSX.Element;
|
|
7
7
|
export default DatePickerAndroid;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
declare const DatePickerCalendar: ({ value, minDate, maxDate, label, placeholder, onChange, confirmLabel, displayFormat, disabled, required, error, helpText, style, testID, monthPickerConfirmLabel, monthPickerCancelLabel, supportedOrientations, renderSelectedValue, locale,
|
|
2
|
+
import type { DatePickerProps } from './types';
|
|
3
|
+
declare const DatePickerCalendar: ({ value, minDate, maxDate, label, placeholder, onChange, confirmLabel, displayFormat, disabled, required, error, helpText, style, testID, monthPickerConfirmLabel, monthPickerCancelLabel, supportedOrientations, renderSelectedValue, locale, }: Omit<DatePickerProps, "variant">) => React.JSX.Element;
|
|
4
4
|
export default DatePickerCalendar;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
type DatePickerIOSProps = Omit<
|
|
2
|
+
import type { DatePickerProps } from './types';
|
|
3
|
+
type DatePickerIOSProps = Omit<DatePickerProps, 'variant' | 'monthPickerConfirmLabel' | 'monthPickerCancelLabel'> & {
|
|
4
4
|
variant?: 'default' | 'month-year';
|
|
5
5
|
};
|
|
6
|
-
declare const DatePickerIOS: ({ value, minDate, maxDate, label, placeholder, onChange, confirmLabel, displayFormat, disabled, required, error, helpText, style, testID, supportedOrientations, variant, locale, renderSelectedValue,
|
|
6
|
+
declare const DatePickerIOS: ({ value, minDate, maxDate, label, placeholder, onChange, confirmLabel, displayFormat, disabled, required, error, helpText, style, testID, supportedOrientations, variant, locale, renderSelectedValue, }: DatePickerIOSProps) => React.JSX.Element;
|
|
7
7
|
export default DatePickerIOS;
|
|
@@ -6,11 +6,4 @@ declare const StyledPickerWrapper: import("@emotion/native").StyledComponent<Vie
|
|
|
6
6
|
}, {}, {
|
|
7
7
|
ref?: import("react").Ref<View> | undefined;
|
|
8
8
|
}>;
|
|
9
|
-
|
|
10
|
-
theme?: import("@emotion/react").Theme;
|
|
11
|
-
as?: React.ElementType;
|
|
12
|
-
} & {
|
|
13
|
-
themeGroupStyleEnabled: boolean;
|
|
14
|
-
themeHasError: boolean;
|
|
15
|
-
}, {}, {}>;
|
|
16
|
-
export { StyledPickerWrapper, StyledTouchableOpacity };
|
|
9
|
+
export { StyledPickerWrapper };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { TextInputProps as NativeTextInputProps, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
-
import type { TextInputProps } from '../TextInput';
|
|
3
2
|
export interface DatePickerProps {
|
|
4
3
|
/**
|
|
5
4
|
* Date picker input label.
|
|
@@ -93,17 +92,3 @@ export interface DatePickerProps {
|
|
|
93
92
|
formattedDateString: string;
|
|
94
93
|
}, props?: NativeTextInputProps) => React.ReactNode;
|
|
95
94
|
}
|
|
96
|
-
export interface InternalDatePickerProps extends DatePickerProps {
|
|
97
|
-
/**
|
|
98
|
-
* Props that are passed to TextInput.
|
|
99
|
-
*/
|
|
100
|
-
inputProps?: Pick<TextInputProps, 'loading' | 'numberOfLines'>;
|
|
101
|
-
/**
|
|
102
|
-
* Whether the component is used within a FormGroup for styling purposes.
|
|
103
|
-
*/
|
|
104
|
-
groupStyleEnabled?: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Input component to use instead of the default TextInput.
|
|
107
|
-
*/
|
|
108
|
-
TextInputComponent?: React.ComponentType<TextInputProps>;
|
|
109
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
3
3
|
import { Animated } from 'react-native';
|
|
4
4
|
import type { IconName } from '../Icon';
|
|
5
5
|
export type FABHandles = {
|
|
@@ -37,5 +37,9 @@ export interface FABProps {
|
|
|
37
37
|
*/
|
|
38
38
|
testID?: string;
|
|
39
39
|
}
|
|
40
|
+
declare const FABWithTitleStyle: React.ForwardRefExoticComponent<FABProps & {
|
|
41
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
42
|
+
} & React.RefAttributes<FABHandles>>;
|
|
40
43
|
declare const FAB: React.ForwardRefExoticComponent<FABProps & React.RefAttributes<FABHandles>>;
|
|
44
|
+
export { FABWithTitleStyle as FABInternal };
|
|
41
45
|
export default FAB;
|