@hero-design/rn 8.103.3 → 8.103.4
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 +8 -0
- package/es/index.js +43 -21
- package/lib/index.js +43 -21
- package/package.json +3 -3
- package/src/components/DatePicker/DatePicker.tsx +38 -0
- package/src/components/DatePicker/DatePickerAndroid.tsx +6 -3
- package/src/components/DatePicker/DatePickerCalendar.tsx +6 -3
- package/src/components/DatePicker/DatePickerIOS.tsx +6 -3
- package/src/components/DatePicker/Dialog/IOSDialog.tsx +6 -1
- package/src/components/DatePicker/Dialog.tsx +15 -0
- package/src/components/DatePicker/index.internal.tsx +10 -0
- package/src/components/DatePicker/index.tsx +6 -29
- package/src/components/DatePicker/types.ts +6 -0
- package/src/components/TimePicker/TimePicker.tsx +15 -0
- package/src/components/TimePicker/TimePickerAndroid.tsx +6 -3
- package/src/components/TimePicker/TimePickerIOS.tsx +6 -3
- package/src/components/TimePicker/index.internal.tsx +9 -0
- package/src/components/TimePicker/index.tsx +4 -13
- package/src/components/TimePicker/types.ts +6 -0
- package/src/index.internal.ts +3 -1
- package/src/types.internal.ts +9 -1
- package/src/types.ts +4 -0
- package/stats/8.103.3/rn-stats.html +0 -2
- package/stats/8.103.4/rn-stats.html +4844 -0
- package/types/components/Calendar/CalendarRowItem.d.ts +1 -1
- package/types/components/DatePicker/DatePicker.d.ts +4 -0
- 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/Dialog.d.ts +4 -0
- package/types/components/DatePicker/index.d.ts +4 -5
- package/types/components/DatePicker/index.internal.d.ts +7 -0
- package/types/components/DatePicker/types.d.ts +4 -0
- package/types/components/TimePicker/TimePicker.d.ts +4 -0
- package/types/components/TimePicker/TimePickerAndroid.d.ts +2 -2
- package/types/components/TimePicker/TimePickerIOS.d.ts +2 -2
- package/types/components/TimePicker/index.d.ts +3 -3
- package/types/components/TimePicker/index.internal.d.ts +5 -0
- package/types/components/TimePicker/types.d.ts +4 -0
- package/types/index.internal.d.ts +3 -1
- package/types/types.d.ts +3 -1
- package/types/types.internal.d.ts +3 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import IOSDatePickerDialog from './Dialog/IOSDialog';
|
|
4
|
+
import AndroidDatePickerDialog from './Dialog/AndroidDialog';
|
|
5
|
+
import { DatePickerDialogProps } from './Dialog/type';
|
|
6
|
+
|
|
7
|
+
const Dialog = ({ ...props }: DatePickerDialogProps) => {
|
|
8
|
+
if (Platform.OS === 'ios') {
|
|
9
|
+
return <IOSDatePickerDialog {...props} />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return <AndroidDatePickerDialog {...props} />;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default Dialog;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import DatePicker from './DatePicker';
|
|
3
|
+
import { InternalDatePickerProps } from './types';
|
|
4
|
+
import Dialog from './Dialog';
|
|
5
|
+
|
|
6
|
+
export type { InternalDatePickerProps as DatePickerProps };
|
|
7
|
+
|
|
8
|
+
const InternalDatePicker =
|
|
9
|
+
DatePicker as FunctionComponent<InternalDatePickerProps>;
|
|
10
|
+
export default Object.assign(InternalDatePicker, { Dialog });
|
|
@@ -1,30 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import DatePickerIOS from './DatePickerIOS';
|
|
6
|
-
import type { DatePickerProps } from './types';
|
|
7
|
-
import IOSDatePickerDialog from './Dialog/IOSDialog';
|
|
8
|
-
import AndroidDatePickerDialog from './Dialog/AndroidDialog';
|
|
9
|
-
import { DatePickerDialogProps } from './Dialog/type';
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import DatePicker from './DatePicker';
|
|
3
|
+
import { DatePickerProps } from './types';
|
|
4
|
+
import Dialog from './Dialog';
|
|
10
5
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
return <DatePickerCalendar {...props} />;
|
|
14
|
-
}
|
|
15
|
-
if (Platform.OS === 'ios') {
|
|
16
|
-
return <DatePickerIOS {...props} variant={variant} />;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return <DatePickerAndroid {...props} variant={variant} />;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const Dialog = ({ ...props }: DatePickerDialogProps) => {
|
|
23
|
-
if (Platform.OS === 'ios') {
|
|
24
|
-
return <IOSDatePickerDialog {...props} />;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return <AndroidDatePickerDialog {...props} />;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default Object.assign(DatePicker, { Dialog });
|
|
6
|
+
const PublicDatePicker = DatePicker as FunctionComponent<DatePickerProps>;
|
|
7
|
+
export default Object.assign(PublicDatePicker, { Dialog });
|
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
StyleProp,
|
|
4
4
|
ViewStyle,
|
|
5
5
|
} from 'react-native';
|
|
6
|
+
import { TextInputProps } from '../TextInput';
|
|
6
7
|
|
|
7
8
|
export interface DatePickerProps {
|
|
8
9
|
/**
|
|
@@ -100,3 +101,8 @@ export interface DatePickerProps {
|
|
|
100
101
|
props?: NativeTextInputProps
|
|
101
102
|
) => React.ReactNode;
|
|
102
103
|
}
|
|
104
|
+
|
|
105
|
+
// Add an internal prop type for TextInputComponent, not exported
|
|
106
|
+
export interface InternalDatePickerProps extends DatePickerProps {
|
|
107
|
+
TextInputComponent?: React.ComponentType<TextInputProps>;
|
|
108
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import TimePickerAndroid from './TimePickerAndroid';
|
|
4
|
+
import TimePickerIOS from './TimePickerIOS';
|
|
5
|
+
import type { InternalTimePickerProps } from './types';
|
|
6
|
+
|
|
7
|
+
const TimePicker = (props: InternalTimePickerProps) => {
|
|
8
|
+
if (Platform.OS === 'ios') {
|
|
9
|
+
return <TimePickerIOS {...props} />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return <TimePickerAndroid {...props} />;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default TimePicker;
|
|
@@ -4,7 +4,7 @@ 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 type {
|
|
7
|
+
import type { InternalTimePickerProps } from './types';
|
|
8
8
|
|
|
9
9
|
const TimePickerAndroid = ({
|
|
10
10
|
value,
|
|
@@ -19,17 +19,20 @@ const TimePickerAndroid = ({
|
|
|
19
19
|
style,
|
|
20
20
|
testID,
|
|
21
21
|
showSuffix = true,
|
|
22
|
-
|
|
22
|
+
TextInputComponent,
|
|
23
|
+
}: InternalTimePickerProps) => {
|
|
23
24
|
const [open, setOpen] = useState(false);
|
|
24
25
|
|
|
25
26
|
const is12Hour = displayFormat.includes('hh');
|
|
26
27
|
const displayValue = value ? formatTime(displayFormat, value) : '';
|
|
27
28
|
const pickerInitValue = value || new Date();
|
|
28
29
|
|
|
30
|
+
const InputComponent = TextInputComponent || TextInput;
|
|
31
|
+
|
|
29
32
|
return (
|
|
30
33
|
<TouchableOpacity onPress={() => setOpen(true)} disabled={disabled}>
|
|
31
34
|
<View pointerEvents="none" testID="timePickerInputAndroid">
|
|
32
|
-
<
|
|
35
|
+
<InputComponent
|
|
33
36
|
label={label}
|
|
34
37
|
value={displayValue}
|
|
35
38
|
suffix={showSuffix ? 'clock-3' : undefined}
|
|
@@ -7,7 +7,7 @@ import BottomSheet from '../BottomSheet';
|
|
|
7
7
|
import TextInput from '../TextInput';
|
|
8
8
|
import Button from '../Button';
|
|
9
9
|
import { StyledPickerWrapper } from './StyledTimePicker';
|
|
10
|
-
import type {
|
|
10
|
+
import type { InternalTimePickerProps } from './types';
|
|
11
11
|
import { useTheme } from '../../theme';
|
|
12
12
|
|
|
13
13
|
const TimePickerIOS = ({
|
|
@@ -25,7 +25,8 @@ const TimePickerIOS = ({
|
|
|
25
25
|
testID,
|
|
26
26
|
showSuffix = true,
|
|
27
27
|
supportedOrientations = ['portrait'],
|
|
28
|
-
|
|
28
|
+
TextInputComponent,
|
|
29
|
+
}: InternalTimePickerProps) => {
|
|
29
30
|
const [selectingDate, setSelectingDate] = useState<Date>(value || new Date());
|
|
30
31
|
const [open, setOpen] = useState(false);
|
|
31
32
|
|
|
@@ -33,6 +34,8 @@ const TimePickerIOS = ({
|
|
|
33
34
|
const displayValue = value ? formatTime(displayFormat, value) : '';
|
|
34
35
|
const theme = useTheme();
|
|
35
36
|
|
|
37
|
+
const InputComponent = TextInputComponent || TextInput;
|
|
38
|
+
|
|
36
39
|
useEffect(() => {
|
|
37
40
|
setSelectingDate(value || new Date());
|
|
38
41
|
}, [value]);
|
|
@@ -40,7 +43,7 @@ const TimePickerIOS = ({
|
|
|
40
43
|
return (
|
|
41
44
|
<TouchableOpacity onPress={() => setOpen(true)} disabled={disabled}>
|
|
42
45
|
<View pointerEvents="none" testID="timePickerInputIOS">
|
|
43
|
-
<
|
|
46
|
+
<InputComponent
|
|
44
47
|
label={label}
|
|
45
48
|
value={displayValue}
|
|
46
49
|
suffix={showSuffix ? 'clock-3' : undefined}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { InternalTimePickerProps } from './types';
|
|
3
|
+
import TimePicker from './TimePicker';
|
|
4
|
+
|
|
5
|
+
const InternalTimePicker =
|
|
6
|
+
TimePicker as FunctionComponent<InternalTimePickerProps>;
|
|
7
|
+
|
|
8
|
+
export type { InternalTimePickerProps as TimePickerProps };
|
|
9
|
+
export default InternalTimePicker;
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Platform } from 'react-native';
|
|
3
|
-
import TimePickerAndroid from './TimePickerAndroid';
|
|
4
|
-
import TimePickerIOS from './TimePickerIOS';
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
5
2
|
import type { TimePickerProps } from './types';
|
|
3
|
+
import TimePicker from './TimePicker';
|
|
6
4
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
return <TimePickerIOS {...props} />;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return <TimePickerAndroid {...props} />;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default TimePicker;
|
|
5
|
+
const PublicTimePicker = TimePicker as FunctionComponent<TimePickerProps>;
|
|
6
|
+
export default PublicTimePicker;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import { TextInputProps } from '../TextInput';
|
|
2
3
|
|
|
3
4
|
export interface TimePickerProps {
|
|
4
5
|
/**
|
|
@@ -61,3 +62,8 @@ export interface TimePickerProps {
|
|
|
61
62
|
*/
|
|
62
63
|
supportedOrientations?: ('portrait' | 'landscape')[];
|
|
63
64
|
}
|
|
65
|
+
|
|
66
|
+
// Add an internal prop type for TextInputComponent, not exported
|
|
67
|
+
export interface InternalTimePickerProps extends TimePickerProps {
|
|
68
|
+
TextInputComponent?: React.ComponentType<TextInputProps>;
|
|
69
|
+
}
|
package/src/index.internal.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Select from './components/Select/index.internal';
|
|
2
|
+
import DatePicker from './components/DatePicker/index.internal';
|
|
3
|
+
import TimePicker from './components/TimePicker/index.internal';
|
|
2
4
|
|
|
3
5
|
export * from '.';
|
|
4
|
-
export { Select };
|
|
6
|
+
export { Select, DatePicker, TimePicker };
|
|
5
7
|
export type { MultiSelectProps, SingleSelectProps } from './types.internal';
|
package/src/types.internal.ts
CHANGED
|
@@ -3,6 +3,14 @@ import type {
|
|
|
3
3
|
MultiSelectProps,
|
|
4
4
|
} from './components/Select/index.internal';
|
|
5
5
|
|
|
6
|
+
import type { DatePickerProps } from './components/DatePicker/index.internal';
|
|
7
|
+
import type { TimePickerProps } from './components/TimePicker/index.internal';
|
|
8
|
+
|
|
6
9
|
export * from './types';
|
|
7
10
|
|
|
8
|
-
export {
|
|
11
|
+
export {
|
|
12
|
+
SingleSelectProps,
|
|
13
|
+
MultiSelectProps,
|
|
14
|
+
DatePickerProps,
|
|
15
|
+
TimePickerProps,
|
|
16
|
+
};
|
package/src/types.ts
CHANGED
|
@@ -49,6 +49,8 @@ import { TitleProps } from './components/Typography/Title';
|
|
|
49
49
|
import { CarouselData, CarouselImageProps } from './components/Carousel/types';
|
|
50
50
|
import { PinInputHandler } from './components/PinInput';
|
|
51
51
|
import { ThemeScale } from './components/Box/types';
|
|
52
|
+
import { TimePickerProps } from './components/TimePicker/types';
|
|
53
|
+
import { DatePickerProps } from './components/DatePicker/types';
|
|
52
54
|
|
|
53
55
|
export type {
|
|
54
56
|
Space,
|
|
@@ -101,4 +103,6 @@ export type {
|
|
|
101
103
|
ListItemProps,
|
|
102
104
|
IconButtonProps,
|
|
103
105
|
BadgeProps,
|
|
106
|
+
TimePickerProps,
|
|
107
|
+
DatePickerProps,
|
|
104
108
|
};
|