react-native-bikram-sambat 0.1.4 → 0.1.5
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/README.md +44 -213
- package/lib/commonjs/accessibility/labels.js +1 -2
- package/lib/commonjs/accessibility/labels.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/CalendarDay.js +8 -41
- package/lib/commonjs/components/NepaliCalendar/CalendarDay.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js +7 -24
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js +18 -6
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js +93 -61
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js.map +1 -1
- package/lib/commonjs/index.js +0 -22
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/theme/default-theme.js +2 -22
- package/lib/commonjs/theme/default-theme.js.map +1 -1
- package/lib/commonjs/utils/date-helpers.js +0 -8
- package/lib/commonjs/utils/date-helpers.js.map +1 -1
- package/lib/module/accessibility/labels.js +1 -2
- package/lib/module/accessibility/labels.js.map +1 -1
- package/lib/module/components/NepaliCalendar/CalendarDay.js +8 -41
- package/lib/module/components/NepaliCalendar/CalendarDay.js.map +1 -1
- package/lib/module/components/NepaliCalendar/CalendarGrid.js +7 -24
- package/lib/module/components/NepaliCalendar/CalendarGrid.js.map +1 -1
- package/lib/module/components/NepaliCalendar/CalendarHeader.js +18 -6
- package/lib/module/components/NepaliCalendar/CalendarHeader.js.map +1 -1
- package/lib/module/components/NepaliCalendar/NepaliCalendar.js +96 -64
- package/lib/module/components/NepaliCalendar/NepaliCalendar.js.map +1 -1
- package/lib/module/index.js +0 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/theme/default-theme.js +2 -22
- package/lib/module/theme/default-theme.js.map +1 -1
- package/lib/module/utils/date-helpers.js +0 -8
- package/lib/module/utils/date-helpers.js.map +1 -1
- package/lib/typescript/src/accessibility/labels.d.ts +1 -1
- package/lib/typescript/src/accessibility/labels.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts +1 -5
- package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts +1 -4
- package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts +1 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts +1 -1
- package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/types.d.ts +6 -10
- package/lib/typescript/src/components/NepaliCalendar/types.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/default-theme.d.ts.map +1 -1
- package/lib/typescript/src/theme/types.d.ts +0 -10
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/date-helpers.d.ts +0 -4
- package/lib/typescript/src/utils/date-helpers.d.ts.map +1 -1
- package/package.json +2 -6
- package/src/accessibility/labels.ts +0 -2
- package/src/components/NepaliCalendar/CalendarDay.tsx +6 -65
- package/src/components/NepaliCalendar/CalendarGrid.tsx +12 -32
- package/src/components/NepaliCalendar/CalendarHeader.tsx +18 -2
- package/src/components/NepaliCalendar/NepaliCalendar.tsx +128 -56
- package/src/components/NepaliCalendar/types.ts +3 -12
- package/src/index.ts +0 -2
- package/src/theme/default-theme.ts +0 -20
- package/src/theme/types.ts +0 -10
- package/src/utils/date-helpers.ts +0 -12
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js +0 -185
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js.map +0 -1
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js +0 -148
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js.map +0 -1
- package/lib/commonjs/components/NepaliDatePicker/index.js +0 -20
- package/lib/commonjs/components/NepaliDatePicker/index.js.map +0 -1
- package/lib/commonjs/components/NepaliDatePicker/types.js +0 -6
- package/lib/commonjs/components/NepaliDatePicker/types.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js +0 -187
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js +0 -275
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/index.js +0 -57
- package/lib/commonjs/components/NepaliRangePicker/index.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js +0 -70
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/types.js +0 -6
- package/lib/commonjs/components/NepaliRangePicker/types.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/DatePickerModal.js +0 -180
- package/lib/module/components/NepaliDatePicker/DatePickerModal.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js +0 -143
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/index.js +0 -5
- package/lib/module/components/NepaliDatePicker/index.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/types.js +0 -4
- package/lib/module/components/NepaliDatePicker/types.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js +0 -182
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js +0 -270
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/index.js +0 -6
- package/lib/module/components/NepaliRangePicker/index.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/range-utils.js +0 -61
- package/lib/module/components/NepaliRangePicker/range-utils.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/types.js +0 -4
- package/lib/module/components/NepaliRangePicker/types.js.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts +0 -4
- package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts +0 -4
- package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/index.d.ts +0 -4
- package/lib/typescript/src/components/NepaliDatePicker/index.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/types.d.ts +0 -50
- package/lib/typescript/src/components/NepaliDatePicker/types.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts +0 -4
- package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts +0 -4
- package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/index.d.ts +0 -5
- package/lib/typescript/src/components/NepaliRangePicker/index.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts +0 -13
- package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/types.d.ts +0 -61
- package/lib/typescript/src/components/NepaliRangePicker/types.d.ts.map +0 -1
- package/src/components/NepaliDatePicker/DatePickerModal.tsx +0 -220
- package/src/components/NepaliDatePicker/NepaliDatePicker.tsx +0 -171
- package/src/components/NepaliDatePicker/index.ts +0 -3
- package/src/components/NepaliDatePicker/types.ts +0 -70
- package/src/components/NepaliRangePicker/NepaliRangePicker.tsx +0 -206
- package/src/components/NepaliRangePicker/RangePickerModal.tsx +0 -336
- package/src/components/NepaliRangePicker/index.ts +0 -11
- package/src/components/NepaliRangePicker/range-utils.ts +0 -75
- package/src/components/NepaliRangePicker/types.ts +0 -84
package/README.md
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
# React Native Bikram Sambat Calendar
|
|
1
|
+
# React Native Bikram Sambat Calendar
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
5
5
|

