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,153 @@
1
+ import {
2
+ isBSDateInSupportedRange,
3
+ clampBSDateToSupportedRange,
4
+ getDefaultSupportedBSDate,
5
+ getSafeCalendarMonth,
6
+ SUPPORTED_BS_START_YEAR,
7
+ SUPPORTED_BS_END_YEAR,
8
+ getSupportedBSRange,
9
+ } from './core';
10
+
11
+ describe('supported range helpers', () => {
12
+ it('exports start and end year constants', () => {
13
+ expect(SUPPORTED_BS_START_YEAR).toBe(2081);
14
+ expect(SUPPORTED_BS_END_YEAR).toBe(2081);
15
+ });
16
+
17
+ it('getSupportedBSRange returns correct range', () => {
18
+ const range = getSupportedBSRange();
19
+ expect(range).toEqual({ start: 2081, end: 2081 });
20
+ });
21
+ });
22
+
23
+ describe('isBSDateInSupportedRange', () => {
24
+ it('returns true for dates inside supported range', () => {
25
+ expect(
26
+ isBSDateInSupportedRange({ calendar: 'BS', year: 2081, month: 1, day: 1 })
27
+ ).toBe(true);
28
+ expect(
29
+ isBSDateInSupportedRange({ calendar: 'BS', year: 2081, month: 12, day: 30 })
30
+ ).toBe(true);
31
+ });
32
+
33
+ it('returns false for dates outside supported range', () => {
34
+ expect(
35
+ isBSDateInSupportedRange({ calendar: 'BS', year: 2080, month: 1, day: 1 })
36
+ ).toBe(false);
37
+ expect(
38
+ isBSDateInSupportedRange({ calendar: 'BS', year: 2082, month: 1, day: 1 })
39
+ ).toBe(false);
40
+ });
41
+
42
+ it('returns false for invalid calendar', () => {
43
+ expect(
44
+ isBSDateInSupportedRange({ calendar: 'AD' as any, year: 2081, month: 1, day: 1 })
45
+ ).toBe(false);
46
+ });
47
+ });
48
+
49
+ describe('clampBSDateToSupportedRange', () => {
50
+ it('returns same date when already in range', () => {
51
+ const date = { calendar: 'BS' as const, year: 2081, month: 6, day: 15 };
52
+ expect(clampBSDateToSupportedRange(date)).toEqual(date);
53
+ });
54
+
55
+ it('clamps year below range to start year month 1 day 1', () => {
56
+ const result = clampBSDateToSupportedRange({
57
+ calendar: 'BS',
58
+ year: 2080,
59
+ month: 6,
60
+ day: 15,
61
+ });
62
+ expect(result.year).toBe(2081);
63
+ expect(result.month).toBe(1);
64
+ expect(result.day).toBe(1);
65
+ });
66
+
67
+ it('clamps year above range to end year month 12 day 30', () => {
68
+ const result = clampBSDateToSupportedRange({
69
+ calendar: 'BS',
70
+ year: 2082,
71
+ month: 6,
72
+ day: 15,
73
+ });
74
+ expect(result.year).toBe(2081);
75
+ expect(result.month).toBe(12);
76
+ expect(result.day).toBe(30);
77
+ });
78
+
79
+ it('clamps month to valid range', () => {
80
+ const result = clampBSDateToSupportedRange({
81
+ calendar: 'BS',
82
+ year: 2081,
83
+ month: 13,
84
+ day: 1,
85
+ });
86
+ expect(result.month).toBe(12);
87
+ });
88
+
89
+ it('clamps day to valid month length', () => {
90
+ const result = clampBSDateToSupportedRange({
91
+ calendar: 'BS',
92
+ year: 2081,
93
+ month: 8,
94
+ day: 30,
95
+ });
96
+ expect(result.day).toBe(29);
97
+ });
98
+ });
99
+
100
+ describe('getDefaultSupportedBSDate', () => {
101
+ it('returns first day of first supported year', () => {
102
+ const date = getDefaultSupportedBSDate();
103
+ expect(date).toEqual({
104
+ calendar: 'BS',
105
+ year: 2081,
106
+ month: 1,
107
+ day: 1,
108
+ });
109
+ });
110
+ });
111
+
112
+ describe('getSafeCalendarMonth', () => {
113
+ it('uses value when in supported range', () => {
114
+ const result = getSafeCalendarMonth({
115
+ value: { calendar: 'BS', year: 2081, month: 5, day: 10 },
116
+ });
117
+ expect(result).toEqual({ year: 2081, month: 5 });
118
+ });
119
+
120
+ it('uses defaultValue when value is null', () => {
121
+ const result = getSafeCalendarMonth({
122
+ value: null,
123
+ defaultValue: { calendar: 'BS', year: 2081, month: 3, day: 1 },
124
+ });
125
+ expect(result).toEqual({ year: 2081, month: 3 });
126
+ });
127
+
128
+ it('uses year/month when in supported range', () => {
129
+ const result = getSafeCalendarMonth({
130
+ year: 2081,
131
+ month: 7,
132
+ });
133
+ expect(result).toEqual({ year: 2081, month: 7 });
134
+ });
135
+
136
+ it('falls back to supported range when year is out of range', () => {
137
+ const result = getSafeCalendarMonth({
138
+ year: 2082,
139
+ month: 1,
140
+ });
141
+ expect(result).toEqual({ year: 2081, month: 1 });
142
+ });
143
+
144
+ it('falls back to supported range when no valid input', () => {
145
+ const result = getSafeCalendarMonth({});
146
+ expect(result).toEqual({ year: 2081, month: 1 });
147
+ });
148
+
149
+ it('falls back to supported range when input is undefined', () => {
150
+ const result = getSafeCalendarMonth();
151
+ expect(result).toEqual({ year: 2081, month: 1 });
152
+ });
153
+ });
@@ -0,0 +1,29 @@
1
+ import { useColorScheme } from 'react-native';
2
+ import type { CalendarTheme, ColorScheme } from './types';
3
+ import { LIGHT_THEME, DARK_THEME } from './default-theme';
4
+
5
+ export function useCalendarTheme(options?: {
6
+ colorScheme?: ColorScheme;
7
+ theme?: Partial<CalendarTheme>;
8
+ }): CalendarTheme {
9
+ const deviceScheme = useColorScheme();
10
+ const colorScheme = options?.colorScheme ?? 'system';
11
+ const resolved = colorScheme === 'system' ? deviceScheme : colorScheme;
12
+ const base = resolved === 'dark' ? DARK_THEME : LIGHT_THEME;
13
+
14
+ if (!options?.theme) return base;
15
+
16
+ return deepMergeThemes(base, options.theme);
17
+ }
18
+
19
+ function deepMergeThemes(
20
+ base: CalendarTheme,
21
+ override: Partial<CalendarTheme>
22
+ ): CalendarTheme {
23
+ return {
24
+ colors: { ...base.colors, ...(override.colors ?? {}) },
25
+ radius: { ...base.radius, ...(override.radius ?? {}) },
26
+ spacing: { ...base.spacing, ...(override.spacing ?? {}) },
27
+ typography: { ...base.typography, ...(override.typography ?? {}) },
28
+ };
29
+ }
@@ -0,0 +1,99 @@
1
+ import type { TextStyle } from 'react-native';
2
+ import type { CalendarTheme } from './types';
3
+
4
+ const headerStyle: TextStyle = {
5
+ fontSize: 18,
6
+ fontWeight: '600',
7
+ };
8
+
9
+ const weekdayStyle: TextStyle = {
10
+ fontSize: 12,
11
+ fontWeight: '500',
12
+ };
13
+
14
+ const dayStyle: TextStyle = {
15
+ fontSize: 15,
16
+ fontWeight: '400',
17
+ };
18
+
19
+ export const LIGHT_THEME: CalendarTheme = {
20
+ colors: {
21
+ background: '#ffffff',
22
+ surface: '#ffffff',
23
+ text: '#111827',
24
+ mutedText: '#6b7280',
25
+ primary: '#2563eb',
26
+ primaryText: '#ffffff',
27
+ todayBorder: '#2563eb',
28
+ disabledText: '#d1d5db',
29
+ outsideMonthText: '#d1d5db',
30
+ border: '#e5e7eb',
31
+ marker: '#2563eb',
32
+ overlay: 'rgba(0, 0, 0, 0.5)',
33
+ modalBackground: '#ffffff',
34
+ fieldBackground: '#ffffff',
35
+ fieldBorder: '#e5e7eb',
36
+ placeholderText: '#9ca3af',
37
+ rangeBackground: '#dbeafe',
38
+ rangeText: '#1e40af',
39
+ rangeStartBackground: '#2563eb',
40
+ rangeEndBackground: '#2563eb',
41
+ danger: '#ef4444',
42
+ },
43
+ radius: {
44
+ day: 20,
45
+ calendar: 12,
46
+ },
47
+ spacing: {
48
+ xs: 4,
49
+ sm: 8,
50
+ md: 12,
51
+ lg: 16,
52
+ },
53
+ typography: {
54
+ header: headerStyle,
55
+ weekday: weekdayStyle,
56
+ day: dayStyle,
57
+ },
58
+ };
59
+
60
+ export const DARK_THEME: CalendarTheme = {
61
+ colors: {
62
+ background: '#111827',
63
+ surface: '#1f2937',
64
+ text: '#f9fafb',
65
+ mutedText: '#9ca3af',
66
+ primary: '#3b82f6',
67
+ primaryText: '#ffffff',
68
+ todayBorder: '#3b82f6',
69
+ disabledText: '#4b5563',
70
+ outsideMonthText: '#4b5563',
71
+ border: '#374151',
72
+ marker: '#3b82f6',
73
+ overlay: 'rgba(0, 0, 0, 0.6)',
74
+ modalBackground: '#1f2937',
75
+ fieldBackground: '#1f2937',
76
+ fieldBorder: '#374151',
77
+ placeholderText: '#6b7280',
78
+ rangeBackground: '#1e3a5f',
79
+ rangeText: '#93c5fd',
80
+ rangeStartBackground: '#3b82f6',
81
+ rangeEndBackground: '#3b82f6',
82
+ danger: '#f87171',
83
+ },
84
+ radius: {
85
+ day: 20,
86
+ calendar: 12,
87
+ },
88
+ spacing: {
89
+ xs: 4,
90
+ sm: 8,
91
+ md: 12,
92
+ lg: 16,
93
+ },
94
+ typography: {
95
+ header: headerStyle,
96
+ weekday: weekdayStyle,
97
+ day: dayStyle,
98
+ },
99
+ };
@@ -0,0 +1,3 @@
1
+ export type { CalendarTheme, ColorScheme } from './types';
2
+ export { LIGHT_THEME, DARK_THEME } from './default-theme';
3
+ export { useCalendarTheme } from './create-theme';
@@ -0,0 +1,44 @@
1
+ import type { TextStyle } from 'react-native';
2
+
3
+ export type CalendarTheme = {
4
+ colors: {
5
+ background: string;
6
+ surface: string;
7
+ text: string;
8
+ mutedText: string;
9
+ primary: string;
10
+ primaryText: string;
11
+ todayBorder: string;
12
+ disabledText: string;
13
+ outsideMonthText: string;
14
+ border: string;
15
+ marker: string;
16
+ overlay: string;
17
+ modalBackground: string;
18
+ fieldBackground: string;
19
+ fieldBorder: string;
20
+ placeholderText: string;
21
+ rangeBackground: string;
22
+ rangeText: string;
23
+ rangeStartBackground: string;
24
+ rangeEndBackground: string;
25
+ danger: string;
26
+ };
27
+ radius: {
28
+ day: number;
29
+ calendar: number;
30
+ };
31
+ spacing: {
32
+ xs: number;
33
+ sm: number;
34
+ md: number;
35
+ lg: number;
36
+ };
37
+ typography: {
38
+ header: TextStyle;
39
+ weekday: TextStyle;
40
+ day: TextStyle;
41
+ };
42
+ };
43
+
44
+ export type ColorScheme = 'light' | 'dark' | 'system';
@@ -0,0 +1,146 @@
1
+ import type { BSDateValue } from '../core/types';
2
+ import { formatBS } from '../core/format';
3
+ import { isValidBSDate, isBSDateInSupportedRange, getDefaultSupportedBSDate } from '../core/validation';
4
+ import type { LocaleCode, NumeralSystem, CalendarLocale } from '../core/locale';
5
+
6
+ export function safeFormatBSDate(
7
+ date: BSDateValue | null | undefined,
8
+ pattern: string,
9
+ locale?: LocaleCode | CalendarLocale,
10
+ numerals?: NumeralSystem
11
+ ): string | null {
12
+ if (!date) return null;
13
+ if (!isValidBSDate(date)) return null;
14
+ if (!isBSDateInSupportedRange(date)) return null;
15
+
16
+ try {
17
+ return formatBS(date, pattern, { locale, numerals });
18
+ } catch {
19
+ return null;
20
+ }
21
+ }
22
+
23
+ export function getSafeInitialBSDate(
24
+ value: BSDateValue | null | undefined,
25
+ defaultValue: BSDateValue | undefined
26
+ ): BSDateValue {
27
+ if (value && isValidBSDate(value) && isBSDateInSupportedRange(value)) {
28
+ return value;
29
+ }
30
+
31
+ if (defaultValue && isValidBSDate(defaultValue) && isBSDateInSupportedRange(defaultValue)) {
32
+ return defaultValue;
33
+ }
34
+
35
+ return getDefaultSupportedBSDate();
36
+ }
37
+
38
+ export function isDateDisabled(
39
+ date: BSDateValue,
40
+ options: {
41
+ minDate?: BSDateValue;
42
+ maxDate?: BSDateValue;
43
+ disabledDates?: string[] | ((date: BSDateValue) => boolean);
44
+ dateKey: string;
45
+ }
46
+ ): boolean {
47
+ const { minDate, maxDate, disabledDates, dateKey } = options;
48
+
49
+ if (minDate && compareBSDate(date, minDate) < 0) return true;
50
+ if (maxDate && compareBSDate(date, maxDate) > 0) return true;
51
+
52
+ if (Array.isArray(disabledDates)) {
53
+ return disabledDates.includes(dateKey);
54
+ }
55
+
56
+ if (typeof disabledDates === 'function') {
57
+ return disabledDates(date);
58
+ }
59
+
60
+ return false;
61
+ }
62
+
63
+ function compareBSDate(a: BSDateValue, b: BSDateValue): number {
64
+ if (a.year !== b.year) return a.year - b.year;
65
+ if (a.month !== b.month) return a.month - b.month;
66
+ return a.day - b.day;
67
+ }
68
+
69
+ export function createDateAccessibilityLabel(
70
+ date: BSDateValue,
71
+ locale: CalendarLocale,
72
+ options: {
73
+ selected?: boolean;
74
+ today?: boolean;
75
+ disabled?: boolean;
76
+ outsideMonth?: boolean;
77
+ rangeStart?: boolean;
78
+ rangeEnd?: boolean;
79
+ inRange?: boolean;
80
+ markedLabel?: string;
81
+ }
82
+ ): string {
83
+ const {
84
+ selected,
85
+ today,
86
+ disabled,
87
+ outsideMonth,
88
+ rangeStart,
89
+ rangeEnd,
90
+ inRange,
91
+ markedLabel,
92
+ } = options;
93
+
94
+ const parts: string[] = [];
95
+
96
+ try {
97
+ parts.push(formatBS(date, 'yyyy MMMM d', { locale }));
98
+ } catch {
99
+ parts.push(`${date.year}/${date.month}/${date.day}`);
100
+ }
101
+
102
+ if (rangeStart) parts.push('range start');
103
+ if (rangeEnd) parts.push('range end');
104
+ if (inRange && !rangeStart && !rangeEnd) parts.push('in selected range');
105
+ if (selected && !inRange) parts.push('selected');
106
+ if (today) parts.push('today');
107
+ if (disabled) parts.push('disabled');
108
+ if (outsideMonth) parts.push('outside month');
109
+ if (markedLabel) parts.push(markedLabel);
110
+
111
+ return parts.join(', ');
112
+ }
113
+
114
+ export function warnInvalidDateInDev(
115
+ message: string,
116
+ value: unknown
117
+ ): void {
118
+ if (__DEV__) {
119
+ console.warn(`react-native-bikram-sambat: ${message}`, value);
120
+ }
121
+ }
122
+
123
+ export function warnOutOfRangeInDev(
124
+ value: BSDateValue,
125
+ range: { min: number; max: number }
126
+ ): void {
127
+ if (__DEV__) {
128
+ const dateStr = `${value.year}-${String(value.month).padStart(2, '0')}-${String(value.day).padStart(2, '0')}`;
129
+ console.warn(
130
+ `react-native-bikram-sambat: value ${dateStr} is outside supported BS range ${range.min}–${range.max}. Falling back to ${range.min}-01-01.`
131
+ );
132
+ }
133
+ }
134
+
135
+ export function warnMinMaxInDev(
136
+ minDate: BSDateValue | undefined,
137
+ maxDate: BSDateValue | undefined
138
+ ): void {
139
+ if (__DEV__ && minDate && maxDate) {
140
+ if (compareBSDate(minDate, maxDate) > 0) {
141
+ console.warn(
142
+ 'react-native-bikram-sambat: minDate is after maxDate. This may cause unexpected behavior.'
143
+ );
144
+ }
145
+ }
146
+ }
@@ -0,0 +1,9 @@
1
+ export {
2
+ safeFormatBSDate,
3
+ getSafeInitialBSDate,
4
+ isDateDisabled,
5
+ createDateAccessibilityLabel,
6
+ warnInvalidDateInDev,
7
+ warnOutOfRangeInDev,
8
+ warnMinMaxInDev,
9
+ } from './date-helpers';