react-native-molecules 0.5.0-beta.0
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/components/Accordion/Accordion.tsx +89 -0
- package/components/Accordion/AccordionItem.tsx +94 -0
- package/components/Accordion/AccordionItemContent.tsx +17 -0
- package/components/Accordion/AccordionItemHeader.tsx +122 -0
- package/components/Accordion/index.tsx +36 -0
- package/components/Accordion/utils.ts +62 -0
- package/components/ActivityIndicator/ActivityIndicator.ios.tsx +1 -0
- package/components/ActivityIndicator/ActivityIndicator.tsx +200 -0
- package/components/ActivityIndicator/AnimatedSpinner.tsx +121 -0
- package/components/ActivityIndicator/index.tsx +17 -0
- package/components/Appbar/AppbarActions.tsx +13 -0
- package/components/Appbar/AppbarBase.tsx +60 -0
- package/components/Appbar/AppbarCenterAligned.tsx +13 -0
- package/components/Appbar/AppbarLarge.tsx +13 -0
- package/components/Appbar/AppbarLeft.tsx +26 -0
- package/components/Appbar/AppbarMedium.tsx +13 -0
- package/components/Appbar/AppbarRight.tsx +40 -0
- package/components/Appbar/AppbarSmall.tsx +13 -0
- package/components/Appbar/AppbarTitle.tsx +49 -0
- package/components/Appbar/index.tsx +46 -0
- package/components/Appbar/types.ts +19 -0
- package/components/Appbar/utils.ts +127 -0
- package/components/Avatar/Avatar.tsx +189 -0
- package/components/Avatar/index.tsx +11 -0
- package/components/Avatar/utils.ts +35 -0
- package/components/Backdrop/Backdrop.tsx +18 -0
- package/components/Backdrop/index.tsx +11 -0
- package/components/Backdrop/types.ts +3 -0
- package/components/Backdrop/utils.ts +21 -0
- package/components/Badge/Badge.tsx +29 -0
- package/components/Badge/index.tsx +11 -0
- package/components/Badge/utils.ts +38 -0
- package/components/Button/Button.tsx +349 -0
- package/components/Button/index.tsx +11 -0
- package/components/Button/types.ts +5 -0
- package/components/Button/utils.ts +416 -0
- package/components/Card/Card.tsx +160 -0
- package/components/Card/CardActions.tsx +18 -0
- package/components/Card/CardContent.tsx +29 -0
- package/components/Card/CardHeader.tsx +31 -0
- package/components/Card/CardHeadline.tsx +15 -0
- package/components/Card/CardMedia.tsx +36 -0
- package/components/Card/CardSubhead.tsx +15 -0
- package/components/Card/CardText.tsx +13 -0
- package/components/Card/CardTypography.tsx +113 -0
- package/components/Card/index.tsx +38 -0
- package/components/Card/types.ts +1 -0
- package/components/Card/utils.ts +23 -0
- package/components/Checkbox/Checkbox.tsx +123 -0
- package/components/Checkbox/CheckboxBase.ios.tsx +86 -0
- package/components/Checkbox/CheckboxBase.tsx +216 -0
- package/components/Checkbox/index.tsx +11 -0
- package/components/Checkbox/types.ts +72 -0
- package/components/Checkbox/utils.ts +210 -0
- package/components/Chip/Chip.tsx +416 -0
- package/components/Chip/index.tsx +51 -0
- package/components/Chip/utils.ts +100 -0
- package/components/DatePickerDocked/DatePickerDocked.tsx +30 -0
- package/components/DatePickerDocked/DatePickerDockedHeader.tsx +129 -0
- package/components/DatePickerDocked/index.tsx +21 -0
- package/components/DatePickerDocked/types.ts +11 -0
- package/components/DatePickerDocked/utils.ts +155 -0
- package/components/DatePickerInline/AutoSizer.tsx +46 -0
- package/components/DatePickerInline/DatePickerContext.tsx +21 -0
- package/components/DatePickerInline/DatePickerInline.tsx +82 -0
- package/components/DatePickerInline/DatePickerInlineBase.tsx +181 -0
- package/components/DatePickerInline/DatePickerInlineHeader.tsx +108 -0
- package/components/DatePickerInline/Day.tsx +88 -0
- package/components/DatePickerInline/DayName.tsx +17 -0
- package/components/DatePickerInline/DayNames.tsx +32 -0
- package/components/DatePickerInline/DayRange.tsx +48 -0
- package/components/DatePickerInline/HeaderItem.tsx +111 -0
- package/components/DatePickerInline/Month.tsx +233 -0
- package/components/DatePickerInline/MonthPicker.tsx +174 -0
- package/components/DatePickerInline/Swiper.native.tsx +172 -0
- package/components/DatePickerInline/Swiper.tsx +172 -0
- package/components/DatePickerInline/SwiperUtils.ts +40 -0
- package/components/DatePickerInline/Week.tsx +67 -0
- package/components/DatePickerInline/YearPicker.tsx +139 -0
- package/components/DatePickerInline/dateUtils.tsx +334 -0
- package/components/DatePickerInline/index.tsx +41 -0
- package/components/DatePickerInline/types.ts +104 -0
- package/components/DatePickerInline/utils.ts +367 -0
- package/components/DatePickerInput/DatePickerInput.tsx +139 -0
- package/components/DatePickerInput/DatePickerInputModal.tsx +48 -0
- package/components/DatePickerInput/DatePickerInputWithoutModal.tsx +77 -0
- package/components/DatePickerInput/DateRangeInput.tsx +88 -0
- package/components/DatePickerInput/index.tsx +14 -0
- package/components/DatePickerInput/inputUtils.ts +138 -0
- package/components/DatePickerInput/types.ts +28 -0
- package/components/DatePickerInput/utils.ts +16 -0
- package/components/DatePickerModal/AnimatedCrossView.tsx +94 -0
- package/components/DatePickerModal/CalendarEdit.tsx +139 -0
- package/components/DatePickerModal/DatePickerModal.tsx +85 -0
- package/components/DatePickerModal/DatePickerModalContent.tsx +155 -0
- package/components/DatePickerModal/DatePickerModalContentHeader.tsx +213 -0
- package/components/DatePickerModal/DatePickerModalHeader.tsx +74 -0
- package/components/DatePickerModal/DatePickerModalHeaderBackground.tsx +13 -0
- package/components/DatePickerModal/index.tsx +20 -0
- package/components/DatePickerModal/types.ts +92 -0
- package/components/DatePickerModal/utils.ts +121 -0
- package/components/DateTimePicker/DateTimePicker.tsx +172 -0
- package/components/DateTimePicker/index.tsx +14 -0
- package/components/DateTimePicker/utils.ts +13 -0
- package/components/Dialog/Dialog.tsx +66 -0
- package/components/Dialog/DialogActions.tsx +89 -0
- package/components/Dialog/DialogContent.tsx +37 -0
- package/components/Dialog/DialogIcon.tsx +69 -0
- package/components/Dialog/DialogTitle.tsx +68 -0
- package/components/Dialog/index.tsx +37 -0
- package/components/Dialog/utils.ts +80 -0
- package/components/Drawer/Collapsible/DrawerCollapsible.tsx +22 -0
- package/components/Drawer/Collapsible/DrawerCollapsibleItem.tsx +38 -0
- package/components/Drawer/Collapsible/DrawerCollapsibleItemContent.tsx +16 -0
- package/components/Drawer/Collapsible/DrawerCollapsibleItemHeader.tsx +48 -0
- package/components/Drawer/Collapsible/index.tsx +23 -0
- package/components/Drawer/Collapsible/utils.ts +49 -0
- package/components/Drawer/Drawer.tsx +43 -0
- package/components/Drawer/DrawerContent.tsx +35 -0
- package/components/Drawer/DrawerFooter.tsx +27 -0
- package/components/Drawer/DrawerHeader.tsx +27 -0
- package/components/Drawer/DrawerItem.tsx +206 -0
- package/components/Drawer/DrawerItemGroup.tsx +82 -0
- package/components/Drawer/index.tsx +47 -0
- package/components/Drawer/types.ts +3 -0
- package/components/Drawer/utils.ts +8 -0
- package/components/ElementGroup/ElementGroup.tsx +139 -0
- package/components/ElementGroup/index.tsx +11 -0
- package/components/ElementGroup/utils.ts +25 -0
- package/components/FAB/FAB.tsx +176 -0
- package/components/FAB/index.tsx +12 -0
- package/components/FAB/types.ts +1 -0
- package/components/FAB/utils.ts +221 -0
- package/components/FilePicker/FilePicker.tsx +133 -0
- package/components/FilePicker/index.tsx +11 -0
- package/components/FilePicker/utils.ts +13 -0
- package/components/HelperText/HelperText.tsx +139 -0
- package/components/HelperText/index.tsx +11 -0
- package/components/HelperText/utils.ts +29 -0
- package/components/HorizontalDivider/HorizontalDivider.tsx +101 -0
- package/components/HorizontalDivider/index.tsx +13 -0
- package/components/Icon/CrossFadeIcon.tsx +116 -0
- package/components/Icon/Icon.tsx +41 -0
- package/components/Icon/iconFactory.tsx +23 -0
- package/components/Icon/index.tsx +11 -0
- package/components/Icon/types.ts +35 -0
- package/components/IconButton/IconButton.tsx +218 -0
- package/components/IconButton/index.tsx +11 -0
- package/components/IconButton/types.ts +1 -0
- package/components/IconButton/utils.ts +325 -0
- package/components/If/index.tsx +13 -0
- package/components/InputAddon/InputAddon.tsx +27 -0
- package/components/InputAddon/index.tsx +11 -0
- package/components/InputAddon/utils.ts +33 -0
- package/components/Link/Link.tsx +48 -0
- package/components/Link/index.tsx +11 -0
- package/components/Link/utils.ts +37 -0
- package/components/ListItem/ListItem.tsx +136 -0
- package/components/ListItem/ListItemDescription.tsx +25 -0
- package/components/ListItem/ListItemTitle.tsx +25 -0
- package/components/ListItem/index.tsx +18 -0
- package/components/ListItem/utils.ts +113 -0
- package/components/Menu/Menu.tsx +69 -0
- package/components/Menu/MenuDivider.tsx +13 -0
- package/components/Menu/MenuItem.tsx +128 -0
- package/components/Menu/index.tsx +19 -0
- package/components/Menu/utils.ts +92 -0
- package/components/Modal/Modal.tsx +261 -0
- package/components/Modal/index.tsx +11 -0
- package/components/Modal/utils.ts +45 -0
- package/components/NavigationRail/NavigationRail.tsx +32 -0
- package/components/NavigationRail/NavigationRailContent.tsx +25 -0
- package/components/NavigationRail/NavigationRailFooter.tsx +18 -0
- package/components/NavigationRail/NavigationRailHeader.tsx +18 -0
- package/components/NavigationRail/NavigationRailItem.tsx +226 -0
- package/components/NavigationRail/index.tsx +35 -0
- package/components/NavigationRail/utils.ts +170 -0
- package/components/NavigationStack/NavigationStack.tsx +85 -0
- package/components/NavigationStack/NavigationStackItem.tsx +60 -0
- package/components/NavigationStack/index.tsx +20 -0
- package/components/NavigationStack/utils.tsx +16 -0
- package/components/Popover/Popover.native.tsx +185 -0
- package/components/Popover/Popover.tsx +198 -0
- package/components/Popover/common.ts +459 -0
- package/components/Popover/index.ts +2 -0
- package/components/Portal/Portal.tsx +13 -0
- package/components/Portal/index.tsx +12 -0
- package/components/RadioButton/RadioButton.tsx +138 -0
- package/components/RadioButton/RadioButtonAndroid.tsx +188 -0
- package/components/RadioButton/RadioButtonGroup.tsx +98 -0
- package/components/RadioButton/RadioButtonIOS.tsx +106 -0
- package/components/RadioButton/RadioButtonItem.tsx +232 -0
- package/components/RadioButton/index.ts +27 -0
- package/components/RadioButton/utils.ts +164 -0
- package/components/Rating/Rating.tsx +149 -0
- package/components/Rating/RatingItem.tsx +125 -0
- package/components/Rating/index.tsx +13 -0
- package/components/Rating/utils.ts +38 -0
- package/components/Select/Select.tsx +1038 -0
- package/components/Select/index.ts +14 -0
- package/components/Select/types.ts +115 -0
- package/components/StateLayer/StateLayer.tsx +12 -0
- package/components/StateLayer/index.tsx +11 -0
- package/components/StateLayer/utils.ts +17 -0
- package/components/Surface/BackgroundContextWrapper.tsx +27 -0
- package/components/Surface/Surface.android.tsx +62 -0
- package/components/Surface/Surface.ios.tsx +123 -0
- package/components/Surface/Surface.tsx +48 -0
- package/components/Surface/index.tsx +12 -0
- package/components/Surface/utils.ts +106 -0
- package/components/Switch/Switch.ios.tsx +67 -0
- package/components/Switch/Switch.tsx +278 -0
- package/components/Switch/index.tsx +11 -0
- package/components/Switch/utils.ts +283 -0
- package/components/Tabs/TabItem.tsx +150 -0
- package/components/Tabs/TabLabel.tsx +84 -0
- package/components/Tabs/Tabs.tsx +398 -0
- package/components/Tabs/index.tsx +21 -0
- package/components/Tabs/utils.ts +126 -0
- package/components/Text/Text.tsx +23 -0
- package/components/Text/index.tsx +2 -0
- package/components/Text/textFactory.tsx +33 -0
- package/components/TextInput/InputLabel.tsx +181 -0
- package/components/TextInput/TextInput.tsx +693 -0
- package/components/TextInput/index.tsx +16 -0
- package/components/TextInput/types.ts +96 -0
- package/components/TextInput/utils.ts +544 -0
- package/components/TextInputWithMask/TextInputMask.tsx +57 -0
- package/components/TextInputWithMask/index.tsx +11 -0
- package/components/TextInputWithMask/utils.ts +56 -0
- package/components/TimePicker/AmPmSwitcher.tsx +99 -0
- package/components/TimePicker/AnalogClock.tsx +165 -0
- package/components/TimePicker/AnalogClockHours.tsx +163 -0
- package/components/TimePicker/AnalogClockMinutes.tsx +68 -0
- package/components/TimePicker/AnimatedClockSwitcher.tsx +72 -0
- package/components/TimePicker/DisplayModeContext.tsx +6 -0
- package/components/TimePicker/TimeInput.tsx +112 -0
- package/components/TimePicker/TimeInputs.tsx +148 -0
- package/components/TimePicker/TimePicker.tsx +130 -0
- package/components/TimePicker/index.tsx +19 -0
- package/components/TimePicker/timeUtils.ts +159 -0
- package/components/TimePicker/utils.ts +285 -0
- package/components/TimePickerField/TimePickerField.tsx +152 -0
- package/components/TimePickerField/index.tsx +14 -0
- package/components/TimePickerField/sanitizeTime.ts +85 -0
- package/components/TimePickerField/utils.ts +95 -0
- package/components/TimePickerModal/TimePickerModal.tsx +115 -0
- package/components/TimePickerModal/index.tsx +14 -0
- package/components/TimePickerModal/utils.ts +48 -0
- package/components/Tooltip/Tooltip.tsx +137 -0
- package/components/Tooltip/TooltipContent.tsx +12 -0
- package/components/Tooltip/TooltipTrigger.tsx +94 -0
- package/components/Tooltip/index.tsx +20 -0
- package/components/Tooltip/utils.ts +21 -0
- package/components/TouchableRipple/TouchableRipple.native.tsx +105 -0
- package/components/TouchableRipple/TouchableRipple.tsx +286 -0
- package/components/TouchableRipple/index.tsx +14 -0
- package/components/TouchableRipple/utils.ts +15 -0
- package/components/VerticalDivider/VerticalDivider.tsx +99 -0
- package/components/VerticalDivider/index.tsx +13 -0
- package/context-bridge/index.tsx +87 -0
- package/core/componentsRegistry.ts +164 -0
- package/core/index.tsx +2 -0
- package/fast-context/index.tsx +190 -0
- package/hocs/index.tsx +5 -0
- package/hocs/typedMemo.tsx +5 -0
- package/hocs/withKeyboardAccessibility.tsx +231 -0
- package/hocs/withPortal.tsx +16 -0
- package/hooks/createPsuedoHook.tsx +50 -0
- package/hooks/index.tsx +29 -0
- package/hooks/useActionState.native.tsx +22 -0
- package/hooks/useActionState.tsx +34 -0
- package/hooks/useActive.tsx +5 -0
- package/hooks/useBreakpoints.tsx +7 -0
- package/hooks/useColorMode.tsx +17 -0
- package/hooks/useContrastColor.ts +15 -0
- package/hooks/useControlledValue.tsx +68 -0
- package/hooks/useFilePicker.tsx +48 -0
- package/hooks/useFocus.tsx +5 -0
- package/hooks/useHandleNumberFormat.tsx +106 -0
- package/hooks/useHover.tsx +5 -0
- package/hooks/useKeyboardDismissable.ts +66 -0
- package/hooks/useLatest.tsx +9 -0
- package/hooks/useMediaQuery.tsx +64 -0
- package/hooks/useMergedRefs.ts +14 -0
- package/hooks/usePrevious.ts +13 -0
- package/hooks/useQueryFilter.tsx +35 -0
- package/hooks/useSearchable.tsx +74 -0
- package/hooks/useSubcomponents.tsx +59 -0
- package/hooks/useTheme.ts +3 -0
- package/hooks/useToggle.tsx +24 -0
- package/package.json +114 -0
- package/shortcuts-manager/EventsManager.tsx +121 -0
- package/shortcuts-manager/ShortcutsManager/ShortcutsManager.native.tsx +9 -0
- package/shortcuts-manager/ShortcutsManager/ShortcutsManager.tsx +58 -0
- package/shortcuts-manager/ShortcutsManager/index.tsx +2 -0
- package/shortcuts-manager/ShortcutsManager/utils.tsx +30 -0
- package/shortcuts-manager/index.tsx +6 -0
- package/shortcuts-manager/types.ts +24 -0
- package/shortcuts-manager/useIsKeyPressed/index.tsx +1 -0
- package/shortcuts-manager/useIsKeyPressed/useIsKeyPress.tsx +9 -0
- package/shortcuts-manager/useSetScopes/index.tsx +1 -0
- package/shortcuts-manager/useSetScopes/useSetScopes.native.tsx +9 -0
- package/shortcuts-manager/useSetScopes/useSetScopes.tsx +25 -0
- package/shortcuts-manager/useShortcut/index.tsx +2 -0
- package/shortcuts-manager/useShortcut/types.ts +3 -0
- package/shortcuts-manager/useShortcut/useShortcut.native.tsx +9 -0
- package/shortcuts-manager/useShortcut/useShortcut.tsx +61 -0
- package/shortcuts-manager/utils.ts +105 -0
- package/styles/index.ts +4 -0
- package/styles/overlay.ts +69 -0
- package/styles/shadow.ts +21 -0
- package/styles/themes/DarkTheme.tsx +98 -0
- package/styles/themes/LightTheme.tsx +212 -0
- package/styles/themes/tokens.ts +248 -0
- package/styles/utils.ts +11 -0
- package/types/index.ts +129 -0
- package/types/theme.ts +159 -0
- package/utils/DocumentPicker/documentPicker.native.ts +10 -0
- package/utils/DocumentPicker/documentPicker.ts +76 -0
- package/utils/DocumentPicker/index.ts +2 -0
- package/utils/DocumentPicker/types.ts +28 -0
- package/utils/addEventListener.tsx +51 -0
- package/utils/backgroundContext.ts +9 -0
- package/utils/color.ts +22 -0
- package/utils/compare/index.ts +54 -0
- package/utils/composeEventHandlers.ts +9 -0
- package/utils/createNumberMask/createNumberMask.ts +98 -0
- package/utils/createNumberMask/index.ts +5 -0
- package/utils/createSyntheticEvent.ts +31 -0
- package/utils/date-fns.ts +7 -0
- package/utils/dateTimePicker.ts +5 -0
- package/utils/escapeRegex.ts +9 -0
- package/utils/extractTextStyles.ts +52 -0
- package/utils/formatNumberWithMask/formatNumberWithMask.ts +26 -0
- package/utils/formatNumberWithMask/formatWithMask.ts +119 -0
- package/utils/formatNumberWithMask/index.ts +6 -0
- package/utils/getCursorStyle/getCursorStyle.native.ts +1 -0
- package/utils/getCursorStyle/getCursorStyle.ts +1 -0
- package/utils/getCursorStyle/index.ts +1 -0
- package/utils/getOS/getOS.native.ts +7 -0
- package/utils/getOS/getOS.ts +24 -0
- package/utils/getOS/index.ts +1 -0
- package/utils/getyearRange.ts +5 -0
- package/utils/index.ts +20 -0
- package/utils/lodash.ts +50 -0
- package/utils/mergeRefs.ts +13 -0
- package/utils/normalizeBorderRadiuses.ts +24 -0
- package/utils/normalizeSpacings.ts +110 -0
- package/utils/normalizeToNumberString/index.ts +4 -0
- package/utils/normalizeToNumberString/normalizeToNumberString.ts +48 -0
- package/utils/repository.ts +103 -0
- package/utils/resolveColorMode.ts +9 -0
- package/utils/resolveStateVariant.ts +26 -0
- package/utils/tokenStylesParser.ts +7 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
|
|
3
|
+
import { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
|
|
4
|
+
import { daySize } from './dateUtils';
|
|
5
|
+
|
|
6
|
+
export const dayNamesHeight = 44;
|
|
7
|
+
|
|
8
|
+
// TODO make it flexible
|
|
9
|
+
export const weekMargin = 6;
|
|
10
|
+
export const weekSize = daySize + weekMargin;
|
|
11
|
+
export const montHeaderHeight = 56;
|
|
12
|
+
export const monthHeaderSingleMarginTop = 4;
|
|
13
|
+
export const monthHeaderSingleMarginBottom = 8 + 22 + 12;
|
|
14
|
+
export const monthHeaderSingleHeight = monthHeaderSingleMarginTop + monthHeaderSingleMarginBottom;
|
|
15
|
+
|
|
16
|
+
const datePickerStylesDefault = StyleSheet.create(theme => ({
|
|
17
|
+
root: {
|
|
18
|
+
backgroundColor: theme.colors.surface,
|
|
19
|
+
// ...({
|
|
20
|
+
// roundness: theme.shapes.corner.extraSmall,
|
|
21
|
+
// headerBackgroundColor: theme.colors.surface,
|
|
22
|
+
// } as any),
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
container: {
|
|
26
|
+
minHeight: 360,
|
|
27
|
+
minWidth: 360,
|
|
28
|
+
},
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
const datePickerMonthStylesDefault = StyleSheet.create(theme => ({
|
|
32
|
+
root: {
|
|
33
|
+
backgroundColor: theme.colors.surface,
|
|
34
|
+
},
|
|
35
|
+
monthLabel: {
|
|
36
|
+
...theme.typescale.bodyMedium,
|
|
37
|
+
opacity: 0.7,
|
|
38
|
+
},
|
|
39
|
+
yearButton: {
|
|
40
|
+
alignSelf: 'flex-start',
|
|
41
|
+
marginLeft: 6,
|
|
42
|
+
borderRadius: theme.shapes.corner.extraSmall,
|
|
43
|
+
},
|
|
44
|
+
yearButtonInner: {
|
|
45
|
+
paddingLeft: theme.spacings['4'],
|
|
46
|
+
flexDirection: 'row',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
borderRadius: theme.shapes.corner.extraSmall,
|
|
49
|
+
},
|
|
50
|
+
month: {},
|
|
51
|
+
monthHeader: {
|
|
52
|
+
height: montHeaderHeight,
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
overflow: 'hidden',
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
monthButton: {
|
|
58
|
+
borderRadius: theme.shapes.corner.extraLarge,
|
|
59
|
+
overflow: 'hidden',
|
|
60
|
+
},
|
|
61
|
+
buttonContainerStyle: { flexDirection: 'row', alignItems: 'center' },
|
|
62
|
+
dockedHeaderStyle: {},
|
|
63
|
+
weekContainerStyle: {},
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
const datePickerYearPickerStylesDefault = StyleSheet.create(theme => ({
|
|
67
|
+
root: {
|
|
68
|
+
backgroundColor: theme.colors.surface,
|
|
69
|
+
},
|
|
70
|
+
yearContainer: {
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
},
|
|
73
|
+
yearButton: {
|
|
74
|
+
borderRadius: theme.shapes.corner.extraLarge,
|
|
75
|
+
overflow: 'hidden',
|
|
76
|
+
height: 46,
|
|
77
|
+
alignItems: 'center',
|
|
78
|
+
justifyContent: 'center',
|
|
79
|
+
marginLeft: theme.spacings['4'],
|
|
80
|
+
marginRight: theme.spacings['4'],
|
|
81
|
+
},
|
|
82
|
+
yearInner: {
|
|
83
|
+
borderRadius: theme.shapes.corner.extraLarge,
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
justifyContent: 'center',
|
|
86
|
+
},
|
|
87
|
+
yearLabel: {
|
|
88
|
+
fontSize: 16,
|
|
89
|
+
},
|
|
90
|
+
}));
|
|
91
|
+
|
|
92
|
+
const datePickerDayStylesDefault = StyleSheet.create(theme => ({
|
|
93
|
+
containerStyle: {
|
|
94
|
+
flex: 1,
|
|
95
|
+
flexBasis: 0,
|
|
96
|
+
justifyContent: 'center',
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
position: 'relative',
|
|
99
|
+
|
|
100
|
+
variants: {
|
|
101
|
+
state: {
|
|
102
|
+
disabled: {
|
|
103
|
+
opacity: 0.3,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
disabled: {
|
|
109
|
+
opacity: 0.3,
|
|
110
|
+
},
|
|
111
|
+
button: {
|
|
112
|
+
width: daySize,
|
|
113
|
+
height: daySize,
|
|
114
|
+
overflow: 'hidden',
|
|
115
|
+
borderRadius: daySize / 2,
|
|
116
|
+
|
|
117
|
+
variants: {
|
|
118
|
+
state: {
|
|
119
|
+
inRange: {
|
|
120
|
+
backgroundColor: theme.colors.primary,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
day: {
|
|
126
|
+
flexBasis: 0,
|
|
127
|
+
flex: 1,
|
|
128
|
+
borderRadius: daySize / 2,
|
|
129
|
+
width: daySize,
|
|
130
|
+
height: daySize,
|
|
131
|
+
justifyContent: 'center',
|
|
132
|
+
alignItems: 'center',
|
|
133
|
+
borderWidth: 1,
|
|
134
|
+
borderColor: 'transparent',
|
|
135
|
+
|
|
136
|
+
variants: {
|
|
137
|
+
state: {
|
|
138
|
+
selected: {
|
|
139
|
+
backgroundColor: theme.colors.primary,
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
inRange: {
|
|
143
|
+
borderColor: theme.colors.primary,
|
|
144
|
+
button: {
|
|
145
|
+
backgroundColor: theme.colors.primary,
|
|
146
|
+
},
|
|
147
|
+
today: {
|
|
148
|
+
borderColor: theme.colors.primary,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
today: {
|
|
155
|
+
borderColor: theme.colors.primary,
|
|
156
|
+
variants: {
|
|
157
|
+
state: {
|
|
158
|
+
inRange: {
|
|
159
|
+
borderColor: theme.colors.primary,
|
|
160
|
+
button: {
|
|
161
|
+
backgroundColor: theme.colors.primary,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
text: {
|
|
168
|
+
variants: {
|
|
169
|
+
state: {
|
|
170
|
+
selected: {
|
|
171
|
+
color: theme.colors.onPrimary,
|
|
172
|
+
day: {
|
|
173
|
+
backgroundColor: theme.colors.primary,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
inRange: {
|
|
178
|
+
color: theme.colors.onPrimary,
|
|
179
|
+
|
|
180
|
+
day: {
|
|
181
|
+
borderColor: theme.colors.primary,
|
|
182
|
+
},
|
|
183
|
+
button: {
|
|
184
|
+
backgroundColor: theme.colors.primary,
|
|
185
|
+
},
|
|
186
|
+
today: {
|
|
187
|
+
borderColor: theme.colors.primary,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
flex1: {
|
|
194
|
+
flex: 1,
|
|
195
|
+
},
|
|
196
|
+
}));
|
|
197
|
+
|
|
198
|
+
const datePickerDayEmptyStylesDefault = StyleSheet.create({
|
|
199
|
+
root: {
|
|
200
|
+
flex: 1,
|
|
201
|
+
flexBasis: 0,
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const datePickerWeekStylesDefault = StyleSheet.create({
|
|
206
|
+
root: {
|
|
207
|
+
flexDirection: 'row',
|
|
208
|
+
height: daySize,
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
const datePickerHeaderStylesDefault = StyleSheet.create(theme => ({
|
|
213
|
+
datePickerHeader: {
|
|
214
|
+
flexDirection: 'row',
|
|
215
|
+
alignItems: 'center',
|
|
216
|
+
justifyContent: 'space-between',
|
|
217
|
+
marginHorizontal: theme.spacings['5'],
|
|
218
|
+
},
|
|
219
|
+
buttonContainer: {
|
|
220
|
+
height: 56,
|
|
221
|
+
marginTop: theme.spacings['1'],
|
|
222
|
+
marginBottom: theme.spacings['2'],
|
|
223
|
+
flexDirection: 'row',
|
|
224
|
+
alignItems: 'center',
|
|
225
|
+
},
|
|
226
|
+
buttonWrapper: {},
|
|
227
|
+
spacer: { flex: 1 },
|
|
228
|
+
yearLabelStyle: {
|
|
229
|
+
...theme.typescale.bodyMedium,
|
|
230
|
+
opacity: 0.7,
|
|
231
|
+
},
|
|
232
|
+
yearButtonStyle: {
|
|
233
|
+
alignSelf: 'flex-start',
|
|
234
|
+
marginLeft: 6,
|
|
235
|
+
borderRadius: theme.shapes.corner.extraSmall,
|
|
236
|
+
},
|
|
237
|
+
yearInnerStyle: {
|
|
238
|
+
paddingLeft: theme.spacings['4'],
|
|
239
|
+
flexDirection: 'row',
|
|
240
|
+
alignItems: 'center',
|
|
241
|
+
borderRadius: theme.shapes.corner.extraSmall,
|
|
242
|
+
},
|
|
243
|
+
}));
|
|
244
|
+
|
|
245
|
+
const dateDayNameStylesDefault = StyleSheet.create(theme => ({
|
|
246
|
+
container: {
|
|
247
|
+
height: dayNamesHeight,
|
|
248
|
+
flexDirection: 'row',
|
|
249
|
+
alignItems: 'center',
|
|
250
|
+
backgroundColor: theme.colors.surface,
|
|
251
|
+
},
|
|
252
|
+
dayName: { flex: 1, alignItems: 'center' },
|
|
253
|
+
dayNameLabel: {
|
|
254
|
+
opacity: 0.7,
|
|
255
|
+
...theme.typescale.bodyMedium,
|
|
256
|
+
},
|
|
257
|
+
}));
|
|
258
|
+
|
|
259
|
+
const datePickerDayRangeStylesDefault = StyleSheet.create(theme => ({
|
|
260
|
+
container: {
|
|
261
|
+
flexDirection: 'row',
|
|
262
|
+
|
|
263
|
+
variants: {
|
|
264
|
+
state: {
|
|
265
|
+
bothWays: {
|
|
266
|
+
borderRadius: daySize / 2,
|
|
267
|
+
},
|
|
268
|
+
inRange: {
|
|
269
|
+
backgroundColor: theme.colors.primary,
|
|
270
|
+
},
|
|
271
|
+
isCrop: {
|
|
272
|
+
backgroundColor: undefined,
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
rightCrop: {
|
|
278
|
+
flex: 1,
|
|
279
|
+
|
|
280
|
+
variants: {
|
|
281
|
+
state: {
|
|
282
|
+
isRightCrop: {
|
|
283
|
+
backgroundColor: theme.colors.primary,
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
leftCrop: {
|
|
289
|
+
flex: 1,
|
|
290
|
+
|
|
291
|
+
variants: {
|
|
292
|
+
state: {
|
|
293
|
+
isLeftCrop: {
|
|
294
|
+
backgroundColor: theme.colors.primary,
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
centerCrop: {
|
|
300
|
+
backgroundColor: theme.colors.primary,
|
|
301
|
+
minWidth: daySize,
|
|
302
|
+
minHeight: daySize,
|
|
303
|
+
|
|
304
|
+
variants: {
|
|
305
|
+
state: {
|
|
306
|
+
isLeftCrop: {
|
|
307
|
+
borderTopLeftRadius: daySize / 2,
|
|
308
|
+
borderBottomLeftRadius: daySize / 2,
|
|
309
|
+
},
|
|
310
|
+
isRightCrop: {
|
|
311
|
+
borderTopRightRadius: daySize / 2,
|
|
312
|
+
borderBottomRightRadius: daySize / 2,
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
}));
|
|
318
|
+
|
|
319
|
+
const datePickerYearItemStylesDefault = StyleSheet.create(theme => ({
|
|
320
|
+
yearButton: {
|
|
321
|
+
variants: {
|
|
322
|
+
state: {
|
|
323
|
+
selected: {
|
|
324
|
+
backgroundColor: theme.colors.primary,
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
yearLabel: {
|
|
331
|
+
variants: {
|
|
332
|
+
state: {
|
|
333
|
+
selected: {
|
|
334
|
+
color: theme.colors.onPrimary,
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
}));
|
|
340
|
+
|
|
341
|
+
registerComponentsStyles({
|
|
342
|
+
DatePickerInline: datePickerStylesDefault,
|
|
343
|
+
DatePicker_Month: datePickerMonthStylesDefault,
|
|
344
|
+
DatePicker_YearPicker: datePickerYearPickerStylesDefault,
|
|
345
|
+
DatePicker_Day: datePickerDayStylesDefault,
|
|
346
|
+
DatePicker_DayEmpty: datePickerDayEmptyStylesDefault,
|
|
347
|
+
DatePicker_Week: datePickerWeekStylesDefault,
|
|
348
|
+
DatePicker_Header: datePickerHeaderStylesDefault,
|
|
349
|
+
DatePicker_DayName: dateDayNameStylesDefault,
|
|
350
|
+
DatePicker_DayRange: datePickerDayRangeStylesDefault,
|
|
351
|
+
DatePicker_YearItem: datePickerYearItemStylesDefault,
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
export const datePickerStyles = getRegisteredMoleculesComponentStyles('DatePickerInline');
|
|
355
|
+
export const datePickerMonthStyles = getRegisteredMoleculesComponentStyles('DatePicker_Month');
|
|
356
|
+
export const datePickerYearPickerStyles =
|
|
357
|
+
getRegisteredMoleculesComponentStyles('DatePicker_YearPicker');
|
|
358
|
+
export const datePickerDayStyles = getRegisteredMoleculesComponentStyles('DatePicker_Day');
|
|
359
|
+
export const datePickerDayEmptyStyles =
|
|
360
|
+
getRegisteredMoleculesComponentStyles('DatePicker_DayEmpty');
|
|
361
|
+
export const datePickerWeekStyles = getRegisteredMoleculesComponentStyles('DatePicker_Week');
|
|
362
|
+
export const datePickerHeaderStyles = getRegisteredMoleculesComponentStyles('DatePicker_Header');
|
|
363
|
+
export const dateDayNameStyles = getRegisteredMoleculesComponentStyles('DatePicker_DayName');
|
|
364
|
+
export const datePickerDayRangeStyles =
|
|
365
|
+
getRegisteredMoleculesComponentStyles('DatePicker_DayRange');
|
|
366
|
+
export const datePickerYearItemStyles =
|
|
367
|
+
getRegisteredMoleculesComponentStyles('DatePicker_YearItem');
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { forwardRef, memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useLatest, useToggle } from '../../hooks';
|
|
5
|
+
import { noop } from '../../utils/lodash';
|
|
6
|
+
import { DatePickerDocked } from '../DatePickerDocked';
|
|
7
|
+
import { IconButton } from '../IconButton';
|
|
8
|
+
import DatePickerInputModal from './DatePickerInputModal';
|
|
9
|
+
import DatePickerInputWithoutModal from './DatePickerInputWithoutModal';
|
|
10
|
+
import type { DatePickerInputProps } from './types';
|
|
11
|
+
|
|
12
|
+
function DatePickerInput(
|
|
13
|
+
{
|
|
14
|
+
withModal = true,
|
|
15
|
+
calendarIcon = 'calendar',
|
|
16
|
+
value,
|
|
17
|
+
locale,
|
|
18
|
+
inputMode,
|
|
19
|
+
validRange,
|
|
20
|
+
onChange = noop,
|
|
21
|
+
disabled = false,
|
|
22
|
+
pickerMode = 'modal',
|
|
23
|
+
startYear,
|
|
24
|
+
endYear,
|
|
25
|
+
dockedPopoverContentProps,
|
|
26
|
+
//locale = 'en',
|
|
27
|
+
...rest
|
|
28
|
+
}: DatePickerInputProps,
|
|
29
|
+
ref: any,
|
|
30
|
+
) {
|
|
31
|
+
const triggerRef = useRef(null);
|
|
32
|
+
const { state: isOpen, onToggle } = useToggle(false);
|
|
33
|
+
const [visible, setVisible] = useState<boolean>(false);
|
|
34
|
+
|
|
35
|
+
const onDismiss = useCallback(() => {
|
|
36
|
+
setVisible(false);
|
|
37
|
+
}, [setVisible]);
|
|
38
|
+
|
|
39
|
+
const onChangeRef = useLatest(onChange);
|
|
40
|
+
|
|
41
|
+
const onInnerConfirm = useCallback(
|
|
42
|
+
({ date }: any) => {
|
|
43
|
+
setVisible(false);
|
|
44
|
+
onChangeRef.current(date);
|
|
45
|
+
},
|
|
46
|
+
[setVisible, onChangeRef],
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const onPressCalendarIcon = useCallback(() => {
|
|
50
|
+
if (pickerMode === 'docked') {
|
|
51
|
+
onToggle();
|
|
52
|
+
}
|
|
53
|
+
setVisible(true);
|
|
54
|
+
}, [pickerMode, onToggle]);
|
|
55
|
+
|
|
56
|
+
const renderers = useMemo(() => {
|
|
57
|
+
return {
|
|
58
|
+
modal: (
|
|
59
|
+
<DatePickerInputModal
|
|
60
|
+
date={value}
|
|
61
|
+
mode="single"
|
|
62
|
+
isOpen={visible}
|
|
63
|
+
onClose={onDismiss}
|
|
64
|
+
onConfirm={onInnerConfirm}
|
|
65
|
+
locale={locale}
|
|
66
|
+
validRange={validRange}
|
|
67
|
+
/>
|
|
68
|
+
),
|
|
69
|
+
docked: (
|
|
70
|
+
<DatePickerDocked
|
|
71
|
+
date={value}
|
|
72
|
+
locale={locale}
|
|
73
|
+
startYear={startYear}
|
|
74
|
+
endYear={endYear}
|
|
75
|
+
onChange={onInnerConfirm}
|
|
76
|
+
isOpen={isOpen}
|
|
77
|
+
onClose={onDismiss}
|
|
78
|
+
onToggle={onToggle}
|
|
79
|
+
triggerRef={triggerRef}
|
|
80
|
+
popoverContentProps={dockedPopoverContentProps}
|
|
81
|
+
/>
|
|
82
|
+
),
|
|
83
|
+
};
|
|
84
|
+
}, [
|
|
85
|
+
dockedPopoverContentProps,
|
|
86
|
+
endYear,
|
|
87
|
+
isOpen,
|
|
88
|
+
locale,
|
|
89
|
+
onDismiss,
|
|
90
|
+
onInnerConfirm,
|
|
91
|
+
onToggle,
|
|
92
|
+
startYear,
|
|
93
|
+
validRange,
|
|
94
|
+
value,
|
|
95
|
+
visible,
|
|
96
|
+
]);
|
|
97
|
+
|
|
98
|
+
const rightElement = useMemo(
|
|
99
|
+
() => (
|
|
100
|
+
<>
|
|
101
|
+
{withModal || pickerMode === 'docked' ? (
|
|
102
|
+
<>
|
|
103
|
+
<IconButton
|
|
104
|
+
ref={triggerRef}
|
|
105
|
+
style={styles.calendarButton}
|
|
106
|
+
name={calendarIcon}
|
|
107
|
+
onPress={onPressCalendarIcon}
|
|
108
|
+
disabled={disabled}
|
|
109
|
+
/>
|
|
110
|
+
{renderers[pickerMode]}
|
|
111
|
+
</>
|
|
112
|
+
) : null}
|
|
113
|
+
</>
|
|
114
|
+
),
|
|
115
|
+
[calendarIcon, disabled, onPressCalendarIcon, pickerMode, renderers, withModal],
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<DatePickerInputWithoutModal
|
|
120
|
+
ref={ref}
|
|
121
|
+
{...rest}
|
|
122
|
+
disabled={disabled}
|
|
123
|
+
value={value}
|
|
124
|
+
inputMode={inputMode}
|
|
125
|
+
validRange={validRange}
|
|
126
|
+
onChange={onChange}
|
|
127
|
+
// locale={locale}
|
|
128
|
+
inputButtons={rightElement}
|
|
129
|
+
/>
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const styles = StyleSheet.create({
|
|
134
|
+
calendarButton: {
|
|
135
|
+
marginRight: -4,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export default memo(forwardRef(DatePickerInput));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { memo, useCallback, useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { DatePickerModalProps } from '../DatePickerModal';
|
|
4
|
+
import { DatePickerModal } from '../DatePickerModal/DatePickerModal';
|
|
5
|
+
|
|
6
|
+
const DatePickerInputModal = ({
|
|
7
|
+
date,
|
|
8
|
+
onConfirm: onConfirmProp,
|
|
9
|
+
onClose: onCloseProp,
|
|
10
|
+
...rest
|
|
11
|
+
}: DatePickerModalProps) => {
|
|
12
|
+
// want to control this by the input and only pass the value when onConfirm is clicked
|
|
13
|
+
const [value, onValueChange] = useState(date);
|
|
14
|
+
|
|
15
|
+
const onChange = useCallback(
|
|
16
|
+
(val: any) => {
|
|
17
|
+
onValueChange(val?.date);
|
|
18
|
+
},
|
|
19
|
+
[onValueChange],
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const onConfirm = useCallback(() => {
|
|
23
|
+
onConfirmProp?.({ date: value } as any);
|
|
24
|
+
}, [onConfirmProp, value]);
|
|
25
|
+
|
|
26
|
+
const onClose = useCallback(() => {
|
|
27
|
+
onValueChange(date); // revert back before close it
|
|
28
|
+
|
|
29
|
+
onCloseProp?.();
|
|
30
|
+
}, [date, onCloseProp]);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
onValueChange(date);
|
|
34
|
+
}, [date]);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<DatePickerModal
|
|
38
|
+
{...rest}
|
|
39
|
+
onClose={onClose}
|
|
40
|
+
onConfirm={onConfirm}
|
|
41
|
+
date={value}
|
|
42
|
+
onChange={onChange}
|
|
43
|
+
mode="single"
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default memo(DatePickerInputModal);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { forwardRef, memo, useCallback, useImperativeHandle, useMemo, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { TextInputWithMask } from '../TextInputWithMask';
|
|
4
|
+
import useDateInput from './inputUtils';
|
|
5
|
+
import type { DatePickerInputWithoutModalProps } from './types';
|
|
6
|
+
import { datePickerInputStyles } from './utils';
|
|
7
|
+
|
|
8
|
+
function DatePickerInputWithoutModal(
|
|
9
|
+
{
|
|
10
|
+
label,
|
|
11
|
+
value,
|
|
12
|
+
onChange: onChangeProp,
|
|
13
|
+
// locale = 'en',
|
|
14
|
+
validRange,
|
|
15
|
+
inputMode,
|
|
16
|
+
inputButtons,
|
|
17
|
+
dateFormat = 'dd/MM/yyyy',
|
|
18
|
+
style,
|
|
19
|
+
onBlur: onBlurProp,
|
|
20
|
+
onFocus: onFocusProp,
|
|
21
|
+
...rest
|
|
22
|
+
}: DatePickerInputWithoutModalProps,
|
|
23
|
+
ref: any,
|
|
24
|
+
) {
|
|
25
|
+
const inputRef = useRef(null);
|
|
26
|
+
const isBlurredRef = useRef(true);
|
|
27
|
+
|
|
28
|
+
const onChange = useCallback(
|
|
29
|
+
(date: Date | null) => {
|
|
30
|
+
// because onChange was already trigger not need to trigger again on
|
|
31
|
+
if (!isBlurredRef.current) {
|
|
32
|
+
onChangeProp?.(date);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!date && isBlurredRef.current) (inputRef.current as any)?.setDisplayValue('');
|
|
36
|
+
},
|
|
37
|
+
[onChangeProp],
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const { formattedValue, onChangeText, onBlur, onFocus } = useDateInput({
|
|
41
|
+
// locale,
|
|
42
|
+
value,
|
|
43
|
+
validRange,
|
|
44
|
+
inputMode,
|
|
45
|
+
onChange,
|
|
46
|
+
dateFormat,
|
|
47
|
+
onBlur: onBlurProp,
|
|
48
|
+
onFocus: onFocusProp,
|
|
49
|
+
isBlurredRef,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const inputStyle = useMemo(() => [datePickerInputStyles.root, style], [style]);
|
|
53
|
+
|
|
54
|
+
useImperativeHandle(ref, () => inputRef.current);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<TextInputWithMask
|
|
58
|
+
placeholder={dateFormat}
|
|
59
|
+
style={inputStyle}
|
|
60
|
+
{...rest}
|
|
61
|
+
onBlur={onBlur}
|
|
62
|
+
onFocus={onFocus}
|
|
63
|
+
ref={inputRef}
|
|
64
|
+
label={label}
|
|
65
|
+
value={formattedValue}
|
|
66
|
+
keyboardType={'number-pad'}
|
|
67
|
+
mask={dateFormat}
|
|
68
|
+
onChangeText={onChangeText}
|
|
69
|
+
// keyboardAppearance={theme.dark ? 'dark' : 'default'}
|
|
70
|
+
// error={formattedValue ? !!error : false}
|
|
71
|
+
right={inputButtons}
|
|
72
|
+
// supportingText={formattedValue ? error || undefined : undefined}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default memo(forwardRef(DatePickerInputWithoutModal));
|