@tactics/toddle-styleguide 1.4.8 → 1.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/App.tsx CHANGED
@@ -73,6 +73,7 @@ import {QuickMessagePreview} from './src/components/atoms/quick-message/quick-me
73
73
  import {TabViewPreview} from './src/components/organisms/tab-view/tab-view.preview';
74
74
  import {LinePreview} from './src/components/atoms/line/line.preview';
75
75
  import {JournalEntryPreview} from './src/components/organisms/journal-entry/journal-entry.preview';
76
+ import { TimetableEditPreview } from './src/components/organisms/timetable-edit/timetable-edit.preview';
76
77
 
77
78
  import {
78
79
  SafeAreaProvider,
@@ -278,6 +279,10 @@ const HomeScreen = ({navigation}: {navigation: any}) => {
278
279
  title="Time Tracker"
279
280
  onPress={() => navigation.push('time-tracker')}
280
281
  />
282
+ <ReactBtn
283
+ title="Timetable Edit"
284
+ onPress={() => navigation.push('timetable-edit')}
285
+ />
281
286
  <ReactBtn title="Timeline" onPress={() => navigation.push('timeline')} />
282
287
  <ReactBtn
283
288
  title="Toddle DateTime"
@@ -464,6 +469,9 @@ function App() {
464
469
  <Stack.Screen name="time-tracker">
465
470
  {() => <TimeTrackerPreview />}
466
471
  </Stack.Screen>
472
+ <Stack.Screen name="timetable-edit">
473
+ {() => <TimetableEditPreview />}
474
+ </Stack.Screen>
467
475
  <Stack.Screen name="timeline">
468
476
  {() => <TimeLinePreview />}
469
477
  </Stack.Screen>
package/index.d.ts CHANGED
@@ -58,6 +58,7 @@ import { QuickMessage } from './src/components/atoms/quick-message/quick-message
58
58
  import { TabView } from './src/components/organisms/tab-view/tab-view.component';
59
59
  import { Line } from './src/components/atoms/line/line.component';
60
60
  import { JournalEntry } from './src/components/organisms/journal-entry/journal-entry.component';
61
+ import { TimetableEdit } from './src/components/organisms/timetable-edit/timetable-edit.component';
61
62
  import { BubbleAlignment } from './src/types/bubble-alignment.enum';
62
63
  import { KeyBoardTypes } from './src/types/keyboard-types.enum';
63
64
  import { Size } from './src/types/size.enum';
@@ -67,4 +68,4 @@ import { ToddleDateTime } from './src/utilities/toddle-datetime/toddle-datetime.
67
68
  import { ThemeCtx } from './src/context/theme.context';
68
69
  import { Scale } from './src/theme/scale/index';
69
70
  import CreateResponsiveStyle from './src/theme/responsive/index';
70
- export { AllCapsHeading, Avatar, BackgroundGradient, BlockedMessage, Button, Calendar, CalendarSelect, CancelLink, Check, Checkbox, ChildListItem, ContactItem, ContactRole, DateInput, DaySelect, DefaultSelect, DepartmentLogo, FilterRange, FilterTab, Footer, Heading1, Heading2, Heading3, Heading4, Icon, ImageBubble, IncrementInput, Info, JournalEntry, LanguageButton, Line, LoadingIndicator, Logo, MessageInput, Modal, MoreInfoButton, MyChildListItem, Paragraph, PasswordInput, PersonInfoCard, Pill, Popover, PopOverAction, PressableIcon, QuickFilter, QuickMessage, Search, SelectLink, SelectListItem, SelectPicker, SmallText, Snackbar, SplitContainer, Swipe, TabView, Tag, TextBubble, TextInput, TimeLine, TimePicker, TimeTracker, TinyText, WaveBackground, WideButton, BubbleAlignment, Initials, KeyBoardTypes, Size, ThemeCtx, ToddleDateTime, VisualState, CreateResponsiveStyle, Scale, };
71
+ export { AllCapsHeading, Avatar, BackgroundGradient, BlockedMessage, Button, Calendar, CalendarSelect, CancelLink, Check, Checkbox, ChildListItem, ContactItem, ContactRole, DateInput, DaySelect, DefaultSelect, DepartmentLogo, FilterRange, FilterTab, Footer, Heading1, Heading2, Heading3, Heading4, Icon, ImageBubble, IncrementInput, Info, JournalEntry, LanguageButton, Line, LoadingIndicator, Logo, MessageInput, Modal, MoreInfoButton, MyChildListItem, Paragraph, PasswordInput, PersonInfoCard, Pill, Popover, PopOverAction, PressableIcon, QuickFilter, QuickMessage, Search, SelectLink, SelectListItem, SelectPicker, SmallText, Snackbar, SplitContainer, Swipe, TabView, Tag, TextBubble, TextInput, TimeLine, TimePicker, TimeTracker, TinyText, WaveBackground, WideButton, BubbleAlignment, Initials, KeyBoardTypes, Size, ThemeCtx, ToddleDateTime, VisualState, CreateResponsiveStyle, Scale, TimetableEdit };
package/index.tsx CHANGED
@@ -76,6 +76,7 @@ import {QuickMessage} from './src/components/atoms/quick-message/quick-message.c
76
76
  import {TabView} from './src/components/organisms/tab-view/tab-view.component';
77
77
  import {Line} from './src/components/atoms/line/line.component';
78
78
  import {JournalEntry} from './src/components/organisms/journal-entry/journal-entry.component';
79
+ import {TimetableEdit} from './src/components/organisms/timetable-edit/timetable-edit.component';
79
80
 
80
81
  // Exports of enums
81
82
  import {BubbleAlignment} from './src/types/bubble-alignment.enum';
@@ -172,4 +173,5 @@ export {
172
173
  VisualState,
173
174
  CreateResponsiveStyle,
174
175
  Scale,
176
+ TimetableEdit
175
177
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tactics/toddle-styleguide",
3
- "version": "1.4.8",
3
+ "version": "1.4.9",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -1,6 +1,6 @@
1
1
  import {View} from 'react-native';
2
2
  import WheelPickerExpo from 'react-native-wheel-picker-expo';
3
- import {Heading1, Heading3} from '../../atoms/heading-components';
3
+ import {Heading1} from '../../atoms/heading-components';
4
4
  import {Stylesheet} from './time-picker.styles';
5
5
  import {Scale} from '../../../theme/scale/index';
6
6
  import {useContext} from 'react';
@@ -1,27 +1,27 @@
1
1
  export function Stylesheet(context: any): {
2
- rootContainer: {
3
- flexDirection: 'row';
4
- alignItems: 'center';
5
- gap: number;
6
- };
7
- container: {
8
- borderColor: any;
9
- borderWidth: number;
10
- borderStyle: 'solid';
11
- borderRadius: number;
12
- overflow: 'hidden';
13
- justifyContent: 'center';
14
- alignItems: 'center';
15
- maxHeight: number;
16
- maxWidth: number;
17
- };
18
- text: {
19
- fontWeight: '200';
20
- fontSize: number;
21
- };
22
- colon: {
23
- fontWeight: '200';
24
- lineHeight: number;
25
- fontSize: number;
26
- };
2
+ rootContainer: {
3
+ flexDirection: "row";
4
+ alignItems: "center";
5
+ gap: number;
6
+ };
7
+ container: {
8
+ borderColor: any;
9
+ borderWidth: number;
10
+ borderStyle: "solid";
11
+ borderRadius: number;
12
+ overflow: "hidden";
13
+ justifyContent: "center";
14
+ alignItems: "center";
15
+ maxHeight: number;
16
+ maxWidth: number;
17
+ };
18
+ text: {
19
+ fontWeight: "200";
20
+ fontSize: number;
21
+ };
22
+ colon: {
23
+ fontWeight: "200";
24
+ lineHeight: number;
25
+ fontSize: number;
26
+ };
27
27
  };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ interface TimetableEditProps {
3
+ initialInHours: string;
4
+ initialInMinutes: string;
5
+ initialOutHours: string;
6
+ initialOutMinutes: string;
7
+ onChangeInHours: (value: string) => void;
8
+ onChangeInMinutes: (value: string) => void;
9
+ onChangeOutHours: (value: string) => void;
10
+ onChangeOutMinutes: (value: string) => void;
11
+ }
12
+ export declare const TimetableEdit: ({ initialInHours, initialInMinutes, initialOutHours, initialOutMinutes, onChangeInHours, onChangeInMinutes, onChangeOutHours, onChangeOutMinutes, }: TimetableEditProps) => React.JSX.Element;
13
+ export {};
@@ -0,0 +1,94 @@
1
+ import {View} from 'react-native';
2
+ import {Heading3} from '../../atoms/heading-components';
3
+ import {useContext, useState} from 'react';
4
+ import {ThemeCtx} from '../../../context/theme.context';
5
+ import React from 'react';
6
+ import { Stylesheet } from './timetable-edit.styles';
7
+ import { Tag } from '../../molecules/tag/tag.component';
8
+ import { TimetableEditState } from '../../../types/timetable-edit.enum';
9
+ import { TimePicker } from '../../molecules/time-picker/time-picker.component';
10
+
11
+ interface TimetableEditProps {
12
+ initialInHours: string;
13
+ initialInMinutes: string;
14
+ initialOutHours: string;
15
+ initialOutMinutes: string;
16
+ onChangeInHours: (value: string) => void;
17
+ onChangeInMinutes: (value: string) => void;
18
+ onChangeOutHours: (value: string) => void;
19
+ onChangeOutMinutes: (value: string) => void;
20
+ }
21
+
22
+ export const TimetableEdit = ({
23
+ initialInHours,
24
+ initialInMinutes,
25
+ initialOutHours,
26
+ initialOutMinutes,
27
+ onChangeInHours,
28
+ onChangeInMinutes,
29
+ onChangeOutHours,
30
+ onChangeOutMinutes,
31
+ }: TimetableEditProps) => {
32
+ const context = useContext(ThemeCtx);
33
+ const styles = Stylesheet(context);
34
+ const [editState, setEditState] = useState('');
35
+
36
+ const updateEditState = (state: string) => {
37
+ if (editState == state) {
38
+ setEditState('')
39
+ } else {
40
+ setEditState(state);
41
+ }
42
+ }
43
+
44
+ return (
45
+ <View style={styles.rootContainer}>
46
+ <View style={styles.rowContainer}>
47
+ <View style={styles.tagContainer}>
48
+ <Heading3
49
+ addStyle={{width: 'auto'}}
50
+ bold={true}
51
+ >Van</Heading3>
52
+ <Tag
53
+ value={TimetableEditState.IN}
54
+ label={`${initialInHours}:${initialInMinutes}`}
55
+ isSelected={editState == TimetableEditState.IN}
56
+ onPress={updateEditState}
57
+ />
58
+ </View>
59
+ <View style={styles.tagContainer}>
60
+ <Heading3
61
+ addStyle={{width: 'auto'}}
62
+ bold={true}
63
+ >Tot</Heading3>
64
+ <Tag
65
+ value={TimetableEditState.OUT}
66
+ label={`${initialOutHours}:${initialOutMinutes}`}
67
+ isSelected={editState == TimetableEditState.OUT}
68
+ onPress={updateEditState}
69
+ />
70
+ </View>
71
+ </View>
72
+ {editState === TimetableEditState.IN &&
73
+ <View style={styles.pickerContainer}>
74
+ <TimePicker
75
+ initialHours={initialInHours}
76
+ initialMinutes={initialInMinutes}
77
+ onChangeHours={onChangeInHours}
78
+ onChangeMinutes={onChangeInMinutes}
79
+ />
80
+ </View>
81
+ }
82
+ {editState === TimetableEditState.OUT &&
83
+ <View style={styles.pickerContainer}>
84
+ <TimePicker
85
+ initialHours={initialOutHours}
86
+ initialMinutes={initialOutMinutes}
87
+ onChangeHours={onChangeOutHours}
88
+ onChangeMinutes={onChangeOutMinutes}
89
+ />
90
+ </View>
91
+ }
92
+ </View>
93
+ );
94
+ };
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const TimetableEditPreview: ({}: {}) => React.JSX.Element;
@@ -0,0 +1,72 @@
1
+ import React, {useState} from 'react';
2
+ import {View} from 'react-native';
3
+ import {Modal} from '../../templates/modal/modal.component';
4
+ import { Button } from '../../molecules/button/button.component';
5
+ import { TimetableEdit } from './timetable-edit.component';
6
+
7
+ export const TimetableEditPreview = ({}: {}) => {
8
+ const [popoverIsVisible, setPopoverIsVisible] = useState(false);
9
+
10
+ const [checkInHours, setCheckInHours] = useState('09');
11
+ const [checkInMinutes, setCheckInMinutes] = useState('06');
12
+
13
+ const [checkOutHours, setCheckOutHours] = useState('--');
14
+ const [checkOutMinutes, setCheckOutMinutes] = useState('--');
15
+
16
+ console.log(`
17
+ Check In:
18
+ Hours: ${checkInHours}
19
+ Minutes: ${checkInMinutes}
20
+
21
+ Check Out:
22
+ Hours: ${checkOutHours}
23
+ Minutes: ${checkOutMinutes}
24
+ `);
25
+
26
+ return (
27
+ <View
28
+ style={{
29
+ width: '100%',
30
+ height: '100%',
31
+ zIndex: 10000,
32
+ }}
33
+ >
34
+ <View
35
+ style={{
36
+ marginTop: 150,
37
+ }}
38
+ >
39
+ <Button
40
+ onPress={() => setPopoverIsVisible(true)}
41
+ label="Open popover"
42
+ />
43
+ </View>
44
+ <Modal
45
+ title={'Bewerken'}
46
+ subtitle={'17 Jan 2021'}
47
+ onClose={() => setPopoverIsVisible(false)}
48
+ isVisible={popoverIsVisible}
49
+ >
50
+ <View>
51
+ <TimetableEdit
52
+ initialInHours={checkInHours}
53
+ initialInMinutes={checkInMinutes}
54
+ initialOutHours={checkOutHours}
55
+ initialOutMinutes={checkOutMinutes}
56
+ onChangeInHours={setCheckInHours}
57
+ onChangeInMinutes={setCheckInMinutes}
58
+ onChangeOutHours={setCheckOutHours}
59
+ onChangeOutMinutes={setCheckOutMinutes}
60
+ />
61
+
62
+ <View style={{marginTop: 32, marginBottom: 16, alignItems: 'center'}}>
63
+ <Button
64
+ label={'Bewaar'}
65
+ onPress={() => console.log('Bewaar registratie aanpassing')}
66
+ />
67
+ </View>
68
+ </View>
69
+ </Modal>
70
+ </View>
71
+ );
72
+ };
@@ -0,0 +1,21 @@
1
+ export function Stylesheet(context: any): {
2
+ rootContainer: {
3
+ flexDirection: "column";
4
+ gap: number;
5
+ justifyContent: "center";
6
+ alignItems: "center";
7
+ };
8
+ rowContainer: {
9
+ flexDirection: "row";
10
+ alignItems: "center";
11
+ gap: number;
12
+ };
13
+ tagContainer: {
14
+ flexDirection: "row";
15
+ alignItems: "center";
16
+ gap: number;
17
+ };
18
+ pickerContainer: {
19
+ justifyContent: "center";
20
+ };
21
+ };
@@ -0,0 +1,25 @@
1
+ import {StyleSheet} from 'react-native';
2
+ import {Scale} from '../../../theme/scale/index';
3
+
4
+ export const Stylesheet = (context) =>
5
+ StyleSheet.create({
6
+ rootContainer: {
7
+ flexDirection: 'column',
8
+ gap: 16,
9
+ justifyContent: 'center',
10
+ alignItems: 'center'
11
+ },
12
+ rowContainer : {
13
+ flexDirection: 'row',
14
+ alignItems: 'center',
15
+ gap: 32
16
+ },
17
+ tagContainer: {
18
+ flexDirection: 'row',
19
+ alignItems: 'center',
20
+ gap: 16
21
+ },
22
+ pickerContainer: {
23
+ justifyContent: 'center'
24
+ }
25
+ });
@@ -0,0 +1,4 @@
1
+ export declare enum TimetableEditState {
2
+ IN = "IN",
3
+ OUT = "OUT"
4
+ }
@@ -0,0 +1,4 @@
1
+ export enum TimetableEditState {
2
+ IN = 'IN',
3
+ OUT = 'OUT',
4
+ }