@momo-kits/calendar 0.0.55-beta.1 → 0.0.55-beta.11

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": "@momo-kits/calendar",
3
- "version": "0.0.55-beta.1",
3
+ "version": "0.0.55-beta.11",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "dependencies": {
package/src/Calendar.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { Component } from 'react';
3
- import { View, Switch, ScrollView, Platform, StyleSheet } from 'react-native';
3
+ import { View, ScrollView, Platform, StyleSheet } from 'react-native';
4
4
  import moment from 'moment';
5
- import { Text, SwitchLanguage } from '@momo-kits/core';
5
+ import { Text, SwitchLanguage, Colors, Spacing, Radius } from '@momo-kits/core';
6
+ import Switch from '@momo-kits/switch';
6
7
  import CalendarPro from './CalendarPro';
7
8
  import TabHeader from './TabHeader';
8
9
 
@@ -318,21 +319,19 @@ class Calendar extends Component {
318
319
  renderSwitchReturnSelection = () => {
319
320
  const { isDoubleDateMode } = this.state;
320
321
  return (
321
- <View style={styles.viewSwitch}>
322
- <Text.Caption style={styles.textSwitch}>
323
- {SwitchLanguage.chooseRoundtrip}
324
- </Text.Caption>
325
- <Switch
326
- value={isDoubleDateMode}
327
- onValueChange={this.toggleSelectionDateMode}
328
- thumbColor={isDoubleDateMode ? '#78ca32' : 'white'}
329
- trackColor={{ false: '#e5e7ec', true: '#e5e7ec' }}
330
- style={[
331
- Platform.OS === 'ios' && {
332
- transform: [{ scaleX: 0.8 }, { scaleY: 0.8 }],
333
- },
334
- ]}
335
- />
322
+ <View style={styles.headerContainer}>
323
+ <View style={styles.viewSwitch}>
324
+ <Text.Title weight="medium" style={styles.textSwitch}>
325
+ {SwitchLanguage.chooseRoundtrip}
326
+ </Text.Title>
327
+ <Switch
328
+ value={isDoubleDateMode}
329
+ onChange={this.toggleSelectionDateMode}
330
+ thumbColor={isDoubleDateMode ? '#78ca32' : 'white'}
331
+ trackColor={{ false: '#e5e7ec', true: '#e5e7ec' }}
332
+ />
333
+ </View>
334
+ <View style={styles.seperator} />
336
335
  </View>
337
336
  );
338
337
  };
@@ -420,9 +419,15 @@ class Calendar extends Component {
420
419
  } = this.props;
421
420
  const { isDoubleDateMode } = this.state;
422
421
  return (
423
- <ScrollView style={{ flex: 1, backgroundColor: 'white' }}>
424
- {!isHiddenSwitch && this.renderSwitchReturnSelection()}
425
- {!isHideHeaderPanel && this.renderHeaderPanel()}
422
+ <ScrollView style={{ flex: 1, backgroundColor: 'transparent' }}>
423
+ <View
424
+ style={{
425
+ backgroundColor: Colors.black_01,
426
+ borderRadius: Radius.XS,
427
+ }}>
428
+ {!isHiddenSwitch && this.renderSwitchReturnSelection()}
429
+ {!isHideHeaderPanel && this.renderHeaderPanel()}
430
+ </View>
426
431
  <CalendarPro
427
432
  ref={this.calendarPicker}
428
433
  startDate={doubleDate?.first}
@@ -485,36 +490,35 @@ Calendar.defaultProps = {
485
490
 
486
491
  const styles = StyleSheet.create({
487
492
  viewPanel_2: {
488
- height: 46,
489
493
  paddingVertical: 10,
490
- justifyContent: 'center',
491
- alignItems: 'center',
494
+ alignItems: 'flex-start',
492
495
  backgroundColor: 'white',
493
496
  borderRadius: 8,
497
+ paddingHorizontal: Spacing.M,
494
498
  },
495
499
  viewPanel: {
496
500
  height: 50,
497
501
  marginHorizontal: 12,
498
502
  marginTop: 6,
499
- marginBottom: 25,
500
- padding: 2,
501
503
  flexDirection: 'row',
502
- backgroundColor: '#eeeeef',
503
- justifyContent: 'space-around',
504
- borderRadius: 8,
505
504
  },
506
505
  textSwitch: {
507
- // fontSize: 10,
508
- fontWeight: 'bold',
509
- color: '#222222',
506
+ color: Colors.black_15,
510
507
  },
511
508
  viewSwitch: {
512
509
  flexDirection: 'row',
513
510
  justifyContent: 'space-between',
514
- paddingHorizontal: 12,
515
511
  alignItems: 'center',
516
- backgroundColor: '#f2f3f5',
517
- paddingVertical: 9,
512
+ backgroundColor: Colors.white,
518
513
  height: 42,
519
514
  },
515
+ seperator: {
516
+ height: 1,
517
+ width: '100%',
518
+ backgroundColor: Colors.black_04,
519
+ },
520
+ headerContainer: {
521
+ paddingHorizontal: 12,
522
+ paddingVertical: 8,
523
+ },
520
524
  });
@@ -17,6 +17,8 @@ import {
17
17
  Colors,
18
18
  Image,
19
19
  IconSource,
20
+ Spacing,
21
+ Radius,
20
22
  } from '@momo-kits/core';
21
23
  import MonthList from './MonthList';
22
24
  import HeaderControl from './HeaderControl';
@@ -248,44 +250,47 @@ export default class CalendarPro extends Component {
248
250
  onPressBackArrow={this.onPressBackArrow}
249
251
  onPressNextArrow={this.onPressNextArrow}
250
252
  />
251
- <View style={styles.viewDay}>
252
- {[1, 2, 3, 4, 5, 6, 7].map((item) => (
253
- <Text
254
- style={[
255
- styles.textDay,
256
- {
257
- color:
258
- item === 6 || item === 7
259
- ? Colors.red_05
260
- : Colors.black_12,
261
- },
262
- ]}
263
- key={item}>
264
- {Util.mapWeeKDate(item)}
265
- </Text>
266
- ))}
253
+ <View style={styles.blueSeperator} />
254
+ <View style={{ paddingHorizontal: Spacing.M }}>
255
+ <View style={styles.viewDay}>
256
+ {[1, 2, 3, 4, 5, 6, 7].map((item) => (
257
+ <Text
258
+ style={[
259
+ styles.textDay,
260
+ {
261
+ color:
262
+ item === 6 || item === 7
263
+ ? Colors.red_05
264
+ : Colors.black_12,
265
+ },
266
+ ]}
267
+ key={item}>
268
+ {Util.mapWeeKDate(item)}
269
+ </Text>
270
+ ))}
271
+ </View>
272
+ <MonthList
273
+ ref="MonthList"
274
+ today={this.today}
275
+ minDate={this.minDate}
276
+ maxDate={this.maxDate}
277
+ startDate={startDate}
278
+ endDate={endDate}
279
+ onChoose={this.onChoose}
280
+ i18n={i18n}
281
+ onScrollCalendar={this.onScrollCalendar}
282
+ isShowLunar={!isOffLunar && showLunar}
283
+ isDoubleDateMode={isDoubleDateMode}
284
+ tabSelected={tabSelected}
285
+ lunarConverter={this.converter}
286
+ holidays={holidays}
287
+ selectedDate={this.selectedDate}
288
+ priceList={priceListFormat}
289
+ labelFrom={labelFrom}
290
+ labelTo={labelTo}
291
+ isHideLabel={isHideLabel}
292
+ />
267
293
  </View>
268
- <MonthList
269
- ref="MonthList"
270
- today={this.today}
271
- minDate={this.minDate}
272
- maxDate={this.maxDate}
273
- startDate={startDate}
274
- endDate={endDate}
275
- onChoose={this.onChoose}
276
- i18n={i18n}
277
- onScrollCalendar={this.onScrollCalendar}
278
- isShowLunar={!isOffLunar && showLunar}
279
- isDoubleDateMode={isDoubleDateMode}
280
- tabSelected={tabSelected}
281
- lunarConverter={this.converter}
282
- holidays={holidays}
283
- selectedDate={this.selectedDate}
284
- priceList={priceListFormat}
285
- labelFrom={labelFrom}
286
- labelTo={labelTo}
287
- isHideLabel={isHideLabel}
288
- />
289
294
  </View>
290
295
  {!isOffLunar && (
291
296
  <View style={styles.viewLunar}>
@@ -407,7 +412,7 @@ const styles = StyleSheet.create({
407
412
  borderStyle: 'solid',
408
413
  borderColor: '#c7c7cd',
409
414
  },
410
- viewDate: { paddingHorizontal: 12 },
415
+ viewDate: {},
411
416
  textDay: {
412
417
  // fontSize: 14,
413
418
  lineHeight: 16,
@@ -418,9 +423,19 @@ const styles = StyleSheet.create({
418
423
  viewDay: {
419
424
  flexDirection: 'row',
420
425
  justifyContent: 'space-between',
421
- paddingHorizontal: 7,
426
+ paddingHorizontal: Spacing.S,
422
427
  paddingTop: 15,
423
428
  paddingBottom: 10,
424
429
  },
425
- container: { flex: 1, backgroundColor: 'white', marginTop: 20 },
430
+ container: {
431
+ flex: 1,
432
+ backgroundColor: 'white',
433
+ marginTop: Spacing.S,
434
+ borderRadius: Radius.XS,
435
+ },
436
+ blueSeperator: {
437
+ height: 1,
438
+ width: '100%',
439
+ backgroundColor: Colors.blue_05,
440
+ },
426
441
  });
@@ -1,50 +1,54 @@
1
1
  import React, { useState, forwardRef, useImperativeHandle } from 'react';
2
- import {
3
- View, TouchableOpacity, StyleSheet
4
- } from 'react-native';
2
+ import { View, TouchableOpacity, StyleSheet } from 'react-native';
5
3
  import moment from 'moment';
6
- import {
7
- Text, Icon, Colors
8
- } from '@momo-kits/core';
4
+ import { Text, Icon, Colors, Spacing, ScaleSize } from '@momo-kits/core';
9
5
  import Util from './Util';
10
6
 
11
- const HeaderControl = forwardRef(({ onPressBackArrow, onPressNextArrow, selectedDate }, ref) => {
12
- const [info, setInfo] = useState({
13
- date: moment(selectedDate || new Date())
14
- });
7
+ const HeaderControl = forwardRef(
8
+ ({ onPressBackArrow, onPressNextArrow, selectedDate }, ref) => {
9
+ const [info, setInfo] = useState({
10
+ date: moment(selectedDate || new Date()),
11
+ });
15
12
 
16
- useImperativeHandle(ref, () => ({
17
- onUpdateInfo
18
- }));
13
+ useImperativeHandle(ref, () => ({
14
+ onUpdateInfo,
15
+ }));
19
16
 
20
- const onUpdateInfo = (date) => {
21
- setInfo(date);
22
- };
17
+ const onUpdateInfo = (date) => {
18
+ setInfo(date);
19
+ };
23
20
 
24
- if (info && info.date) {
25
- const headerFormat = `${Util.mapMonth(info.date.month() + 1)}/${info.date.year()}`;
26
- return (
27
- <View style={styles.container}>
28
- <TouchableOpacity
29
- style={styles.btnLeft}
30
- onPress={onPressBackArrow}
31
- >
32
- <Icon name="24_arrow_chevron_left_small" tintColor={Colors.black_17} style={styles.icon} />
33
- </TouchableOpacity>
34
- <Text.H4 style={styles.txtHeader}>
35
- {headerFormat}
36
- </Text.H4>
37
- <TouchableOpacity
38
- style={styles.btnRight}
39
- onPress={onPressNextArrow}
40
- >
41
- <Icon name="24_arrow_chevron_right_small" tintColor={Colors.black_17} style={styles.icon} />
42
- </TouchableOpacity>
43
- </View>
44
- );
45
- }
46
- return <View />;
47
- });
21
+ if (info && info.date) {
22
+ const headerFormat = `${Util.mapMonth(
23
+ info.date.month() + 1,
24
+ )}/${info.date.year()}`;
25
+ return (
26
+ <View style={styles.container}>
27
+ <TouchableOpacity
28
+ style={styles.btnLeft}
29
+ onPress={onPressBackArrow}>
30
+ <Icon
31
+ name="24_arrow_chevron_left_small"
32
+ tintColor={Colors.black_17}
33
+ style={styles.icon}
34
+ />
35
+ </TouchableOpacity>
36
+ <Text.H4 style={styles.txtHeader}>{headerFormat}</Text.H4>
37
+ <TouchableOpacity
38
+ style={styles.btnRight}
39
+ onPress={onPressNextArrow}>
40
+ <Icon
41
+ name="24_arrow_chevron_right_small"
42
+ tintColor={Colors.black_17}
43
+ style={styles.icon}
44
+ />
45
+ </TouchableOpacity>
46
+ </View>
47
+ );
48
+ }
49
+ return <View />;
50
+ },
51
+ );
48
52
 
49
53
  export default HeaderControl;
50
54
  const styles = StyleSheet.create({
@@ -54,26 +58,26 @@ const styles = StyleSheet.create({
54
58
  lineHeight: 19,
55
59
  fontWeight: 'bold',
56
60
  textAlign: 'center',
57
- color: Colors.black_17
61
+ color: Colors.black_17,
58
62
  },
59
63
  btnRight: {
60
64
  width: 36,
61
65
  height: 36,
62
66
  justifyContent: 'center',
63
- alignItems: 'center'
67
+ alignItems: 'center',
64
68
  },
65
69
  btnLeft: {
66
70
  width: 36,
67
71
  height: 36,
68
72
  justifyContent: 'center',
69
- alignItems: 'center'
73
+ alignItems: 'center',
70
74
  },
71
75
  container: {
72
- height: 36,
76
+ height: ScaleSize(44),
73
77
  flexDirection: 'row',
74
78
  justifyContent: 'space-between',
75
- backgroundColor: '#edf6fe',
79
+ backgroundColor: Colors.blue_10,
76
80
  alignItems: 'center',
77
- borderRadius: 4
81
+ borderRadius: 4,
78
82
  },
79
83
  });
package/src/TabHeader.js CHANGED
@@ -1,13 +1,14 @@
1
1
  import React from 'react';
2
- import { TouchableWithoutFeedback, View, Text } from 'react-native';
2
+ import { TouchableWithoutFeedback, View } from 'react-native';
3
3
  import Moment from 'moment';
4
4
  import Util from './Util';
5
+ import { Colors, Text } from '@momo-kits/core';
5
6
 
6
7
  export default class TabHeader extends React.Component {
7
8
  constructor(props) {
8
9
  super(props);
9
10
  this.state = {
10
- active: props.activeTab
11
+ active: props.activeTab,
11
12
  };
12
13
  this.label = props.label;
13
14
  this.defaultDate = props.date ? Moment(props.date) : '';
@@ -23,7 +24,7 @@ export default class TabHeader extends React.Component {
23
24
  updateView = (date, activeTab) => {
24
25
  this.setState({
25
26
  date: date ? Moment(date) : '',
26
- active: activeTab
27
+ active: activeTab,
27
28
  });
28
29
  };
29
30
 
@@ -35,42 +36,54 @@ export default class TabHeader extends React.Component {
35
36
  const { label, disabled } = this.props;
36
37
  const { date, active } = this.state;
37
38
  const formattedDateFromState = date ? date.format('DD/MM/YYYY') : '';
38
- const formattedDateFromDefault = this.defaultDate ? this.defaultDate.format('DD/MM/YYYY') : '';
39
- const dayOfWeekFromState = date ? `${Util.WEEKDAYSFROMMOMENT[date.day()]} -` : '';
40
- const dayOfWeekFromDefault = this.defaultDate ? `${Util.WEEKDAYSFROMMOMENT[this.defaultDate.day()]} -` : '';
39
+ const formattedDateFromDefault = this.defaultDate
40
+ ? this.defaultDate.format('DD/MM/YYYY')
41
+ : '';
42
+ const dayOfWeekFromState = date
43
+ ? `${Util.WEEKDAYSFROMMOMENT[date.day()]} -`
44
+ : '';
45
+ const dayOfWeekFromDefault = this.defaultDate
46
+ ? `${Util.WEEKDAYSFROMMOMENT[this.defaultDate.day()]} -`
47
+ : '';
41
48
 
42
49
  return (
43
- <TouchableWithoutFeedback disabled={disabled} onPress={this.onChangeTab}>
44
- <View style={{
45
- flex: 1,
46
- justifyContent: 'center',
47
- alignItems: 'center',
48
- backgroundColor: active ? 'white' : '#eeeeef',
49
- borderRadius: 8
50
- }}
51
- >
52
- <Text style={{
53
- fontSize: 12,
54
- // lineHeight: 14,
55
- color: active ? '#222222' : '#8d919d',
56
- fontWeight: 'bold'
57
- }}
58
- >
50
+ <TouchableWithoutFeedback
51
+ disabled={disabled}
52
+ onPress={this.onChangeTab}>
53
+ <View
54
+ style={{
55
+ flex: 1,
56
+ backgroundColor: Colors.white,
57
+ }}>
58
+ <Text
59
+ style={{
60
+ fontSize: 12,
61
+ lineHeight: 16,
62
+ color: Colors.black_09,
63
+ }}>
59
64
  {label}
60
-
61
65
  </Text>
62
- <Text style={{
63
- marginTop: 3,
64
- fontSize: 12,
65
- // lineHeight: 14,
66
- color: '#8d919d'
67
- }}
68
- >
69
- <Text style={{ color: active ? '#b0006d' : '#8d919d', fontWeight: 'bold' }}>
70
- {`${dayOfWeekFromState || dayOfWeekFromDefault || '--'} `}
71
-
66
+ <Text
67
+ weight={active ? 'semibold' : 'regular'}
68
+ style={{
69
+ marginTop: 3,
70
+ fontSize: 14,
71
+ color: Colors.black_17,
72
+ }}>
73
+ <Text
74
+ weight={active ? 'semibold' : 'regular'}
75
+ style={{
76
+ color: Colors.black_17,
77
+ }}>
78
+ {`${
79
+ dayOfWeekFromState ||
80
+ dayOfWeekFromDefault ||
81
+ '--'
82
+ } `}
72
83
  </Text>
73
- {formattedDateFromState || formattedDateFromDefault || '--/--/----'}
84
+ {formattedDateFromState ||
85
+ formattedDateFromDefault ||
86
+ '--/--/----'}
74
87
  </Text>
75
88
  </View>
76
89
  </TouchableWithoutFeedback>