@tactics/toddle-styleguide 1.2.2 → 1.2.3
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 +11 -1
- package/index.d.ts +3 -2
- package/index.tsx +4 -2
- package/package.json +5 -1
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +234 -234
- package/src/components/atoms/calendar/calendar.component.tsx +8 -6
- package/src/components/molecules/calendar-select/calendar-select.component.d.ts +2 -2
- package/src/components/molecules/calendar-select/calendar-select.component.tsx +4 -14
- package/src/components/molecules/calendar-select/calendar-select.preview.tsx +9 -22
- package/src/components/molecules/time-picker/__snapshots__/time-picker.test.js.snap +2149 -0
- package/src/components/molecules/time-picker/time-picker.component.d.ts +8 -0
- package/src/components/molecules/time-picker/time-picker.component.tsx +65 -0
- package/src/components/molecules/time-picker/time-picker.preview.d.ts +1 -0
- package/src/components/molecules/time-picker/time-picker.preview.tsx +109 -0
- package/src/components/molecules/time-picker/time-picker.styles.d.ts +15 -0
- package/src/components/molecules/time-picker/time-picker.styles.js +19 -0
- package/src/components/molecules/time-picker/time-picker.test.js +18 -0
- package/src/components/molecules/time-tracker/time-tracker.test.js +0 -1
- package/src/components/molecules/timeline/__snapshots__/timeline.test.js.snap +47 -39
- package/src/components/molecules/timeline/timeline.component.d.ts +2 -2
- package/src/components/molecules/timeline/timeline.component.tsx +27 -120
- package/src/components/molecules/timeline/timeline.preview.tsx +9 -20
- package/src/components/molecules/timeline/timeline.styles.d.ts +58 -40
- package/src/components/molecules/timeline/timeline.styles.js +24 -17
- package/src/components/molecules/timeline/timeline.test.js +3 -3
- package/src/components/templates/modal/components/fade-panel.component.d.ts +2 -1
- package/src/components/templates/modal/components/fade-panel.component.tsx +8 -2
- package/src/components/templates/modal/modal.component.d.ts +2 -1
- package/src/components/templates/modal/modal.component.tsx +4 -3
- package/src/components/templates/modal/modal.styles.d.ts +3 -6
- package/src/components/templates/modal/modal.styles.js +3 -3
- package/src/components/templates/popover/components/modal/modal.component.tsx +0 -2
- package/src/theme/provider/parent.theme.d.ts +4 -1
- package/src/theme/provider/parent.theme.ts +4 -1
- package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +2 -2
- package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +2 -2
|
@@ -63,18 +63,20 @@ export const Calendar = ({
|
|
|
63
63
|
}: CalendarProps) => {
|
|
64
64
|
const context = useContext(ThemeCtx);
|
|
65
65
|
const styles = Stylesheet(context);
|
|
66
|
-
const initDate = ToddleDateTime.now().toISODate();
|
|
66
|
+
const initDate = ToddleDateTime.now().toISODate() || undefined;
|
|
67
67
|
|
|
68
68
|
const today = selected.toISODate();
|
|
69
69
|
|
|
70
|
-
const marked = useMemo(
|
|
71
|
-
()
|
|
70
|
+
const marked = useMemo(() => {
|
|
71
|
+
if (today === null) {
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
72
75
|
[today]: {
|
|
73
76
|
selected: true,
|
|
74
77
|
},
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
);
|
|
78
|
+
};
|
|
79
|
+
}, [today]);
|
|
78
80
|
|
|
79
81
|
return (
|
|
80
82
|
<RNCalendar
|
|
@@ -2,8 +2,8 @@ import { ToddleDateTime } from '../../../utilities/toddle-datetime/toddle-dateti
|
|
|
2
2
|
type CalendarSelectProps = {
|
|
3
3
|
onPressDate: (date: ToddleDateTime) => void;
|
|
4
4
|
startDate: ToddleDateTime;
|
|
5
|
-
pressChevronRight
|
|
6
|
-
pressChevronLeft
|
|
5
|
+
pressChevronRight: (date: ToddleDateTime) => void;
|
|
6
|
+
pressChevronLeft: (date: ToddleDateTime) => void;
|
|
7
7
|
};
|
|
8
8
|
declare const CalendarSelect: ({ onPressDate, startDate, pressChevronLeft, pressChevronRight, }: CalendarSelectProps) => JSX.Element;
|
|
9
9
|
export { CalendarSelect as CalendarSelect };
|
|
@@ -10,8 +10,8 @@ import {Icon} from '../../../icons/index';
|
|
|
10
10
|
type CalendarSelectProps = {
|
|
11
11
|
onPressDate: (date: ToddleDateTime) => void;
|
|
12
12
|
startDate: ToddleDateTime;
|
|
13
|
-
pressChevronRight
|
|
14
|
-
pressChevronLeft
|
|
13
|
+
pressChevronRight: (date: ToddleDateTime) => void;
|
|
14
|
+
pressChevronLeft: (date: ToddleDateTime) => void;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const CalendarSelect = ({
|
|
@@ -29,20 +29,11 @@ const CalendarSelect = ({
|
|
|
29
29
|
setVisibleDate(startDate);
|
|
30
30
|
}, [startDate]);
|
|
31
31
|
|
|
32
|
-
const onPressRight = () => {
|
|
33
|
-
setVisibleDate(visibleDate.plus({days: 1}));
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const onPressLeft = () => {
|
|
37
|
-
setVisibleDate(visibleDate.minus({days: 1}));
|
|
38
|
-
};
|
|
39
|
-
|
|
40
32
|
return (
|
|
41
33
|
<View style={styles.container}>
|
|
42
34
|
<Pressable
|
|
43
35
|
onPress={() => {
|
|
44
|
-
|
|
45
|
-
if (pressChevronLeft) pressChevronLeft(visibleDate.minus({days: 1}));
|
|
36
|
+
pressChevronLeft(visibleDate.minus({days: 1}));
|
|
46
37
|
}}
|
|
47
38
|
>
|
|
48
39
|
<Icon style={'regular'} name={'chevron-left'} />
|
|
@@ -68,8 +59,7 @@ const CalendarSelect = ({
|
|
|
68
59
|
|
|
69
60
|
<Pressable
|
|
70
61
|
onPress={() => {
|
|
71
|
-
|
|
72
|
-
if (pressChevronRight) pressChevronRight(visibleDate.plus({days: 1}));
|
|
62
|
+
pressChevronRight(visibleDate.plus({days: 1}));
|
|
73
63
|
}}
|
|
74
64
|
>
|
|
75
65
|
<Icon style={'regular'} name={'chevron-right'} />
|
|
@@ -1,33 +1,20 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
2
|
import {View} from 'react-native';
|
|
3
3
|
import {CalendarSelect} from './calendar-select.component';
|
|
4
4
|
import {ToddleDateTime} from '../../../utilities/toddle-datetime/toddle-datetime.class';
|
|
5
5
|
|
|
6
6
|
export const CalendarSelectPreview = ({}: {}) => {
|
|
7
|
+
const [date, setDate] = useState(
|
|
8
|
+
ToddleDateTime.local({zone: 'America/Los_Angeles'})
|
|
9
|
+
);
|
|
10
|
+
console.log(date);
|
|
7
11
|
return (
|
|
8
12
|
<View>
|
|
9
13
|
<CalendarSelect
|
|
10
|
-
onPressDate={(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'date is:',
|
|
15
|
-
date.toLocaleString(ToddleDateTime.DATE_MED)
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
startDate={ToddleDateTime.now()}
|
|
19
|
-
pressChevronRight={(date) =>
|
|
20
|
-
console.log(
|
|
21
|
-
'pijl rechts gedrukt, aangepaste data=',
|
|
22
|
-
date.toLocaleString()
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
pressChevronLeft={(date) =>
|
|
26
|
-
console.log(
|
|
27
|
-
'pijl links gedrukt, aangepaste data=',
|
|
28
|
-
date.toLocaleString()
|
|
29
|
-
)
|
|
30
|
-
}
|
|
14
|
+
onPressDate={() => console.log('open modal')}
|
|
15
|
+
startDate={date}
|
|
16
|
+
pressChevronRight={setDate}
|
|
17
|
+
pressChevronLeft={setDate}
|
|
31
18
|
/>
|
|
32
19
|
</View>
|
|
33
20
|
);
|