@tactics/toddle-styleguide 0.1.11 → 0.1.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tactics/toddle-styleguide",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -2,6 +2,8 @@ import { ToddleDateTime } from '../../../utilities/toddle-datetime/toddle-dateti
2
2
  declare type CalendarSelectProps = {
3
3
  onPressDate: (date: ToddleDateTime) => void;
4
4
  startDate: ToddleDateTime;
5
+ pressChevronRight?: (date: ToddleDateTime) => void;
6
+ pressChevronLeft?: (date: ToddleDateTime) => void;
5
7
  };
6
- declare const CalendarSelect: ({ onPressDate, startDate }: CalendarSelectProps) => JSX.Element;
8
+ declare const CalendarSelect: ({ onPressDate, startDate, pressChevronLeft, pressChevronRight, }: CalendarSelectProps) => JSX.Element;
7
9
  export { CalendarSelect as CalendarSelect };
@@ -11,9 +11,16 @@ import {CalendarIcon} from '../../../icons/outline/calendar/calendar.icon';
11
11
  type CalendarSelectProps = {
12
12
  onPressDate: (date: ToddleDateTime) => void;
13
13
  startDate: ToddleDateTime;
14
+ pressChevronRight?: (date: ToddleDateTime) => void;
15
+ pressChevronLeft?: (date: ToddleDateTime) => void;
14
16
  };
15
17
 
16
- const CalendarSelect = ({onPressDate, startDate}: CalendarSelectProps) => {
18
+ const CalendarSelect = ({
19
+ onPressDate,
20
+ startDate,
21
+ pressChevronLeft,
22
+ pressChevronRight,
23
+ }: CalendarSelectProps) => {
17
24
  const context = useContext(ThemeCtx);
18
25
  const styles = Stylesheet(context);
19
26
 
@@ -29,7 +36,12 @@ const CalendarSelect = ({onPressDate, startDate}: CalendarSelectProps) => {
29
36
 
30
37
  return (
31
38
  <View style={styles.container}>
32
- <Pressable onPress={onPressLeft}>
39
+ <Pressable
40
+ onPress={() => {
41
+ onPressLeft();
42
+ if (pressChevronLeft) pressChevronLeft(visibleDate.minus({days: 1}));
43
+ }}
44
+ >
33
45
  <ChevronLeftIcon />
34
46
  </Pressable>
35
47
 
@@ -47,7 +59,12 @@ const CalendarSelect = ({onPressDate, startDate}: CalendarSelectProps) => {
47
59
  </View>
48
60
  </Pressable>
49
61
 
50
- <Pressable onPress={onPressRight}>
62
+ <Pressable
63
+ onPress={() => {
64
+ onPressRight();
65
+ if (pressChevronRight) pressChevronRight(visibleDate.plus({days: 1}));
66
+ }}
67
+ >
51
68
  <ChevronRightIcon />
52
69
  </Pressable>
53
70
  </View>
@@ -16,6 +16,18 @@ export const CalendarSelectPreview = ({}: {}) => {
16
16
  )
17
17
  }
18
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
+ }
19
31
  />
20
32
  </View>
21
33
  );
@@ -1,10 +1,9 @@
1
- import { DateTime as LuxonDateTime } from 'luxon';
2
1
  import { LocaleOptions, DateTimeOptions } from './interfaces/toddle-datetime.interface';
3
2
  import { DurationLike } from './types/duration-like.type';
4
3
  import { DateTimeFormatOptions, DateTimeUnit } from './types/toddle-datetime.type';
5
4
  export declare class ToddleDateTime {
6
5
  private dateTime;
7
- constructor(dateTime?: LuxonDateTime);
6
+ private constructor();
8
7
  static now(): ToddleDateTime;
9
8
  static fromISO(date: string, options?: DateTimeOptions): ToddleDateTime;
10
9
  static get DATE_MED(): DateTimeFormatOptions;