@tactics/toddle-styleguide 1.2.3 → 1.2.5
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/App.tsx +202 -191
- package/index.d.ts +2 -1
- package/index.tsx +2 -0
- package/package.json +2 -2
- package/src/components/atoms/backdrop/backdrop.component.d.ts +2 -1
- package/src/components/atoms/backdrop/backdrop.component.tsx +8 -2
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +1821 -641
- package/src/components/atoms/text-input/text-input.component.d.ts +4 -5
- package/src/components/atoms/text-input/text-input.component.tsx +9 -13
- package/src/components/atoms/text-input/text-input.preview.tsx +5 -5
- package/src/components/atoms/text-input/text-input.test.js +4 -4
- package/src/components/molecules/avatar/__snapshots__/avatar.test.js.snap +70 -62
- package/src/components/molecules/avatar/avatar.component.d.ts +2 -1
- package/src/components/molecules/avatar/avatar.component.tsx +22 -11
- package/src/components/molecules/avatar/avatar.preview.tsx +58 -44
- package/src/components/molecules/avatar/avatar.styles.d.ts +54 -15
- package/src/components/molecules/avatar/avatar.styles.js +33 -5
- package/src/components/molecules/button/__snapshots__/button.test.js.snap +144 -0
- package/src/components/molecules/button/button.component.d.ts +6 -4
- package/src/components/molecules/button/button.component.tsx +30 -9
- package/src/components/molecules/button/button.preview.tsx +16 -1
- package/src/components/molecules/button/button.styles.d.ts +13 -16
- package/src/components/molecules/button/button.styles.js +2 -4
- package/src/components/molecules/button/button.test.js +12 -0
- package/src/components/molecules/date-input/date-input.preview.tsx +25 -23
- package/src/components/molecules/message-input/__snapshots__/message-input.test.js.snap +4 -0
- package/src/components/molecules/message-input/message-input.component.d.ts +4 -6
- package/src/components/molecules/message-input/message-input.component.tsx +10 -12
- package/src/components/molecules/message-input/message-input.preview.tsx +28 -15
- package/src/components/molecules/password-input/password-input.component.d.ts +4 -6
- package/src/components/molecules/password-input/password-input.component.tsx +11 -15
- package/src/components/molecules/swipe/__snapshots__/swipe.test.js.snap +263 -420
- package/src/components/molecules/swipe/swipe.component.d.ts +4 -4
- package/src/components/molecules/swipe/swipe.component.tsx +47 -20
- package/src/components/molecules/swipe/swipe.preview.tsx +111 -51
- package/src/components/molecules/swipe/swipe.styles.d.ts +28 -0
- package/src/components/molecules/swipe/swipe.styles.js +32 -0
- package/src/components/molecules/swipe/swipe.test.js +1 -1
- package/src/components/molecules/tag/__snapshots__/tag.test.js.snap +10 -10
- package/src/components/molecules/tag/tag.component.d.ts +3 -8
- package/src/components/molecules/tag/tag.component.tsx +7 -13
- package/src/components/molecules/tag/tag.preview.tsx +22 -19
- package/src/components/molecules/tag/tag.styles.js +4 -2
- package/src/components/molecules/tag/tag.test.js +10 -2
- package/src/components/molecules/time-picker/__snapshots__/time-picker.test.js.snap +1868 -1776
- package/src/components/molecules/time-picker/time-picker.component.tsx +49 -23
- package/src/components/molecules/time-picker/time-picker.preview.tsx +5 -4
- package/src/components/molecules/time-picker/time-picker.styles.d.ts +16 -4
- package/src/components/molecules/time-picker/time-picker.styles.js +18 -6
- package/src/components/molecules/timestamp/__snapshots__/timestamp.test.js.snap +1 -1
- package/src/components/molecules/timestamp/timestamp.component.tsx +0 -2
- package/src/components/organisms/child-list-item/__snapshots__/child-list-item.test.js.snap +174 -162
- package/src/components/organisms/contact-item/__snapshots__/contact-item.test.js.snap +70 -127
- package/src/components/organisms/contact-item/contact-item.component.tsx +10 -9
- package/src/components/organisms/my-child-list-item/__snapshots__/my-child-list-item.test.js.snap +97 -89
- package/src/components/organisms/person-info-card/__snapshots__/person-info-card.test.js.snap +233 -209
- package/src/components/organisms/text-bubble/__snapshots__/text-bubble.test.js.snap +7 -7
- package/src/components/templates/modal/modal.component.tsx +0 -1
- package/src/components/templates/popover/components/modal/modal.component.tsx +0 -1
- package/src/components/templates/popover/components/modal/modal.styles.d.ts +2 -1
- package/src/components/templates/popover/components/modal/modal.styles.js +2 -2
- package/src/components/templates/popover/popover.component.tsx +27 -14
- package/src/components/templates/popover/popover.preview.tsx +63 -97
- package/src/components/templates/popover/popover.styles.d.ts +1 -1
- package/src/components/templates/popover/popover.styles.js +3 -1
- package/src/components/templates/popover-action/popover-action.component.d.ts +8 -0
- package/src/components/templates/popover-action/popover-action.component.tsx +119 -0
- package/src/components/templates/popover-action/popover-action.preview.d.ts +1 -0
- package/src/components/templates/popover-action/popover-action.preview.tsx +142 -0
- package/src/components/templates/popover-action/popover-action.styles.d.ts +26 -0
- package/src/components/templates/popover-action/popover-action.styles.js +31 -0
- package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +5 -0
- package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +23 -0
- package/src/utilities/toddle-datetime/toddle-datetime.preview.tsx +15 -1
- package/src/utilities/toddle-datetime/toddle-datetime.test.js +10 -0
- package/src/components/molecules/swipe/Swipe.styles.d.ts +0 -7
- package/src/components/molecules/swipe/Swipe.styles.js +0 -10
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {ThemeCtx} from '../../../context/theme.context';
|
|
5
|
-
import {Dimensions, useWindowDimensions, View} from 'react-native';
|
|
2
|
+
import {useEffect, useState} from 'react';
|
|
3
|
+
import {Dimensions, Platform, StatusBar, View} from 'react-native';
|
|
6
4
|
import {Stylesheet} from './popover.styles';
|
|
7
5
|
import {Backdrop} from '../../atoms/backdrop/backdrop.component';
|
|
8
6
|
import {Modal, Foreground} from './components';
|
|
@@ -15,8 +13,6 @@ type PopoverProps = {
|
|
|
15
13
|
children?: React.ReactNode;
|
|
16
14
|
};
|
|
17
15
|
|
|
18
|
-
const window = Dimensions.get('window');
|
|
19
|
-
|
|
20
16
|
const Popover = ({
|
|
21
17
|
isVisible,
|
|
22
18
|
title,
|
|
@@ -24,20 +20,37 @@ const Popover = ({
|
|
|
24
20
|
onClose,
|
|
25
21
|
children,
|
|
26
22
|
}: PopoverProps) => {
|
|
27
|
-
const
|
|
23
|
+
const [windowHeight, setWindowHeight] = useState(
|
|
24
|
+
Dimensions.get('window').height
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const updateWindowHeight = () => {
|
|
29
|
+
let availableHeight = Dimensions.get('window').height;
|
|
30
|
+
if (Platform.OS === 'android') {
|
|
31
|
+
availableHeight += StatusBar.currentHeight ?? 0;
|
|
32
|
+
}
|
|
33
|
+
setWindowHeight(availableHeight);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
updateWindowHeight();
|
|
37
|
+
|
|
38
|
+
const subscription = Dimensions.addEventListener(
|
|
39
|
+
'change',
|
|
40
|
+
updateWindowHeight
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return () => subscription?.remove();
|
|
44
|
+
}, []);
|
|
28
45
|
|
|
29
|
-
const
|
|
30
|
-
const styles = Stylesheet(context);
|
|
46
|
+
const styles = Stylesheet();
|
|
31
47
|
|
|
32
48
|
return (
|
|
33
|
-
<View
|
|
34
|
-
style={[styles.element, {width: width, height: height}]}
|
|
35
|
-
pointerEvents={isVisible ? 'auto' : 'none'}
|
|
36
|
-
>
|
|
49
|
+
<View style={styles.element} pointerEvents={isVisible ? 'auto' : 'none'}>
|
|
37
50
|
<Backdrop isVisible={isVisible} />
|
|
38
51
|
<Foreground>
|
|
39
52
|
<Modal
|
|
40
|
-
windowHeight={
|
|
53
|
+
windowHeight={windowHeight}
|
|
41
54
|
isVisible={isVisible}
|
|
42
55
|
onClose={onClose}
|
|
43
56
|
title={title}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React, {useState} from 'react';
|
|
2
2
|
import {Button} from '../../molecules/button/button.component';
|
|
3
|
-
import {ScrollView} from 'react-native';
|
|
4
|
-
|
|
5
3
|
const {Popover} = require('./popover.component');
|
|
6
4
|
const {View} = require('react-native');
|
|
7
5
|
|
|
@@ -32,101 +30,69 @@ export const PopoverPreview = ({}: {}) => {
|
|
|
32
30
|
title={'Taal'}
|
|
33
31
|
subtitle={'Welke taal wilt u gebruiken?'}
|
|
34
32
|
>
|
|
35
|
-
<
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
</View>
|
|
99
|
-
<View>
|
|
100
|
-
<Button label={'test'} />
|
|
101
|
-
</View>
|
|
102
|
-
<View>
|
|
103
|
-
<Button label={'test'} />
|
|
104
|
-
</View>
|
|
105
|
-
<View>
|
|
106
|
-
<Button label={'test'} />
|
|
107
|
-
</View>
|
|
108
|
-
<View>
|
|
109
|
-
<Button label={'test'} />
|
|
110
|
-
</View>
|
|
111
|
-
<View>
|
|
112
|
-
<Button label={'test'} />
|
|
113
|
-
</View>
|
|
114
|
-
<View>
|
|
115
|
-
<Button label={'test'} />
|
|
116
|
-
</View>
|
|
117
|
-
<View>
|
|
118
|
-
<Button label={'test'} />
|
|
119
|
-
</View>
|
|
120
|
-
<View>
|
|
121
|
-
<Button label={'test'} />
|
|
122
|
-
</View>
|
|
123
|
-
<View>
|
|
124
|
-
<Button label={'test'} />
|
|
125
|
-
</View>
|
|
126
|
-
<View>
|
|
127
|
-
<Button label={'test'} />
|
|
128
|
-
</View>
|
|
129
|
-
</ScrollView>
|
|
33
|
+
<View>
|
|
34
|
+
<Button label={'test'} />
|
|
35
|
+
</View>
|
|
36
|
+
<View>
|
|
37
|
+
<Button label={'test'} />
|
|
38
|
+
</View>
|
|
39
|
+
<View>
|
|
40
|
+
<Button label={'test'} />
|
|
41
|
+
</View>
|
|
42
|
+
<View>
|
|
43
|
+
<Button label={'test'} />
|
|
44
|
+
</View>
|
|
45
|
+
<View>
|
|
46
|
+
<Button label={'test'} />
|
|
47
|
+
</View>
|
|
48
|
+
<View>
|
|
49
|
+
<Button label={'test'} />
|
|
50
|
+
</View>
|
|
51
|
+
<View>
|
|
52
|
+
<Button label={'test'} />
|
|
53
|
+
</View>
|
|
54
|
+
<View>
|
|
55
|
+
<Button label={'test'} />
|
|
56
|
+
</View>
|
|
57
|
+
<View>
|
|
58
|
+
<Button label={'test'} />
|
|
59
|
+
</View>
|
|
60
|
+
<View>
|
|
61
|
+
<Button label={'test'} />
|
|
62
|
+
</View>
|
|
63
|
+
<View>
|
|
64
|
+
<Button label={'test'} />
|
|
65
|
+
</View>
|
|
66
|
+
<View>
|
|
67
|
+
<Button label={'test'} />
|
|
68
|
+
</View>
|
|
69
|
+
<View>
|
|
70
|
+
<Button label={'test'} />
|
|
71
|
+
</View>
|
|
72
|
+
<View>
|
|
73
|
+
<Button label={'test'} />
|
|
74
|
+
</View>
|
|
75
|
+
<View>
|
|
76
|
+
<Button label={'test'} />
|
|
77
|
+
</View>
|
|
78
|
+
<View>
|
|
79
|
+
<Button label={'test'} />
|
|
80
|
+
</View>
|
|
81
|
+
<View>
|
|
82
|
+
<Button label={'test'} />
|
|
83
|
+
</View>
|
|
84
|
+
<View>
|
|
85
|
+
<Button label={'test'} />
|
|
86
|
+
</View>
|
|
87
|
+
<View>
|
|
88
|
+
<Button label={'test'} />
|
|
89
|
+
</View>
|
|
90
|
+
<View>
|
|
91
|
+
<Button label={'test'} />
|
|
92
|
+
</View>
|
|
93
|
+
<View>
|
|
94
|
+
<Button label={'test'} />
|
|
95
|
+
</View>
|
|
130
96
|
</Popover>
|
|
131
97
|
</View>
|
|
132
98
|
);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type PopOverActionProps = {
|
|
3
|
+
isVisible: boolean;
|
|
4
|
+
touchBackDrop: (value: boolean) => void;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const PopOverAction: ({ isVisible, children, touchBackDrop, }: PopOverActionProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import React, {Children, useContext, useEffect, useMemo, useState} from 'react';
|
|
2
|
+
import {Animated, Dimensions, Platform, StatusBar, View} from 'react-native';
|
|
3
|
+
import {Backdrop} from '../../atoms/backdrop/backdrop.component';
|
|
4
|
+
import {Stylesheet} from './popover-action.styles';
|
|
5
|
+
import {Swipe} from '../../molecules/swipe/swipe.component';
|
|
6
|
+
import {ThemeCtx} from '../../../context/theme.context';
|
|
7
|
+
|
|
8
|
+
type PopOverActionProps = {
|
|
9
|
+
isVisible: boolean;
|
|
10
|
+
touchBackDrop: (value: boolean) => void;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export const PopOverAction = ({
|
|
14
|
+
isVisible,
|
|
15
|
+
children,
|
|
16
|
+
touchBackDrop,
|
|
17
|
+
}: PopOverActionProps) => {
|
|
18
|
+
const [windowHeight, setWindowHeight] = useState(
|
|
19
|
+
Dimensions.get('window').height
|
|
20
|
+
);
|
|
21
|
+
const [elementSize, setElementSize] = useState({width: 0, height: 0});
|
|
22
|
+
const [currentChildIndex, setCurrentChildIndex] = useState(0);
|
|
23
|
+
const [childDimensions, setChildDimensions] = useState<any[]>([]);
|
|
24
|
+
|
|
25
|
+
const handleChildLayout = (index: number, layout: any) => {
|
|
26
|
+
const updatedDimensions = [...childDimensions];
|
|
27
|
+
updatedDimensions[index] = layout;
|
|
28
|
+
|
|
29
|
+
setChildDimensions(updatedDimensions);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const renderChildren = Children.map(children, (child, index) => {
|
|
33
|
+
return React.cloneElement(child as React.ReactElement, {
|
|
34
|
+
onLayout: (event: any) =>
|
|
35
|
+
handleChildLayout(index, event.nativeEvent.layout),
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const handleChildIndexChange = (index: number) => {
|
|
40
|
+
setCurrentChildIndex(index);
|
|
41
|
+
|
|
42
|
+
const childDimension = childDimensions[index];
|
|
43
|
+
if (childDimension) {
|
|
44
|
+
const {width, height} = childDimension;
|
|
45
|
+
setElementSize({width: width, height: height});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const updateWindowHeight = () => {
|
|
51
|
+
let availableHeight = Dimensions.get('window').height;
|
|
52
|
+
if (Platform.OS === 'android') {
|
|
53
|
+
availableHeight += StatusBar.currentHeight ?? 0;
|
|
54
|
+
}
|
|
55
|
+
setWindowHeight(availableHeight);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
updateWindowHeight();
|
|
59
|
+
|
|
60
|
+
const subscription = Dimensions.addEventListener(
|
|
61
|
+
'change',
|
|
62
|
+
updateWindowHeight
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return () => subscription?.remove();
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
const context = useContext(ThemeCtx);
|
|
69
|
+
const styles = Stylesheet(context);
|
|
70
|
+
|
|
71
|
+
const elementHeight = Math.round(elementSize.height);
|
|
72
|
+
const maxHeight = Math.round(windowHeight / 100) * 80;
|
|
73
|
+
const translateYStartingPoint = windowHeight;
|
|
74
|
+
const saveHeight = elementHeight > maxHeight ? maxHeight : elementHeight;
|
|
75
|
+
|
|
76
|
+
const translateY = useMemo(
|
|
77
|
+
() => new Animated.Value(translateYStartingPoint),
|
|
78
|
+
[translateYStartingPoint]
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const open = () => {
|
|
82
|
+
Animated.timing(translateY, {
|
|
83
|
+
toValue: translateYStartingPoint - saveHeight,
|
|
84
|
+
duration: 500,
|
|
85
|
+
useNativeDriver: true,
|
|
86
|
+
}).start();
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const close = () => {
|
|
90
|
+
Animated.timing(translateY, {
|
|
91
|
+
toValue: translateYStartingPoint,
|
|
92
|
+
duration: 500,
|
|
93
|
+
useNativeDriver: true,
|
|
94
|
+
}).start();
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
if (isVisible) {
|
|
98
|
+
open();
|
|
99
|
+
} else {
|
|
100
|
+
close();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const transform = [{translateY: translateY}];
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<View style={styles.element} pointerEvents={isVisible ? 'auto' : 'none'}>
|
|
107
|
+
<Backdrop isVisible={isVisible} touchBackDrop={touchBackDrop} />
|
|
108
|
+
<Animated.View
|
|
109
|
+
style={[
|
|
110
|
+
styles.slidePanelContainer,
|
|
111
|
+
{maxHeight: maxHeight},
|
|
112
|
+
{transform: transform},
|
|
113
|
+
]}
|
|
114
|
+
>
|
|
115
|
+
<Swipe onIndexChange={handleChildIndexChange}>{renderChildren}</Swipe>
|
|
116
|
+
</Animated.View>
|
|
117
|
+
</View>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PopOverActionPreview: () => JSX.Element;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import {Button} from '../../molecules/button/button.component';
|
|
4
|
+
import {PopOverAction} from './popover-action.component';
|
|
5
|
+
import {Heading2} from '../../atoms/heading-components';
|
|
6
|
+
import {Icon} from '../../../icons/index';
|
|
7
|
+
import {Paragraph} from '../../atoms/paragraph-components';
|
|
8
|
+
import {TimePicker} from '../../molecules/time-picker/time-picker.component';
|
|
9
|
+
|
|
10
|
+
export const PopOverActionPreview = () => {
|
|
11
|
+
const [isVisible, setIsVisible] = useState<boolean>(false);
|
|
12
|
+
const [checkInHours, setCheckInHours] = useState('09');
|
|
13
|
+
const [checkInMinutes, setCheckInMinutes] = useState('06');
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<View style={{width: '100%', height: '100%', zIndex: 10000}}>
|
|
17
|
+
<View style={{marginTop: 150}}>
|
|
18
|
+
<Button
|
|
19
|
+
label={'Open popover action'}
|
|
20
|
+
onPress={() => setIsVisible(true)}
|
|
21
|
+
/>
|
|
22
|
+
</View>
|
|
23
|
+
|
|
24
|
+
<PopOverAction isVisible={isVisible} touchBackDrop={setIsVisible}>
|
|
25
|
+
{/*FIRST CHILD*/}
|
|
26
|
+
<View
|
|
27
|
+
style={{
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
gap: 60,
|
|
30
|
+
height: 460,
|
|
31
|
+
}}
|
|
32
|
+
key={1}
|
|
33
|
+
>
|
|
34
|
+
<View style={{gap: 10}}>
|
|
35
|
+
<Heading2 bold={true} textAlign={'center'}>
|
|
36
|
+
Uurregistratie
|
|
37
|
+
</Heading2>
|
|
38
|
+
|
|
39
|
+
<View
|
|
40
|
+
style={{
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
gap: 16,
|
|
43
|
+
justifyContent: 'center',
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
<Icon style={'regular'} name={'calendar'} color={'#000000'} />
|
|
48
|
+
<View>
|
|
49
|
+
<Paragraph>17 Jan 2021</Paragraph>
|
|
50
|
+
</View>
|
|
51
|
+
</View>
|
|
52
|
+
</View>
|
|
53
|
+
<TimePicker
|
|
54
|
+
initialHours={checkInHours}
|
|
55
|
+
initialMinutes={checkInMinutes}
|
|
56
|
+
onChangeHours={setCheckInHours}
|
|
57
|
+
onChangeMinutes={setCheckInMinutes}
|
|
58
|
+
/>
|
|
59
|
+
</View>
|
|
60
|
+
|
|
61
|
+
{/*SECOND CHILD*/}
|
|
62
|
+
|
|
63
|
+
<View
|
|
64
|
+
style={{
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
gap: 60,
|
|
67
|
+
height: 400,
|
|
68
|
+
}}
|
|
69
|
+
key={2}
|
|
70
|
+
>
|
|
71
|
+
<View style={{gap: 12}}>
|
|
72
|
+
<Heading2 bold={true} textAlign={'center'}>
|
|
73
|
+
Uurregistratie
|
|
74
|
+
</Heading2>
|
|
75
|
+
|
|
76
|
+
<View
|
|
77
|
+
style={{
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
gap: 16,
|
|
80
|
+
justifyContent: 'center',
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<Icon style={'regular'} name={'calendar'} color={'#000000'} />
|
|
85
|
+
<View>
|
|
86
|
+
<Paragraph>17 Jan 2021</Paragraph>
|
|
87
|
+
</View>
|
|
88
|
+
</View>
|
|
89
|
+
</View>
|
|
90
|
+
|
|
91
|
+
<TimePicker
|
|
92
|
+
initialHours={checkInHours}
|
|
93
|
+
initialMinutes={checkInMinutes}
|
|
94
|
+
onChangeHours={setCheckInHours}
|
|
95
|
+
onChangeMinutes={setCheckInMinutes}
|
|
96
|
+
/>
|
|
97
|
+
|
|
98
|
+
<Button
|
|
99
|
+
label={'Test button'}
|
|
100
|
+
onPress={() => console.log('pressed')}
|
|
101
|
+
/>
|
|
102
|
+
</View>
|
|
103
|
+
|
|
104
|
+
{/*Third CHILD*/}
|
|
105
|
+
|
|
106
|
+
<View
|
|
107
|
+
style={{
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
gap: 60,
|
|
110
|
+
height: 600,
|
|
111
|
+
}}
|
|
112
|
+
key={3}
|
|
113
|
+
>
|
|
114
|
+
<View style={{gap: 12}}>
|
|
115
|
+
<Heading2 bold={true} textAlign={'center'}>
|
|
116
|
+
Uurregistratie
|
|
117
|
+
</Heading2>
|
|
118
|
+
|
|
119
|
+
<View
|
|
120
|
+
style={{
|
|
121
|
+
flexDirection: 'row',
|
|
122
|
+
gap: 16,
|
|
123
|
+
justifyContent: 'center',
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
<Icon style={'regular'} name={'calendar'} color={'#000000'} />
|
|
128
|
+
<View>
|
|
129
|
+
<Paragraph>17 Jan 2021</Paragraph>
|
|
130
|
+
</View>
|
|
131
|
+
</View>
|
|
132
|
+
</View>
|
|
133
|
+
|
|
134
|
+
<Button
|
|
135
|
+
label={'Test button'}
|
|
136
|
+
onPress={() => console.log('pressed')}
|
|
137
|
+
/>
|
|
138
|
+
</View>
|
|
139
|
+
</PopOverAction>
|
|
140
|
+
</View>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function Stylesheet(context: any): {
|
|
2
|
+
element: {
|
|
3
|
+
width: string;
|
|
4
|
+
height: string;
|
|
5
|
+
position: 'absolute';
|
|
6
|
+
left: number;
|
|
7
|
+
top: number;
|
|
8
|
+
zIndex: number;
|
|
9
|
+
};
|
|
10
|
+
slidePanelContainer: {
|
|
11
|
+
position: 'relative';
|
|
12
|
+
display: 'flex';
|
|
13
|
+
flex: number;
|
|
14
|
+
alignItems: 'stretch';
|
|
15
|
+
paddingLeft: number;
|
|
16
|
+
paddingTop: number;
|
|
17
|
+
paddingRight: number;
|
|
18
|
+
paddingBottom: number;
|
|
19
|
+
marginLeft: number;
|
|
20
|
+
marginRight: number;
|
|
21
|
+
borderTopLeftRadius: number;
|
|
22
|
+
borderTopRightRadius: number;
|
|
23
|
+
zIndex: number;
|
|
24
|
+
backgroundColor: any;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {StyleSheet} from 'react-native';
|
|
3
|
+
import {Scale} from '../../../theme/scale/index';
|
|
4
|
+
|
|
5
|
+
export const Stylesheet = (context) =>
|
|
6
|
+
StyleSheet.create({
|
|
7
|
+
element: {
|
|
8
|
+
width: '100%',
|
|
9
|
+
height: '100%',
|
|
10
|
+
position: 'absolute',
|
|
11
|
+
left: 0,
|
|
12
|
+
top: 0,
|
|
13
|
+
zIndex: 1000,
|
|
14
|
+
},
|
|
15
|
+
slidePanelContainer: {
|
|
16
|
+
position: 'relative',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flex: 1,
|
|
19
|
+
alignItems: 'stretch',
|
|
20
|
+
paddingLeft: Scale.m,
|
|
21
|
+
paddingTop: Scale.xl,
|
|
22
|
+
paddingRight: Scale.m,
|
|
23
|
+
paddingBottom: Scale.m,
|
|
24
|
+
marginLeft: Scale.m,
|
|
25
|
+
marginRight: Scale.m,
|
|
26
|
+
borderTopLeftRadius: Scale.l,
|
|
27
|
+
borderTopRightRadius: Scale.l,
|
|
28
|
+
zIndex: 1004,
|
|
29
|
+
backgroundColor: context.colors.ui.white,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -21,7 +21,12 @@ export declare class ToddleDateTime {
|
|
|
21
21
|
static local(year: number, month: number, day: number, hour: number, minute: number, second: number, opts?: DateTimeJSOptions): ToddleDateTime;
|
|
22
22
|
static local(year: number, month: number, day: number, hour: number, minute: number, second: number, milliseconds: number, opts?: DateTimeJSOptions): ToddleDateTime;
|
|
23
23
|
static fromISO(date: string, options?: DateTimeOptions): ToddleDateTime;
|
|
24
|
+
static fromSeconds(seconds: number, options?: DateTimeJSOptions): ToddleDateTime;
|
|
24
25
|
static get DATE_MED(): DateTimeFormatOptions;
|
|
26
|
+
get hour(): number;
|
|
27
|
+
get minute(): number;
|
|
28
|
+
get second(): number;
|
|
29
|
+
get millisecond(): number;
|
|
25
30
|
get day(): number;
|
|
26
31
|
get weekdayShort(): string;
|
|
27
32
|
plus(duration: DurationLike): ToddleDateTime;
|
|
@@ -87,6 +87,13 @@ export class ToddleDateTime {
|
|
|
87
87
|
return new ToddleDateTime(LuxonDateTime.fromISO(date, options));
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
static fromSeconds(
|
|
91
|
+
seconds: number,
|
|
92
|
+
options?: DateTimeJSOptions
|
|
93
|
+
): ToddleDateTime {
|
|
94
|
+
return new ToddleDateTime(LuxonDateTime.fromSeconds(seconds, options));
|
|
95
|
+
}
|
|
96
|
+
|
|
90
97
|
// FORMAT PRESETS
|
|
91
98
|
|
|
92
99
|
static get DATE_MED(): DateTimeFormatOptions {
|
|
@@ -95,6 +102,22 @@ export class ToddleDateTime {
|
|
|
95
102
|
|
|
96
103
|
// GET
|
|
97
104
|
|
|
105
|
+
get hour(): number {
|
|
106
|
+
return this.dateTime.hour;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
get minute(): number {
|
|
110
|
+
return this.dateTime.minute;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
get second(): number {
|
|
114
|
+
return this.dateTime.second;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
get millisecond(): number {
|
|
118
|
+
return this.dateTime.millisecond;
|
|
119
|
+
}
|
|
120
|
+
|
|
98
121
|
get day(): number {
|
|
99
122
|
return this.dateTime.day;
|
|
100
123
|
}
|
|
@@ -7,13 +7,15 @@ import {Heading2, Heading4} from '../../components/atoms/heading-components';
|
|
|
7
7
|
export const ToddleDateTimePreview = ({}: {}) => {
|
|
8
8
|
const now = ToddleDateTime.now();
|
|
9
9
|
const fromISO = ToddleDateTime.fromISO('2016-05-25T09:08:34.123');
|
|
10
|
-
const
|
|
10
|
+
const timestamp = 1688729520;
|
|
11
|
+
|
|
11
12
|
return (
|
|
12
13
|
<View
|
|
13
14
|
style={{
|
|
14
15
|
marginTop: 50,
|
|
15
16
|
alignContent: 'center',
|
|
16
17
|
justifyContent: 'center',
|
|
18
|
+
paddingBottom: 50,
|
|
17
19
|
}}
|
|
18
20
|
>
|
|
19
21
|
<Heading2 bold={true} textAlign={'center'} addStyle={{marginBottom: 50}}>
|
|
@@ -110,6 +112,18 @@ export const ToddleDateTimePreview = ({}: {}) => {
|
|
|
110
112
|
<Paragraph addStyle={{marginBottom: 12}}>
|
|
111
113
|
{fromISO.timestamp()}
|
|
112
114
|
</Paragraph>
|
|
115
|
+
|
|
116
|
+
<Heading4 bold={true}>.fromSeconds(seconds, options?)</Heading4>
|
|
117
|
+
<Paragraph>Returns a ToddleDateTime from a timestamp.</Paragraph>
|
|
118
|
+
<Paragraph addStyle={{marginBottom: 12}}>
|
|
119
|
+
{ToddleDateTime.fromSeconds(timestamp).toLocaleString({
|
|
120
|
+
day: 'numeric',
|
|
121
|
+
month: 'short',
|
|
122
|
+
hourCycle: 'h24',
|
|
123
|
+
hour: 'numeric',
|
|
124
|
+
minute: '2-digit',
|
|
125
|
+
})}
|
|
126
|
+
</Paragraph>
|
|
113
127
|
</ScrollView>
|
|
114
128
|
</View>
|
|
115
129
|
);
|