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.
- package/LICENSE +21 -0
- package/README.md +340 -0
- package/lib/commonjs/accessibility/index.js +25 -0
- package/lib/commonjs/accessibility/index.js.map +1 -0
- package/lib/commonjs/accessibility/labels.js +20 -0
- package/lib/commonjs/accessibility/labels.js.map +1 -0
- package/lib/commonjs/calendar/calendar-types.js +6 -0
- package/lib/commonjs/calendar/calendar-types.js.map +1 -0
- package/lib/commonjs/calendar/get-calendar-month-grid.js +114 -0
- package/lib/commonjs/calendar/get-calendar-month-grid.js.map +1 -0
- package/lib/commonjs/calendar/index.js +13 -0
- package/lib/commonjs/calendar/index.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarDay.js +137 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarDay.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js +116 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js +114 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarWeekdays.js +44 -0
- package/lib/commonjs/components/NepaliCalendar/CalendarWeekdays.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js +288 -0
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/index.js +13 -0
- package/lib/commonjs/components/NepaliCalendar/index.js.map +1 -0
- package/lib/commonjs/components/NepaliCalendar/types.js +6 -0
- package/lib/commonjs/components/NepaliCalendar/types.js.map +1 -0
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js +185 -0
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js.map +1 -0
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js +148 -0
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js.map +1 -0
- package/lib/commonjs/components/NepaliDatePicker/index.js +20 -0
- package/lib/commonjs/components/NepaliDatePicker/index.js.map +1 -0
- package/lib/commonjs/components/NepaliDatePicker/types.js +6 -0
- package/lib/commonjs/components/NepaliDatePicker/types.js.map +1 -0
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js +187 -0
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js.map +1 -0
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js +275 -0
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js.map +1 -0
- package/lib/commonjs/components/NepaliRangePicker/index.js +57 -0
- package/lib/commonjs/components/NepaliRangePicker/index.js.map +1 -0
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js +70 -0
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js.map +1 -0
- package/lib/commonjs/components/NepaliRangePicker/types.js +6 -0
- package/lib/commonjs/components/NepaliRangePicker/types.js.map +1 -0
- package/lib/commonjs/core/arithmetic.js +36 -0
- package/lib/commonjs/core/arithmetic.js.map +1 -0
- package/lib/commonjs/core/bsData.js +89 -0
- package/lib/commonjs/core/bsData.js.map +1 -0
- package/lib/commonjs/core/conversion.js +53 -0
- package/lib/commonjs/core/conversion.js.map +1 -0
- package/lib/commonjs/core/dateKey.js +31 -0
- package/lib/commonjs/core/dateKey.js.map +1 -0
- package/lib/commonjs/core/epochDay.js +47 -0
- package/lib/commonjs/core/epochDay.js.map +1 -0
- package/lib/commonjs/core/format/format.js +86 -0
- package/lib/commonjs/core/format/format.js.map +1 -0
- package/lib/commonjs/core/format/index.js +20 -0
- package/lib/commonjs/core/format/index.js.map +1 -0
- package/lib/commonjs/core/format/parse.js +41 -0
- package/lib/commonjs/core/format/parse.js.map +1 -0
- package/lib/commonjs/core/format/tokens.js +9 -0
- package/lib/commonjs/core/format/tokens.js.map +1 -0
- package/lib/commonjs/core/index.js +116 -0
- package/lib/commonjs/core/index.js.map +1 -0
- package/lib/commonjs/core/locale/en.js +15 -0
- package/lib/commonjs/core/locale/en.js.map +1 -0
- package/lib/commonjs/core/locale/index.js +20 -0
- package/lib/commonjs/core/locale/index.js.map +1 -0
- package/lib/commonjs/core/locale/ne.js +15 -0
- package/lib/commonjs/core/locale/ne.js.map +1 -0
- package/lib/commonjs/core/locale/types.js +2 -0
- package/lib/commonjs/core/locale/types.js.map +1 -0
- package/lib/commonjs/core/numerals/index.js +19 -0
- package/lib/commonjs/core/numerals/index.js.map +1 -0
- package/lib/commonjs/core/numerals/nepali-numerals.js +28 -0
- package/lib/commonjs/core/numerals/nepali-numerals.js.map +1 -0
- package/lib/commonjs/core/types.js +2 -0
- package/lib/commonjs/core/types.js.map +1 -0
- package/lib/commonjs/core/validation.js +125 -0
- package/lib/commonjs/core/validation.js.map +1 -0
- package/lib/commonjs/core/validation.test.js +248 -0
- package/lib/commonjs/core/validation.test.js.map +1 -0
- package/lib/commonjs/exports.test.js +133 -0
- package/lib/commonjs/exports.test.js.map +1 -0
- package/lib/commonjs/index.js +94 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/phase2.test.js +446 -0
- package/lib/commonjs/phase2.test.js.map +1 -0
- package/lib/commonjs/phase3.test.js +91 -0
- package/lib/commonjs/phase3.test.js.map +1 -0
- package/lib/commonjs/phase4.test.js +89 -0
- package/lib/commonjs/phase4.test.js.map +1 -0
- package/lib/commonjs/phase5.test.js +246 -0
- package/lib/commonjs/phase5.test.js.map +1 -0
- package/lib/commonjs/phase7.test.js +284 -0
- package/lib/commonjs/phase7.test.js.map +1 -0
- package/lib/commonjs/range-helpers.test.js +182 -0
- package/lib/commonjs/range-helpers.test.js.map +1 -0
- package/lib/commonjs/theme/create-theme.js +37 -0
- package/lib/commonjs/theme/create-theme.js.map +1 -0
- package/lib/commonjs/theme/default-theme.js +99 -0
- package/lib/commonjs/theme/default-theme.js.map +1 -0
- package/lib/commonjs/theme/index.js +26 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/theme/types.js +6 -0
- package/lib/commonjs/theme/types.js.map +1 -0
- package/lib/commonjs/utils/date-helpers.js +106 -0
- package/lib/commonjs/utils/date-helpers.js.map +1 -0
- package/lib/commonjs/utils/index.js +49 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/module/accessibility/index.js +4 -0
- package/lib/module/accessibility/index.js.map +1 -0
- package/lib/module/accessibility/labels.js +15 -0
- package/lib/module/accessibility/labels.js.map +1 -0
- package/lib/module/calendar/calendar-types.js +4 -0
- package/lib/module/calendar/calendar-types.js.map +1 -0
- package/lib/module/calendar/get-calendar-month-grid.js +111 -0
- package/lib/module/calendar/get-calendar-month-grid.js.map +1 -0
- package/lib/module/calendar/index.js +4 -0
- package/lib/module/calendar/index.js.map +1 -0
- package/lib/module/components/NepaliCalendar/CalendarDay.js +132 -0
- package/lib/module/components/NepaliCalendar/CalendarDay.js.map +1 -0
- package/lib/module/components/NepaliCalendar/CalendarGrid.js +111 -0
- package/lib/module/components/NepaliCalendar/CalendarGrid.js.map +1 -0
- package/lib/module/components/NepaliCalendar/CalendarHeader.js +109 -0
- package/lib/module/components/NepaliCalendar/CalendarHeader.js.map +1 -0
- package/lib/module/components/NepaliCalendar/CalendarWeekdays.js +39 -0
- package/lib/module/components/NepaliCalendar/CalendarWeekdays.js.map +1 -0
- package/lib/module/components/NepaliCalendar/NepaliCalendar.js +283 -0
- package/lib/module/components/NepaliCalendar/NepaliCalendar.js.map +1 -0
- package/lib/module/components/NepaliCalendar/index.js +4 -0
- package/lib/module/components/NepaliCalendar/index.js.map +1 -0
- package/lib/module/components/NepaliCalendar/types.js +4 -0
- package/lib/module/components/NepaliCalendar/types.js.map +1 -0
- package/lib/module/components/NepaliDatePicker/DatePickerModal.js +180 -0
- package/lib/module/components/NepaliDatePicker/DatePickerModal.js.map +1 -0
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js +143 -0
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js.map +1 -0
- package/lib/module/components/NepaliDatePicker/index.js +5 -0
- package/lib/module/components/NepaliDatePicker/index.js.map +1 -0
- package/lib/module/components/NepaliDatePicker/types.js +4 -0
- package/lib/module/components/NepaliDatePicker/types.js.map +1 -0
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js +182 -0
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js.map +1 -0
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js +270 -0
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js.map +1 -0
- package/lib/module/components/NepaliRangePicker/index.js +6 -0
- package/lib/module/components/NepaliRangePicker/index.js.map +1 -0
- package/lib/module/components/NepaliRangePicker/range-utils.js +61 -0
- package/lib/module/components/NepaliRangePicker/range-utils.js.map +1 -0
- package/lib/module/components/NepaliRangePicker/types.js +4 -0
- package/lib/module/components/NepaliRangePicker/types.js.map +1 -0
- package/lib/module/core/arithmetic.js +29 -0
- package/lib/module/core/arithmetic.js.map +1 -0
- package/lib/module/core/bsData.js +82 -0
- package/lib/module/core/bsData.js.map +1 -0
- package/lib/module/core/conversion.js +48 -0
- package/lib/module/core/conversion.js.map +1 -0
- package/lib/module/core/dateKey.js +26 -0
- package/lib/module/core/dateKey.js.map +1 -0
- package/lib/module/core/epochDay.js +39 -0
- package/lib/module/core/epochDay.js.map +1 -0
- package/lib/module/core/format/format.js +82 -0
- package/lib/module/core/format/format.js.map +1 -0
- package/lib/module/core/format/index.js +5 -0
- package/lib/module/core/format/index.js.map +1 -0
- package/lib/module/core/format/parse.js +37 -0
- package/lib/module/core/format/parse.js.map +1 -0
- package/lib/module/core/format/tokens.js +5 -0
- package/lib/module/core/format/tokens.js.map +1 -0
- package/lib/module/core/index.js +13 -0
- package/lib/module/core/index.js.map +1 -0
- package/lib/module/core/locale/en.js +11 -0
- package/lib/module/core/locale/en.js.map +1 -0
- package/lib/module/core/locale/index.js +5 -0
- package/lib/module/core/locale/index.js.map +1 -0
- package/lib/module/core/locale/ne.js +11 -0
- package/lib/module/core/locale/ne.js.map +1 -0
- package/lib/module/core/locale/types.js +2 -0
- package/lib/module/core/locale/types.js.map +1 -0
- package/lib/module/core/numerals/index.js +4 -0
- package/lib/module/core/numerals/index.js.map +1 -0
- package/lib/module/core/numerals/nepali-numerals.js +23 -0
- package/lib/module/core/numerals/nepali-numerals.js.map +1 -0
- package/lib/module/core/types.js +2 -0
- package/lib/module/core/types.js.map +1 -0
- package/lib/module/core/validation.js +115 -0
- package/lib/module/core/validation.js.map +1 -0
- package/lib/module/core/validation.test.js +248 -0
- package/lib/module/core/validation.test.js.map +1 -0
- package/lib/module/exports.test.js +133 -0
- package/lib/module/exports.test.js.map +1 -0
- package/lib/module/index.js +11 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/phase2.test.js +446 -0
- package/lib/module/phase2.test.js.map +1 -0
- package/lib/module/phase3.test.js +91 -0
- package/lib/module/phase3.test.js.map +1 -0
- package/lib/module/phase4.test.js +89 -0
- package/lib/module/phase4.test.js.map +1 -0
- package/lib/module/phase5.test.js +246 -0
- package/lib/module/phase5.test.js.map +1 -0
- package/lib/module/phase7.test.js +284 -0
- package/lib/module/phase7.test.js.map +1 -0
- package/lib/module/range-helpers.test.js +182 -0
- package/lib/module/range-helpers.test.js.map +1 -0
- package/lib/module/theme/create-theme.js +33 -0
- package/lib/module/theme/create-theme.js.map +1 -0
- package/lib/module/theme/default-theme.js +95 -0
- package/lib/module/theme/default-theme.js.map +1 -0
- package/lib/module/theme/index.js +5 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/theme/types.js +4 -0
- package/lib/module/theme/types.js.map +1 -0
- package/lib/module/utils/date-helpers.js +96 -0
- package/lib/module/utils/date-helpers.js.map +1 -0
- package/lib/module/utils/index.js +4 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/typescript/src/accessibility/index.d.ts +2 -0
- package/lib/typescript/src/accessibility/index.d.ts.map +1 -0
- package/lib/typescript/src/accessibility/labels.d.ts +6 -0
- package/lib/typescript/src/accessibility/labels.d.ts.map +1 -0
- package/lib/typescript/src/calendar/calendar-types.d.ts +23 -0
- package/lib/typescript/src/calendar/calendar-types.d.ts.map +1 -0
- package/lib/typescript/src/calendar/get-calendar-month-grid.d.ts +3 -0
- package/lib/typescript/src/calendar/get-calendar-month-grid.d.ts.map +1 -0
- package/lib/typescript/src/calendar/index.d.ts +3 -0
- package/lib/typescript/src/calendar/index.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts +23 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts +25 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts +17 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarWeekdays.d.ts +11 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarWeekdays.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts +4 -0
- package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/index.d.ts +3 -0
- package/lib/typescript/src/components/NepaliCalendar/index.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliCalendar/types.d.ts +52 -0
- package/lib/typescript/src/components/NepaliCalendar/types.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts +4 -0
- package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts +4 -0
- package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliDatePicker/index.d.ts +4 -0
- package/lib/typescript/src/components/NepaliDatePicker/index.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliDatePicker/types.d.ts +50 -0
- package/lib/typescript/src/components/NepaliDatePicker/types.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts +4 -0
- package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts +4 -0
- package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliRangePicker/index.d.ts +5 -0
- package/lib/typescript/src/components/NepaliRangePicker/index.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts +13 -0
- package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts.map +1 -0
- package/lib/typescript/src/components/NepaliRangePicker/types.d.ts +61 -0
- package/lib/typescript/src/components/NepaliRangePicker/types.d.ts.map +1 -0
- package/lib/typescript/src/core/arithmetic.d.ts +6 -0
- package/lib/typescript/src/core/arithmetic.d.ts.map +1 -0
- package/lib/typescript/src/core/bsData.d.ts +39 -0
- package/lib/typescript/src/core/bsData.d.ts.map +1 -0
- package/lib/typescript/src/core/conversion.d.ts +4 -0
- package/lib/typescript/src/core/conversion.d.ts.map +1 -0
- package/lib/typescript/src/core/dateKey.d.ts +4 -0
- package/lib/typescript/src/core/dateKey.d.ts.map +1 -0
- package/lib/typescript/src/core/epochDay.d.ts +7 -0
- package/lib/typescript/src/core/epochDay.d.ts.map +1 -0
- package/lib/typescript/src/core/format/format.d.ts +8 -0
- package/lib/typescript/src/core/format/format.d.ts.map +1 -0
- package/lib/typescript/src/core/format/index.d.ts +5 -0
- package/lib/typescript/src/core/format/index.d.ts.map +1 -0
- package/lib/typescript/src/core/format/parse.d.ts +7 -0
- package/lib/typescript/src/core/format/parse.d.ts.map +1 -0
- package/lib/typescript/src/core/format/tokens.d.ts +4 -0
- package/lib/typescript/src/core/format/tokens.d.ts.map +1 -0
- package/lib/typescript/src/core/index.d.ts +11 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -0
- package/lib/typescript/src/core/locale/en.d.ts +3 -0
- package/lib/typescript/src/core/locale/en.d.ts.map +1 -0
- package/lib/typescript/src/core/locale/index.d.ts +4 -0
- package/lib/typescript/src/core/locale/index.d.ts.map +1 -0
- package/lib/typescript/src/core/locale/ne.d.ts +3 -0
- package/lib/typescript/src/core/locale/ne.d.ts.map +1 -0
- package/lib/typescript/src/core/locale/types.d.ts +11 -0
- package/lib/typescript/src/core/locale/types.d.ts.map +1 -0
- package/lib/typescript/src/core/numerals/index.d.ts +2 -0
- package/lib/typescript/src/core/numerals/index.d.ts.map +1 -0
- package/lib/typescript/src/core/numerals/nepali-numerals.d.ts +3 -0
- package/lib/typescript/src/core/numerals/nepali-numerals.d.ts.map +1 -0
- package/lib/typescript/src/core/types.d.ts +14 -0
- package/lib/typescript/src/core/types.d.ts.map +1 -0
- package/lib/typescript/src/core/validation.d.ts +17 -0
- package/lib/typescript/src/core/validation.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/create-theme.d.ts +6 -0
- package/lib/typescript/src/theme/create-theme.d.ts.map +1 -0
- package/lib/typescript/src/theme/default-theme.d.ts +4 -0
- package/lib/typescript/src/theme/default-theme.d.ts.map +1 -0
- package/lib/typescript/src/theme/index.d.ts +4 -0
- package/lib/typescript/src/theme/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/types.d.ts +43 -0
- package/lib/typescript/src/theme/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/date-helpers.d.ts +27 -0
- package/lib/typescript/src/utils/date-helpers.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +2 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -0
- package/package.json +85 -0
- package/src/accessibility/index.ts +5 -0
- package/src/accessibility/labels.ts +22 -0
- package/src/calendar/calendar-types.ts +25 -0
- package/src/calendar/get-calendar-month-grid.ts +125 -0
- package/src/calendar/index.ts +2 -0
- package/src/components/NepaliCalendar/CalendarDay.tsx +198 -0
- package/src/components/NepaliCalendar/CalendarGrid.tsx +159 -0
- package/src/components/NepaliCalendar/CalendarHeader.tsx +126 -0
- package/src/components/NepaliCalendar/CalendarWeekdays.tsx +49 -0
- package/src/components/NepaliCalendar/NepaliCalendar.tsx +279 -0
- package/src/components/NepaliCalendar/index.ts +6 -0
- package/src/components/NepaliCalendar/types.ts +62 -0
- package/src/components/NepaliDatePicker/DatePickerModal.tsx +220 -0
- package/src/components/NepaliDatePicker/NepaliDatePicker.tsx +171 -0
- package/src/components/NepaliDatePicker/index.ts +3 -0
- package/src/components/NepaliDatePicker/types.ts +70 -0
- package/src/components/NepaliRangePicker/NepaliRangePicker.tsx +206 -0
- package/src/components/NepaliRangePicker/RangePickerModal.tsx +336 -0
- package/src/components/NepaliRangePicker/index.ts +11 -0
- package/src/components/NepaliRangePicker/range-utils.ts +75 -0
- package/src/components/NepaliRangePicker/types.ts +84 -0
- package/src/core/arithmetic.ts +34 -0
- package/src/core/bsData.ts +115 -0
- package/src/core/conversion.ts +73 -0
- package/src/core/dateKey.ts +31 -0
- package/src/core/epochDay.ts +49 -0
- package/src/core/format/format.ts +108 -0
- package/src/core/format/index.ts +4 -0
- package/src/core/format/parse.ts +68 -0
- package/src/core/format/tokens.ts +35 -0
- package/src/core/index.ts +10 -0
- package/src/core/locale/en.ts +23 -0
- package/src/core/locale/index.ts +3 -0
- package/src/core/locale/ne.ts +31 -0
- package/src/core/locale/types.ts +12 -0
- package/src/core/numerals/index.ts +1 -0
- package/src/core/numerals/nepali-numerals.ts +27 -0
- package/src/core/types.ts +15 -0
- package/src/core/validation.test.ts +207 -0
- package/src/core/validation.ts +141 -0
- package/src/exports.test.ts +135 -0
- package/src/index.ts +8 -0
- package/src/phase2.test.ts +424 -0
- package/src/phase3.test.ts +83 -0
- package/src/phase4.test.ts +86 -0
- package/src/phase5.test.ts +257 -0
- package/src/phase7.test.ts +307 -0
- package/src/range-helpers.test.ts +153 -0
- package/src/theme/create-theme.ts +29 -0
- package/src/theme/default-theme.ts +99 -0
- package/src/theme/index.ts +3 -0
- package/src/theme/types.ts +44 -0
- package/src/utils/date-helpers.ts +146 -0
- 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,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
|
+
}
|