react-native-bikram-sambat 0.1.0

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.
Files changed (367) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +340 -0
  3. package/lib/commonjs/accessibility/index.js +25 -0
  4. package/lib/commonjs/accessibility/index.js.map +1 -0
  5. package/lib/commonjs/accessibility/labels.js +20 -0
  6. package/lib/commonjs/accessibility/labels.js.map +1 -0
  7. package/lib/commonjs/calendar/calendar-types.js +6 -0
  8. package/lib/commonjs/calendar/calendar-types.js.map +1 -0
  9. package/lib/commonjs/calendar/get-calendar-month-grid.js +114 -0
  10. package/lib/commonjs/calendar/get-calendar-month-grid.js.map +1 -0
  11. package/lib/commonjs/calendar/index.js +13 -0
  12. package/lib/commonjs/calendar/index.js.map +1 -0
  13. package/lib/commonjs/components/NepaliCalendar/CalendarDay.js +137 -0
  14. package/lib/commonjs/components/NepaliCalendar/CalendarDay.js.map +1 -0
  15. package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js +116 -0
  16. package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js.map +1 -0
  17. package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js +114 -0
  18. package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js.map +1 -0
  19. package/lib/commonjs/components/NepaliCalendar/CalendarWeekdays.js +44 -0
  20. package/lib/commonjs/components/NepaliCalendar/CalendarWeekdays.js.map +1 -0
  21. package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js +288 -0
  22. package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js.map +1 -0
  23. package/lib/commonjs/components/NepaliCalendar/index.js +13 -0
  24. package/lib/commonjs/components/NepaliCalendar/index.js.map +1 -0
  25. package/lib/commonjs/components/NepaliCalendar/types.js +6 -0
  26. package/lib/commonjs/components/NepaliCalendar/types.js.map +1 -0
  27. package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js +185 -0
  28. package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js.map +1 -0
  29. package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js +148 -0
  30. package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js.map +1 -0
  31. package/lib/commonjs/components/NepaliDatePicker/index.js +20 -0
  32. package/lib/commonjs/components/NepaliDatePicker/index.js.map +1 -0
  33. package/lib/commonjs/components/NepaliDatePicker/types.js +6 -0
  34. package/lib/commonjs/components/NepaliDatePicker/types.js.map +1 -0
  35. package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js +187 -0
  36. package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js.map +1 -0
  37. package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js +275 -0
  38. package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js.map +1 -0
  39. package/lib/commonjs/components/NepaliRangePicker/index.js +57 -0
  40. package/lib/commonjs/components/NepaliRangePicker/index.js.map +1 -0
  41. package/lib/commonjs/components/NepaliRangePicker/range-utils.js +70 -0
  42. package/lib/commonjs/components/NepaliRangePicker/range-utils.js.map +1 -0
  43. package/lib/commonjs/components/NepaliRangePicker/types.js +6 -0
  44. package/lib/commonjs/components/NepaliRangePicker/types.js.map +1 -0
  45. package/lib/commonjs/core/arithmetic.js +36 -0
  46. package/lib/commonjs/core/arithmetic.js.map +1 -0
  47. package/lib/commonjs/core/bsData.js +89 -0
  48. package/lib/commonjs/core/bsData.js.map +1 -0
  49. package/lib/commonjs/core/conversion.js +53 -0
  50. package/lib/commonjs/core/conversion.js.map +1 -0
  51. package/lib/commonjs/core/dateKey.js +31 -0
  52. package/lib/commonjs/core/dateKey.js.map +1 -0
  53. package/lib/commonjs/core/epochDay.js +47 -0
  54. package/lib/commonjs/core/epochDay.js.map +1 -0
  55. package/lib/commonjs/core/format/format.js +86 -0
  56. package/lib/commonjs/core/format/format.js.map +1 -0
  57. package/lib/commonjs/core/format/index.js +20 -0
  58. package/lib/commonjs/core/format/index.js.map +1 -0
  59. package/lib/commonjs/core/format/parse.js +41 -0
  60. package/lib/commonjs/core/format/parse.js.map +1 -0
  61. package/lib/commonjs/core/format/tokens.js +9 -0
  62. package/lib/commonjs/core/format/tokens.js.map +1 -0
  63. package/lib/commonjs/core/index.js +116 -0
  64. package/lib/commonjs/core/index.js.map +1 -0
  65. package/lib/commonjs/core/locale/en.js +15 -0
  66. package/lib/commonjs/core/locale/en.js.map +1 -0
  67. package/lib/commonjs/core/locale/index.js +20 -0
  68. package/lib/commonjs/core/locale/index.js.map +1 -0
  69. package/lib/commonjs/core/locale/ne.js +15 -0
  70. package/lib/commonjs/core/locale/ne.js.map +1 -0
  71. package/lib/commonjs/core/locale/types.js +2 -0
  72. package/lib/commonjs/core/locale/types.js.map +1 -0
  73. package/lib/commonjs/core/numerals/index.js +19 -0
  74. package/lib/commonjs/core/numerals/index.js.map +1 -0
  75. package/lib/commonjs/core/numerals/nepali-numerals.js +28 -0
  76. package/lib/commonjs/core/numerals/nepali-numerals.js.map +1 -0
  77. package/lib/commonjs/core/types.js +2 -0
  78. package/lib/commonjs/core/types.js.map +1 -0
  79. package/lib/commonjs/core/validation.js +125 -0
  80. package/lib/commonjs/core/validation.js.map +1 -0
  81. package/lib/commonjs/core/validation.test.js +248 -0
  82. package/lib/commonjs/core/validation.test.js.map +1 -0
  83. package/lib/commonjs/exports.test.js +133 -0
  84. package/lib/commonjs/exports.test.js.map +1 -0
  85. package/lib/commonjs/index.js +94 -0
  86. package/lib/commonjs/index.js.map +1 -0
  87. package/lib/commonjs/package.json +1 -0
  88. package/lib/commonjs/phase2.test.js +446 -0
  89. package/lib/commonjs/phase2.test.js.map +1 -0
  90. package/lib/commonjs/phase3.test.js +91 -0
  91. package/lib/commonjs/phase3.test.js.map +1 -0
  92. package/lib/commonjs/phase4.test.js +89 -0
  93. package/lib/commonjs/phase4.test.js.map +1 -0
  94. package/lib/commonjs/phase5.test.js +246 -0
  95. package/lib/commonjs/phase5.test.js.map +1 -0
  96. package/lib/commonjs/phase7.test.js +284 -0
  97. package/lib/commonjs/phase7.test.js.map +1 -0
  98. package/lib/commonjs/range-helpers.test.js +182 -0
  99. package/lib/commonjs/range-helpers.test.js.map +1 -0
  100. package/lib/commonjs/theme/create-theme.js +37 -0
  101. package/lib/commonjs/theme/create-theme.js.map +1 -0
  102. package/lib/commonjs/theme/default-theme.js +99 -0
  103. package/lib/commonjs/theme/default-theme.js.map +1 -0
  104. package/lib/commonjs/theme/index.js +26 -0
  105. package/lib/commonjs/theme/index.js.map +1 -0
  106. package/lib/commonjs/theme/types.js +6 -0
  107. package/lib/commonjs/theme/types.js.map +1 -0
  108. package/lib/commonjs/utils/date-helpers.js +106 -0
  109. package/lib/commonjs/utils/date-helpers.js.map +1 -0
  110. package/lib/commonjs/utils/index.js +49 -0
  111. package/lib/commonjs/utils/index.js.map +1 -0
  112. package/lib/module/accessibility/index.js +4 -0
  113. package/lib/module/accessibility/index.js.map +1 -0
  114. package/lib/module/accessibility/labels.js +15 -0
  115. package/lib/module/accessibility/labels.js.map +1 -0
  116. package/lib/module/calendar/calendar-types.js +4 -0
  117. package/lib/module/calendar/calendar-types.js.map +1 -0
  118. package/lib/module/calendar/get-calendar-month-grid.js +111 -0
  119. package/lib/module/calendar/get-calendar-month-grid.js.map +1 -0
  120. package/lib/module/calendar/index.js +4 -0
  121. package/lib/module/calendar/index.js.map +1 -0
  122. package/lib/module/components/NepaliCalendar/CalendarDay.js +132 -0
  123. package/lib/module/components/NepaliCalendar/CalendarDay.js.map +1 -0
  124. package/lib/module/components/NepaliCalendar/CalendarGrid.js +111 -0
  125. package/lib/module/components/NepaliCalendar/CalendarGrid.js.map +1 -0
  126. package/lib/module/components/NepaliCalendar/CalendarHeader.js +109 -0
  127. package/lib/module/components/NepaliCalendar/CalendarHeader.js.map +1 -0
  128. package/lib/module/components/NepaliCalendar/CalendarWeekdays.js +39 -0
  129. package/lib/module/components/NepaliCalendar/CalendarWeekdays.js.map +1 -0
  130. package/lib/module/components/NepaliCalendar/NepaliCalendar.js +283 -0
  131. package/lib/module/components/NepaliCalendar/NepaliCalendar.js.map +1 -0
  132. package/lib/module/components/NepaliCalendar/index.js +4 -0
  133. package/lib/module/components/NepaliCalendar/index.js.map +1 -0
  134. package/lib/module/components/NepaliCalendar/types.js +4 -0
  135. package/lib/module/components/NepaliCalendar/types.js.map +1 -0
  136. package/lib/module/components/NepaliDatePicker/DatePickerModal.js +180 -0
  137. package/lib/module/components/NepaliDatePicker/DatePickerModal.js.map +1 -0
  138. package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js +143 -0
  139. package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js.map +1 -0
  140. package/lib/module/components/NepaliDatePicker/index.js +5 -0
  141. package/lib/module/components/NepaliDatePicker/index.js.map +1 -0
  142. package/lib/module/components/NepaliDatePicker/types.js +4 -0
  143. package/lib/module/components/NepaliDatePicker/types.js.map +1 -0
  144. package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js +182 -0
  145. package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js.map +1 -0
  146. package/lib/module/components/NepaliRangePicker/RangePickerModal.js +270 -0
  147. package/lib/module/components/NepaliRangePicker/RangePickerModal.js.map +1 -0
  148. package/lib/module/components/NepaliRangePicker/index.js +6 -0
  149. package/lib/module/components/NepaliRangePicker/index.js.map +1 -0
  150. package/lib/module/components/NepaliRangePicker/range-utils.js +61 -0
  151. package/lib/module/components/NepaliRangePicker/range-utils.js.map +1 -0
  152. package/lib/module/components/NepaliRangePicker/types.js +4 -0
  153. package/lib/module/components/NepaliRangePicker/types.js.map +1 -0
  154. package/lib/module/core/arithmetic.js +29 -0
  155. package/lib/module/core/arithmetic.js.map +1 -0
  156. package/lib/module/core/bsData.js +82 -0
  157. package/lib/module/core/bsData.js.map +1 -0
  158. package/lib/module/core/conversion.js +48 -0
  159. package/lib/module/core/conversion.js.map +1 -0
  160. package/lib/module/core/dateKey.js +26 -0
  161. package/lib/module/core/dateKey.js.map +1 -0
  162. package/lib/module/core/epochDay.js +39 -0
  163. package/lib/module/core/epochDay.js.map +1 -0
  164. package/lib/module/core/format/format.js +82 -0
  165. package/lib/module/core/format/format.js.map +1 -0
  166. package/lib/module/core/format/index.js +5 -0
  167. package/lib/module/core/format/index.js.map +1 -0
  168. package/lib/module/core/format/parse.js +37 -0
  169. package/lib/module/core/format/parse.js.map +1 -0
  170. package/lib/module/core/format/tokens.js +5 -0
  171. package/lib/module/core/format/tokens.js.map +1 -0
  172. package/lib/module/core/index.js +13 -0
  173. package/lib/module/core/index.js.map +1 -0
  174. package/lib/module/core/locale/en.js +11 -0
  175. package/lib/module/core/locale/en.js.map +1 -0
  176. package/lib/module/core/locale/index.js +5 -0
  177. package/lib/module/core/locale/index.js.map +1 -0
  178. package/lib/module/core/locale/ne.js +11 -0
  179. package/lib/module/core/locale/ne.js.map +1 -0
  180. package/lib/module/core/locale/types.js +2 -0
  181. package/lib/module/core/locale/types.js.map +1 -0
  182. package/lib/module/core/numerals/index.js +4 -0
  183. package/lib/module/core/numerals/index.js.map +1 -0
  184. package/lib/module/core/numerals/nepali-numerals.js +23 -0
  185. package/lib/module/core/numerals/nepali-numerals.js.map +1 -0
  186. package/lib/module/core/types.js +2 -0
  187. package/lib/module/core/types.js.map +1 -0
  188. package/lib/module/core/validation.js +115 -0
  189. package/lib/module/core/validation.js.map +1 -0
  190. package/lib/module/core/validation.test.js +248 -0
  191. package/lib/module/core/validation.test.js.map +1 -0
  192. package/lib/module/exports.test.js +133 -0
  193. package/lib/module/exports.test.js.map +1 -0
  194. package/lib/module/index.js +11 -0
  195. package/lib/module/index.js.map +1 -0
  196. package/lib/module/package.json +1 -0
  197. package/lib/module/phase2.test.js +446 -0
  198. package/lib/module/phase2.test.js.map +1 -0
  199. package/lib/module/phase3.test.js +91 -0
  200. package/lib/module/phase3.test.js.map +1 -0
  201. package/lib/module/phase4.test.js +89 -0
  202. package/lib/module/phase4.test.js.map +1 -0
  203. package/lib/module/phase5.test.js +246 -0
  204. package/lib/module/phase5.test.js.map +1 -0
  205. package/lib/module/phase7.test.js +284 -0
  206. package/lib/module/phase7.test.js.map +1 -0
  207. package/lib/module/range-helpers.test.js +182 -0
  208. package/lib/module/range-helpers.test.js.map +1 -0
  209. package/lib/module/theme/create-theme.js +33 -0
  210. package/lib/module/theme/create-theme.js.map +1 -0
  211. package/lib/module/theme/default-theme.js +95 -0
  212. package/lib/module/theme/default-theme.js.map +1 -0
  213. package/lib/module/theme/index.js +5 -0
  214. package/lib/module/theme/index.js.map +1 -0
  215. package/lib/module/theme/types.js +4 -0
  216. package/lib/module/theme/types.js.map +1 -0
  217. package/lib/module/utils/date-helpers.js +96 -0
  218. package/lib/module/utils/date-helpers.js.map +1 -0
  219. package/lib/module/utils/index.js +4 -0
  220. package/lib/module/utils/index.js.map +1 -0
  221. package/lib/typescript/src/accessibility/index.d.ts +2 -0
  222. package/lib/typescript/src/accessibility/index.d.ts.map +1 -0
  223. package/lib/typescript/src/accessibility/labels.d.ts +6 -0
  224. package/lib/typescript/src/accessibility/labels.d.ts.map +1 -0
  225. package/lib/typescript/src/calendar/calendar-types.d.ts +23 -0
  226. package/lib/typescript/src/calendar/calendar-types.d.ts.map +1 -0
  227. package/lib/typescript/src/calendar/get-calendar-month-grid.d.ts +3 -0
  228. package/lib/typescript/src/calendar/get-calendar-month-grid.d.ts.map +1 -0
  229. package/lib/typescript/src/calendar/index.d.ts +3 -0
  230. package/lib/typescript/src/calendar/index.d.ts.map +1 -0
  231. package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts +23 -0
  232. package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts.map +1 -0
  233. package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts +25 -0
  234. package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts.map +1 -0
  235. package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts +17 -0
  236. package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts.map +1 -0
  237. package/lib/typescript/src/components/NepaliCalendar/CalendarWeekdays.d.ts +11 -0
  238. package/lib/typescript/src/components/NepaliCalendar/CalendarWeekdays.d.ts.map +1 -0
  239. package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts +4 -0
  240. package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts.map +1 -0
  241. package/lib/typescript/src/components/NepaliCalendar/index.d.ts +3 -0
  242. package/lib/typescript/src/components/NepaliCalendar/index.d.ts.map +1 -0
  243. package/lib/typescript/src/components/NepaliCalendar/types.d.ts +52 -0
  244. package/lib/typescript/src/components/NepaliCalendar/types.d.ts.map +1 -0
  245. package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts +4 -0
  246. package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts.map +1 -0
  247. package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts +4 -0
  248. package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts.map +1 -0
  249. package/lib/typescript/src/components/NepaliDatePicker/index.d.ts +4 -0
  250. package/lib/typescript/src/components/NepaliDatePicker/index.d.ts.map +1 -0
  251. package/lib/typescript/src/components/NepaliDatePicker/types.d.ts +50 -0
  252. package/lib/typescript/src/components/NepaliDatePicker/types.d.ts.map +1 -0
  253. package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts +4 -0
  254. package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts.map +1 -0
  255. package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts +4 -0
  256. package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts.map +1 -0
  257. package/lib/typescript/src/components/NepaliRangePicker/index.d.ts +5 -0
  258. package/lib/typescript/src/components/NepaliRangePicker/index.d.ts.map +1 -0
  259. package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts +13 -0
  260. package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts.map +1 -0
  261. package/lib/typescript/src/components/NepaliRangePicker/types.d.ts +61 -0
  262. package/lib/typescript/src/components/NepaliRangePicker/types.d.ts.map +1 -0
  263. package/lib/typescript/src/core/arithmetic.d.ts +6 -0
  264. package/lib/typescript/src/core/arithmetic.d.ts.map +1 -0
  265. package/lib/typescript/src/core/bsData.d.ts +39 -0
  266. package/lib/typescript/src/core/bsData.d.ts.map +1 -0
  267. package/lib/typescript/src/core/conversion.d.ts +4 -0
  268. package/lib/typescript/src/core/conversion.d.ts.map +1 -0
  269. package/lib/typescript/src/core/dateKey.d.ts +4 -0
  270. package/lib/typescript/src/core/dateKey.d.ts.map +1 -0
  271. package/lib/typescript/src/core/epochDay.d.ts +7 -0
  272. package/lib/typescript/src/core/epochDay.d.ts.map +1 -0
  273. package/lib/typescript/src/core/format/format.d.ts +8 -0
  274. package/lib/typescript/src/core/format/format.d.ts.map +1 -0
  275. package/lib/typescript/src/core/format/index.d.ts +5 -0
  276. package/lib/typescript/src/core/format/index.d.ts.map +1 -0
  277. package/lib/typescript/src/core/format/parse.d.ts +7 -0
  278. package/lib/typescript/src/core/format/parse.d.ts.map +1 -0
  279. package/lib/typescript/src/core/format/tokens.d.ts +4 -0
  280. package/lib/typescript/src/core/format/tokens.d.ts.map +1 -0
  281. package/lib/typescript/src/core/index.d.ts +11 -0
  282. package/lib/typescript/src/core/index.d.ts.map +1 -0
  283. package/lib/typescript/src/core/locale/en.d.ts +3 -0
  284. package/lib/typescript/src/core/locale/en.d.ts.map +1 -0
  285. package/lib/typescript/src/core/locale/index.d.ts +4 -0
  286. package/lib/typescript/src/core/locale/index.d.ts.map +1 -0
  287. package/lib/typescript/src/core/locale/ne.d.ts +3 -0
  288. package/lib/typescript/src/core/locale/ne.d.ts.map +1 -0
  289. package/lib/typescript/src/core/locale/types.d.ts +11 -0
  290. package/lib/typescript/src/core/locale/types.d.ts.map +1 -0
  291. package/lib/typescript/src/core/numerals/index.d.ts +2 -0
  292. package/lib/typescript/src/core/numerals/index.d.ts.map +1 -0
  293. package/lib/typescript/src/core/numerals/nepali-numerals.d.ts +3 -0
  294. package/lib/typescript/src/core/numerals/nepali-numerals.d.ts.map +1 -0
  295. package/lib/typescript/src/core/types.d.ts +14 -0
  296. package/lib/typescript/src/core/types.d.ts.map +1 -0
  297. package/lib/typescript/src/core/validation.d.ts +17 -0
  298. package/lib/typescript/src/core/validation.d.ts.map +1 -0
  299. package/lib/typescript/src/index.d.ts +9 -0
  300. package/lib/typescript/src/index.d.ts.map +1 -0
  301. package/lib/typescript/src/theme/create-theme.d.ts +6 -0
  302. package/lib/typescript/src/theme/create-theme.d.ts.map +1 -0
  303. package/lib/typescript/src/theme/default-theme.d.ts +4 -0
  304. package/lib/typescript/src/theme/default-theme.d.ts.map +1 -0
  305. package/lib/typescript/src/theme/index.d.ts +4 -0
  306. package/lib/typescript/src/theme/index.d.ts.map +1 -0
  307. package/lib/typescript/src/theme/types.d.ts +43 -0
  308. package/lib/typescript/src/theme/types.d.ts.map +1 -0
  309. package/lib/typescript/src/utils/date-helpers.d.ts +27 -0
  310. package/lib/typescript/src/utils/date-helpers.d.ts.map +1 -0
  311. package/lib/typescript/src/utils/index.d.ts +2 -0
  312. package/lib/typescript/src/utils/index.d.ts.map +1 -0
  313. package/package.json +85 -0
  314. package/src/accessibility/index.ts +5 -0
  315. package/src/accessibility/labels.ts +22 -0
  316. package/src/calendar/calendar-types.ts +25 -0
  317. package/src/calendar/get-calendar-month-grid.ts +125 -0
  318. package/src/calendar/index.ts +2 -0
  319. package/src/components/NepaliCalendar/CalendarDay.tsx +198 -0
  320. package/src/components/NepaliCalendar/CalendarGrid.tsx +159 -0
  321. package/src/components/NepaliCalendar/CalendarHeader.tsx +126 -0
  322. package/src/components/NepaliCalendar/CalendarWeekdays.tsx +49 -0
  323. package/src/components/NepaliCalendar/NepaliCalendar.tsx +279 -0
  324. package/src/components/NepaliCalendar/index.ts +6 -0
  325. package/src/components/NepaliCalendar/types.ts +62 -0
  326. package/src/components/NepaliDatePicker/DatePickerModal.tsx +220 -0
  327. package/src/components/NepaliDatePicker/NepaliDatePicker.tsx +171 -0
  328. package/src/components/NepaliDatePicker/index.ts +3 -0
  329. package/src/components/NepaliDatePicker/types.ts +70 -0
  330. package/src/components/NepaliRangePicker/NepaliRangePicker.tsx +206 -0
  331. package/src/components/NepaliRangePicker/RangePickerModal.tsx +336 -0
  332. package/src/components/NepaliRangePicker/index.ts +11 -0
  333. package/src/components/NepaliRangePicker/range-utils.ts +75 -0
  334. package/src/components/NepaliRangePicker/types.ts +84 -0
  335. package/src/core/arithmetic.ts +34 -0
  336. package/src/core/bsData.ts +115 -0
  337. package/src/core/conversion.ts +73 -0
  338. package/src/core/dateKey.ts +31 -0
  339. package/src/core/epochDay.ts +49 -0
  340. package/src/core/format/format.ts +108 -0
  341. package/src/core/format/index.ts +4 -0
  342. package/src/core/format/parse.ts +68 -0
  343. package/src/core/format/tokens.ts +35 -0
  344. package/src/core/index.ts +10 -0
  345. package/src/core/locale/en.ts +23 -0
  346. package/src/core/locale/index.ts +3 -0
  347. package/src/core/locale/ne.ts +31 -0
  348. package/src/core/locale/types.ts +12 -0
  349. package/src/core/numerals/index.ts +1 -0
  350. package/src/core/numerals/nepali-numerals.ts +27 -0
  351. package/src/core/types.ts +15 -0
  352. package/src/core/validation.test.ts +207 -0
  353. package/src/core/validation.ts +141 -0
  354. package/src/exports.test.ts +135 -0
  355. package/src/index.ts +8 -0
  356. package/src/phase2.test.ts +424 -0
  357. package/src/phase3.test.ts +83 -0
  358. package/src/phase4.test.ts +86 -0
  359. package/src/phase5.test.ts +257 -0
  360. package/src/phase7.test.ts +307 -0
  361. package/src/range-helpers.test.ts +153 -0
  362. package/src/theme/create-theme.ts +29 -0
  363. package/src/theme/default-theme.ts +99 -0
  364. package/src/theme/index.ts +3 -0
  365. package/src/theme/types.ts +44 -0
  366. package/src/utils/date-helpers.ts +146 -0
  367. package/src/utils/index.ts +9 -0