|
|
6
6
|

|
|
7
7
|
|
|
8
|
-
`react-native-bikram-sambat`
|
|
8
|
+
`react-native-bikram-sambat` provides a clean inline Bikram Sambat calendar UI for React Native, plus TypeScript date utilities for AD/BS conversion, formatting, parsing, validation, and calendar grid generation.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
The current built-in conversion dataset supports BS years `2000` through `2100`.
|
|
10
|
+
The package does not include a date picker modal or range picker. You can place `NepaliCalendar` inside your own screen, bottom sheet, modal, or form flow.
|
|
13
11
|
|
|
14
12
|
## Features
|
|
15
13
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
14
|
+
- Inline `NepaliCalendar` UI component
|
|
15
|
+
- Shows the current BS month by default
|
|
16
|
+
- Month navigation
|
|
17
|
+
- Press the header year to open an inline year selector
|
|
18
|
+
- Optional `onDayPress` callback for custom behavior
|
|
19
|
+
- AD to BS and BS to AD conversion helpers
|
|
21
20
|
- English and Nepali locale support
|
|
22
21
|
- Latin and Devanagari numeral support
|
|
23
|
-
-
|
|
24
|
-
-
|
|
22
|
+
- Theme overrides and dark mode support
|
|
23
|
+
- TypeScript-first exports
|
|
24
|
+
|
|
25
|
+
The built-in conversion dataset supports BS years `2000` through `2100`.
|
|
25
26
|
|
|
26
27
|
## Installation
|
|
27
28
|
|
|
@@ -35,241 +36,71 @@ or
|
|
|
35
36
|
yarn add react-native-bikram-sambat
|
|
36
37
|
```
|
|
37
38
|
|
|
38
|
-
##
|
|
39
|
-
|
|
40
|
-
```tsx
|
|
41
|
-
import React, { useState } from 'react';
|
|
42
|
-
import { SafeAreaView } from 'react-native';
|
|
43
|
-
import {
|
|
44
|
-
NepaliDatePicker,
|
|
45
|
-
type BSDateValue,
|
|
46
|
-
} from 'react-native-bikram-sambat';
|
|
47
|
-
|
|
48
|
-
export default function App() {
|
|
49
|
-
const [date, setDate] = useState<BSDateValue | null>(null);
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
53
|
-
<NepaliDatePicker
|
|
54
|
-
value={date}
|
|
55
|
-
onChange={setDate}
|
|
56
|
-
placeholder="Select date"
|
|
57
|
-
locale="ne"
|
|
58
|
-
numerals="devanagari"
|
|
59
|
-
/>
|
|
60
|
-
</SafeAreaView>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## AD to BS Example
|
|
66
|
-
|
|
67
|
-
Use the built-in AD to BS converter when you need to convert a Gregorian date to a Bikram Sambat date.
|
|
68
|
-
|
|
69
|
-
```ts
|
|
70
|
-
import { toBS } from 'react-native-bikram-sambat';
|
|
71
|
-
|
|
72
|
-
const bsDate = toBS({
|
|
73
|
-
calendar: 'AD',
|
|
74
|
-
year: 2024,
|
|
75
|
-
month: 4,
|
|
76
|
-
day: 13,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
// Example result shape:
|
|
80
|
-
// { calendar: 'BS', year: 2081, month: 1, day: 1 }
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## BS to AD Example
|
|
84
|
-
|
|
85
|
-
Use the BS to AD converter when your app stores Bikram Sambat values and needs Gregorian output.
|
|
86
|
-
|
|
87
|
-
```ts
|
|
88
|
-
import { toAD } from 'react-native-bikram-sambat';
|
|
89
|
-
|
|
90
|
-
const adDate = toAD({
|
|
91
|
-
calendar: 'BS',
|
|
92
|
-
year: 2081,
|
|
93
|
-
month: 1,
|
|
94
|
-
day: 1,
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// Example result shape:
|
|
98
|
-
// { calendar: 'AD', year: 2024, month: 4, day: 13 }
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## React Native Date Picker Example
|
|
39
|
+
## Calendar Usage
|
|
102
40
|
|
|
103
41
|
```tsx
|
|
104
|
-
import React
|
|
42
|
+
import React from 'react';
|
|
105
43
|
import { SafeAreaView } from 'react-native';
|
|
106
|
-
import {
|
|
107
|
-
NepaliDatePicker,
|
|
108
|
-
type BSDateValue,
|
|
109
|
-
} from 'react-native-bikram-sambat';
|
|
44
|
+
import { NepaliCalendar } from 'react-native-bikram-sambat';
|
|
110
45
|
|
|
111
46
|
export default function App() {
|
|
112
|
-
const [selectedDate, setSelectedDate] = useState<BSDateValue | null>(null);
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
116
|
-
<NepaliDatePicker
|
|
117
|
-
value={selectedDate}
|
|
118
|
-
onChange={setSelectedDate}
|
|
119
|
-
placeholder="Choose a BS date"
|
|
120
|
-
displayFormat="yyyy-MM-dd"
|
|
121
|
-
locale="en"
|
|
122
|
-
numerals="latin"
|
|
123
|
-
/>
|
|
124
|
-
</SafeAreaView>
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
## More Usage Examples
|
|
130
|
-
|
|
131
|
-
### Inline Bikram Sambat calendar
|
|
132
|
-
|
|
133
|
-
```tsx
|
|
134
|
-
import React, { useState } from 'react';
|
|
135
|
-
import { SafeAreaView } from 'react-native';
|
|
136
|
-
import {
|
|
137
|
-
NepaliCalendar,
|
|
138
|
-
type BSDateValue,
|
|
139
|
-
} from 'react-native-bikram-sambat';
|
|
140
|
-
|
|
141
|
-
export default function App() {
|
|
142
|
-
const [date, setDate] = useState<BSDateValue | null>(null);
|
|
143
|
-
|
|
144
47
|
return (
|
|
145
48
|
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
146
49
|
<NepaliCalendar
|
|
147
|
-
value={date}
|
|
148
|
-
onChange={setDate}
|
|
149
50
|
locale="ne"
|
|
150
51
|
numerals="devanagari"
|
|
52
|
+
onDayPress={(date) => {
|
|
53
|
+
// Open your own modal, update form state, or navigate.
|
|
54
|
+
console.log(date);
|
|
55
|
+
}}
|
|
151
56
|
/>
|
|
152
57
|
</SafeAreaView>
|
|
153
58
|
);
|
|
154
59
|
}
|
|
155
60
|
```
|
|
156
61
|
|
|
157
|
-
|
|
62
|
+
## Controlled Month
|
|
158
63
|
|
|
159
64
|
```tsx
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
end: null,
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
return (
|
|
174
|
-
<SafeAreaView style={{ flex: 1, padding: 16 }}>
|
|
175
|
-
<NepaliRangePicker
|
|
176
|
-
value={range}
|
|
177
|
-
onChange={setRange}
|
|
178
|
-
placeholder="Select date range"
|
|
179
|
-
/>
|
|
180
|
-
</SafeAreaView>
|
|
181
|
-
);
|
|
182
|
-
}
|
|
65
|
+
<NepaliCalendar
|
|
66
|
+
year={2081}
|
|
67
|
+
month={1}
|
|
68
|
+
onMonthChange={({ year, month }) => {
|
|
69
|
+
console.log(year, month);
|
|
70
|
+
}}
|
|
71
|
+
onYearChange={({ year }) => {
|
|
72
|
+
console.log('selected year', year);
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
183
75
|
```
|
|
184
76
|
|
|
185
|
-
|
|
77
|
+
## Core Utilities
|
|
186
78
|
|
|
187
79
|
```ts
|
|
188
80
|
import {
|
|
81
|
+
toBS,
|
|
82
|
+
toAD,
|
|
189
83
|
formatBS,
|
|
190
84
|
parseBS,
|
|
191
|
-
|
|
192
|
-
|
|
85
|
+
todayBS,
|
|
86
|
+
createBSDateKey,
|
|
193
87
|
} from 'react-native-bikram-sambat';
|
|
194
88
|
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
const
|
|
89
|
+
const today = todayBS();
|
|
90
|
+
const bs = toBS({ calendar: 'AD', year: 2024, month: 4, day: 13 });
|
|
91
|
+
const ad = toAD({ calendar: 'BS', year: 2081, month: 1, day: 1 });
|
|
92
|
+
const label = formatBS(bs, 'dd MMMM yyyy', {
|
|
199
93
|
locale: 'ne',
|
|
200
94
|
numerals: 'devanagari',
|
|
201
95
|
});
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
const devanagari = toNepaliNumerals('2081');
|
|
205
|
-
const latin = toLatinNumerals('२०८१');
|
|
96
|
+
const parsed = parseBS('2081-01-01', 'yyyy-MM-dd');
|
|
97
|
+
const key = createBSDateKey(today);
|
|
206
98
|
```
|
|
207
99
|
|
|
208
|
-
##
|
|
209
|
-
|
|
210
|
-
### Components
|
|
211
|
-
|
|
212
|
-
- `NepaliCalendar`: Inline Bikram Sambat calendar component for React Native
|
|
213
|
-
- `NepaliDatePicker`: Pressable Nepali date picker input with modal calendar
|
|
214
|
-
- `DatePickerModal`: Controlled date picker modal component
|
|
215
|
-
- `NepaliRangePicker`: Range picker input for selecting start and end BS dates
|
|
216
|
-
- `RangePickerModal`: Controlled range picker modal component
|
|
217
|
-
|
|
218
|
-
### Conversion and formatting
|
|
219
|
-
|
|
220
|
-
- `toBS`: Convert an AD date to a BS date
|
|
221
|
-
- `toAD`: Convert a BS date to an AD date
|
|
222
|
-
- `formatBS`: Format a BS date using supported tokens
|
|
223
|
-
- `parseBS`: Parse a BS date string using the supported `yyyy-MM-dd` pattern
|
|
224
|
-
- `toNepaliNumerals`: Convert Latin digits to Devanagari digits
|
|
225
|
-
- `toLatinNumerals`: Convert Devanagari digits to Latin digits
|
|
226
|
-
|
|
227
|
-
### Validation and helpers
|
|
228
|
-
|
|
229
|
-
- `isValidBSDate`
|
|
230
|
-
- `isValidADDate`
|
|
231
|
-
- `isBSDateInSupportedRange`
|
|
232
|
-
- `getSupportedBSRange`
|
|
233
|
-
- `createBSDateKey`
|
|
234
|
-
- `parseBSDateKey`
|
|
235
|
-
- `compareBS`
|
|
236
|
-
- `addBSDays`
|
|
237
|
-
- `subBSDays`
|
|
238
|
-
- `todayBS`
|
|
239
|
-
- `getCalendarMonthGrid`
|
|
240
|
-
|
|
241
|
-
## Use Cases
|
|
242
|
-
|
|
243
|
-
- Building a Nepali date picker in a React Native checkout, booking, or profile flow
|
|
244
|
-
- Showing a Bikram Sambat calendar in education, finance, HR, government, or scheduling apps
|
|
245
|
-
- Converting user-entered Gregorian dates with an AD to BS converter
|
|
246
|
-
- Converting stored BS values to Gregorian dates with a BS to AD converter
|
|
247
|
-
- Supporting Nepali date conversion and display in apps for users in Nepal
|
|
248
|
-
- Adding a TypeScript React Native calendar package to an Expo or React Native CLI codebase
|
|
249
|
-
|
|
250
|
-
## Why Use This Package?
|
|
251
|
-
|
|
252
|
-
- It gives you a single package for both Nepali date conversion and React Native UI components.
|
|
253
|
-
- It reduces maintenance compared with rolling your own Bikram Sambat calendar logic.
|
|
254
|
-
- It keeps TypeScript types close to the public API for better editor support and safer integration.
|
|
255
|
-
- It supports theming, locales, numerals, and accessibility so teams can ship a more polished Nepali calendar for React Native.
|
|
256
|
-
|
|
257
|
-
## TypeScript Support
|
|
258
|
-
|
|
259
|
-
This package is built with TypeScript and publishes declaration files via the `types` field. Public types include `BSDateValue`, `ADDateValue`, `DateRangeValue`, `NepaliCalendarProps`, `NepaliDatePickerProps`, `RangePickerModalProps`, and theme-related types.
|
|
260
|
-
|
|
261
|
-
## Expo and React Native CLI Compatibility
|
|
262
|
-
|
|
263
|
-
This package currently appears suitable for both Expo-managed and React Native CLI projects because the published source is JavaScript and TypeScript only and does not define custom native modules. You should still test your target screens in your own app, especially if you rely on specific React Native versions, theming constraints, or accessibility requirements.
|
|
264
|
-
|
|
265
|
-
## Preview
|
|
100
|
+
## Screenshot
|
|
266
101
|
|
|
267
102
|

|
|
268
103
|
|
|
269
|
-
## Contributing
|
|
270
|
-
|
|
271
|
-
Contributions are welcome. Please open an issue for bugs, feature requests, or API discussions before large changes, and see [CONTRIBUTING.md](./CONTRIBUTING.md) for local setup and contribution guidance.
|
|
272
|
-
|
|
273
104
|
## License
|
|
274
105
|
|
|
275
|
-
MIT
|
|
106
|
+
MIT
|
|
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.HEADER_PREV_MONTH_LABEL = exports.HEADER_NEXT_MONTH_LABEL = void 0;
|
|
7
7
|
exports.getDayAccessibilityLabel = getDayAccessibilityLabel;
|
|
8
8
|
var _format = require("../core/format");
|
|
9
|
-
function getDayAccessibilityLabel(date, locale,
|
|
9
|
+
function getDayAccessibilityLabel(date, locale, today, disabled) {
|
|
10
10
|
const dateStr = (0, _format.formatBS)(date, 'yyyy MMMM d', {
|
|
11
11
|
locale
|
|
12
12
|
});
|
|
13
13
|
if (disabled) return `${dateStr}, disabled`;
|
|
14
|
-
if (selected) return `${dateStr}, selected`;
|
|
15
14
|
if (today) return `${dateStr}, today`;
|
|
16
15
|
return dateStr;
|
|
17
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_format","require","getDayAccessibilityLabel","date","locale","
|
|
1
|
+
{"version":3,"names":["_format","require","getDayAccessibilityLabel","date","locale","today","disabled","dateStr","formatBS","HEADER_PREV_MONTH_LABEL","exports","HEADER_NEXT_MONTH_LABEL"],"sourceRoot":"../../../src","sources":["accessibility/labels.ts"],"mappings":";;;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AAEO,SAASC,wBAAwBA,CACtCC,IAAiB,EACjBC,MAAsB,EACtBC,KAAc,EACdC,QAAiB,EACT;EACR,MAAMC,OAAO,GAAG,IAAAC,gBAAQ,EAACL,IAAI,EAAE,aAAa,EAAE;IAAEC;EAAO,CAAC,CAAC;EAEzD,IAAIE,QAAQ,EAAE,OAAO,GAAGC,OAAO,YAAY;EAC3C,IAAIF,KAAK,EAAE,OAAO,GAAGE,OAAO,SAAS;EAErC,OAAOA,OAAO;AAChB;AAEO,MAAME,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,gBAAgB;AAChD,MAAME,uBAAuB,GAAAD,OAAA,CAAAC,uBAAA,GAAG,YAAY","ignoreList":[]}
|
|
@@ -12,7 +12,6 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
12
12
|
const CalendarDay = exports.CalendarDay = /*#__PURE__*/(0, _react.memo)(function CalendarDay({
|
|
13
13
|
date,
|
|
14
14
|
day,
|
|
15
|
-
selected,
|
|
16
15
|
today,
|
|
17
16
|
disabled,
|
|
18
17
|
inCurrentMonth,
|
|
@@ -20,30 +19,16 @@ const CalendarDay = exports.CalendarDay = /*#__PURE__*/(0, _react.memo)(function
|
|
|
20
19
|
numerals,
|
|
21
20
|
theme,
|
|
22
21
|
onPress,
|
|
23
|
-
rangeStart,
|
|
24
|
-
rangeEnd,
|
|
25
|
-
inRange,
|
|
26
22
|
locale
|
|
27
23
|
}) {
|
|
28
24
|
const displayDay = (0, _react.useMemo)(() => numerals === 'devanagari' ? (0, _numerals.toNepaliNumerals)(day) : String(day), [day, numerals]);
|
|
29
|
-
const
|
|
25
|
+
const isPressable = Boolean(onPress) && !disabled;
|
|
30
26
|
const textColor = (0, _react.useMemo)(() => {
|
|
31
27
|
if (disabled) return theme.colors.disabledText;
|
|
32
|
-
if (isRangeEndpoint) return theme.colors.primaryText;
|
|
33
|
-
if (inRange) return theme.colors.rangeText;
|
|
34
|
-
if (selected) return theme.colors.primaryText;
|
|
35
28
|
if (!inCurrentMonth) return theme.colors.outsideMonthText;
|
|
36
29
|
if (marked?.textColor) return marked.textColor;
|
|
37
30
|
return theme.colors.text;
|
|
38
|
-
}, [disabled,
|
|
39
|
-
const backgroundColor = (0, _react.useMemo)(() => {
|
|
40
|
-
if (isRangeEndpoint) {
|
|
41
|
-
return rangeStart ? theme.colors.rangeStartBackground : theme.colors.rangeEndBackground;
|
|
42
|
-
}
|
|
43
|
-
if (inRange) return theme.colors.rangeBackground;
|
|
44
|
-
if (selected) return theme.colors.primary;
|
|
45
|
-
return undefined;
|
|
46
|
-
}, [isRangeEndpoint, rangeStart, inRange, selected, theme.colors.rangeStartBackground, theme.colors.rangeEndBackground, theme.colors.rangeBackground, theme.colors.primary]);
|
|
31
|
+
}, [disabled, inCurrentMonth, marked?.textColor, theme.colors.disabledText, theme.colors.outsideMonthText, theme.colors.text]);
|
|
47
32
|
const accessibilityLabel = (0, _react.useMemo)(() => {
|
|
48
33
|
const parts = [];
|
|
49
34
|
if (locale) {
|
|
@@ -60,31 +45,24 @@ const CalendarDay = exports.CalendarDay = /*#__PURE__*/(0, _react.memo)(function
|
|
|
60
45
|
} else {
|
|
61
46
|
parts.push(`${date.year}/${date.month}/${day}`);
|
|
62
47
|
}
|
|
63
|
-
if (rangeStart) parts.push('range start');
|
|
64
|
-
if (rangeEnd) parts.push('range end');
|
|
65
|
-
if (inRange && !rangeStart && !rangeEnd) parts.push('in selected range');
|
|
66
|
-
if (selected && !inRange) parts.push('selected');
|
|
67
48
|
if (today) parts.push('today');
|
|
68
49
|
if (disabled) parts.push('disabled');
|
|
69
50
|
if (!inCurrentMonth) parts.push('outside month');
|
|
70
51
|
if (marked?.label) parts.push(marked.label);
|
|
71
52
|
return parts.join(', ');
|
|
72
|
-
}, [date, day, locale,
|
|
73
|
-
const containerStyle = [styles.dayContainer,
|
|
74
|
-
backgroundColor
|
|
75
|
-
}, today && !isRangeEndpoint && !selected && !inRange && {
|
|
53
|
+
}, [date, day, locale, today, disabled, inCurrentMonth, marked?.label]);
|
|
54
|
+
const containerStyle = [styles.dayContainer, today && {
|
|
76
55
|
borderWidth: 1,
|
|
77
56
|
borderColor: theme.colors.todayBorder
|
|
78
|
-
}, disabled && styles.dayDisabled
|
|
57
|
+
}, disabled && styles.dayDisabled];
|
|
79
58
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
80
59
|
style: containerStyle,
|
|
81
60
|
onPress: onPress,
|
|
82
|
-
disabled:
|
|
83
|
-
accessibilityRole:
|
|
61
|
+
disabled: !isPressable,
|
|
62
|
+
accessibilityRole: isPressable ? 'button' : undefined,
|
|
84
63
|
accessibilityLabel: accessibilityLabel,
|
|
85
64
|
accessibilityState: {
|
|
86
|
-
disabled
|
|
87
|
-
selected: selected || isRangeEndpoint
|
|
65
|
+
disabled: disabled || !isPressable
|
|
88
66
|
},
|
|
89
67
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
90
68
|
style: [styles.dayText, {
|
|
@@ -107,17 +85,6 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
107
85
|
borderRadius: 20,
|
|
108
86
|
position: 'relative'
|
|
109
87
|
},
|
|
110
|
-
dayInRange: {
|
|
111
|
-
borderRadius: 0
|
|
112
|
-
},
|
|
113
|
-
dayRangeStart: {
|
|
114
|
-
borderTopLeftRadius: 20,
|
|
115
|
-
borderBottomLeftRadius: 20
|
|
116
|
-
},
|
|
117
|
-
dayRangeEnd: {
|
|
118
|
-
borderTopRightRadius: 20,
|
|
119
|
-
borderBottomRightRadius: 20
|
|
120
|
-
},
|
|
121
88
|
dayText: {
|
|
122
89
|
fontSize: 15,
|
|
123
90
|
textAlign: 'center',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_numerals","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","CalendarDay","exports","memo","date","day","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_numerals","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","CalendarDay","exports","memo","date","day","today","disabled","inCurrentMonth","marked","numerals","theme","onPress","locale","displayDay","useMemo","toNepaliNumerals","String","isPressable","Boolean","textColor","colors","disabledText","outsideMonthText","text","accessibilityLabel","parts","formatBS","push","year","month","label","join","containerStyle","styles","dayContainer","borderWidth","borderColor","todayBorder","dayDisabled","jsxs","Pressable","style","accessibilityRole","undefined","accessibilityState","children","jsx","Text","dayText","color","View","marker","backgroundColor","StyleSheet","create","alignItems","justifyContent","height","width","borderRadius","position","fontSize","textAlign","lineHeight","opacity","bottom"],"sourceRoot":"../../../../src","sources":["components/NepaliCalendar/CalendarDay.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAAuD,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,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BC,UAAU,EAAE;EACd,CAAC;EACDzB,WAAW,EAAE;IACX0B,OAAO,EAAE;EACX,CAAC;EACDb,MAAM,EAAE;IACNS,QAAQ,EAAE,UAAU;IACpBK,MAAM,EAAE,CAAC;IACTP,KAAK,EAAE,CAAC;IACRD,MAAM,EAAE,CAAC;IACTE,YAAY,EAAE;EAChB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -6,22 +6,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.CalendarGrid = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var _core = require("../../core");
|
|
10
|
-
var _rangeUtils = require("../NepaliRangePicker/range-utils");
|
|
11
9
|
var _CalendarDay = require("./CalendarDay");
|
|
12
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
12
|
const CalendarGrid = exports.CalendarGrid = /*#__PURE__*/(0, _react.memo)(function CalendarGrid({
|
|
15
13
|
grid,
|
|
16
|
-
value,
|
|
17
14
|
today,
|
|
18
15
|
numerals,
|
|
19
16
|
theme,
|
|
20
17
|
markedDates,
|
|
21
18
|
disabledDates,
|
|
22
|
-
|
|
19
|
+
onDayPress,
|
|
23
20
|
renderDay,
|
|
24
|
-
rangeValue,
|
|
25
21
|
locale
|
|
26
22
|
}) {
|
|
27
23
|
const isDateDisabledByList = (0, _react.useCallback)((date, dateKey) => {
|
|
@@ -34,37 +30,28 @@ const CalendarGrid = exports.CalendarGrid = /*#__PURE__*/(0, _react.memo)(functi
|
|
|
34
30
|
return false;
|
|
35
31
|
}, [disabledDates]);
|
|
36
32
|
const rows = (0, _react.useMemo)(() => {
|
|
37
|
-
const hasRange = rangeValue?.start != null;
|
|
38
33
|
return grid.weeks.map((week, weekIndex) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
39
34
|
style: styles.weekRow,
|
|
40
35
|
children: week.map(cell => {
|
|
41
36
|
const dateKey = cell.key;
|
|
42
|
-
const
|
|
43
|
-
const isTodayCell = today !== null && (0, _core.compareBS)(cell.date, today) === 0;
|
|
37
|
+
const isTodayCell = today !== null && cell.date.year === today.year && cell.date.month === today.month && cell.date.day === today.day;
|
|
44
38
|
const marked = markedDates?.[dateKey];
|
|
45
39
|
const explicitlyDisabled = marked?.disabled ?? false;
|
|
46
40
|
const disabled = explicitlyDisabled || cell.isDisabled || isDateDisabledByList(cell.date, dateKey);
|
|
47
|
-
const rangeStart = hasRange && (0, _rangeUtils.isRangeStart)(cell.date, rangeValue);
|
|
48
|
-
const rangeEnd = hasRange && (0, _rangeUtils.isRangeEnd)(cell.date, rangeValue);
|
|
49
|
-
const inRange = hasRange && (0, _rangeUtils.isDateInRange)(cell.date, rangeValue);
|
|
50
41
|
const handlePress = () => {
|
|
51
|
-
if (!disabled) {
|
|
52
|
-
|
|
42
|
+
if (!disabled && onDayPress) {
|
|
43
|
+
onDayPress(cell.date);
|
|
53
44
|
}
|
|
54
45
|
};
|
|
55
46
|
const dayProps = {
|
|
56
47
|
date: cell.date,
|
|
57
48
|
dateKey,
|
|
58
49
|
day: cell.day,
|
|
59
|
-
selected: isSelected,
|
|
60
50
|
today: isTodayCell,
|
|
61
51
|
disabled,
|
|
62
52
|
inCurrentMonth: cell.inCurrentMonth,
|
|
63
53
|
marked,
|
|
64
|
-
onPress: handlePress
|
|
65
|
-
rangeStart,
|
|
66
|
-
rangeEnd,
|
|
67
|
-
inRange
|
|
54
|
+
onPress: onDayPress ? handlePress : undefined
|
|
68
55
|
};
|
|
69
56
|
if (renderDay) {
|
|
70
57
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
@@ -77,23 +64,19 @@ const CalendarGrid = exports.CalendarGrid = /*#__PURE__*/(0, _react.memo)(functi
|
|
|
77
64
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CalendarDay.CalendarDay, {
|
|
78
65
|
date: cell.date,
|
|
79
66
|
day: cell.day,
|
|
80
|
-
selected: isSelected,
|
|
81
67
|
today: isTodayCell,
|
|
82
68
|
disabled: disabled,
|
|
83
69
|
inCurrentMonth: cell.inCurrentMonth,
|
|
84
70
|
marked: marked,
|
|
85
71
|
numerals: numerals,
|
|
86
72
|
theme: theme,
|
|
87
|
-
onPress: handlePress,
|
|
88
|
-
rangeStart: rangeStart,
|
|
89
|
-
rangeEnd: rangeEnd,
|
|
90
|
-
inRange: inRange,
|
|
73
|
+
onPress: onDayPress ? handlePress : undefined,
|
|
91
74
|
locale: locale
|
|
92
75
|
})
|
|
93
76
|
}, dateKey);
|
|
94
77
|
})
|
|
95
78
|
}, weekIndex));
|
|
96
|
-
}, [grid.weeks,
|
|
79
|
+
}, [grid.weeks, today, numerals, theme, markedDates, isDateDisabledByList, onDayPress, renderDay, locale]);
|
|
97
80
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
98
81
|
style: styles.grid,
|
|
99
82
|
children: rows
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_CalendarDay","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","CalendarGrid","exports","memo","grid","today","numerals","theme","markedDates","disabledDates","onDayPress","renderDay","locale","isDateDisabledByList","useCallback","date","dateKey","Array","isArray","includes","rows","useMemo","weeks","map","week","weekIndex","jsx","View","style","styles","weekRow","children","cell","key","isTodayCell","year","month","day","marked","explicitlyDisabled","disabled","isDisabled","handlePress","dayProps","inCurrentMonth","onPress","undefined","dayCell","CalendarDay","StyleSheet","create","paddingHorizontal","paddingBottom","flexDirection","justifyContent","flex","alignItems"],"sourceRoot":"../../../../src","sources":["components/NepaliCalendar/CalendarGrid.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,YAAA,GAAAF,OAAA;AAA4C,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAA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AI;YACdhC,KAAK,EAAE6B,WAAY;YACnBM,QAAQ,EAAEA,QAAS;YACnBI,cAAc,EAAEZ,IAAI,CAACY,cAAe;YACpCN,MAAM,EAAEA,MAAO;YACfhC,QAAQ,EAAEA,QAAS;YACnBC,KAAK,EAAEA,KAAM;YACbsC,OAAO,EAAEnC,UAAU,GAAGgC,WAAW,GAAGI,SAAU;YAC9ClC,MAAM,EAAEA;UAAO,CAChB;QAAC,GAZOI,OAaL,CAAC;MAEX,CAAC;IAAC,GAxDOS,SAyDL,CACP,CAAC;EACJ,CAAC,EAAE,CACDrB,IAAI,CAACkB,KAAK,EACVjB,KAAK,EACLC,QAAQ,EACRC,KAAK,EACLC,WAAW,EACXK,oBAAoB,EACpBH,UAAU,EACVC,SAAS,EACTC,MAAM,CACP,CAAC;EAEF,oBAAO,IAAA/B,WAAA,CAAA6C,GAAA,EAAC/C,YAAA,CAAAgD,IAAI;IAACC,KAAK,EAAEC,MAAM,CAACzB,IAAK;IAAA2B,QAAA,EAAEX;EAAI,CAAO,CAAC;AAChD,CAAC,CAAC;AAEF,MAAMS,MAAM,GAAGoB,uBAAU,CAACC,MAAM,CAAC;EAC/B9C,IAAI,EAAE;IACJ+C,iBAAiB,EAAE,CAAC;IACpBC,aAAa,EAAE;EACjB,CAAC;EACDtB,OAAO,EAAE;IACPuB,aAAa,EAAE,KAAK;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDP,OAAO,EAAE;IACPQ,IAAI,EAAE,CAAC;IACPC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -38,6 +38,7 @@ const CalendarHeader = exports.CalendarHeader = /*#__PURE__*/(0, _react.memo)(fu
|
|
|
38
38
|
theme,
|
|
39
39
|
onPrevMonth,
|
|
40
40
|
onNextMonth,
|
|
41
|
+
onYearPress,
|
|
41
42
|
canGoPrev,
|
|
42
43
|
canGoNext
|
|
43
44
|
}) {
|
|
@@ -62,11 +63,17 @@ const CalendarHeader = exports.CalendarHeader = /*#__PURE__*/(0, _react.memo)(fu
|
|
|
62
63
|
}],
|
|
63
64
|
children: "\u2039"
|
|
64
65
|
})
|
|
65
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.
|
|
66
|
-
style:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
67
|
+
style: styles.titleButton,
|
|
68
|
+
onPress: onYearPress,
|
|
69
|
+
accessibilityRole: "button",
|
|
70
|
+
accessibilityLabel: `Select year, ${title}`,
|
|
71
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
72
|
+
style: [styles.title, {
|
|
73
|
+
color: theme.colors.text
|
|
74
|
+
}],
|
|
75
|
+
children: title
|
|
76
|
+
})
|
|
70
77
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
71
78
|
style: [styles.navButton, !canGoNext && styles.navButtonDisabled],
|
|
72
79
|
onPress: handleNext,
|
|
@@ -93,9 +100,14 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
93
100
|
title: {
|
|
94
101
|
fontSize: 18,
|
|
95
102
|
fontWeight: '600',
|
|
96
|
-
flex: 1,
|
|
97
103
|
textAlign: 'center'
|
|
98
104
|
},
|
|
105
|
+
titleButton: {
|
|
106
|
+
flex: 1,
|
|
107
|
+
minHeight: 40,
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
justifyContent: 'center'
|
|
110
|
+
},
|
|
99
111
|
navButton: {
|
|
100
112
|
width: 40,
|
|
101
113
|
height: 40,
|