@tecsinapse/react-core 1.12.8 → 1.12.9
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 +8 -0
- package/dist/components/atoms/Input/hooks/useCurrencyMask.js +2 -2
- package/dist/components/atoms/Input/hooks/useCurrencyMask.js.map +1 -1
- package/dist/components/atoms/Input/hooks/useMask.js +2 -2
- package/dist/components/atoms/Input/hooks/useMask.js.map +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.js +6 -6
- package/dist/components/atoms/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/molecules/Calendar/index.d.ts +1 -1
- package/dist/components/molecules/Calendar/index.js +6 -0
- package/dist/components/molecules/Calendar/index.js.map +1 -1
- package/dist/components/molecules/Calendar/styled.js +0 -17
- package/dist/components/molecules/Calendar/styled.js.map +1 -1
- package/dist/components/molecules/DatePicker/DatePicker.d.ts +6 -5
- package/dist/components/molecules/DatePicker/DatePicker.js +22 -32
- package/dist/components/molecules/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/molecules/DatePicker/styled.d.ts +0 -14
- package/dist/components/molecules/DatePicker/styled.js +1 -46
- package/dist/components/molecules/DatePicker/styled.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/DateTimePicker.d.ts +5 -4
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js +35 -37
- package/dist/components/molecules/DateTimePicker/DateTimePicker.js.map +1 -1
- package/dist/components/molecules/DateTimePicker/styled.d.ts +0 -21
- package/dist/components/molecules/DateTimePicker/styled.js +3 -51
- package/dist/components/molecules/DateTimePicker/styled.js.map +1 -1
- package/dist/components/molecules/Grid/Item/Item.d.ts +1 -1
- package/dist/components/molecules/Grid/Item/Item.js +7 -5
- package/dist/components/molecules/Grid/Item/Item.js.map +1 -1
- package/dist/components/molecules/HintInputContainer/HintInputContainer.d.ts +3 -2
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js +4 -4
- package/dist/components/molecules/HintInputContainer/HintInputContainer.js.map +1 -1
- package/dist/components/molecules/TextArea/TextArea.d.ts +3 -1
- package/dist/components/molecules/TextArea/TextArea.js +4 -4
- package/dist/components/molecules/TextArea/TextArea.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/atoms/Input/hooks/useCurrencyMask.ts +2 -2
- package/src/components/atoms/Input/hooks/useMask.ts +1 -1
- package/src/components/atoms/ProgressBar/ProgressBar.tsx +5 -5
- package/src/components/molecules/Calendar/index.ts +1 -0
- package/src/components/molecules/Calendar/styled.ts +0 -22
- package/src/components/molecules/DatePicker/DatePicker.tsx +32 -41
- package/src/components/molecules/DatePicker/styled.ts +0 -40
- package/src/components/molecules/DateTimePicker/DateTimePicker.tsx +46 -52
- package/src/components/molecules/DateTimePicker/styled.ts +1 -49
- package/src/components/molecules/Grid/Item/Item.tsx +3 -5
- package/src/components/molecules/HintInputContainer/HintInputContainer.tsx +3 -8
- package/src/components/molecules/TextArea/TextArea.tsx +3 -9
- package/src/index.ts +1 -0
- package/dist/components/molecules/DatePicker/Modal.d.ts +0 -8
- package/dist/components/molecules/DatePicker/Modal.js +0 -60
- package/dist/components/molecules/DatePicker/Modal.js.map +0 -1
- package/dist/components/molecules/DateTimePicker/Modal.d.ts +0 -7
- package/dist/components/molecules/DateTimePicker/Modal.js +0 -89
- package/dist/components/molecules/DateTimePicker/Modal.js.map +0 -1
- package/src/components/molecules/DatePicker/DatePicker.stories.tsx +0 -44
- package/src/components/molecules/DatePicker/Modal.tsx +0 -51
- package/src/components/molecules/DateTimePicker/DateTimePicker.stories.tsx +0 -26
- package/src/components/molecules/DateTimePicker/Modal.tsx +0 -84
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import { format as formatDate } from 'date-fns';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
4
|
import { InputContainerProps, useInputFocus } from '../../atoms/Input';
|
|
5
5
|
import { Text, TextProps } from '../../atoms/Text';
|
|
6
6
|
import { CalendarProps, DateRange, SelectionType } from '../Calendar';
|
|
7
|
-
import { DatePickerModalProps, Modal } from './Modal';
|
|
8
|
-
import { CalendarIcon, getStyledTextComponent } from './styled';
|
|
9
7
|
import { HintInputContainer } from '../HintInputContainer';
|
|
10
|
-
import {
|
|
8
|
+
import { CalendarIcon, getStyledTextComponent } from './styled';
|
|
11
9
|
|
|
12
|
-
export interface DatePickerProps<T extends SelectionType>
|
|
13
|
-
extends InputContainerProps,
|
|
14
|
-
DatePickerModalProps<T>,
|
|
15
|
-
Omit<CalendarProps<T>, 'style'> {
|
|
10
|
+
export interface DatePickerProps<T extends SelectionType> extends InputContainerProps, Omit<CalendarProps<T>, 'style'> {
|
|
16
11
|
controlComponent?: (
|
|
17
12
|
onPress: () => void,
|
|
18
13
|
displayValue?: string
|
|
19
14
|
) => JSX.Element;
|
|
20
15
|
TextComponent?: React.FC<TextProps>;
|
|
21
|
-
|
|
16
|
+
CalendarComponent: React.FC<CalendarProps<T>>
|
|
22
17
|
placeholder?: string;
|
|
23
18
|
onFocus?: () => void | never;
|
|
24
19
|
onBlur?: () => void | never;
|
|
25
20
|
format?: string;
|
|
26
21
|
closeOnPick?: boolean;
|
|
22
|
+
renderCalendar: (calendar: React.ReactElement, blur?: () => void) => JSX.Element|null
|
|
23
|
+
requestShowCalendar: () => void
|
|
24
|
+
requestCloseCalendar: () => void
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
function DatePicker<T extends SelectionType>({
|
|
@@ -34,7 +32,6 @@ function DatePicker<T extends SelectionType>({
|
|
|
34
32
|
value,
|
|
35
33
|
type,
|
|
36
34
|
format = 'yyyy-MM-dd',
|
|
37
|
-
|
|
38
35
|
placeholder,
|
|
39
36
|
onFocus,
|
|
40
37
|
onBlur,
|
|
@@ -45,31 +42,26 @@ function DatePicker<T extends SelectionType>({
|
|
|
45
42
|
variant,
|
|
46
43
|
TextComponent = Text,
|
|
47
44
|
CalendarComponent,
|
|
48
|
-
bottomOffset,
|
|
49
45
|
rightComponent,
|
|
50
|
-
animationType = 'fade',
|
|
51
46
|
style,
|
|
52
47
|
locale,
|
|
53
48
|
closeOnPick = false,
|
|
49
|
+
renderCalendar,
|
|
50
|
+
requestShowCalendar,
|
|
51
|
+
requestCloseCalendar,
|
|
54
52
|
...rest
|
|
55
53
|
}: DatePickerProps<T>): JSX.Element {
|
|
54
|
+
|
|
56
55
|
const { focused, handleBlur, handleFocus } = useInputFocus(
|
|
57
56
|
onFocus,
|
|
58
57
|
onBlur,
|
|
59
58
|
!disabled
|
|
60
59
|
);
|
|
61
60
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
const handlePressInput = React.useCallback(() => {
|
|
65
|
-
setModalVisible(true);
|
|
61
|
+
const handleShowCalendar = React.useCallback(() => {
|
|
62
|
+
requestShowCalendar()
|
|
66
63
|
handleFocus();
|
|
67
|
-
}, [handleFocus,
|
|
68
|
-
|
|
69
|
-
const handleCloseModal = React.useCallback(() => {
|
|
70
|
-
setModalVisible(false);
|
|
71
|
-
handleBlur();
|
|
72
|
-
}, [handleBlur, setModalVisible]);
|
|
64
|
+
}, [handleFocus, requestShowCalendar]);
|
|
73
65
|
|
|
74
66
|
const getDisplayValue = () => {
|
|
75
67
|
if (!value) return placeholder;
|
|
@@ -89,23 +81,35 @@ function DatePicker<T extends SelectionType>({
|
|
|
89
81
|
|
|
90
82
|
useEffect(() => {
|
|
91
83
|
if (closeOnPick && value && type === 'day') {
|
|
92
|
-
setTimeout(
|
|
84
|
+
setTimeout(requestCloseCalendar, 200);
|
|
93
85
|
}
|
|
94
86
|
if (closeOnPick && value && type === 'range') {
|
|
95
87
|
const { lowest, highest } = value as DateRange;
|
|
96
|
-
lowest && highest && setTimeout(
|
|
88
|
+
lowest && highest && setTimeout(requestCloseCalendar, 200);
|
|
97
89
|
}
|
|
98
|
-
}, [value, closeOnPick, type,
|
|
90
|
+
}, [value, closeOnPick, type, requestCloseCalendar]);
|
|
91
|
+
|
|
92
|
+
const calendar = (
|
|
93
|
+
<CalendarComponent
|
|
94
|
+
pointerEvents={'box-none'}
|
|
95
|
+
type={type}
|
|
96
|
+
value={value}
|
|
97
|
+
month={month}
|
|
98
|
+
year={year}
|
|
99
|
+
onChange={onChange}
|
|
100
|
+
locale={locale}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
99
103
|
|
|
100
104
|
return (
|
|
101
105
|
<>
|
|
102
106
|
{controlComponent ? (
|
|
103
|
-
controlComponent(
|
|
107
|
+
controlComponent(handleShowCalendar, getDisplayValue())
|
|
104
108
|
) : (
|
|
105
109
|
<HintInputContainer
|
|
106
110
|
focused={focused}
|
|
107
111
|
viewStyle={style}
|
|
108
|
-
onPress={
|
|
112
|
+
onPress={handleShowCalendar}
|
|
109
113
|
disabled={disabled}
|
|
110
114
|
hintComponent={hintComponent}
|
|
111
115
|
LabelComponent={TextComponent}
|
|
@@ -124,20 +128,7 @@ function DatePicker<T extends SelectionType>({
|
|
|
124
128
|
</StyledText>
|
|
125
129
|
</HintInputContainer>
|
|
126
130
|
)}
|
|
127
|
-
|
|
128
|
-
CalendarComponent={CalendarComponent}
|
|
129
|
-
bottomOffset={bottomOffset}
|
|
130
|
-
visible={modalVisible}
|
|
131
|
-
onRequestClose={handleCloseModal}
|
|
132
|
-
animated
|
|
133
|
-
animationType={animationType}
|
|
134
|
-
month={month}
|
|
135
|
-
year={year}
|
|
136
|
-
onChange={onChange}
|
|
137
|
-
value={value}
|
|
138
|
-
type={type}
|
|
139
|
-
locale={locale}
|
|
140
|
-
/>
|
|
131
|
+
{renderCalendar(calendar, handleBlur)}
|
|
141
132
|
</>
|
|
142
133
|
);
|
|
143
134
|
}
|
|
@@ -1,50 +1,10 @@
|
|
|
1
1
|
import styled, { css } from '@emotion/native';
|
|
2
2
|
import { FC } from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
|
-
import { hex2rgba } from '../../../styles/definitions';
|
|
5
3
|
import { StyleProps } from '../../../types/defaults';
|
|
6
|
-
import { RFValue } from '../../../utils';
|
|
7
4
|
import { Icon } from '../../atoms/Icon';
|
|
8
5
|
import { disabledInputStyles, InputContainerProps } from '../../atoms/Input';
|
|
9
|
-
import { PressableSurface } from '../../atoms/PressableSurface';
|
|
10
6
|
import { TextProps } from '../../atoms/Text';
|
|
11
7
|
|
|
12
|
-
const isWeb = Platform.OS === 'web';
|
|
13
|
-
|
|
14
|
-
export const Backdrop = styled(PressableSurface)<Partial<StyleProps>>`
|
|
15
|
-
${({ theme }) =>
|
|
16
|
-
isWeb
|
|
17
|
-
? css`
|
|
18
|
-
justify-content: center;
|
|
19
|
-
align-items: center;
|
|
20
|
-
background-color: ${hex2rgba(theme.miscellaneous.overlay, 0.5)};
|
|
21
|
-
height: 100vh;
|
|
22
|
-
`
|
|
23
|
-
: css`
|
|
24
|
-
justify-content: flex-end;
|
|
25
|
-
background-color: ${hex2rgba(theme.miscellaneous.overlay, 0.5)};
|
|
26
|
-
height: 100%;
|
|
27
|
-
`}
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
export const ModalContent = styled.View<
|
|
31
|
-
{ offset: number } & Partial<StyleProps>
|
|
32
|
-
>`
|
|
33
|
-
background-color: transparent;
|
|
34
|
-
padding-bottom: ${({ offset }) => `${RFValue(offset)}px`};
|
|
35
|
-
${({ theme: { borderRadius } }) => css`
|
|
36
|
-
${isWeb
|
|
37
|
-
? `
|
|
38
|
-
border-radius: ${borderRadius.micro};
|
|
39
|
-
`
|
|
40
|
-
: `
|
|
41
|
-
border-top-left-radius: ${borderRadius.deca};
|
|
42
|
-
border-top-right-radius: ${borderRadius.deca};
|
|
43
|
-
`}
|
|
44
|
-
`}
|
|
45
|
-
overflow: hidden;
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
8
|
export const getStyledTextComponent = (component: FC<TextProps>) => {
|
|
49
9
|
return styled(component)(
|
|
50
10
|
(props: Partial<InputContainerProps> & Partial<StyleProps>) => css`
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { format as formatDate } from 'date-fns';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { ModalBaseProps } from 'react-native';
|
|
4
3
|
import { InputContainerProps, useInputFocus } from '../../atoms/Input';
|
|
5
4
|
import { Text, TextProps } from '../../atoms/Text';
|
|
6
5
|
import { CalendarIcon, getStyledTextComponent } from '../DatePicker/styled';
|
|
7
|
-
import { DateTimeSelectorProps } from '../DateTimeSelector';
|
|
8
|
-
import { DateTimePickerModalProps, Modal } from './Modal';
|
|
6
|
+
import { DateTimeSelector, DateTimeSelectorProps } from '../DateTimeSelector';
|
|
9
7
|
import { HintInputContainer } from '../HintInputContainer';
|
|
8
|
+
import { getStyledDateTimeSelector } from './styled';
|
|
10
9
|
|
|
11
|
-
export interface DateTimePickerProps
|
|
12
|
-
extends InputContainerProps,
|
|
13
|
-
DateTimePickerModalProps,
|
|
14
|
-
Omit<DateTimeSelectorProps, 'style'> {
|
|
10
|
+
export interface DateTimePickerProps extends InputContainerProps, Omit<DateTimeSelectorProps, 'style'> {
|
|
15
11
|
controlComponent?: (
|
|
16
12
|
onPress: () => void,
|
|
17
13
|
displayValue?: string
|
|
18
14
|
) => JSX.Element;
|
|
19
15
|
TextComponent?: React.FC<TextProps>;
|
|
20
|
-
|
|
16
|
+
DateTimeSelectorComponent: React.FC<DateTimeSelectorProps>;
|
|
21
17
|
placeholder?: string;
|
|
22
18
|
onFocus?: () => void | never;
|
|
23
19
|
onBlur?: () => void | never;
|
|
20
|
+
renderSelector: (selector: React.ReactElement, blur?: () => void) => JSX.Element|null
|
|
21
|
+
requestShowSelector: () => void
|
|
22
|
+
requestCloseSelector: () => void
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
@@ -34,7 +33,6 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
|
34
33
|
offsetThreshold,
|
|
35
34
|
upperOffsetThreshold,
|
|
36
35
|
lowerOffsetThreshold,
|
|
37
|
-
|
|
38
36
|
dateModalTitle,
|
|
39
37
|
timeModalTitle,
|
|
40
38
|
dateConfirmButtonText,
|
|
@@ -44,7 +42,6 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
|
44
42
|
yearLabel,
|
|
45
43
|
hourLabel,
|
|
46
44
|
minuteLabel,
|
|
47
|
-
|
|
48
45
|
placeholder,
|
|
49
46
|
onFocus,
|
|
50
47
|
onBlur,
|
|
@@ -54,45 +51,68 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
|
54
51
|
hint,
|
|
55
52
|
variant = 'default',
|
|
56
53
|
TextComponent = Text,
|
|
57
|
-
DateTimeSelectorComponent,
|
|
58
|
-
bottomOffset,
|
|
54
|
+
DateTimeSelectorComponent = DateTimeSelector,
|
|
59
55
|
rightComponent,
|
|
60
|
-
animationType = 'fade',
|
|
61
56
|
style,
|
|
57
|
+
renderSelector,
|
|
58
|
+
requestShowSelector,
|
|
59
|
+
requestCloseSelector,
|
|
62
60
|
...rest
|
|
63
61
|
}) => {
|
|
62
|
+
|
|
64
63
|
const { focused, handleBlur, handleFocus } = useInputFocus(
|
|
65
64
|
onFocus,
|
|
66
65
|
onBlur,
|
|
67
66
|
!disabled
|
|
68
67
|
);
|
|
69
68
|
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
const handlePressInput = () => {
|
|
73
|
-
setModalVisible(true);
|
|
69
|
+
const handleShowSelector = () => {
|
|
70
|
+
requestShowSelector()
|
|
74
71
|
handleFocus();
|
|
75
72
|
};
|
|
76
73
|
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
const handleChoosing = (value: Date) => {
|
|
75
|
+
onChange?.(value)
|
|
76
|
+
requestCloseSelector()
|
|
80
77
|
};
|
|
81
78
|
|
|
82
79
|
const StyledText = getStyledTextComponent(TextComponent);
|
|
83
|
-
const displayValue =
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
const displayValue = (value ? formatDate(value, format, { locale: locale }) : placeholder) || ' ';
|
|
81
|
+
const StyledDateTimeSelector = getStyledDateTimeSelector(DateTimeSelectorComponent)
|
|
82
|
+
|
|
83
|
+
const dateTimeSelector = (
|
|
84
|
+
<StyledDateTimeSelector
|
|
85
|
+
value={value}
|
|
86
|
+
mode={mode}
|
|
87
|
+
format={format}
|
|
88
|
+
locale={locale}
|
|
89
|
+
upperDateThreshold={upperDateThreshold}
|
|
90
|
+
lowerDateThreshold={lowerDateThreshold}
|
|
91
|
+
offsetThreshold={offsetThreshold}
|
|
92
|
+
upperOffsetThreshold={upperOffsetThreshold}
|
|
93
|
+
lowerOffsetThreshold={lowerOffsetThreshold}
|
|
94
|
+
dateModalTitle={dateModalTitle}
|
|
95
|
+
timeModalTitle={timeModalTitle}
|
|
96
|
+
dateConfirmButtonText={dateConfirmButtonText}
|
|
97
|
+
timeConfirmButtonText={timeConfirmButtonText}
|
|
98
|
+
dayLabel={dayLabel}
|
|
99
|
+
monthLabel={monthLabel}
|
|
100
|
+
yearLabel={yearLabel}
|
|
101
|
+
hourLabel={hourLabel}
|
|
102
|
+
minuteLabel={minuteLabel}
|
|
103
|
+
onChange={handleChoosing}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
86
106
|
|
|
87
107
|
return (
|
|
88
108
|
<>
|
|
89
109
|
{controlComponent ? (
|
|
90
|
-
controlComponent(
|
|
110
|
+
controlComponent(handleShowSelector, displayValue)
|
|
91
111
|
) : (
|
|
92
112
|
<HintInputContainer
|
|
93
113
|
focused={focused}
|
|
94
114
|
viewStyle={style}
|
|
95
|
-
onPress={
|
|
115
|
+
onPress={handleShowSelector}
|
|
96
116
|
disabled={disabled}
|
|
97
117
|
LabelComponent={TextComponent}
|
|
98
118
|
variant={variant}
|
|
@@ -111,33 +131,7 @@ const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
|
111
131
|
</StyledText>
|
|
112
132
|
</HintInputContainer>
|
|
113
133
|
)}
|
|
114
|
-
|
|
115
|
-
DateTimeSelectorComponent={DateTimeSelectorComponent}
|
|
116
|
-
bottomOffset={bottomOffset}
|
|
117
|
-
visible={modalVisible}
|
|
118
|
-
onRequestClose={handleCloseModal}
|
|
119
|
-
animated
|
|
120
|
-
animationType={animationType}
|
|
121
|
-
onChange={onChange}
|
|
122
|
-
value={value}
|
|
123
|
-
mode={mode}
|
|
124
|
-
format={format}
|
|
125
|
-
locale={locale}
|
|
126
|
-
upperDateThreshold={upperDateThreshold}
|
|
127
|
-
lowerDateThreshold={lowerDateThreshold}
|
|
128
|
-
offsetThreshold={offsetThreshold}
|
|
129
|
-
upperOffsetThreshold={upperOffsetThreshold}
|
|
130
|
-
lowerOffsetThreshold={lowerOffsetThreshold}
|
|
131
|
-
dateModalTitle={dateModalTitle}
|
|
132
|
-
timeModalTitle={timeModalTitle}
|
|
133
|
-
dateConfirmButtonText={dateConfirmButtonText}
|
|
134
|
-
timeConfirmButtonText={timeConfirmButtonText}
|
|
135
|
-
dayLabel={dayLabel}
|
|
136
|
-
monthLabel={monthLabel}
|
|
137
|
-
yearLabel={yearLabel}
|
|
138
|
-
hourLabel={hourLabel}
|
|
139
|
-
minuteLabel={minuteLabel}
|
|
140
|
-
/>
|
|
134
|
+
{renderSelector(dateTimeSelector, handleBlur)}
|
|
141
135
|
</>
|
|
142
136
|
);
|
|
143
137
|
};
|
|
@@ -1,56 +1,8 @@
|
|
|
1
|
-
import styled
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
2
|
import { FC } from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
3
|
import { StyleProps } from '../../../types/defaults';
|
|
5
|
-
import { RFValue, RFValueStr } from '../../../utils';
|
|
6
|
-
import {
|
|
7
|
-
PressableSurface,
|
|
8
|
-
PressableSurfaceProps
|
|
9
|
-
} from '../../atoms/PressableSurface';
|
|
10
4
|
import { DateTimeSelectorProps } from '../DateTimeSelector';
|
|
11
5
|
|
|
12
|
-
const isWeb = Platform.OS === 'web';
|
|
13
|
-
|
|
14
|
-
export const StyledPressableSurface = styled(
|
|
15
|
-
PressableSurface
|
|
16
|
-
)<PressableSurfaceProps>`
|
|
17
|
-
width: 100%;
|
|
18
|
-
`;
|
|
19
|
-
|
|
20
|
-
export const Backdrop = styled(PressableSurface)<Partial<StyleProps>>`
|
|
21
|
-
${isWeb
|
|
22
|
-
? css`
|
|
23
|
-
justify-content: center;
|
|
24
|
-
align-items: center;
|
|
25
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
26
|
-
height: 100vh;
|
|
27
|
-
`
|
|
28
|
-
: css`
|
|
29
|
-
justify-content: flex-end;
|
|
30
|
-
background-color: rgba(0, 0, 0, 0.5);
|
|
31
|
-
height: 100%;
|
|
32
|
-
`}
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
export const ModalContent = styled.View<
|
|
36
|
-
{ offset: number } & Partial<StyleProps>
|
|
37
|
-
>`
|
|
38
|
-
background-color: transparent;
|
|
39
|
-
padding-bottom: ${({ offset }) => `${RFValue(offset)}px`};
|
|
40
|
-
${({ theme: { borderRadius } }) => css`
|
|
41
|
-
${isWeb
|
|
42
|
-
? `
|
|
43
|
-
width: ${RFValueStr('375px')};
|
|
44
|
-
border-radius: ${borderRadius.micro};
|
|
45
|
-
`
|
|
46
|
-
: `
|
|
47
|
-
border-top-left-radius: ${borderRadius.deca};
|
|
48
|
-
border-top-right-radius: ${borderRadius.deca};
|
|
49
|
-
`}
|
|
50
|
-
`}
|
|
51
|
-
overflow: hidden;
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
6
|
export const getStyledDateTimeSelector = (
|
|
55
7
|
component: FC<DateTimeSelectorProps>
|
|
56
8
|
) => {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
extractNumbersFromString,
|
|
4
|
-
SpacingType,
|
|
5
|
-
useTheme,
|
|
6
|
-
} from '@tecsinapse/react-core';
|
|
7
2
|
import { View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../../hooks';
|
|
4
|
+
import { SpacingType } from '../../../../types/defaults';
|
|
5
|
+
import { extractNumbersFromString } from '../../../../utils';
|
|
8
6
|
|
|
9
7
|
type FlexPositioning = 'flex-start' | 'flex-end' | 'center';
|
|
10
8
|
type FlexAlignBase = FlexPositioning | 'stretch';
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Hint,
|
|
3
|
-
InputVariantType,
|
|
4
|
-
PressableInputContainer,
|
|
5
|
-
PressableInputContainerProps,
|
|
6
|
-
TextProps,
|
|
7
|
-
} from '@tecsinapse/react-core';
|
|
8
|
-
import { StyleProp, View, ViewStyle } from 'react-native';
|
|
9
1
|
import * as React from 'react';
|
|
2
|
+
import { StyleProp, View, ViewStyle } from 'react-native';
|
|
3
|
+
import { Hint, InputVariantType, PressableInputContainer, PressableInputContainerProps } from '../../atoms/Input';
|
|
4
|
+
import { TextProps } from '../../atoms/Text';
|
|
10
5
|
|
|
11
6
|
export interface HintInputContainerProps extends PressableInputContainerProps {
|
|
12
7
|
viewStyle?: StyleProp<ViewStyle>;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import React, { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
FontStackType,
|
|
4
|
-
FontWeightType,
|
|
5
|
-
Hint,
|
|
6
|
-
InputContainerProps,
|
|
7
|
-
InputElementProps,
|
|
8
|
-
TextProps,
|
|
9
|
-
} from '@tecsinapse/react-core';
|
|
10
2
|
import { View } from 'react-native';
|
|
3
|
+
import { FontStackType, FontWeightType } from '../../../types/defaults';
|
|
4
|
+
import { Hint, InputContainerProps, InputElementProps } from '../../atoms/Input';
|
|
5
|
+
import { Text, TextProps } from '../../atoms/Text';
|
|
11
6
|
import { StyledInputContainer } from './styled';
|
|
12
|
-
import { Text } from '../../atoms/Text';
|
|
13
7
|
|
|
14
8
|
export interface TextAreaProps
|
|
15
9
|
extends Omit<InputElementProps, 'style' | 'multiline' | 'value'>,
|
package/src/index.ts
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ModalProps } from 'react-native';
|
|
3
|
-
import { CalendarProps, SelectionType } from '../Calendar';
|
|
4
|
-
export interface DatePickerModalProps<T extends SelectionType> {
|
|
5
|
-
CalendarComponent?: React.FC<CalendarProps<T>>;
|
|
6
|
-
bottomOffset?: number;
|
|
7
|
-
}
|
|
8
|
-
export declare const Modal: <T extends SelectionType>({ type, value, onRequestClose, month, year, onChange, CalendarComponent, bottomOffset, locale, ...modalProps }: CalendarProps<T> & import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps & DatePickerModalProps<T>) => JSX.Element;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Modal = void 0;
|
|
7
|
-
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
|
-
var _Calendar = require("../Calendar");
|
|
13
|
-
|
|
14
|
-
var _styled = require("./styled");
|
|
15
|
-
|
|
16
|
-
var _reactCore = require("@tecsinapse/react-core");
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
-
|
|
24
|
-
const Component = ({
|
|
25
|
-
type,
|
|
26
|
-
value,
|
|
27
|
-
onRequestClose,
|
|
28
|
-
month,
|
|
29
|
-
year,
|
|
30
|
-
onChange,
|
|
31
|
-
CalendarComponent = _Calendar.Calendar,
|
|
32
|
-
bottomOffset = 0,
|
|
33
|
-
locale,
|
|
34
|
-
...modalProps
|
|
35
|
-
}) => {
|
|
36
|
-
return React.createElement(_reactNative.Modal, _extends({
|
|
37
|
-
transparent: true,
|
|
38
|
-
hardwareAccelerated: true,
|
|
39
|
-
statusBarTranslucent: true
|
|
40
|
-
}, modalProps, {
|
|
41
|
-
onRequestClose: onRequestClose
|
|
42
|
-
}), React.createElement(_styled.Backdrop, {
|
|
43
|
-
onPress: onRequestClose,
|
|
44
|
-
effect: "none"
|
|
45
|
-
}, React.createElement(_reactCore.PressableSurface, null, React.createElement(_styled.ModalContent, {
|
|
46
|
-
offset: bottomOffset
|
|
47
|
-
}, React.createElement(CalendarComponent, {
|
|
48
|
-
pointerEvents: 'box-none',
|
|
49
|
-
type: type,
|
|
50
|
-
value: value,
|
|
51
|
-
month: month,
|
|
52
|
-
year: year,
|
|
53
|
-
onChange: onChange,
|
|
54
|
-
locale: locale
|
|
55
|
-
})))));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const Modal = Component;
|
|
59
|
-
exports.Modal = Modal;
|
|
60
|
-
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/DatePicker/Modal.tsx"],"names":["Component","type","value","onRequestClose","month","year","onChange","CalendarComponent","Calendar","bottomOffset","locale","modalProps","Modal"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAOA,MAAMA,SAAS,GAAG,CAA0B;AAC1CC,EAAAA,IAD0C;AAE1CC,EAAAA,KAF0C;AAG1CC,EAAAA,cAH0C;AAI1CC,EAAAA,KAJ0C;AAK1CC,EAAAA,IAL0C;AAM1CC,EAAAA,QAN0C;AAO1CC,EAAAA,iBAAiB,GAAGC,kBAPsB;AAQ1CC,EAAAA,YAAY,GAAG,CAR2B;AAS1CC,EAAAA,MAT0C;AAU1C,KAAGC;AAVuC,CAA1B,KAW0D;AAC1E,SACE,oBAAC,kBAAD;AACE,IAAA,WAAW,MADb;AAEE,IAAA,mBAAmB,MAFrB;AAGE,IAAA,oBAAoB;AAHtB,KAIMA,UAJN;AAKE,IAAA,cAAc,EAAER;AALlB,MAOE,oBAAC,gBAAD;AAAU,IAAA,OAAO,EAAEA,cAAnB;AAAmC,IAAA,MAAM,EAAC;AAA1C,KACE,oBAAC,2BAAD,QACE,oBAAC,oBAAD;AAAc,IAAA,MAAM,EAAEM;AAAtB,KACE,oBAAC,iBAAD;AACE,IAAA,aAAa,EAAE,UADjB;AAEE,IAAA,IAAI,EAAER,IAFR;AAGE,IAAA,KAAK,EAAEC,KAHT;AAIE,IAAA,KAAK,EAAEE,KAJT;AAKE,IAAA,IAAI,EAAEC,IALR;AAME,IAAA,QAAQ,EAAEC,QANZ;AAOE,IAAA,MAAM,EAAEI;AAPV,IADF,CADF,CADF,CAPF,CADF;AAyBD,CArCD;;AAuCO,MAAME,KAAK,GAAGZ,SAAd","sourcesContent":["import * as React from 'react';\nimport { Modal as RNModal, ModalProps } from 'react-native';\nimport { Calendar, CalendarProps, SelectionType } from '../Calendar';\nimport { Backdrop, ModalContent } from './styled';\nimport { PressableSurface } from '@tecsinapse/react-core';\n\nexport interface DatePickerModalProps<T extends SelectionType> {\n CalendarComponent?: React.FC<CalendarProps<T>>;\n bottomOffset?: number;\n}\n\nconst Component = <T extends SelectionType>({\n type,\n value,\n onRequestClose,\n month,\n year,\n onChange,\n CalendarComponent = Calendar,\n bottomOffset = 0,\n locale,\n ...modalProps\n}: CalendarProps<T> & ModalProps & DatePickerModalProps<T>): JSX.Element => {\n return (\n <RNModal\n transparent\n hardwareAccelerated\n statusBarTranslucent\n {...modalProps}\n onRequestClose={onRequestClose}\n >\n <Backdrop onPress={onRequestClose} effect=\"none\">\n <PressableSurface>\n <ModalContent offset={bottomOffset}>\n <CalendarComponent\n pointerEvents={'box-none'}\n type={type}\n value={value}\n month={month}\n year={year}\n onChange={onChange}\n locale={locale}\n />\n </ModalContent>\n </PressableSurface>\n </Backdrop>\n </RNModal>\n );\n};\n\nexport const Modal = Component;\n"],"file":"Modal.js"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { DateTimeSelectorProps } from '../DateTimeSelector';
|
|
3
|
-
export interface DateTimePickerModalProps {
|
|
4
|
-
DateTimeSelectorComponent?: React.FC<DateTimeSelectorProps>;
|
|
5
|
-
bottomOffset?: number;
|
|
6
|
-
}
|
|
7
|
-
export declare const Modal: React.FC<DateTimeSelectorProps & import("react-native").ModalBaseProps & import("react-native").ModalPropsIOS & import("react-native").ModalPropsAndroid & import("react-native").ViewProps & DateTimePickerModalProps>;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Modal = void 0;
|
|
7
|
-
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _reactNative = require("react-native");
|
|
11
|
-
|
|
12
|
-
var _DateTimeSelector = require("../DateTimeSelector");
|
|
13
|
-
|
|
14
|
-
var _styled = require("./styled");
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
|
-
|
|
22
|
-
const Component = ({
|
|
23
|
-
onRequestClose,
|
|
24
|
-
onChange,
|
|
25
|
-
value,
|
|
26
|
-
mode,
|
|
27
|
-
format,
|
|
28
|
-
locale,
|
|
29
|
-
upperDateThreshold,
|
|
30
|
-
lowerDateThreshold,
|
|
31
|
-
offsetThreshold,
|
|
32
|
-
upperOffsetThreshold,
|
|
33
|
-
lowerOffsetThreshold,
|
|
34
|
-
dateModalTitle,
|
|
35
|
-
timeModalTitle,
|
|
36
|
-
dateConfirmButtonText,
|
|
37
|
-
timeConfirmButtonText,
|
|
38
|
-
dayLabel,
|
|
39
|
-
monthLabel,
|
|
40
|
-
yearLabel,
|
|
41
|
-
hourLabel,
|
|
42
|
-
minuteLabel,
|
|
43
|
-
DateTimeSelectorComponent = _DateTimeSelector.DateTimeSelector,
|
|
44
|
-
bottomOffset = 0,
|
|
45
|
-
...modalProps
|
|
46
|
-
}) => {
|
|
47
|
-
const handleDateTimeSelectorChange = date => {
|
|
48
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(date);
|
|
49
|
-
onRequestClose === null || onRequestClose === void 0 ? void 0 : onRequestClose();
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const StyledDateTimeSelector = (0, _styled.getStyledDateTimeSelector)(DateTimeSelectorComponent);
|
|
53
|
-
return React.createElement(_reactNative.Modal, _extends({
|
|
54
|
-
transparent: true,
|
|
55
|
-
hardwareAccelerated: true,
|
|
56
|
-
statusBarTranslucent: true
|
|
57
|
-
}, modalProps, {
|
|
58
|
-
onRequestClose: onRequestClose
|
|
59
|
-
}), React.createElement(_styled.Backdrop, {
|
|
60
|
-
onPress: onRequestClose,
|
|
61
|
-
effect: "none"
|
|
62
|
-
}, React.createElement(_styled.ModalContent, {
|
|
63
|
-
offset: bottomOffset
|
|
64
|
-
}, React.createElement(StyledDateTimeSelector, {
|
|
65
|
-
value: value,
|
|
66
|
-
mode: mode,
|
|
67
|
-
format: format,
|
|
68
|
-
locale: locale,
|
|
69
|
-
upperDateThreshold: upperDateThreshold,
|
|
70
|
-
lowerDateThreshold: lowerDateThreshold,
|
|
71
|
-
offsetThreshold: offsetThreshold,
|
|
72
|
-
upperOffsetThreshold: upperOffsetThreshold,
|
|
73
|
-
lowerOffsetThreshold: lowerOffsetThreshold,
|
|
74
|
-
dateModalTitle: dateModalTitle,
|
|
75
|
-
timeModalTitle: timeModalTitle,
|
|
76
|
-
dateConfirmButtonText: dateConfirmButtonText,
|
|
77
|
-
timeConfirmButtonText: timeConfirmButtonText,
|
|
78
|
-
dayLabel: dayLabel,
|
|
79
|
-
monthLabel: monthLabel,
|
|
80
|
-
yearLabel: yearLabel,
|
|
81
|
-
hourLabel: hourLabel,
|
|
82
|
-
minuteLabel: minuteLabel,
|
|
83
|
-
onChange: handleDateTimeSelectorChange
|
|
84
|
-
}))));
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const Modal = Component;
|
|
88
|
-
exports.Modal = Modal;
|
|
89
|
-
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/molecules/DateTimePicker/Modal.tsx"],"names":["Component","onRequestClose","onChange","value","mode","format","locale","upperDateThreshold","lowerDateThreshold","offsetThreshold","upperOffsetThreshold","lowerOffsetThreshold","dateModalTitle","timeModalTitle","dateConfirmButtonText","timeConfirmButtonText","dayLabel","monthLabel","yearLabel","hourLabel","minuteLabel","DateTimeSelectorComponent","DateTimeSelector","bottomOffset","modalProps","handleDateTimeSelectorChange","date","StyledDateTimeSelector","Modal"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;AAOA,MAAMA,SAEL,GAAG,CAAC;AACHC,EAAAA,cADG;AAEHC,EAAAA,QAFG;AAGHC,EAAAA,KAHG;AAIHC,EAAAA,IAJG;AAKHC,EAAAA,MALG;AAMHC,EAAAA,MANG;AAOHC,EAAAA,kBAPG;AAQHC,EAAAA,kBARG;AASHC,EAAAA,eATG;AAUHC,EAAAA,oBAVG;AAWHC,EAAAA,oBAXG;AAYHC,EAAAA,cAZG;AAaHC,EAAAA,cAbG;AAcHC,EAAAA,qBAdG;AAeHC,EAAAA,qBAfG;AAgBHC,EAAAA,QAhBG;AAiBHC,EAAAA,UAjBG;AAkBHC,EAAAA,SAlBG;AAmBHC,EAAAA,SAnBG;AAoBHC,EAAAA,WApBG;AAqBHC,EAAAA,yBAAyB,GAAGC,kCArBzB;AAsBHC,EAAAA,YAAY,GAAG,CAtBZ;AAuBH,KAAGC;AAvBA,CAAD,KAwBE;AACJ,QAAMC,4BAA4B,GAAIC,IAAD,IAAgB;AACnDxB,IAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAGwB,IAAH,CAAR;AACAzB,IAAAA,cAAc,SAAd,IAAAA,cAAc,WAAd,YAAAA,cAAc;AACf,GAHD;;AAKA,QAAM0B,sBAAsB,GAAG,uCAC7BN,yBAD6B,CAA/B;AAIA,SACE,oBAAC,kBAAD;AACE,IAAA,WAAW,MADb;AAEE,IAAA,mBAAmB,MAFrB;AAGE,IAAA,oBAAoB;AAHtB,KAIMG,UAJN;AAKE,IAAA,cAAc,EAAEvB;AALlB,MAOE,oBAAC,gBAAD;AAAU,IAAA,OAAO,EAAEA,cAAnB;AAAmC,IAAA,MAAM,EAAC;AAA1C,KACE,oBAAC,oBAAD;AAAc,IAAA,MAAM,EAAEsB;AAAtB,KACE,oBAAC,sBAAD;AACE,IAAA,KAAK,EAAEpB,KADT;AAEE,IAAA,IAAI,EAAEC,IAFR;AAGE,IAAA,MAAM,EAAEC,MAHV;AAIE,IAAA,MAAM,EAAEC,MAJV;AAKE,IAAA,kBAAkB,EAAEC,kBALtB;AAME,IAAA,kBAAkB,EAAEC,kBANtB;AAOE,IAAA,eAAe,EAAEC,eAPnB;AAQE,IAAA,oBAAoB,EAAEC,oBARxB;AASE,IAAA,oBAAoB,EAAEC,oBATxB;AAUE,IAAA,cAAc,EAAEC,cAVlB;AAWE,IAAA,cAAc,EAAEC,cAXlB;AAYE,IAAA,qBAAqB,EAAEC,qBAZzB;AAaE,IAAA,qBAAqB,EAAEC,qBAbzB;AAcE,IAAA,QAAQ,EAAEC,QAdZ;AAeE,IAAA,UAAU,EAAEC,UAfd;AAgBE,IAAA,SAAS,EAAEC,SAhBb;AAiBE,IAAA,SAAS,EAAEC,SAjBb;AAkBE,IAAA,WAAW,EAAEC,WAlBf;AAmBE,IAAA,QAAQ,EAAEK;AAnBZ,IADF,CADF,CAPF,CADF;AAmCD,CAvED;;AAyEO,MAAMG,KAAK,GAAG5B,SAAd","sourcesContent":["import * as React from 'react';\nimport { Modal as RNModal, ModalProps } from 'react-native';\nimport { DateTimeSelector, DateTimeSelectorProps } from '../DateTimeSelector';\nimport { Backdrop, getStyledDateTimeSelector, ModalContent } from './styled';\n\nexport interface DateTimePickerModalProps {\n DateTimeSelectorComponent?: React.FC<DateTimeSelectorProps>;\n bottomOffset?: number;\n}\n\nconst Component: React.FC<\n DateTimeSelectorProps & ModalProps & DateTimePickerModalProps\n> = ({\n onRequestClose,\n onChange,\n value,\n mode,\n format,\n locale,\n upperDateThreshold,\n lowerDateThreshold,\n offsetThreshold,\n upperOffsetThreshold,\n lowerOffsetThreshold,\n dateModalTitle,\n timeModalTitle,\n dateConfirmButtonText,\n timeConfirmButtonText,\n dayLabel,\n monthLabel,\n yearLabel,\n hourLabel,\n minuteLabel,\n DateTimeSelectorComponent = DateTimeSelector,\n bottomOffset = 0,\n ...modalProps\n}) => {\n const handleDateTimeSelectorChange = (date: Date) => {\n onChange?.(date);\n onRequestClose?.();\n };\n\n const StyledDateTimeSelector = getStyledDateTimeSelector(\n DateTimeSelectorComponent\n );\n\n return (\n <RNModal\n transparent\n hardwareAccelerated\n statusBarTranslucent\n {...modalProps}\n onRequestClose={onRequestClose}\n >\n <Backdrop onPress={onRequestClose} effect=\"none\">\n <ModalContent offset={bottomOffset}>\n <StyledDateTimeSelector\n value={value}\n mode={mode}\n format={format}\n locale={locale}\n upperDateThreshold={upperDateThreshold}\n lowerDateThreshold={lowerDateThreshold}\n offsetThreshold={offsetThreshold}\n upperOffsetThreshold={upperOffsetThreshold}\n lowerOffsetThreshold={lowerOffsetThreshold}\n dateModalTitle={dateModalTitle}\n timeModalTitle={timeModalTitle}\n dateConfirmButtonText={dateConfirmButtonText}\n timeConfirmButtonText={timeConfirmButtonText}\n dayLabel={dayLabel}\n monthLabel={monthLabel}\n yearLabel={yearLabel}\n hourLabel={hourLabel}\n minuteLabel={minuteLabel}\n onChange={handleDateTimeSelectorChange}\n />\n </ModalContent>\n </Backdrop>\n </RNModal>\n );\n};\n\nexport const Modal = Component;\n"],"file":"Modal.js"}
|