@@ -0,0 +1,43 @@
1
+ import type { TextStyle } from 'react-native';
2
+ export type CalendarTheme = {
3
+ colors: {
4
+ background: string;
5
+ surface: string;
6
+ text: string;
7
+ mutedText: string;
8
+ primary: string;
9
+ primaryText: string;
10
+ todayBorder: string;
11
+ disabledText: string;
12
+ outsideMonthText: string;
13
+ border: string;
14
+ marker: string;
15
+ overlay: string;
16
+ modalBackground: string;
17
+ fieldBackground: string;
18
+ fieldBorder: string;
19
+ placeholderText: string;
20
+ rangeBackground: string;
21
+ rangeText: string;
22
+ rangeStartBackground: string;
23
+ rangeEndBackground: string;
24
+ danger: string;
25
+ };
26
+ radius: {
27
+ day: number;
28
+ calendar: number;
29
+ };
30
+ spacing: {
31
+ xs: number;
32
+ sm: number;
33
+ md: number;
34
+ lg: number;
35
+ };
36
+ typography: {
37
+ header: TextStyle;
38
+ weekday: TextStyle;
39
+ day: TextStyle;
40
+ };
41
+ };
42
+ export type ColorScheme = 'light' | 'dark' | 'system';
43
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/theme/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,SAAS,EAAE,MAAM,CAAC;QAClB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;QACX,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,UAAU,EAAE;QACV,MAAM,EAAE,SAAS,CAAC;QAClB,OAAO,EAAE,SAAS,CAAC;QACnB,GAAG,EAAE,SAAS,CAAC;KAChB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { BSDateValue } from '../core/types';
2
+ import type { LocaleCode, NumeralSystem, CalendarLocale } from '../core/locale';
3
+ export declare function safeFormatBSDate(date: BSDateValue | null | undefined, pattern: string, locale?: LocaleCode | CalendarLocale, numerals?: NumeralSystem): string | null;
4
+ export declare function getSafeInitialBSDate(value: BSDateValue | null | undefined, defaultValue: BSDateValue | undefined): BSDateValue;
5
+ export declare function isDateDisabled(date: BSDateValue, options: {
6
+ minDate?: BSDateValue;
7
+ maxDate?: BSDateValue;
8
+ disabledDates?: string[] | ((date: BSDateValue) => boolean);
9
+ dateKey: string;
10
+ }): boolean;
11
+ export declare function createDateAccessibilityLabel(date: BSDateValue, locale: CalendarLocale, options: {
12
+ selected?: boolean;
13
+ today?: boolean;
14
+ disabled?: boolean;
15
+ outsideMonth?: boolean;
16
+ rangeStart?: boolean;
17
+ rangeEnd?: boolean;
18
+ inRange?: boolean;
19
+ markedLabel?: string;
20
+ }): string;
21
+ export declare function warnInvalidDateInDev(message: string, value: unknown): void;
22
+ export declare function warnOutOfRangeInDev(value: BSDateValue, range: {
23
+ min: number;
24
+ max: number;
25
+ }): void;
26
+ export declare function warnMinMaxInDev(minDate: BSDateValue | undefined, maxDate: BSDateValue | undefined): void;
27
+ //# sourceMappingURL=date-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-helpers.d.ts","sourceRoot":"","sources":["../../../../src/utils/date-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,UAAU,GAAG,cAAc,EACpC,QAAQ,CAAC,EAAE,aAAa,GACvB,MAAM,GAAG,IAAI,CAUf;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACrC,YAAY,EAAE,WAAW,GAAG,SAAS,GACpC,WAAW,CAUb;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE;IACP,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC;IAC5D,OAAO,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAeT;AAQD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE;IACP,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GACA,MAAM,CA8BR;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,GACb,IAAI,CAIN;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAClC,IAAI,CAON;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,GAAG,SAAS,EAChC,OAAO,EAAE,WAAW,GAAG,SAAS,GAC/B,IAAI,CAQN"}
@@ -0,0 +1,2 @@
1
+ export { safeFormatBSDate, getSafeInitialBSDate, isDateDisabled, createDateAccessibilityLabel, warnInvalidDateInDev, warnOutOfRangeInDev, warnMinMaxInDev, } from './date-helpers';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,gBAAgB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "react-native-bikram-sambat",
3
+ "version": "0.1.0",
4
+ "description": "A production-grade Bikram Sambat calendar engine and React Native date picker for React Native.",
5
+ "main": "./lib/commonjs/index.js",
6
+ "module": "./lib/module/index.js",
7
+ "types": "./lib/typescript/src/index.d.ts",
8
+ "react-native": "./src/index.ts",
9
+ "source": "./src/index.ts",
10
+ "sideEffects": false,
11
+ "exports": {
12
+ ".": {
13
+ "react-native": "./src/index.ts",
14
+ "types": "./lib/typescript/src/index.d.ts",
15
+ "import": "./lib/module/index.js",
16
+ "require": "./lib/commonjs/index.js"
17
+ },
18
+ "./package.json": "./package.json"
19
+ },
20
+ "files": [
21
+ "src",
22
+ "lib",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "keywords": [
27
+ "react-native",
28
+ "bikram-sambat",
29
+ "nepali-calendar",
30
+ "bs-date",
31
+ "date-picker",
32
+ "calendar",
33
+ "nepali-date",
34
+ "bs-to-ad",
35
+ "ad-to-bs"
36
+ ],
37
+ "author": "",
38
+ "license": "MIT",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/your-org/react-native-bikram-sambat.git"
42
+ },
43
+ "bugs": {
44
+ "url": "https://github.com/your-org/react-native-bikram-sambat/issues"
45
+ },
46
+ "homepage": "https://github.com/your-org/react-native-bikram-sambat#readme",
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "peerDependencies": {
51
+ "react": ">=18",
52
+ "react-native": ">=0.73"
53
+ },
54
+ "devDependencies": {
55
+ "@types/jest": "^29.5.12",
56
+ "@types/react": "^19.2.14",
57
+ "jest": "^29.7.0",
58
+ "react-native-builder-bob": "^0.30.0",
59
+ "rimraf": "^6.0.1",
60
+ "ts-jest": "^29.2.5",
61
+ "typescript": "^5.5.4"
62
+ },
63
+ "scripts": {
64
+ "build": "bob build",
65
+ "typecheck": "tsc --noEmit",
66
+ "test": "jest",
67
+ "clean": "rimraf lib",
68
+ "prepack": "bob build",
69
+ "pack:dry": "npm pack --dry-run"
70
+ },
71
+ "react-native-builder-bob": {
72
+ "source": "src",
73
+ "output": "lib",
74
+ "targets": [
75
+ "commonjs",
76
+ "module",
77
+ [
78
+ "typescript",
79
+ {
80
+ "project": "tsconfig.build.json"
81
+ }
82
+ ]
83
+ ]
84
+ }
85
+ }
@@ -0,0 +1,5 @@
1
+ export {
2
+ getDayAccessibilityLabel,
3
+ HEADER_PREV_MONTH_LABEL,
4
+ HEADER_NEXT_MONTH_LABEL,
5
+ } from './labels';
@@ -0,0 +1,22 @@
1
+ import type { BSDateValue } from '../core/types';
2
+ import type { CalendarLocale } from '../core/locale';
3
+ import { formatBS } from '../core/format';
4
+
5
+ export function getDayAccessibilityLabel(
6
+ date: BSDateValue,
7
+ locale: CalendarLocale,
8
+ selected: boolean,
9
+ today: boolean,
10
+ disabled: boolean
11
+ ): string {
12
+ const dateStr = formatBS(date, 'yyyy MMMM d', { locale });
13
+
14
+ if (disabled) return `${dateStr}, disabled`;
15
+ if (selected) return `${dateStr}, selected`;
16
+ if (today) return `${dateStr}, today`;
17
+
18
+ return dateStr;
19
+ }
20
+
21
+ export const HEADER_PREV_MONTH_LABEL = 'Previous month';
22
+ export const HEADER_NEXT_MONTH_LABEL = 'Next month';
@@ -0,0 +1,25 @@
1
+ import type { BSDateValue } from '../core/types';
2
+
3
+ export type CalendarMonthGridOptions = {
4
+ year: number;
5
+ month: number;
6
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
7
+ minDate?: BSDateValue;
8
+ maxDate?: BSDateValue;
9
+ today?: BSDateValue;
10
+ };
11
+
12
+ export type CalendarMonthCell = {
13
+ key: string;
14
+ date: BSDateValue;
15
+ day: number;
16
+ inCurrentMonth: boolean;
17
+ isToday: boolean;
18
+ isDisabled: boolean;
19
+ };
20
+
21
+ export type CalendarMonthGrid = {
22
+ year: number;
23
+ month: number;
24
+ weeks: CalendarMonthCell[][];
25
+ };
@@ -0,0 +1,125 @@
1
+ import type { BSDateValue } from '../core/types';
2
+ import { createBSDateKey } from '../core/dateKey';
3
+ import { getBSMonthLength } from '../core/validation';
4
+ import { getSupportedBSYearRange } from '../core/bsData';
5
+ import { compareBS } from '../core/arithmetic';
6
+ import { toAD } from '../core/conversion';
7
+ import { todayBS } from '../core/arithmetic';
8
+ import type { CalendarMonthCell, CalendarMonthGrid, CalendarMonthGridOptions } from './calendar-types';
9
+
10
+ function getWeekday(bsDate: BSDateValue): number {
11
+ const ad = toAD(bsDate);
12
+ const utcDate = new Date(Date.UTC(ad.year, ad.month - 1, ad.day));
13
+ return utcDate.getUTCDay();
14
+ }
15
+
16
+ function safeGetBSMonthLength(year: number, month: number): number | null {
17
+ try {
18
+ return getBSMonthLength(year, month);
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+
24
+ function safeCreateBSDateKey(date: BSDateValue): string {
25
+ try {
26
+ return createBSDateKey(date);
27
+ } catch {
28
+ return `${date.year}-${String(date.month).padStart(2, '0')}-${String(date.day).padStart(2, '0')}`;
29
+ }
30
+ }
31
+
32
+ function isDateInRange(year: number): boolean {
33
+ const range = getSupportedBSYearRange();
34
+ return year >= range.min && year <= range.max;
35
+ }
36
+
37
+ function makeCell(
38
+ year: number,
39
+ month: number,
40
+ day: number,
41
+ inCurrentMonth: boolean,
42
+ todayDate: BSDateValue | null,
43
+ minDate: BSDateValue | undefined,
44
+ maxDate: BSDateValue | undefined
45
+ ): CalendarMonthCell {
46
+ const date: BSDateValue = { calendar: 'BS', year, month, day };
47
+ const key = safeCreateBSDateKey(date);
48
+ const inRange = isDateInRange(year);
49
+ const isToday = inRange && todayDate !== null && compareBS(date, todayDate) === 0;
50
+ const isDisabled =
51
+ !inRange ||
52
+ (minDate !== undefined && compareBS(date, minDate) < 0) ||
53
+ (maxDate !== undefined && compareBS(date, maxDate) > 0);
54
+
55
+ return {
56
+ key,
57
+ date,
58
+ day,
59
+ inCurrentMonth,
60
+ isToday,
61
+ isDisabled,
62
+ };
63
+ }
64
+
65
+ export function getCalendarMonthGrid(
66
+ options: CalendarMonthGridOptions
67
+ ): CalendarMonthGrid {
68
+ const { year, month, weekStartsOn = 0, minDate, maxDate } = options;
69
+
70
+ const monthLength = getBSMonthLength(year, month);
71
+ const firstDay: BSDateValue = { calendar: 'BS', year, month, day: 1 };
72
+ const firstWeekday = getWeekday(firstDay);
73
+
74
+ const leadingDays = (firstWeekday - weekStartsOn + 7) % 7;
75
+
76
+ let prevMonth = month - 1;
77
+ let prevYear = year;
78
+ if (prevMonth < 1) {
79
+ prevMonth = 12;
80
+ prevYear -= 1;
81
+ }
82
+ const prevMonthLength = safeGetBSMonthLength(prevYear, prevMonth) ?? 30;
83
+
84
+ let todayDate: BSDateValue | null = null;
85
+ try {
86
+ todayDate = options.today ?? todayBS();
87
+ } catch {
88
+ todayDate = null;
89
+ }
90
+
91
+ const cells: CalendarMonthCell[] = [];
92
+
93
+ for (let i = 0; i < leadingDays; i++) {
94
+ const day = prevMonthLength - leadingDays + i + 1;
95
+ cells.push(makeCell(prevYear, prevMonth, day, false, todayDate, minDate, maxDate));
96
+ }
97
+
98
+ for (let day = 1; day <= monthLength; day++) {
99
+ cells.push(makeCell(year, month, day, true, todayDate, minDate, maxDate));
100
+ }
101
+
102
+ let nextMonth = month + 1;
103
+ let nextYear = year;
104
+ if (nextMonth > 12) {
105
+ nextMonth = 1;
106
+ nextYear += 1;
107
+ }
108
+
109
+ let trailingDay = 1;
110
+ while (cells.length % 7 !== 0) {
111
+ cells.push(makeCell(nextYear, nextMonth, trailingDay, false, todayDate, minDate, maxDate));
112
+ trailingDay += 1;
113
+ }
114
+
115
+ const weeks: CalendarMonthCell[][] = [];
116
+ for (let i = 0; i < cells.length; i += 7) {
117
+ weeks.push(cells.slice(i, i + 7));
118
+ }
119
+
120
+ return {
121
+ year,
122
+ month,
123
+ weeks,
124
+ };
125
+ }
@@ -0,0 +1,2 @@
1
+ export type { CalendarMonthGridOptions, CalendarMonthCell, CalendarMonthGrid } from './calendar-types';
2
+ export { getCalendarMonthGrid } from './get-calendar-month-grid';
@@ -0,0 +1,198 @@
1
+ import React, { memo, useMemo } from 'react';
2
+ import { Pressable, Text, View, StyleSheet } from 'react-native';
3
+ import type { BSDateValue } from '../../core/types';
4
+ import { toNepaliNumerals } from '../../core/numerals';
5
+ import type { CalendarTheme } from '../../theme/types';
6
+ import type { CalendarMarkedDate } from './types';
7
+
8
+ type CalendarDayProps = {
9
+ date: BSDateValue;
10
+ day: number;
11
+ selected: boolean;
12
+ today: boolean;
13
+ disabled: boolean;
14
+ inCurrentMonth: boolean;
15
+ marked?: CalendarMarkedDate;
16
+ numerals: 'latin' | 'devanagari';
17
+ theme: CalendarTheme;
18
+ onPress: () => void;
19
+ rangeStart?: boolean;
20
+ rangeEnd?: boolean;
21
+ inRange?: boolean;
22
+ locale?: import('../../core/locale').CalendarLocale;
23
+ };
24
+
25
+ export const CalendarDay = memo(function CalendarDay({
26
+ date,
27
+ day,
28
+ selected,
29
+ today,
30
+ disabled,
31
+ inCurrentMonth,
32
+ marked,
33
+ numerals,
34
+ theme,
35
+ onPress,
36
+ rangeStart,
37
+ rangeEnd,
38
+ inRange,
39
+ locale,
40
+ }: CalendarDayProps) {
41
+ const displayDay = useMemo(
42
+ () => (numerals === 'devanagari' ? toNepaliNumerals(day) : String(day)),
43
+ [day, numerals]
44
+ );
45
+
46
+ const isRangeEndpoint = rangeStart || rangeEnd;
47
+
48
+ const textColor = useMemo(() => {
49
+ if (disabled) return theme.colors.disabledText;
50
+ if (isRangeEndpoint) return theme.colors.primaryText;
51
+ if (inRange) return theme.colors.rangeText;
52
+ if (selected) return theme.colors.primaryText;
53
+ if (!inCurrentMonth) return theme.colors.outsideMonthText;
54
+ if (marked?.textColor) return marked.textColor;
55
+ return theme.colors.text;
56
+ }, [
57
+ disabled,
58
+ isRangeEndpoint,
59
+ inRange,
60
+ selected,
61
+ inCurrentMonth,
62
+ marked?.textColor,
63
+ theme.colors.disabledText,
64
+ theme.colors.primaryText,
65
+ theme.colors.rangeText,
66
+ theme.colors.outsideMonthText,
67
+ theme.colors.text,
68
+ ]);
69
+
70
+ const backgroundColor = useMemo(() => {
71
+ if (isRangeEndpoint) {
72
+ return rangeStart
73
+ ? theme.colors.rangeStartBackground
74
+ : theme.colors.rangeEndBackground;
75
+ }
76
+ if (inRange) return theme.colors.rangeBackground;
77
+ if (selected) return theme.colors.primary;
78
+ return undefined;
79
+ }, [
80
+ isRangeEndpoint,
81
+ rangeStart,
82
+ inRange,
83
+ selected,
84
+ theme.colors.rangeStartBackground,
85
+ theme.colors.rangeEndBackground,
86
+ theme.colors.rangeBackground,
87
+ theme.colors.primary,
88
+ ]);
89
+
90
+ const accessibilityLabel = useMemo(() => {
91
+ const parts: string[] = [];
92
+
93
+ if (locale) {
94
+ try {
95
+ const { formatBS } = require('../../core/format');
96
+ parts.push(formatBS(date, 'yyyy MMMM d', { locale }));
97
+ } catch {
98
+ parts.push(`${date.year}/${date.month}/${day}`);
99
+ }
100
+ } else {
101
+ parts.push(`${date.year}/${date.month}/${day}`);
102
+ }
103
+
104
+ if (rangeStart) parts.push('range start');
105
+ if (rangeEnd) parts.push('range end');
106
+ if (inRange && !rangeStart && !rangeEnd) parts.push('in selected range');
107
+ if (selected && !inRange) parts.push('selected');
108
+ if (today) parts.push('today');
109
+ if (disabled) parts.push('disabled');
110
+ if (!inCurrentMonth) parts.push('outside month');
111
+ if (marked?.label) parts.push(marked.label);
112
+
113
+ return parts.join(', ');
114
+ }, [
115
+ date,
116
+ day,
117
+ locale,
118
+ rangeStart,
119
+ rangeEnd,
120
+ inRange,
121
+ selected,
122
+ today,
123
+ disabled,
124
+ inCurrentMonth,
125
+ marked?.label,
126
+ ]);
127
+
128
+ const containerStyle = [
129
+ styles.dayContainer,
130
+ backgroundColor && { backgroundColor },
131
+ today && !isRangeEndpoint && !selected && !inRange && {
132
+ borderWidth: 1,
133
+ borderColor: theme.colors.todayBorder,
134
+ },
135
+ disabled && styles.dayDisabled,
136
+ inRange && !isRangeEndpoint && styles.dayInRange,
137
+ rangeStart && styles.dayRangeStart,
138
+ rangeEnd && styles.dayRangeEnd,
139
+ ];
140
+
141
+ return (
142
+ <Pressable
143
+ style={containerStyle}
144
+ onPress={onPress}
145
+ disabled={disabled}
146
+ accessibilityRole="button"
147
+ accessibilityLabel={accessibilityLabel}
148
+ accessibilityState={{ disabled, selected: selected || isRangeEndpoint }}
149
+ >
150
+ <Text style={[styles.dayText, { color: textColor }]}>{displayDay}</Text>
151
+ {marked && !disabled && (
152
+ <View
153
+ style={[
154
+ styles.marker,
155
+ { backgroundColor: marked.color ?? theme.colors.marker },
156
+ ]}
157
+ />
158
+ )}
159
+ </Pressable>
160
+ );
161
+ });
162
+
163
+ const styles = StyleSheet.create({
164
+ dayContainer: {
165
+ alignItems: 'center',
166
+ justifyContent: 'center',
167
+ height: 40,
168
+ width: 40,
169
+ borderRadius: 20,
170
+ position: 'relative',
171
+ },
172
+ dayInRange: {
173
+ borderRadius: 0,
174
+ },
175
+ dayRangeStart: {
176
+ borderTopLeftRadius: 20,
177
+ borderBottomLeftRadius: 20,
178
+ },
179
+ dayRangeEnd: {
180
+ borderTopRightRadius: 20,
181
+ borderBottomRightRadius: 20,
182
+ },
183
+ dayText: {
184
+ fontSize: 15,
185
+ textAlign: 'center',
186
+ lineHeight: 20,
187
+ },
188
+ dayDisabled: {
189
+ opacity: 0.5,
190
+ },
191
+ marker: {
192
+ position: 'absolute',
193
+ bottom: 4,
194
+ width: 4,
195
+ height: 4,
196
+ borderRadius: 2,
197
+ },
198
+ });