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,155 @@
|
|
|
1
|
+
import { memo, useCallback, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useControlledValue } from '../../hooks';
|
|
4
|
+
import { DatePickerInlineBase, getStateValue } from '../DatePickerInline';
|
|
5
|
+
import DatePickerInlineHeader from '../DatePickerInline/DatePickerInlineHeader';
|
|
6
|
+
import AnimatedCrossView from './AnimatedCrossView';
|
|
7
|
+
import CalendarEdit from './CalendarEdit';
|
|
8
|
+
import DatePickerModalContentHeader from './DatePickerModalContentHeader';
|
|
9
|
+
import DatePickerModalHeader from './DatePickerModalHeader';
|
|
10
|
+
import DatePickerModalHeaderBackground from './DatePickerModalHeaderBackground';
|
|
11
|
+
import type {
|
|
12
|
+
DatePickerModalContentMultiProps,
|
|
13
|
+
DatePickerModalContentRangeProps,
|
|
14
|
+
DatePickerModalContentSingleProps,
|
|
15
|
+
LocalState,
|
|
16
|
+
LocalStateMultiple,
|
|
17
|
+
LocalStateRange,
|
|
18
|
+
LocalStateSingle,
|
|
19
|
+
} from './types';
|
|
20
|
+
|
|
21
|
+
type Props =
|
|
22
|
+
| DatePickerModalContentSingleProps
|
|
23
|
+
| DatePickerModalContentRangeProps
|
|
24
|
+
| DatePickerModalContentMultiProps;
|
|
25
|
+
|
|
26
|
+
export function DatePickerModalContent(props: Props) {
|
|
27
|
+
const {
|
|
28
|
+
mode = 'single',
|
|
29
|
+
onChange,
|
|
30
|
+
onConfirm,
|
|
31
|
+
onClose,
|
|
32
|
+
disableSafeTop,
|
|
33
|
+
disableWeekDays,
|
|
34
|
+
// locale = 'en',
|
|
35
|
+
validRange,
|
|
36
|
+
dateMode,
|
|
37
|
+
startYear,
|
|
38
|
+
endYear,
|
|
39
|
+
date,
|
|
40
|
+
startDate,
|
|
41
|
+
endDate,
|
|
42
|
+
dates,
|
|
43
|
+
} = props;
|
|
44
|
+
const [collapsed, setCollapsed] = useState<boolean>(true);
|
|
45
|
+
|
|
46
|
+
const onInnerChange = useCallback(
|
|
47
|
+
(params: any) => {
|
|
48
|
+
onChange?.(params);
|
|
49
|
+
},
|
|
50
|
+
[onChange],
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const [state, onStateChange] = useControlledValue<LocalState>({
|
|
54
|
+
value: getStateValue(
|
|
55
|
+
{
|
|
56
|
+
date,
|
|
57
|
+
dates,
|
|
58
|
+
startDate,
|
|
59
|
+
endDate,
|
|
60
|
+
},
|
|
61
|
+
mode,
|
|
62
|
+
),
|
|
63
|
+
onChange: onInnerChange,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const onInnerConfirm = useCallback(() => {
|
|
67
|
+
if (mode === 'single') {
|
|
68
|
+
(onConfirm as DatePickerModalContentSingleProps['onConfirm'])?.({
|
|
69
|
+
date: (state as LocalStateSingle)?.date,
|
|
70
|
+
});
|
|
71
|
+
} else if (mode === 'range') {
|
|
72
|
+
(onConfirm as DatePickerModalContentRangeProps['onConfirm'])?.({
|
|
73
|
+
startDate: (state as LocalStateRange)?.startDate,
|
|
74
|
+
endDate: (state as LocalStateRange)?.endDate,
|
|
75
|
+
});
|
|
76
|
+
} else if (mode === 'multiple') {
|
|
77
|
+
(onConfirm as DatePickerModalContentMultiProps['onConfirm'])?.({
|
|
78
|
+
dates: (state as LocalStateMultiple)?.dates || [],
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}, [state, mode, onConfirm]);
|
|
82
|
+
|
|
83
|
+
const onToggleCollapse = useCallback(() => {
|
|
84
|
+
setCollapsed(prev => !prev);
|
|
85
|
+
}, [setCollapsed]);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<>
|
|
89
|
+
<DatePickerModalHeaderBackground>
|
|
90
|
+
<DatePickerModalHeader
|
|
91
|
+
onSave={onInnerConfirm}
|
|
92
|
+
onClose={onClose}
|
|
93
|
+
saveLabel={props.saveLabel}
|
|
94
|
+
saveLabelDisabled={props.saveLabelDisabled || false}
|
|
95
|
+
disableSafeTop={disableSafeTop}
|
|
96
|
+
closeIcon={props.closeIcon}
|
|
97
|
+
/>
|
|
98
|
+
<DatePickerModalContentHeader
|
|
99
|
+
state={state || { startDate, dates, date, endDate }}
|
|
100
|
+
mode={mode}
|
|
101
|
+
collapsed={collapsed}
|
|
102
|
+
onToggle={onToggleCollapse}
|
|
103
|
+
headerSeparator={props.headerSeparator}
|
|
104
|
+
emptyLabel={props.emptyLabel}
|
|
105
|
+
label={props.label}
|
|
106
|
+
moreLabel={props.moreLabel}
|
|
107
|
+
startLabel={props.startLabel}
|
|
108
|
+
endLabel={props.endLabel}
|
|
109
|
+
uppercase={props.uppercase || true}
|
|
110
|
+
// locale={locale}
|
|
111
|
+
editIcon={props.editIcon}
|
|
112
|
+
calendarIcon={props.calendarIcon}
|
|
113
|
+
/>
|
|
114
|
+
</DatePickerModalHeaderBackground>
|
|
115
|
+
|
|
116
|
+
<AnimatedCrossView
|
|
117
|
+
collapsed={collapsed}
|
|
118
|
+
calendar={
|
|
119
|
+
<DatePickerInlineBase
|
|
120
|
+
// locale={locale}
|
|
121
|
+
mode={mode}
|
|
122
|
+
startDate={(state as LocalStateRange)?.startDate}
|
|
123
|
+
endDate={(state as LocalStateRange)?.endDate}
|
|
124
|
+
date={(state as LocalStateSingle)?.date}
|
|
125
|
+
onChange={onStateChange as typeof onInnerChange}
|
|
126
|
+
disableWeekDays={disableWeekDays}
|
|
127
|
+
dates={(state as LocalStateMultiple)?.dates}
|
|
128
|
+
validRange={validRange}
|
|
129
|
+
dateMode={dateMode}
|
|
130
|
+
startYear={startYear}
|
|
131
|
+
endYear={endYear}
|
|
132
|
+
// TODO - fix ts issues
|
|
133
|
+
// @ts-ignore
|
|
134
|
+
HeaderComponent={DatePickerInlineHeader}
|
|
135
|
+
/>
|
|
136
|
+
}
|
|
137
|
+
calendarEdit={
|
|
138
|
+
<CalendarEdit
|
|
139
|
+
mode={mode}
|
|
140
|
+
state={state || { startDate, dates, date, endDate }}
|
|
141
|
+
label={props.label}
|
|
142
|
+
startLabel={props.startLabel}
|
|
143
|
+
endLabel={props.endLabel}
|
|
144
|
+
collapsed={collapsed}
|
|
145
|
+
onChange={onStateChange}
|
|
146
|
+
validRange={validRange}
|
|
147
|
+
// locale={locale}
|
|
148
|
+
/>
|
|
149
|
+
}
|
|
150
|
+
/>
|
|
151
|
+
</>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export default memo(DatePickerModalContent);
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { type TextStyle, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { format } from '../../utils/date-fns';
|
|
5
|
+
import type { ModeType } from '../DatePickerInline';
|
|
6
|
+
import { IconButton } from '../IconButton';
|
|
7
|
+
import { Text } from '../Text';
|
|
8
|
+
import type { LocalState, LocalStateMultiple, LocalStateRange, LocalStateSingle } from './types';
|
|
9
|
+
import { datePickerModalContentHeaderStyles } from './utils';
|
|
10
|
+
|
|
11
|
+
export interface HeaderPickProps {
|
|
12
|
+
moreLabel?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
emptyLabel?: string;
|
|
15
|
+
saveLabel?: string;
|
|
16
|
+
uppercase?: boolean;
|
|
17
|
+
headerSeparator?: string;
|
|
18
|
+
startLabel?: string;
|
|
19
|
+
endLabel?: string;
|
|
20
|
+
editIcon?: string;
|
|
21
|
+
calendarIcon?: string;
|
|
22
|
+
closeIcon?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface HeaderContentProps extends HeaderPickProps {
|
|
26
|
+
state: LocalState;
|
|
27
|
+
mode: ModeType;
|
|
28
|
+
collapsed: boolean;
|
|
29
|
+
onToggle: () => any;
|
|
30
|
+
// locale: string | undefined;
|
|
31
|
+
textStyle?: TextStyle;
|
|
32
|
+
separatorStyle?: TextStyle;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function getLabel(mode: ModeType, configuredLabel?: string) {
|
|
36
|
+
if (configuredLabel) {
|
|
37
|
+
return configuredLabel;
|
|
38
|
+
}
|
|
39
|
+
if (mode === 'range') {
|
|
40
|
+
return 'Select period';
|
|
41
|
+
}
|
|
42
|
+
if (mode === 'multiple') {
|
|
43
|
+
return 'Select dates';
|
|
44
|
+
}
|
|
45
|
+
if (mode === 'single') {
|
|
46
|
+
return 'Select date';
|
|
47
|
+
}
|
|
48
|
+
return '...';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default function DatePickerModalContentHeader(props: HeaderContentProps) {
|
|
52
|
+
const {
|
|
53
|
+
onToggle,
|
|
54
|
+
collapsed,
|
|
55
|
+
mode,
|
|
56
|
+
moreLabel,
|
|
57
|
+
uppercase,
|
|
58
|
+
editIcon = 'pencil',
|
|
59
|
+
calendarIcon = 'calendar',
|
|
60
|
+
} = props;
|
|
61
|
+
|
|
62
|
+
const label = getLabel(props.mode, props.label);
|
|
63
|
+
const allowEditing = mode !== 'multiple';
|
|
64
|
+
|
|
65
|
+
const {
|
|
66
|
+
fillContainerStyle,
|
|
67
|
+
headerContentContainerStyle,
|
|
68
|
+
headerStyle,
|
|
69
|
+
labelStyle,
|
|
70
|
+
headerTextStyle,
|
|
71
|
+
separatorStyle,
|
|
72
|
+
iconButtonStyle,
|
|
73
|
+
} = useMemo(() => {
|
|
74
|
+
const {
|
|
75
|
+
fill,
|
|
76
|
+
headerContentContainer,
|
|
77
|
+
header,
|
|
78
|
+
label: _labelStyle,
|
|
79
|
+
headerText,
|
|
80
|
+
headerSeparator,
|
|
81
|
+
icon,
|
|
82
|
+
} = datePickerModalContentHeaderStyles;
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
fillContainerStyle: fill,
|
|
86
|
+
headerContentContainerStyle: headerContentContainer,
|
|
87
|
+
headerStyle: header,
|
|
88
|
+
labelStyle: _labelStyle,
|
|
89
|
+
headerTextStyle: headerText,
|
|
90
|
+
separatorStyle: headerSeparator,
|
|
91
|
+
iconButtonStyle: icon,
|
|
92
|
+
};
|
|
93
|
+
}, []);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<View style={headerStyle}>
|
|
97
|
+
<View>
|
|
98
|
+
<Text style={labelStyle}>{uppercase ? label.toUpperCase() : label}</Text>
|
|
99
|
+
<View style={headerContentContainerStyle}>
|
|
100
|
+
<>
|
|
101
|
+
{mode === 'range' ? (
|
|
102
|
+
<HeaderContentRange
|
|
103
|
+
{...props}
|
|
104
|
+
textStyle={headerTextStyle}
|
|
105
|
+
separatorStyle={separatorStyle}
|
|
106
|
+
/>
|
|
107
|
+
) : null}
|
|
108
|
+
</>
|
|
109
|
+
<>
|
|
110
|
+
{mode === 'single' ? (
|
|
111
|
+
<HeaderContentSingle {...props} textStyle={headerTextStyle} />
|
|
112
|
+
) : null}
|
|
113
|
+
</>
|
|
114
|
+
<>
|
|
115
|
+
{mode === 'multiple' ? (
|
|
116
|
+
<HeaderContentMulti
|
|
117
|
+
{...props}
|
|
118
|
+
moreLabel={moreLabel}
|
|
119
|
+
textStyle={headerTextStyle}
|
|
120
|
+
/>
|
|
121
|
+
) : null}
|
|
122
|
+
</>
|
|
123
|
+
</View>
|
|
124
|
+
</View>
|
|
125
|
+
<View style={fillContainerStyle} />
|
|
126
|
+
<>
|
|
127
|
+
{allowEditing ? (
|
|
128
|
+
<IconButton
|
|
129
|
+
name={collapsed ? editIcon : calendarIcon}
|
|
130
|
+
accessibilityLabel={collapsed ? 'Type in date' : 'Pick date from calendar'}
|
|
131
|
+
style={iconButtonStyle}
|
|
132
|
+
onPress={onToggle}
|
|
133
|
+
/>
|
|
134
|
+
) : null}
|
|
135
|
+
</>
|
|
136
|
+
</View>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// TODO add translations
|
|
141
|
+
export function HeaderContentSingle({
|
|
142
|
+
state,
|
|
143
|
+
emptyLabel = ' ',
|
|
144
|
+
// locale,
|
|
145
|
+
textStyle,
|
|
146
|
+
}: HeaderContentProps) {
|
|
147
|
+
const singleState = state as LocalStateSingle;
|
|
148
|
+
|
|
149
|
+
const label = useMemo(
|
|
150
|
+
() => (singleState.date ? format(singleState.date, 'LLL dd') : emptyLabel),
|
|
151
|
+
[emptyLabel, singleState.date],
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
return <Text style={textStyle}>{label}</Text>;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// TODO add translations
|
|
158
|
+
export function HeaderContentMulti({
|
|
159
|
+
state,
|
|
160
|
+
emptyLabel = ' ',
|
|
161
|
+
moreLabel = 'more',
|
|
162
|
+
textStyle,
|
|
163
|
+
}: // locale = 'en',
|
|
164
|
+
HeaderContentProps & { moreLabel: string | undefined }) {
|
|
165
|
+
const multiState = state as LocalStateMultiple;
|
|
166
|
+
|
|
167
|
+
const label = useMemo(() => {
|
|
168
|
+
let _label = emptyLabel;
|
|
169
|
+
const dateCount = multiState.dates?.length || 0;
|
|
170
|
+
|
|
171
|
+
if (dateCount) {
|
|
172
|
+
if (dateCount <= 2) {
|
|
173
|
+
_label = multiState.dates!.map(date => format(date, 'LLL dd')).join(', ');
|
|
174
|
+
} else {
|
|
175
|
+
_label =
|
|
176
|
+
format(multiState.dates![0], 'LLL dd') + ` (+ ${dateCount - 1} ${moreLabel})`;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return _label;
|
|
180
|
+
}, [emptyLabel, moreLabel, multiState.dates]);
|
|
181
|
+
|
|
182
|
+
return <Text style={textStyle}>{label}</Text>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// TODO add translations
|
|
186
|
+
export function HeaderContentRange({
|
|
187
|
+
// locale,
|
|
188
|
+
state,
|
|
189
|
+
headerSeparator = '-',
|
|
190
|
+
startLabel = 'Start',
|
|
191
|
+
endLabel = 'End',
|
|
192
|
+
textStyle,
|
|
193
|
+
separatorStyle,
|
|
194
|
+
}: HeaderContentProps) {
|
|
195
|
+
const rangeState = state as LocalStateRange;
|
|
196
|
+
|
|
197
|
+
const startDateLabel = useMemo(
|
|
198
|
+
() => (rangeState.startDate ? format(rangeState.startDate, 'LLL dd') : startLabel),
|
|
199
|
+
[rangeState.startDate, startLabel],
|
|
200
|
+
);
|
|
201
|
+
const endDateLabel = useMemo(
|
|
202
|
+
() => (rangeState.endDate ? format(rangeState.endDate, 'LLL dd') : endLabel),
|
|
203
|
+
[endLabel, rangeState.endDate],
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
<>
|
|
208
|
+
<Text style={textStyle}>{startDateLabel}</Text>
|
|
209
|
+
<Text style={separatorStyle}>{headerSeparator}</Text>
|
|
210
|
+
<Text style={textStyle}>{endDateLabel}</Text>
|
|
211
|
+
</>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { Animated, SafeAreaView, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { resolveStateVariant } from '../../utils';
|
|
5
|
+
import { Button } from '../Button';
|
|
6
|
+
import { IconButton } from '../IconButton';
|
|
7
|
+
import { datePickerModalHeaderStyles } from './utils';
|
|
8
|
+
|
|
9
|
+
export interface DatePickerModalHeaderProps {
|
|
10
|
+
disableSafeTop?: boolean;
|
|
11
|
+
saveLabel?: string;
|
|
12
|
+
saveLabelDisabled?: boolean;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
onSave: () => void;
|
|
15
|
+
closeIcon?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default function DatePickerModalHeader(props: DatePickerModalHeaderProps) {
|
|
19
|
+
const { disableSafeTop, closeIcon = 'close' } = props;
|
|
20
|
+
|
|
21
|
+
const state = resolveStateVariant({
|
|
22
|
+
disableSafeTop: !!disableSafeTop,
|
|
23
|
+
});
|
|
24
|
+
datePickerModalHeaderStyles.useVariants({
|
|
25
|
+
state: state as any,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const saveLabel = props.saveLabel || 'Save';
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
animatedContainerStyle,
|
|
32
|
+
safeContentStyle,
|
|
33
|
+
appBarHeaderStyle,
|
|
34
|
+
iconButtonStyle,
|
|
35
|
+
buttonStyle,
|
|
36
|
+
} = useMemo(() => {
|
|
37
|
+
const { animated, safeContent, appbarHeader } = datePickerModalHeaderStyles;
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
iconButtonStyle: { color: datePickerModalHeaderStyles.root.color },
|
|
41
|
+
buttonStyle: { color: datePickerModalHeaderStyles.root.color },
|
|
42
|
+
animatedContainerStyle: animated,
|
|
43
|
+
safeContentStyle: safeContent,
|
|
44
|
+
appBarHeaderStyle: appbarHeader,
|
|
45
|
+
};
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
}, [state]);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<>
|
|
51
|
+
<Animated.View style={animatedContainerStyle}>
|
|
52
|
+
<SafeAreaView style={safeContentStyle}>
|
|
53
|
+
<View style={appBarHeaderStyle}>
|
|
54
|
+
<IconButton
|
|
55
|
+
name={closeIcon}
|
|
56
|
+
accessibilityLabel={'Close'}
|
|
57
|
+
onPress={props.onClose}
|
|
58
|
+
style={iconButtonStyle}
|
|
59
|
+
testID="date-picker-close"
|
|
60
|
+
/>
|
|
61
|
+
<Button
|
|
62
|
+
variant="contained"
|
|
63
|
+
style={buttonStyle}
|
|
64
|
+
onPress={props.onSave}
|
|
65
|
+
disabled={props.saveLabelDisabled || false}
|
|
66
|
+
testID="dates-save">
|
|
67
|
+
{saveLabel}
|
|
68
|
+
</Button>
|
|
69
|
+
</View>
|
|
70
|
+
</SafeAreaView>
|
|
71
|
+
</Animated.View>
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Animated, SafeAreaView } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import { datePickerModalHeaderBackgroundStyles } from './utils';
|
|
4
|
+
|
|
5
|
+
export default function DatePickerModalHeaderBackground({ children }: { children: any }) {
|
|
6
|
+
return (
|
|
7
|
+
<Animated.View style={datePickerModalHeaderBackgroundStyles.header}>
|
|
8
|
+
<SafeAreaView style={datePickerModalHeaderBackgroundStyles.safeContent}>
|
|
9
|
+
{children}
|
|
10
|
+
</SafeAreaView>
|
|
11
|
+
</Animated.View>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
|
|
2
|
+
import DatePickerModalDefault from './DatePickerModal';
|
|
3
|
+
|
|
4
|
+
registerMoleculesComponents({
|
|
5
|
+
DatePickerModal: DatePickerModalDefault,
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const DatePickerModal = getRegisteredComponentWithFallback(
|
|
9
|
+
'DatePickerModal',
|
|
10
|
+
DatePickerModalDefault,
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export type { DatePickerModalProps } from './types';
|
|
14
|
+
export {
|
|
15
|
+
datePickerModalContentHeaderStyles,
|
|
16
|
+
datePickerModalEditStyles,
|
|
17
|
+
datePickerModalHeaderBackgroundStyles,
|
|
18
|
+
datePickerModalHeaderStyles,
|
|
19
|
+
datePickerModalStyles,
|
|
20
|
+
} from './utils';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
BaseDatePickerProps,
|
|
5
|
+
CalendarDate,
|
|
6
|
+
CalendarDates,
|
|
7
|
+
MultiChange,
|
|
8
|
+
MultiConfirm,
|
|
9
|
+
RangeChange,
|
|
10
|
+
SingleChange,
|
|
11
|
+
} from '../DatePickerInline';
|
|
12
|
+
import type { HeaderPickProps } from './DatePickerModalContentHeader';
|
|
13
|
+
|
|
14
|
+
export type LocalState = LocalStateSingle | LocalStateMultiple | LocalStateRange;
|
|
15
|
+
|
|
16
|
+
export type LocalStateSingle = {
|
|
17
|
+
date: CalendarDate;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type LocalStateMultiple = {
|
|
21
|
+
dates: CalendarDates;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type LocalStateRange = {
|
|
25
|
+
startDate: CalendarDate;
|
|
26
|
+
endDate: CalendarDate;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
interface DatePickerModalContentBaseProps {
|
|
30
|
+
inputFormat?: string;
|
|
31
|
+
locale?: string;
|
|
32
|
+
onClose: () => any;
|
|
33
|
+
disableSafeTop?: boolean;
|
|
34
|
+
saveLabelDisabled?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface DatePickerModalContentRangeProps
|
|
38
|
+
extends HeaderPickProps,
|
|
39
|
+
BaseDatePickerProps,
|
|
40
|
+
DatePickerModalContentBaseProps {
|
|
41
|
+
mode?: 'range';
|
|
42
|
+
startDate?: CalendarDate;
|
|
43
|
+
endDate?: CalendarDate;
|
|
44
|
+
onChange?: RangeChange;
|
|
45
|
+
onConfirm?: RangeChange;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface DatePickerModalContentSingleProps
|
|
49
|
+
extends HeaderPickProps,
|
|
50
|
+
BaseDatePickerProps,
|
|
51
|
+
DatePickerModalContentBaseProps {
|
|
52
|
+
mode?: 'single';
|
|
53
|
+
date?: CalendarDate;
|
|
54
|
+
onChange?: SingleChange;
|
|
55
|
+
onConfirm?: SingleChange;
|
|
56
|
+
dateMode?: 'start' | 'end';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface DatePickerModalContentMultiProps
|
|
60
|
+
extends HeaderPickProps,
|
|
61
|
+
BaseDatePickerProps,
|
|
62
|
+
DatePickerModalContentBaseProps {
|
|
63
|
+
mode?: 'multiple';
|
|
64
|
+
dates?: CalendarDates;
|
|
65
|
+
onChange?: MultiChange;
|
|
66
|
+
onConfirm?: MultiConfirm;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
interface BaseDatePickerModalProps {
|
|
70
|
+
isOpen: boolean;
|
|
71
|
+
animationType?: 'slide' | 'fade' | 'none';
|
|
72
|
+
disableStatusBar?: boolean;
|
|
73
|
+
disableStatusBarPadding?: boolean;
|
|
74
|
+
style?: ViewStyle;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface DatePickerModalSingleProps
|
|
78
|
+
extends DatePickerModalContentSingleProps,
|
|
79
|
+
BaseDatePickerModalProps {}
|
|
80
|
+
|
|
81
|
+
export interface DatePickerModalMultiProps
|
|
82
|
+
extends DatePickerModalContentMultiProps,
|
|
83
|
+
BaseDatePickerModalProps {}
|
|
84
|
+
|
|
85
|
+
export interface DatePickerModalRangeProps
|
|
86
|
+
extends DatePickerModalContentRangeProps,
|
|
87
|
+
BaseDatePickerModalProps {}
|
|
88
|
+
|
|
89
|
+
export type DatePickerModalProps =
|
|
90
|
+
| DatePickerModalRangeProps
|
|
91
|
+
| DatePickerModalSingleProps
|
|
92
|
+
| DatePickerModalMultiProps;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
2
|
+
|
|
3
|
+
import { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
|
|
4
|
+
|
|
5
|
+
const datePickerModalStylesDefault = StyleSheet.create(theme => ({
|
|
6
|
+
header: {
|
|
7
|
+
backgroundColor: theme.colors.primary,
|
|
8
|
+
},
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
const datePickerModalHeaderStylesDefault = StyleSheet.create(theme => ({
|
|
12
|
+
root: {
|
|
13
|
+
color: theme.colors.onPrimary,
|
|
14
|
+
},
|
|
15
|
+
animated: {
|
|
16
|
+
paddingBottom: theme.spacings['0'],
|
|
17
|
+
elevation: 4,
|
|
18
|
+
},
|
|
19
|
+
safeContent: {
|
|
20
|
+
paddingBottom: theme.spacings['0'],
|
|
21
|
+
|
|
22
|
+
variants: {
|
|
23
|
+
state: {
|
|
24
|
+
disableSafeTop: {
|
|
25
|
+
paddingTop: 0,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
safeContentNoTop: {
|
|
31
|
+
paddingTop: theme.spacings['0'],
|
|
32
|
+
},
|
|
33
|
+
appbarHeader: {
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: 'space-between',
|
|
37
|
+
paddingHorizontal: theme.spacings['2'],
|
|
38
|
+
paddingVertical: theme.spacings['2'],
|
|
39
|
+
elevation: 0,
|
|
40
|
+
backgroundColor: 'transparent',
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
const datePickerModalContentHeaderStylesDefault = StyleSheet.create(theme => ({
|
|
45
|
+
root: {
|
|
46
|
+
color: theme.colors.onPrimary,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
fill: {
|
|
50
|
+
flex: 1,
|
|
51
|
+
},
|
|
52
|
+
header: {
|
|
53
|
+
height: 75,
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
flexDirection: 'row',
|
|
56
|
+
paddingLeft: theme.spacings['6'],
|
|
57
|
+
paddingRight: theme.spacings['3'],
|
|
58
|
+
},
|
|
59
|
+
headerContentContainer: {
|
|
60
|
+
marginTop: theme.spacings['1'],
|
|
61
|
+
flexDirection: 'row',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
},
|
|
64
|
+
label: {
|
|
65
|
+
color: theme.colors.onPrimary,
|
|
66
|
+
letterSpacing: 1,
|
|
67
|
+
fontSize: theme.typescale.bodyMedium.fontSize,
|
|
68
|
+
},
|
|
69
|
+
headerText: {
|
|
70
|
+
fontSize: theme.typescale.bodyMedium.fontSize,
|
|
71
|
+
color: theme.colors.onPrimary,
|
|
72
|
+
},
|
|
73
|
+
headerSeparator: {
|
|
74
|
+
fontSize: theme.typescale.bodyMedium.fontSize,
|
|
75
|
+
paddingLeft: theme.spacings['2'],
|
|
76
|
+
paddingRight: theme.spacings['2'],
|
|
77
|
+
color: theme.colors.onPrimary,
|
|
78
|
+
},
|
|
79
|
+
icon: {
|
|
80
|
+
color: theme.colors.onPrimary,
|
|
81
|
+
},
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
const datePickerModalHeaderBackgroundStylesDefault = StyleSheet.create(theme => ({
|
|
85
|
+
header: {
|
|
86
|
+
backgroundColor: theme.colors.primary,
|
|
87
|
+
paddingBottom: theme.spacings['0'],
|
|
88
|
+
elevation: 4,
|
|
89
|
+
},
|
|
90
|
+
safeContent: {
|
|
91
|
+
paddingBottom: theme.spacings['0'],
|
|
92
|
+
},
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
const datePickerModalEditStylesDefault = StyleSheet.create(theme => ({
|
|
96
|
+
container: { padding: theme.spacings['3'] },
|
|
97
|
+
inner: { flexDirection: 'row' },
|
|
98
|
+
inputContainer: { flex: 1 },
|
|
99
|
+
input: { flex: 1 },
|
|
100
|
+
separator: { width: 12 },
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
registerComponentsStyles({
|
|
104
|
+
DatePickerModal: datePickerModalStylesDefault,
|
|
105
|
+
DatePickerModal_Header: datePickerModalHeaderStylesDefault,
|
|
106
|
+
DatePickerModal_ContentHeader: datePickerModalContentHeaderStylesDefault,
|
|
107
|
+
DatePickerModal_HeaderBackground: datePickerModalHeaderBackgroundStylesDefault,
|
|
108
|
+
DatePickerModal_Edit: datePickerModalEditStylesDefault,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export const datePickerModalStyles = getRegisteredMoleculesComponentStyles('DatePickerModal');
|
|
112
|
+
export const datePickerModalHeaderStyles =
|
|
113
|
+
getRegisteredMoleculesComponentStyles('DatePickerModal_Header');
|
|
114
|
+
export const datePickerModalContentHeaderStyles = getRegisteredMoleculesComponentStyles(
|
|
115
|
+
'DatePickerModal_ContentHeader',
|
|
116
|
+
);
|
|
117
|
+
export const datePickerModalHeaderBackgroundStyles = getRegisteredMoleculesComponentStyles(
|
|
118
|
+
'DatePickerModal_HeaderBackground',
|
|
119
|
+
);
|
|
120
|
+
export const datePickerModalEditStyles =
|
|
121
|
+
getRegisteredMoleculesComponentStyles('DatePickerModal_Edit');
|