react-native-nepali-picker 1.0.7 → 1.0.8

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.
@@ -1,23 +1,23 @@
1
1
  "use strict";
2
2
 
3
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
3
  import { View, StyleSheet } from 'react-native';
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  const ChevronIcon = ({
6
6
  direction = 'right',
7
7
  size = 15,
8
8
  color = '#000'
9
9
  }) => {
10
10
  const isLeft = direction === 'left';
11
- return _jsxs(View, {
11
+ return /*#__PURE__*/_jsxs(View, {
12
12
  style: [styles.container, {
13
13
  width: size,
14
14
  height: size
15
15
  }],
16
- children: [_jsx(View, {
16
+ children: [/*#__PURE__*/_jsx(View, {
17
17
  style: [styles.line, isLeft ? styles.leftTop : styles.rightTop, {
18
18
  backgroundColor: color
19
19
  }]
20
- }), _jsx(View, {
20
+ }), /*#__PURE__*/_jsx(View, {
21
21
  style: [styles.line, isLeft ? styles.leftBottom : styles.rightBottom, {
22
22
  backgroundColor: color
23
23
  }]
@@ -28,20 +28,20 @@ const EditPencilIcon = ({
28
28
  size = 24,
29
29
  color = '#000'
30
30
  }) => {
31
- return _jsxs(View, {
31
+ return /*#__PURE__*/_jsxs(View, {
32
32
  style: [styles.container, {
33
33
  width: size,
34
34
  height: size
35
35
  }],
36
- children: [_jsx(View, {
36
+ children: [/*#__PURE__*/_jsx(View, {
37
37
  style: [styles.pencilBody, {
38
38
  backgroundColor: color
39
39
  }]
40
- }), _jsx(View, {
40
+ }), /*#__PURE__*/_jsx(View, {
41
41
  style: [styles.pencilTip, {
42
42
  borderBottomColor: color
43
43
  }]
44
- }), _jsx(View, {
44
+ }), /*#__PURE__*/_jsx(View, {
45
45
  style: [styles.pencilEraser, {
46
46
  backgroundColor: '#FFA07A'
47
47
  }]
@@ -53,7 +53,7 @@ const Triangle = ({
53
53
  height = 20,
54
54
  color = 'white'
55
55
  }) => {
56
- return _jsx(View, {
56
+ return /*#__PURE__*/_jsx(View, {
57
57
  style: [styles.triangle, {
58
58
  borderLeftWidth: width / 2,
59
59
  borderRightWidth: width / 2,
@@ -66,7 +66,7 @@ const ChevronDown = ({
66
66
  size = 10,
67
67
  color = '#000'
68
68
  }) => {
69
- return _jsxs(View, {
69
+ return /*#__PURE__*/_jsxs(View, {
70
70
  style: [styles.container, {
71
71
  width: size,
72
72
  height: size,
@@ -74,11 +74,11 @@ const ChevronDown = ({
74
74
  rotate: '-90deg'
75
75
  }]
76
76
  }],
77
- children: [_jsx(View, {
77
+ children: [/*#__PURE__*/_jsx(View, {
78
78
  style: [styles.line, styles.rightTop, {
79
79
  backgroundColor: color
80
80
  }]
81
- }), _jsx(View, {
81
+ }), /*#__PURE__*/_jsx(View, {
82
82
  style: [styles.line, styles.rightBottom, {
83
83
  backgroundColor: color
84
84
  }]
@@ -172,10 +172,4 @@ const styles = StyleSheet.create({
172
172
  }
173
173
  });
174
174
  export { ChevronIcon, ChevronDown, EditPencilIcon, Triangle };
175
- //# sourceMappingURL=Icons.js.mapansform: [{
176
- skewX: '5deg'
177
- }]
178
- }
179
- });
180
- export { ChevronIcon, ChevronDown, EditPencilIcon, Triangle };
181
175
  //# sourceMappingURL=Icons.js.map
@@ -1,2 +1 @@
1
1
  {"version":3,"names":["View","StyleSheet","jsx","_jsx","jsxs","_jsxs","ChevronIcon","direction","size","color","isLeft","style","styles","container","width","height","children","line","leftTop","rightTop","backgroundColor","leftBottom","rightBottom","EditPencilIcon","pencilBody","pencilTip","borderBottomColor","pencilEraser","Triangle","triangle","borderLeftWidth","borderRightWidth","borderBottomWidth","ChevronDown","transform","rotate","create","justifyContent","alignItems","position","top","left","bottom","right","borderStyle","borderLeftColor","borderRightColor","borderTopWidth","skewX"],"sourceRoot":"../../../src","sources":["assets/Icons.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAAC,SAAAC,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C;MAAEc,KAAK,EAAE;IAAO,CAAC;EAC/B,CAAC;EACDvB,SAAS,EAAE;IACTX,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTK,eAAe,EAAE,aAAa;IAC9BwB,WAAW,EAAE,OAAO;IACpBd,eAAe,EAAE,CAAC;IAClBC,gBAAgB,EAAE,CAAC;IACnBgB,cAAc,EAAE,CAAC;IACjBF,eAAe,EAAE,aAAa;IAC9BC,gBAAgB,EAAE,aAAa;IAC/Bd,iBAAiB,EAAE,EAAE;IACrBO,QAAQ,EAAE,UAAU;IACpBG,MAAM,EAAE,OAAO;IACfD,IAAI,EAAE;EACR,CAAC;EACDd,YAAY,EAAE;IACZb,KAAK,EAAE,KAAK;IACZC,MAAM,EAAE,KAAK;IACbwB,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,OAAO;IACZC,IAAI,EAAE,KAAK;IACXP,SAAS,EAAE,CAAC;MAAEc,KAAK,EAAE;IAAO,CAAC;EAC/B;AACF,CAAC,CAAC;AAEF,SAAS1C,WAAW,EAAE2B,WAAW,EAAEV,cAAc,EAAEK,QAAQ","ignoreList":[]}
2
- C,CAAC;AACF,SAAS1C,WAAW,EAAE2B,WAAW,EAAEV,cAAc,EAAEK,QAAQ","ignoreList":[]}
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
3
  import { View, StyleSheet } from 'react-native';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  const Triangle = ({
6
6
  width = 10,
7
7
  height = 20,
8
8
  color = 'black'
9
9
  }) => {
10
- return _jsx(View, {
10
+ return /*#__PURE__*/_jsx(View, {
11
11
  style: [styles.triangle, {
12
12
  borderLeftWidth: width / 2,
13
13
  borderRightWidth: width / 2,
@@ -30,4 +30,4 @@ const styles = StyleSheet.create({
30
30
  }
31
31
  });
32
32
  export default Triangle;
33
- //# sourceMappingURL=Triangle.js.mapiangle.js.map
33
+ //# sourceMappingURL=Triangle.js.map
@@ -1,2 +1 @@
1
1
  {"version":3,"names":["View","StyleSheet","jsx","_jsx","Triangle","width","height","color","style","styles","triangle","borderLeftWidth","borderRightWidth","borderBottomWidth","borderBottomColor","create","transform","rotate","backgroundColor","borderStyle","borderLeftColor","borderRightColor"],"sourceRoot":"../../../src","sources":["assets/Triangle.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEhD,MAAMC,QAAQ,GAAGA,CAAC;EAAEC,KAAK,GAAG,EAAE;EAAEC,MAAM,GAAG,EAAE;EAAEC,KAAK,GAAG;AAAQ,CAAC,KAAK;EACjE,oBACEJ,IAAA,CAACH,IAAI;IACHQ,KAAK,EAAE,CACLC,MAAM,CAACC,QAAQ,EACf;MACEC,eAAe,EAAEN,KAAK,GAAG,CAAC;MAC1BO,gBAAgB,EAAEP,KAAK,GAAG,CAAC;MAC3BQ,iBAAiB,EAAEP,MAAM;MACzBQ,iBAAiB,EAAEP;IACrB,CAAC;EACD,CACH,CAAC;AAEN,CAAC;AAED,MAAME,MAAM,GAAGR,UAAU,CAACc,MAAM,CAAC;EAC/BL,QAAQ,EAAE;IACRL,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTU,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAS,CAAC,CAAC;IACjCC,eAAe,EAAE,aAAa;IAC9BC,WAAW,EAAE,OAAO;IACpBC,eAAe,EAAE,aAAa;IAC9BC,gBAAgB,EAAE;EACpB;AACF,CAAC,CAAC;AAEF,eAAejB,QAAQ","ignoreList":[]}
2
- "ignoreList":[]}
@@ -1,2 +1 @@
1
1
  {"version":3,"names":["View","StyleSheet","jsx","_jsx","jsxs","_jsxs","PencilIcon","height","width","style","styles","container","children","borderTopStartRadius","borderTopEndRadius","borderWidth","top","left","borderLeftWidth","borderRightWidth","borderBottomWidth","borderStyle","backgroundColor","borderLeftColor","borderRightColor","borderBottomColor","borderTopWidth","create","transform","rotate","alignItems","marginHorizontal","justifyContent"],"sourceRoot":"../../../src","sources":["assets/cIcon.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEhD,MAAMC,UAAU,GAAGA,CAAC;EAAEC,MAAM,GAAG,EAAE;EAAEC,KAAK,GAAG;AAAG,CAAC,KAAK;EAClD,oBACEH,KAAA,CAACL,IAAI;IAACS,KAAK,EAAE;MAAE,GAAGC,MAAM,CAACC,SAAS;MAAEJ,MAAM,EAAEA,MAAM;MAAEC,KAAK,EAAEA;IAAM,CAAE;IAAAI,QAAA,gBAEjET,IAAA,CAACH,IAAI;MACHS,KAAK,EAAE;QACLF,MAAM,EAAE,KAAK;QACbC,KAAK,EAAE,MAAM;QACbK,oBAAoB,EAAE,CAAC;QACvBC,kBAAkB,EAAE,CAAC;QACrBC,WAAW,EAAE;MACf,CAAE;MAAAH,QAAA,eAEFT,IAAA,CAACH,IAAI;QACHS,KAAK,EAAE;UACLO,GAAG,EAAE,KAAK;UACVR,KAAK,EAAE,MAAM;UACbO,WAAW,EAAE;QACf;MAAE,CACH;IAAC,CACE,CAAC,eAGPZ,IAAA,CAACH,IAAI;MACHS,KAAK,EAAE;QACLF,MAAM,EAAE,KAAK;QACbC,KAAK,EAAE,MAAM;QACbO,WAAW,EAAE;MACf,CAAE;MAAAH,QAAA,eAEFT,IAAA,CAACH,IAAI;QACHS,KAAK,EAAE;UACLQ,IAAI,EAAE,KAAK;UACXV,MAAM,EAAE,MAAM;UACdC,KAAK,EAAE,CAAC;UACRO,WAAW,EAAE;QACf;MAAE,CACH;IAAC,CACE,CAAC,eAKPZ,IAAA,CAACH,IAAI;MACHS,KAAK,EAAE;QACLD,KAAK,EAAE,CAAC;QACRD,MAAM,EAAE,CAAC;QACTW,eAAe,EAAE,CAAC;QAClBC,gBAAgB,EAAE,CAAC;QACnBC,iBAAiB,EAAE,CAAC;QACpBC,WAAW,EAAE,OAAO;QACpBC,eAAe,EAAE,aAAa;QAC9BC,eAAe,EAAE,aAAa;QAC9BC,gBAAgB,EAAE,aAAa;QAC/BC,iBAAiB,EAAE,aAAa;QAChCC,cAAc,EAAE;MAClB;IAAE,CACH,CAAC;EAAA,CACE,CAAC;AAEX,CAAC;AAED,MAAMhB,MAAM,GAAGT,UAAU,CAAC0B,MAAM,CAAC;EAC/BhB,SAAS,EAAE;IACTiB,SAAS,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAQ,CAAC,CAAC;IAChCC,UAAU,EAAE,QAAQ;IACpBC,gBAAgB,EAAE,MAAM;IACxBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC;AAEF,eAAe1B,UAAU","ignoreList":[]}
2
- CpB;AACJ,CAAC,CAAC;AACF,eAAe1B,UAAU","ignoreList":[]}
@@ -32,12 +32,14 @@ const AdToBs = UserDate => {
32
32
  console.log('The minimum possible date you can enter is 2024-04-13 i.e 2081-01-01');
33
33
  return 'The minimum possible date you can enter is 2024-04-13 i.e 2081-01-01';
34
34
  }
35
+
35
36
  // number of days from that reference date
36
37
  const DateDifference = FindDateDifference(ReferenceDate, UserTimeDate);
37
38
  let nepaliYear = 2000;
38
39
  let nepaliMonth = 1;
39
40
  let nepaliDay = 1;
40
41
  //difference can calculate upto previous day so add 1 to get current day(Today)
42
+
41
43
  let DD = DateDifference + 1;
42
44
  outerLoop: for (let year = 2000; year < 2100; year++) {
43
45
  for (let month = 1; month <= 12; month++) {
@@ -94,9 +96,11 @@ const BsToAd = userDate => {
94
96
  if (userMonth < 1 || userMonth > 12) {
95
97
  throw new Error('Month Range is 1 to 12');
96
98
  }
99
+
97
100
  // if (userMonth < 1 || userMonth > 31) {
98
101
  // throw new Error('Month out of supported range');
99
102
  // }
103
+
100
104
  for (let year = 2000; year < userYear; year++) {
101
105
  for (let month = 1; month <= 12; month++) {
102
106
  dateDifference += bs[year][month];
@@ -115,4 +119,4 @@ const BsToAd = userDate => {
115
119
  }
116
120
  };
117
121
  export { AdToBs, BsToAd, formatDate, FindDateDifference, NepaliToday };
118
- //# sourceMappingURL=functions.js.map.map
122
+ //# sourceMappingURL=functions.js.map
@@ -1,2 +1 @@
1
1
  {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
2
- ":[]}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "react-native-nepali-picker",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Minimalist and modern Nepali-date picker with customization.🌟",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
7
7
  "module": "./lib/module/index.js",
8
- "types":"./lib/typescript/module/src/index.d.ts",
8
+ "types": "./lib/typescript/module/src/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "import": {
@@ -135,7 +135,7 @@ const CalendarPicker = ({
135
135
  return (
136
136
  <Modal visible={visible} onRequestClose={onClose} transparent={true}>
137
137
  <Pressable style={styles.outerPressable} onPress={onClose}>
138
- <Pressable onPress={() => {}} style={styles.innerPressable}>
138
+ <Pressable onPress={() => { }} style={styles.innerPressable}>
139
139
  <View
140
140
  style={{
141
141
  ...styles.innerView,
@@ -174,7 +174,7 @@ const CalendarPicker = ({
174
174
  return (
175
175
  <Modal visible={visible} onRequestClose={onClose} transparent={true}>
176
176
  <Pressable style={styles.outerPressable} onPress={onClose}>
177
- <Pressable onPress={() => {}} style={styles.innerPressable}>
177
+ <Pressable onPress={() => { }} style={styles.innerPressable}>
178
178
  <View
179
179
  style={{
180
180
  ...styles.innerView,
@@ -312,7 +312,7 @@ const CalendarPicker = ({
312
312
  key={index}
313
313
  onPress={
314
314
  //execute on day item press, Only execute when dayItem is not null
315
- dayItem ? () => handleDateClick(dayItem) : () => {}
315
+ dayItem ? () => handleDateClick(dayItem) : () => { }
316
316
  }
317
317
  >
318
318
  {dayItem ? (
@@ -374,7 +374,7 @@ const CalendarPicker = ({
374
374
  style={styles.outerPressable}
375
375
  onPress={() => closeYearView()}
376
376
  >
377
- <Pressable style={styles.YearInnerPressable} onPress={() => {}}>
377
+ <Pressable style={styles.YearInnerPressable} onPress={() => { }}>
378
378
  <View
379
379
  style={{
380
380
  ...styles.InnerYearView,
@@ -1,283 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from 'react';
3
- import { View, Text, Modal, Pressable, StyleSheet, TouchableOpacity, ScrollView, } from 'react-native';
4
- import { bs, daysInEnglish, daysInNepali, getNepaliNumber, monthsInEnglish, monthsInNepali, } from './calendar/config';
5
- import { calcFirstDay, isToday } from './calendar/settings';
6
- import { NepaliToday, validateDate } from './calendar/functions';
7
- import { ChevronIcon } from './assets/Icons';
8
- import DateSyncLogo from './assets/DateSync';
9
- import Triangle from './assets/Triangle';
10
- const CalendarPicker = ({ visible, onClose, theme = 'light', onDateSelect, language = 'np', initialDate = NepaliToday(), brandColor = '#2081b9', titleTextStyle = {
11
- fontSize: 20,
12
- fontWeight: 'bold',
13
- }, weekTextStyle = {
14
- fontSize: 15,
15
- fontWeight: 'bold',
16
- }, dayTextStyle = {
17
- fontSize: 15,
18
- fontWeight: '600',
19
- }, }) => {
20
- const value = validateDate(initialDate);
21
- console.log('the initial date is ', initialDate);
22
- const [TodayNepaliDate, setTodayNepaliDate] = useState(initialDate);
23
- const cYear = parseInt(TodayNepaliDate.split('-')[0], 10);
24
- const cMonth = parseInt(TodayNepaliDate.split('-')[1], 10);
25
- const cDay = parseInt(TodayNepaliDate.split('-')[2], 10);
26
- const [firstDayOfMonth, setFirstDayOfMonth] = useState(0);
27
- const [month, setMonth] = useState(cMonth);
28
- const [year, setYear] = useState(cYear);
29
- const [calendarDate, setCalendarDate] = useState([]);
30
- const [yearModal, setYearModal] = useState(false);
31
- const syncToday = () => {
32
- setMonth(cMonth);
33
- setYear(cYear);
34
- };
35
- const handleDateClick = (day) => {
36
- const date = `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
37
- setTodayNepaliDate(date);
38
- onDateSelect(date);
39
- onClose();
40
- };
41
- useEffect(() => {
42
- setTodayNepaliDate(initialDate);
43
- }, [initialDate]);
44
- //Handle Next Month Click
45
- const handleNextClick = () => {
46
- if (month === 12) {
47
- if (year < 2099) {
48
- setYear((prev) => prev + 1);
49
- setMonth(1);
50
- }
51
- }
52
- else {
53
- setMonth((prev) => prev + 1);
54
- }
55
- };
56
- //Handle Previous Month Click
57
- const handlePreviousClick = () => {
58
- if (month === 1) {
59
- if (year > 2000) {
60
- setYear((prev) => prev - 1);
61
- setMonth(12);
62
- }
63
- }
64
- else {
65
- setMonth((prev) => prev - 1);
66
- }
67
- };
68
- const openYearView = () => {
69
- setYearModal(true);
70
- };
71
- const closeYearView = () => {
72
- setYearModal(false);
73
- };
74
- useEffect(() => {
75
- // calculate First Day Of Month (FDOM) and Days In Month(DIM)
76
- const FDOM = calcFirstDay(year, month);
77
- const DIM = bs[year][month];
78
- setFirstDayOfMonth(FDOM);
79
- // array which contain 42 cells and it only fill the date with number if the date is present otherwise it fill cells with null.
80
- const calendarCells = Array.from({ length: 42 }, (_, index) => {
81
- const dayNumber = index - FDOM + 1;
82
- if (dayNumber > 0 && dayNumber <= DIM) {
83
- return dayNumber;
84
- }
85
- else {
86
- return null;
87
- }
88
- });
89
- setCalendarDate(calendarCells);
90
- }, [year, month, initialDate]);
91
- const handleYearClick = (y) => {
92
- setYear(y);
93
- closeYearView();
94
- };
95
- const dark = theme === 'dark';
96
- const weekDays = language === 'en' ? daysInEnglish : daysInNepali;
97
- if (value !== true) {
98
- return (_jsx(Modal, { visible: visible, onRequestClose: onClose, transparent: true, children: _jsx(Pressable, { style: styles.outerPressable, onPress: onClose, children: _jsx(Pressable, { onPress: () => { }, style: styles.innerPressable, children: _jsxs(View, { style: {
99
- ...styles.innerView,
100
- minHeight: '40%',
101
- minWidth: '90%',
102
- justifyContent: 'center',
103
- alignItems: 'center',
104
- backgroundColor: dark ? '#383838' : '#ffffff',
105
- }, children: [_jsx(Text, { style: {
106
- color: dark ? 'white' : 'black',
107
- fontWeight: '600',
108
- paddingHorizontal: 10,
109
- paddingVertical: 10,
110
- }, children: "Unsupported date range on initialDate" }), _jsx(Text, { style: {
111
- color: dark ? 'white' : 'black',
112
- paddingHorizontal: 10,
113
- }, children: value })] }) }) }) }));
114
- }
115
- return (_jsxs(Modal, { visible: visible, onRequestClose: onClose, transparent: true, children: [_jsx(Pressable, { style: styles.outerPressable, onPress: onClose, children: _jsx(Pressable, { onPress: () => { }, style: styles.innerPressable, children: _jsxs(View, { style: {
116
- ...styles.innerView,
117
- backgroundColor: dark ? '#383838' : '#ffffff',
118
- }, children: [_jsx(Text, { style: {
119
- color: dark ? 'white' : 'black',
120
- paddingHorizontal: 10,
121
- }, children: language === 'np' ? 'आजको मिति ' : "Today's Date" }), _jsxs(View, { style: {
122
- display: 'flex',
123
- flexDirection: 'row',
124
- justifyContent: 'space-between',
125
- paddingHorizontal: 10,
126
- marginBottom: 20,
127
- alignItems: 'center',
128
- }, children: [_jsx(View, { children: _jsx(TouchableOpacity, { onPress: syncToday, children: language == 'np' ? (_jsxs(Text, { style: {
129
- ...titleTextStyle,
130
- color: dark ? '#fff' : '#000',
131
- }, children: [getNepaliNumber(cYear), " ", monthsInNepali[cMonth - 1], ' ', " ", getNepaliNumber(cDay)] })) : (_jsxs(Text, { style: {
132
- ...titleTextStyle,
133
- color: dark ? '#fff' : '#000',
134
- }, children: [cYear, " ", monthsInEnglish[cMonth - 1], ' ', " ", cDay] })) }) }), _jsx(TouchableOpacity, { onPress: syncToday, children: _jsx(DateSyncLogo, { day: cDay, color: dark ? '#ffff' : '#000' }) })] }), _jsxs(View, { style: styles.ButtonContainer, children: [_jsx(TouchableOpacity, { style: styles.CButton, onPress: handlePreviousClick, children: _jsx(ChevronIcon, { direction: "right", color: dark ? 'white' : 'black' }) }), _jsxs(TouchableOpacity, { style: { flexDirection: 'row', alignItems: 'center' }, onPress: openYearView, children: [_jsx(Text, { style: {
135
- ...titleTextStyle,
136
- marginRight: 6,
137
- color: dark ? 'white' : 'black',
138
- }, children: language === 'np'
139
- ? monthsInNepali[month - 1]
140
- : monthsInEnglish[month - 1] }), _jsx(Text, { style: {
141
- ...titleTextStyle,
142
- marginRight: 10,
143
- color: dark ? 'white' : 'black',
144
- }, children: language === 'np' ? getNepaliNumber(year) : year }), _jsx(Triangle, { height: 10, width: 13, color: dark ? 'white' : 'black' })] }), _jsx(TouchableOpacity, { style: styles.CButton, onPress: handleNextClick, children: _jsx(ChevronIcon, { direction: "left", color: dark ? 'white' : 'black' }) })] }), _jsxs(View, { style: styles.outerDateConainer, children: [_jsx(View, { style: styles.weekContainer, children: weekDays.map((item, index) => {
145
- return (_jsx(View, { style: styles.WeekItem, children: _jsx(Text, { style: {
146
- ...weekTextStyle,
147
- color: dark ? 'white' : 'black',
148
- }, children: item }) }, index));
149
- }) }), _jsx(View, { style: styles.datesContainer, children: calendarDate.map((dayItem, index) => {
150
- return (_jsx(TouchableOpacity, { style: styles.dateItem, onPress:
151
- //execute on day item press, Only execute when dayItem is not null
152
- dayItem ? () => handleDateClick(dayItem) : () => { }, children: dayItem ? (_jsx(View, { style: {
153
- paddingHorizontal: 6,
154
- paddingVertical: 3,
155
- borderRadius: 999,
156
- //check if the date is today or not and apply conditional styling.
157
- backgroundColor: isToday(TodayNepaliDate, index, year, month, firstDayOfMonth)
158
- ? brandColor
159
- : dark
160
- ? '#383838'
161
- : '#fff',
162
- }, children: _jsx(Text, { style: {
163
- ...dayTextStyle,
164
- color: isToday(TodayNepaliDate, index, year, month, firstDayOfMonth)
165
- ? '#fff'
166
- : dark
167
- ? 'white'
168
- : 'black',
169
- }, children: language === 'np'
170
- ? getNepaliNumber(dayItem)
171
- : dayItem }) })) : null }, index));
172
- }) })] })] }) }) }), _jsx(Modal, { visible: yearModal, onRequestClose: closeYearView, transparent: true, children: _jsx(Pressable, { style: styles.outerPressable, onPress: () => closeYearView(), children: _jsx(Pressable, { style: styles.YearInnerPressable, onPress: () => { }, children: _jsx(View, { style: {
173
- ...styles.InnerYearView,
174
- backgroundColor: dark ? '#383838' : '#f2f2f2',
175
- }, children: _jsx(ScrollView, { showsVerticalScrollIndicator: false, contentContainerStyle: {
176
- display: 'flex',
177
- paddingVertical: 10,
178
- flexDirection: 'row',
179
- justifyContent: 'center',
180
- flexWrap: 'wrap',
181
- }, children: Array(100)
182
- .fill(0)
183
- .map((_, index) => {
184
- return (_jsx(TouchableOpacity, { onPress: () => handleYearClick(index + 2000), style: {
185
- paddingHorizontal: 20,
186
- paddingVertical: 6,
187
- marginHorizontal: 4,
188
- marginVertical: 4,
189
- borderColor: dark ? 'white' : 'black',
190
- borderRadius: 20,
191
- backgroundColor: index + 2000 === year ? brandColor : '',
192
- borderWidth: 0.4,
193
- }, children: _jsx(Text, { style: {
194
- fontWeight: '500',
195
- color: index + 2000 === year
196
- ? 'white'
197
- : dark
198
- ? 'white'
199
- : 'black',
200
- }, children: language === 'np'
201
- ? getNepaliNumber(index + 2000)
202
- : index + 2000 }) }, index));
203
- }) }) }) }) }) })] }));
204
- };
205
- const styles = StyleSheet.create({
206
- outerPressable: {
207
- height: '100%',
208
- justifyContent: 'center',
209
- width: '100%',
210
- alignItems: 'center',
211
- backgroundColor: 'rgba(0,0,0,0.54)',
212
- },
213
- innerPressable: {
214
- minHeight: '20%',
215
- maxWidth: 500,
216
- marginHorizontal: 30,
217
- },
218
- innerView: {
219
- borderRadius: 20,
220
- backgroundColor: '#f2f2f2',
221
- padding: 10,
222
- },
223
- weekContainer: {
224
- flexDirection: 'row',
225
- width: '100%',
226
- },
227
- WeekItem: {
228
- width: '14.28%',
229
- alignItems: 'center',
230
- paddingVertical: 18,
231
- },
232
- //WeekText: {
233
- // fontWeight: 'bold',
234
- // fontSize: 14,
235
- // color: 'black',
236
- //},
237
- datesContainer: {
238
- flexDirection: 'row',
239
- flexWrap: 'wrap',
240
- },
241
- dateItem: {
242
- overflow: 'hidden',
243
- width: '14.28%',
244
- justifyContent: 'center',
245
- alignItems: 'center',
246
- paddingVertical: 10,
247
- },
248
- //DayText: {
249
- // fontSize: 14,
250
- // fontWeight: '600',
251
- //},
252
- CButton: {
253
- paddingHorizontal: 20,
254
- paddingVertical: 10,
255
- },
256
- ButtonContainer: {
257
- alignItems: 'center',
258
- flexDirection: 'row',
259
- marginBottom: 10,
260
- justifyContent: 'space-between',
261
- },
262
- outerDateConainer: {
263
- paddingHorizontal: 3,
264
- },
265
- //TitleText: {
266
- // fontSize: 20,
267
- // fontWeight: 'bold',
268
- //},
269
- // for year view modal
270
- YearInnerPressable: {
271
- justifyContent: 'center',
272
- maxWidth: 500,
273
- maxHeight: '70%',
274
- marginHorizontal: 30,
275
- },
276
- InnerYearView: {
277
- borderRadius: 20,
278
- backgroundColor: '#f2f2f2',
279
- minHeight: 50,
280
- maxHeight: '100%',
281
- },
282
- });
283
- export default CalendarPicker;
@@ -1,66 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { View, Text, StyleSheet } from 'react-native';
3
- const DateSyncLogo = ({ size = 28, color = '#003a05', day = 0 }) => {
4
- const scale = size / 24;
5
- // Format the date as DD
6
- return (_jsxs(View, { style: [styles.container, { width: size, height: size }], children: [_jsx(View, { style: [styles.calendarBase, { borderColor: color }], children: _jsx(Text, { style: [styles.dateText, { color: color, fontSize: 9 * scale }], children: day }) }), _jsx(View, { style: [styles.calendarTop, { borderColor: color, top: 2 * scale }] })] }));
7
- };
8
- const styles = StyleSheet.create({
9
- container: {
10
- aspectRatio: 1,
11
- position: 'relative',
12
- },
13
- calendarBase: {
14
- position: 'absolute',
15
- left: '12.5%',
16
- top: '12.5%',
17
- width: '75%',
18
- height: '75%',
19
- borderWidth: 2,
20
- borderRadius: 3,
21
- justifyContent: 'center',
22
- alignItems: 'center',
23
- },
24
- dateText: {
25
- fontWeight: '800',
26
- },
27
- calendarTop: {
28
- position: 'absolute',
29
- left: '12.5%',
30
- width: '75%',
31
- height: '20%',
32
- borderTopWidth: 4,
33
- borderLeftWidth: 2,
34
- borderRightWidth: 2,
35
- borderTopLeftRadius: 10,
36
- borderTopRightRadius: 0,
37
- },
38
- syncCircle: {
39
- position: 'absolute',
40
- width: '50%',
41
- height: '50%',
42
- borderWidth: 2,
43
- borderRadius: 100,
44
- justifyContent: 'center',
45
- alignItems: 'center',
46
- },
47
- syncArrow: {
48
- position: 'absolute',
49
- width: '40%',
50
- height: '40%',
51
- borderWidth: 2,
52
- borderTopWidth: 0,
53
- borderRightWidth: 0,
54
- transform: [{ rotate: '45deg' }],
55
- },
56
- syncArrowLeft: {
57
- left: '15%',
58
- top: '10%',
59
- },
60
- syncArrowRight: {
61
- right: '15%',
62
- bottom: '10%',
63
- transform: [{ rotate: '225deg' }],
64
- },
65
- });
66
- export default DateSyncLogo;