@tactics/toddle-styleguide 1.4.7 → 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.7",
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
  };
@@ -76,81 +76,75 @@ const ChildListItem = React.memo(
76
76
  visualState={visualStateTimeTracker}
77
77
  textColor={textColor}
78
78
  />
79
- } else {
80
- return <View style={styles.timeTrackerSpacer}></View>
81
79
  }
82
-
83
80
  }
84
81
 
85
82
  return (
86
83
  <View style={styles.container}>
87
- <Pressable
88
- onPress={onPressSelectable}
89
- style={styles.innerContainer}
90
- onLongPress={onLongPressCallback}
91
- >
92
- <Avatar
93
- source={sourceAvatar}
94
- size={Size.MEDIUM}
95
- isLoading={longPressExecuting}
96
- />
97
- <View style={styles.pressableText}>
98
- <View style={styles.trackerContainer}>
99
- {renderTimeTracker(textTimeTracker, visualStateTimeTracker)}
100
- </View>
101
- <View>
102
- <Heading2
103
- bold={true}
104
- numberOfLines={1}
105
- ellipsizeMode={'tail'}
106
- textColor={
107
- isSelected ? context.colors.ui.white : context.colors.ui.black
108
- }
109
- >
110
- {name}
111
- </Heading2>
112
- <SmallText
113
- textColor={
114
- isSelected ? context.colors.ui.white : context.colors.ui.black
115
- }
116
- >
117
- {department}
118
- </SmallText>
119
- </View>
120
- {tags && (
121
- <View
122
- style={{
123
- flexDirection: 'row',
124
- gap: 6,
125
- flexWrap: 'wrap',
126
- marginTop: 10,
127
- }}
128
- >
129
- {tags.map((tag) => {
130
- return (
131
- <ChildListTag
132
- key={`${id}--${tag}`}
133
- label={tag}
134
- isSelected={isSelected}
135
- />
136
- );
137
- })}
138
- </View>
139
- )}
140
- </View>
141
- </Pressable>
142
- {!selectable && (
84
+ <View style={styles.pressableContainer}>
143
85
  <Pressable
144
- onPress={onPressArrowCallback}
145
- style={styles.iconContainer}
86
+ onPress={onPressSelectable}
87
+ style={styles.innerContainer}
88
+ onLongPress={onLongPressCallback}
146
89
  >
147
- <Icon
148
- style={'regular'}
149
- name={'chevron-right'}
150
- size={20}
151
- color={context.colors.ui.black}
90
+ <Avatar
91
+ source={sourceAvatar}
92
+ size={Size.MEDIUM}
93
+ isLoading={longPressExecuting}
152
94
  />
95
+ <View style={styles.pressableText}>
96
+ <View style={styles.trackerContainer}>
97
+ {renderTimeTracker(textTimeTracker, visualStateTimeTracker)}
98
+ </View>
99
+ <View>
100
+ <Heading2
101
+ bold={true}
102
+ numberOfLines={1}
103
+ ellipsizeMode={'tail'}
104
+ textColor={
105
+ isSelected ? context.colors.ui.white : context.colors.ui.black
106
+ }
107
+ >
108
+ {name}
109
+ </Heading2>
110
+ <SmallText
111
+ textColor={
112
+ isSelected ? context.colors.ui.white : context.colors.ui.black
113
+ }
114
+ >
115
+ {department}
116
+ </SmallText>
117
+ </View>
118
+ </View>
153
119
  </Pressable>
120
+ {!selectable && (
121
+ <Pressable
122
+ onPress={onPressArrowCallback}
123
+ style={styles.iconContainer}
124
+ >
125
+ <Icon
126
+ style={'regular'}
127
+ name={'chevron-right'}
128
+ size={20}
129
+ color={context.colors.ui.black}
130
+ />
131
+ </Pressable>
132
+ )}
133
+ </View>
134
+ {tags && (
135
+ <View
136
+ style={styles.tagContainer}
137
+ >
138
+ {tags.map((tag) => {
139
+ return (
140
+ <ChildListTag
141
+ key={`${id}--${tag}`}
142
+ label={tag}
143
+ isSelected={isSelected}
144
+ />
145
+ );
146
+ })}
147
+ </View>
154
148
  )}
155
149
  </View>
156
150
  );
@@ -5,7 +5,7 @@ export function Stylesheet(isSelectedItem: any, context: any): {
5
5
  borderBottomRightRadius: number;
6
6
  borderTopLeftRadius: number;
7
7
  borderBottomLeftRadius: number;
8
- flexDirection: "row";
8
+ flexDirection: "column";
9
9
  backgroundColor: any;
10
10
  };
11
11
  innerContainer: {
@@ -16,6 +16,12 @@ export function Stylesheet(isSelectedItem: any, context: any): {
16
16
  borderBottomRightRadius: number;
17
17
  borderTopLeftRadius: number;
18
18
  borderBottomLeftRadius: number;
19
+ alignItems: "center";
20
+ };
21
+ pressableContainer: {
22
+ flex: number;
23
+ flexDirection: "row";
24
+ alignItems: "center";
19
25
  };
20
26
  pressableText: {
21
27
  marginLeft: number;
@@ -37,4 +43,10 @@ export function Stylesheet(isSelectedItem: any, context: any): {
37
43
  height: number;
38
44
  marginBottom: number;
39
45
  };
46
+ tagContainer: {
47
+ flexDirection: "row";
48
+ gap: number;
49
+ flexWrap: "wrap";
50
+ marginLeft: number;
51
+ };
40
52
  };
@@ -10,7 +10,7 @@ export const Stylesheet = (isSelectedItem, context) =>
10
10
  borderBottomRightRadius: Scale.l,
11
11
  borderTopLeftRadius: Scale.xl,
12
12
  borderBottomLeftRadius: Scale.xl,
13
- flexDirection: 'row',
13
+ flexDirection: 'column',
14
14
  backgroundColor: isSelectedItem
15
15
  ? context.colors.main[6]
16
16
  : context.colors.ui.white,
@@ -23,10 +23,16 @@ export const Stylesheet = (isSelectedItem, context) =>
23
23
  borderBottomRightRadius: Scale.l,
24
24
  borderTopLeftRadius: Scale.xxl,
25
25
  borderBottomLeftRadius: Scale.xxl,
26
+ alignItems: 'center'
27
+ },
28
+ pressableContainer: {
29
+ flex: 1,
30
+ flexDirection: 'row',
31
+ alignItems: 'center',
26
32
  },
27
33
  pressableText: {
28
34
  marginLeft: Scale.l,
29
- flex: 1,
35
+ flex: 1
30
36
  },
31
37
  iconContainer: {
32
38
  alignItems: 'flex-end',
@@ -43,5 +49,11 @@ export const Stylesheet = (isSelectedItem, context) =>
43
49
  timeTrackerSpacer: {
44
50
  height: Scale.s,
45
51
  marginBottom: Scale.xxs
52
+ },
53
+ tagContainer: {
54
+ flexDirection: 'row',
55
+ gap: Scale.s,
56
+ flexWrap: 'wrap',
57
+ marginLeft: Scale.xxxxl
46
58
  }
47
59
  });
@@ -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
+ }