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,257 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isDateInRange,
|
|
3
|
+
isRangeStart,
|
|
4
|
+
isRangeEnd,
|
|
5
|
+
normalizeRange,
|
|
6
|
+
selectRangeDate,
|
|
7
|
+
getRangeDateKey,
|
|
8
|
+
} from './components/NepaliRangePicker/range-utils';
|
|
9
|
+
import type { DateRangeValue } from './components/NepaliRangePicker/types';
|
|
10
|
+
|
|
11
|
+
const d = (y: number, m: number, day: number) =>
|
|
12
|
+
({ calendar: 'BS' as const, year: y, month: m, day });
|
|
13
|
+
|
|
14
|
+
describe('range-utils', () => {
|
|
15
|
+
describe('isDateInRange', () => {
|
|
16
|
+
it('returns true for date between start and end', () => {
|
|
17
|
+
const range: DateRangeValue = {
|
|
18
|
+
start: d(2081, 1, 1),
|
|
19
|
+
end: d(2081, 1, 15),
|
|
20
|
+
};
|
|
21
|
+
expect(isDateInRange(d(2081, 1, 5), range)).toBe(true);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('returns true for start date', () => {
|
|
25
|
+
const range: DateRangeValue = {
|
|
26
|
+
start: d(2081, 1, 1),
|
|
27
|
+
end: d(2081, 1, 15),
|
|
28
|
+
};
|
|
29
|
+
expect(isDateInRange(d(2081, 1, 1), range)).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('returns true for end date', () => {
|
|
33
|
+
const range: DateRangeValue = {
|
|
34
|
+
start: d(2081, 1, 1),
|
|
35
|
+
end: d(2081, 1, 15),
|
|
36
|
+
};
|
|
37
|
+
expect(isDateInRange(d(2081, 1, 15), range)).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('returns false for date before range', () => {
|
|
41
|
+
const range: DateRangeValue = {
|
|
42
|
+
start: d(2081, 1, 5),
|
|
43
|
+
end: d(2081, 1, 15),
|
|
44
|
+
};
|
|
45
|
+
expect(isDateInRange(d(2081, 1, 1), range)).toBe(false);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('returns false for date after range', () => {
|
|
49
|
+
const range: DateRangeValue = {
|
|
50
|
+
start: d(2081, 1, 1),
|
|
51
|
+
end: d(2081, 1, 10),
|
|
52
|
+
};
|
|
53
|
+
expect(isDateInRange(d(2081, 1, 15), range)).toBe(false);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('returns false when range has no end', () => {
|
|
57
|
+
const range: DateRangeValue = {
|
|
58
|
+
start: d(2081, 1, 1),
|
|
59
|
+
end: null,
|
|
60
|
+
};
|
|
61
|
+
expect(isDateInRange(d(2081, 1, 5), range)).toBe(false);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('returns false when range has no start', () => {
|
|
65
|
+
const range: DateRangeValue = {
|
|
66
|
+
start: null,
|
|
67
|
+
end: d(2081, 1, 15),
|
|
68
|
+
};
|
|
69
|
+
expect(isDateInRange(d(2081, 1, 5), range)).toBe(false);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('isRangeStart', () => {
|
|
74
|
+
it('returns true for start date', () => {
|
|
75
|
+
const range: DateRangeValue = {
|
|
76
|
+
start: d(2081, 1, 5),
|
|
77
|
+
end: d(2081, 1, 15),
|
|
78
|
+
};
|
|
79
|
+
expect(isRangeStart(d(2081, 1, 5), range)).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('returns false for non-start date', () => {
|
|
83
|
+
const range: DateRangeValue = {
|
|
84
|
+
start: d(2081, 1, 5),
|
|
85
|
+
end: d(2081, 1, 15),
|
|
86
|
+
};
|
|
87
|
+
expect(isRangeStart(d(2081, 1, 10), range)).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('returns false when no start', () => {
|
|
91
|
+
const range: DateRangeValue = { start: null, end: null };
|
|
92
|
+
expect(isRangeStart(d(2081, 1, 5), range)).toBe(false);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe('isRangeEnd', () => {
|
|
97
|
+
it('returns true for end date', () => {
|
|
98
|
+
const range: DateRangeValue = {
|
|
99
|
+
start: d(2081, 1, 5),
|
|
100
|
+
end: d(2081, 1, 15),
|
|
101
|
+
};
|
|
102
|
+
expect(isRangeEnd(d(2081, 1, 15), range)).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('returns false for non-end date', () => {
|
|
106
|
+
const range: DateRangeValue = {
|
|
107
|
+
start: d(2081, 1, 5),
|
|
108
|
+
end: d(2081, 1, 15),
|
|
109
|
+
};
|
|
110
|
+
expect(isRangeEnd(d(2081, 1, 10), range)).toBe(false);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('returns false when no end', () => {
|
|
114
|
+
const range: DateRangeValue = { start: null, end: null };
|
|
115
|
+
expect(isRangeEnd(d(2081, 1, 15), range)).toBe(false);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
describe('normalizeRange', () => {
|
|
120
|
+
it('keeps correct order when start <= end', () => {
|
|
121
|
+
const result = normalizeRange(d(2081, 1, 1), d(2081, 1, 15));
|
|
122
|
+
expect(result.start).toEqual(d(2081, 1, 1));
|
|
123
|
+
expect(result.end).toEqual(d(2081, 1, 15));
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('swaps when start > end', () => {
|
|
127
|
+
const result = normalizeRange(d(2081, 1, 15), d(2081, 1, 1));
|
|
128
|
+
expect(result.start).toEqual(d(2081, 1, 1));
|
|
129
|
+
expect(result.end).toEqual(d(2081, 1, 15));
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('allows same day when allowSameDay is true', () => {
|
|
133
|
+
const result = normalizeRange(d(2081, 1, 5), d(2081, 1, 5), {
|
|
134
|
+
allowSameDay: true,
|
|
135
|
+
});
|
|
136
|
+
expect(result.start).toEqual(d(2081, 1, 5));
|
|
137
|
+
expect(result.end).toEqual(d(2081, 1, 5));
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('rejects same day when allowSameDay is false', () => {
|
|
141
|
+
const result = normalizeRange(d(2081, 1, 5), d(2081, 1, 5), {
|
|
142
|
+
allowSameDay: false,
|
|
143
|
+
});
|
|
144
|
+
expect(result.start).toEqual(d(2081, 1, 5));
|
|
145
|
+
expect(result.end).toBeNull();
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
describe('selectRangeDate', () => {
|
|
150
|
+
it('selects start when no start exists', () => {
|
|
151
|
+
const current: DateRangeValue = { start: null, end: null };
|
|
152
|
+
const result = selectRangeDate(current, d(2081, 1, 5));
|
|
153
|
+
expect(result.start).toEqual(d(2081, 1, 5));
|
|
154
|
+
expect(result.end).toBeNull();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('selects end when start exists but no end', () => {
|
|
158
|
+
const current: DateRangeValue = { start: d(2081, 1, 1), end: null };
|
|
159
|
+
const result = selectRangeDate(current, d(2081, 1, 15));
|
|
160
|
+
expect(result.start).toEqual(d(2081, 1, 1));
|
|
161
|
+
expect(result.end).toEqual(d(2081, 1, 15));
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('swaps when second date is before start', () => {
|
|
165
|
+
const current: DateRangeValue = { start: d(2081, 1, 15), end: null };
|
|
166
|
+
const result = selectRangeDate(current, d(2081, 1, 1));
|
|
167
|
+
expect(result.start).toEqual(d(2081, 1, 1));
|
|
168
|
+
expect(result.end).toEqual(d(2081, 1, 15));
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('starts new range when both start and end exist', () => {
|
|
172
|
+
const current: DateRangeValue = {
|
|
173
|
+
start: d(2081, 1, 1),
|
|
174
|
+
end: d(2081, 1, 15),
|
|
175
|
+
};
|
|
176
|
+
const result = selectRangeDate(current, d(2081, 2, 1));
|
|
177
|
+
expect(result.start).toEqual(d(2081, 2, 1));
|
|
178
|
+
expect(result.end).toBeNull();
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('rejects same day when allowSameDay is false', () => {
|
|
182
|
+
const current: DateRangeValue = { start: d(2081, 1, 5), end: null };
|
|
183
|
+
const result = selectRangeDate(current, d(2081, 1, 5), {
|
|
184
|
+
allowSameDay: false,
|
|
185
|
+
});
|
|
186
|
+
expect(result.start).toEqual(d(2081, 1, 5));
|
|
187
|
+
expect(result.end).toBeNull();
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('allows same day when allowSameDay is true', () => {
|
|
191
|
+
const current: DateRangeValue = { start: d(2081, 1, 5), end: null };
|
|
192
|
+
const result = selectRangeDate(current, d(2081, 1, 5), {
|
|
193
|
+
allowSameDay: true,
|
|
194
|
+
});
|
|
195
|
+
expect(result.start).toEqual(d(2081, 1, 5));
|
|
196
|
+
expect(result.end).toEqual(d(2081, 1, 5));
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
describe('getRangeDateKey', () => {
|
|
201
|
+
it('returns "start" for start date', () => {
|
|
202
|
+
const range: DateRangeValue = {
|
|
203
|
+
start: d(2081, 1, 5),
|
|
204
|
+
end: d(2081, 1, 15),
|
|
205
|
+
};
|
|
206
|
+
expect(getRangeDateKey(range, d(2081, 1, 5))).toBe('start');
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
it('returns "end" for end date', () => {
|
|
210
|
+
const range: DateRangeValue = {
|
|
211
|
+
start: d(2081, 1, 5),
|
|
212
|
+
end: d(2081, 1, 15),
|
|
213
|
+
};
|
|
214
|
+
expect(getRangeDateKey(range, d(2081, 1, 15))).toBe('end');
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('returns "in-range" for middle date', () => {
|
|
218
|
+
const range: DateRangeValue = {
|
|
219
|
+
start: d(2081, 1, 5),
|
|
220
|
+
end: d(2081, 1, 15),
|
|
221
|
+
};
|
|
222
|
+
expect(getRangeDateKey(range, d(2081, 1, 10))).toBe('in-range');
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('returns "none" for date outside range', () => {
|
|
226
|
+
const range: DateRangeValue = {
|
|
227
|
+
start: d(2081, 1, 5),
|
|
228
|
+
end: d(2081, 1, 15),
|
|
229
|
+
};
|
|
230
|
+
expect(getRangeDateKey(range, d(2081, 1, 1))).toBe('none');
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it('returns "start" when range only has start', () => {
|
|
234
|
+
const range: DateRangeValue = {
|
|
235
|
+
start: d(2081, 1, 5),
|
|
236
|
+
end: null,
|
|
237
|
+
};
|
|
238
|
+
expect(getRangeDateKey(range, d(2081, 1, 5))).toBe('start');
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('returns "end" when range only has end', () => {
|
|
242
|
+
const range: DateRangeValue = {
|
|
243
|
+
start: null,
|
|
244
|
+
end: d(2081, 1, 15),
|
|
245
|
+
};
|
|
246
|
+
expect(getRangeDateKey(range, d(2081, 1, 15))).toBe('end');
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('returns "none" when range is empty', () => {
|
|
250
|
+
const range: DateRangeValue = {
|
|
251
|
+
start: null,
|
|
252
|
+
end: null,
|
|
253
|
+
};
|
|
254
|
+
expect(getRangeDateKey(range, d(2081, 1, 5))).toBe('none');
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
});
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import {
|
|
2
|
+
safeFormatBSDate,
|
|
3
|
+
getSafeInitialBSDate,
|
|
4
|
+
createDateAccessibilityLabel,
|
|
5
|
+
isDateDisabled,
|
|
6
|
+
} from './utils';
|
|
7
|
+
import { LIGHT_THEME, DARK_THEME } from './theme';
|
|
8
|
+
import { EN_LOCALE, NE_LOCALE } from './core/locale';
|
|
9
|
+
import { getDefaultSupportedBSDate } from './core/validation';
|
|
10
|
+
|
|
11
|
+
const d = (y: number, m: number, day: number) =>
|
|
12
|
+
({ calendar: 'BS' as const, year: y, month: m, day });
|
|
13
|
+
|
|
14
|
+
describe('safeFormatBSDate', () => {
|
|
15
|
+
it('returns null for null', () => {
|
|
16
|
+
expect(safeFormatBSDate(null, 'yyyy-MM-dd')).toBeNull();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('returns null for undefined', () => {
|
|
20
|
+
expect(safeFormatBSDate(undefined, 'yyyy-MM-dd')).toBeNull();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('formats valid in-range date', () => {
|
|
24
|
+
const result = safeFormatBSDate(d(2081, 1, 5), 'yyyy-MM-dd');
|
|
25
|
+
expect(result).toBe('2081-01-05');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('returns null for out-of-range date', () => {
|
|
29
|
+
const result = safeFormatBSDate(d(2082, 1, 1), 'yyyy-MM-dd');
|
|
30
|
+
expect(result).toBeNull();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('returns null for invalid date structure', () => {
|
|
34
|
+
const result = safeFormatBSDate(
|
|
35
|
+
{ calendar: 'BS', year: 2081, month: 1, day: 100 },
|
|
36
|
+
'yyyy-MM-dd'
|
|
37
|
+
);
|
|
38
|
+
expect(result).toBeNull();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('formats with Nepali locale and devanagari numerals', () => {
|
|
42
|
+
const result = safeFormatBSDate(d(2081, 1, 5), 'dd MMMM yyyy', 'ne', 'devanagari');
|
|
43
|
+
expect(result).toBe('०५ बैशाख २०८१');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe('getSafeInitialBSDate', () => {
|
|
48
|
+
it('returns valid in-range value', () => {
|
|
49
|
+
const value = d(2081, 3, 15);
|
|
50
|
+
expect(getSafeInitialBSDate(value, undefined)).toEqual(value);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('falls back to defaultValue when value is null', () => {
|
|
54
|
+
const def = d(2081, 5, 1);
|
|
55
|
+
expect(getSafeInitialBSDate(null, def)).toEqual(def);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('falls back to default supported date when both are invalid', () => {
|
|
59
|
+
const result = getSafeInitialBSDate(
|
|
60
|
+
{ calendar: 'BS', year: 2099, month: 1, day: 1 },
|
|
61
|
+
{ calendar: 'BS', year: 2099, month: 1, day: 1 }
|
|
62
|
+
);
|
|
63
|
+
expect(result).toEqual(getDefaultSupportedBSDate());
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('falls back to default supported date when both are null/undefined', () => {
|
|
67
|
+
const result = getSafeInitialBSDate(null, undefined);
|
|
68
|
+
expect(result).toEqual(getDefaultSupportedBSDate());
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('isDateDisabled', () => {
|
|
73
|
+
it('disables dates before minDate', () => {
|
|
74
|
+
expect(
|
|
75
|
+
isDateDisabled(d(2081, 1, 5), {
|
|
76
|
+
minDate: d(2081, 1, 10),
|
|
77
|
+
dateKey: '2081-01-05',
|
|
78
|
+
})
|
|
79
|
+
).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('disables dates after maxDate', () => {
|
|
83
|
+
expect(
|
|
84
|
+
isDateDisabled(d(2081, 1, 15), {
|
|
85
|
+
maxDate: d(2081, 1, 10),
|
|
86
|
+
dateKey: '2081-01-15',
|
|
87
|
+
})
|
|
88
|
+
).toBe(true);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('disables dates in disabled array', () => {
|
|
92
|
+
expect(
|
|
93
|
+
isDateDisabled(d(2081, 1, 5), {
|
|
94
|
+
disabledDates: ['2081-01-05', '2081-01-10'],
|
|
95
|
+
dateKey: '2081-01-05',
|
|
96
|
+
})
|
|
97
|
+
).toBe(true);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('disables dates via predicate function', () => {
|
|
101
|
+
expect(
|
|
102
|
+
isDateDisabled(d(2081, 1, 5), {
|
|
103
|
+
disabledDates: () => true,
|
|
104
|
+
dateKey: '2081-01-05',
|
|
105
|
+
})
|
|
106
|
+
).toBe(true);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('does not disable dates within bounds', () => {
|
|
110
|
+
expect(
|
|
111
|
+
isDateDisabled(d(2081, 1, 10), {
|
|
112
|
+
minDate: d(2081, 1, 5),
|
|
113
|
+
maxDate: d(2081, 1, 15),
|
|
114
|
+
dateKey: '2081-01-10',
|
|
115
|
+
})
|
|
116
|
+
).toBe(false);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe('createDateAccessibilityLabel', () => {
|
|
121
|
+
const date = d(2081, 1, 5);
|
|
122
|
+
|
|
123
|
+
it('returns plain date label', () => {
|
|
124
|
+
const label = createDateAccessibilityLabel(date, EN_LOCALE, {});
|
|
125
|
+
expect(label).toBe('2081 Baisakh 5');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('includes selected state', () => {
|
|
129
|
+
const label = createDateAccessibilityLabel(date, EN_LOCALE, { selected: true });
|
|
130
|
+
expect(label).toBe('2081 Baisakh 5, selected');
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('includes today state', () => {
|
|
134
|
+
const label = createDateAccessibilityLabel(date, EN_LOCALE, { today: true });
|
|
135
|
+
expect(label).toBe('2081 Baisakh 5, today');
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('includes disabled state', () => {
|
|
139
|
+
const label = createDateAccessibilityLabel(date, EN_LOCALE, { disabled: true });
|
|
140
|
+
expect(label).toBe('2081 Baisakh 5, disabled');
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('includes range start state', () => {
|
|
144
|
+
const label = createDateAccessibilityLabel(date, EN_LOCALE, { rangeStart: true });
|
|
145
|
+
expect(label).toBe('2081 Baisakh 5, range start');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('includes range end state', () => {
|
|
149
|
+
const label = createDateAccessibilityLabel(date, EN_LOCALE, { rangeEnd: true });
|
|
150
|
+
expect(label).toBe('2081 Baisakh 5, range end');
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('includes in-range state', () => {
|
|
154
|
+
const label = createDateAccessibilityLabel(date, EN_LOCALE, { inRange: true });
|
|
155
|
+
expect(label).toBe('2081 Baisakh 5, in selected range');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('combines multiple states', () => {
|
|
159
|
+
const label = createDateAccessibilityLabel(date, EN_LOCALE, {
|
|
160
|
+
selected: true,
|
|
161
|
+
today: true,
|
|
162
|
+
});
|
|
163
|
+
expect(label).toBe('2081 Baisakh 5, selected, today');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('includes marked label', () => {
|
|
167
|
+
const label = createDateAccessibilityLabel(date, EN_LOCALE, {
|
|
168
|
+
markedLabel: 'New Year',
|
|
169
|
+
});
|
|
170
|
+
expect(label).toBe('2081 Baisakh 5, New Year');
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('works with Nepali locale', () => {
|
|
174
|
+
const label = createDateAccessibilityLabel(date, NE_LOCALE, { selected: true });
|
|
175
|
+
expect(label).toContain('बैशाख');
|
|
176
|
+
expect(label).toContain('selected');
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
describe('theme defaults', () => {
|
|
181
|
+
it('LIGHT_THEME has all required color keys', () => {
|
|
182
|
+
const colors = LIGHT_THEME.colors;
|
|
183
|
+
expect(colors.background).toBeDefined();
|
|
184
|
+
expect(colors.surface).toBeDefined();
|
|
185
|
+
expect(colors.text).toBeDefined();
|
|
186
|
+
expect(colors.mutedText).toBeDefined();
|
|
187
|
+
expect(colors.primary).toBeDefined();
|
|
188
|
+
expect(colors.primaryText).toBeDefined();
|
|
189
|
+
expect(colors.todayBorder).toBeDefined();
|
|
190
|
+
expect(colors.disabledText).toBeDefined();
|
|
191
|
+
expect(colors.outsideMonthText).toBeDefined();
|
|
192
|
+
expect(colors.border).toBeDefined();
|
|
193
|
+
expect(colors.marker).toBeDefined();
|
|
194
|
+
expect(colors.overlay).toBeDefined();
|
|
195
|
+
expect(colors.modalBackground).toBeDefined();
|
|
196
|
+
expect(colors.fieldBackground).toBeDefined();
|
|
197
|
+
expect(colors.fieldBorder).toBeDefined();
|
|
198
|
+
expect(colors.placeholderText).toBeDefined();
|
|
199
|
+
expect(colors.rangeBackground).toBeDefined();
|
|
200
|
+
expect(colors.rangeText).toBeDefined();
|
|
201
|
+
expect(colors.rangeStartBackground).toBeDefined();
|
|
202
|
+
expect(colors.rangeEndBackground).toBeDefined();
|
|
203
|
+
expect(colors.danger).toBeDefined();
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it('DARK_THEME has all required color keys', () => {
|
|
207
|
+
const colors = DARK_THEME.colors;
|
|
208
|
+
expect(colors.background).toBeDefined();
|
|
209
|
+
expect(colors.overlay).toBeDefined();
|
|
210
|
+
expect(colors.modalBackground).toBeDefined();
|
|
211
|
+
expect(colors.fieldBackground).toBeDefined();
|
|
212
|
+
expect(colors.fieldBorder).toBeDefined();
|
|
213
|
+
expect(colors.placeholderText).toBeDefined();
|
|
214
|
+
expect(colors.danger).toBeDefined();
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('LIGHT_THEME has dark enough contrast for primary text', () => {
|
|
218
|
+
expect(LIGHT_THEME.colors.primaryText).toBe('#ffffff');
|
|
219
|
+
expect(LIGHT_THEME.colors.primary).toBe('#2563eb');
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('DARK_THEME has light enough text on dark background', () => {
|
|
223
|
+
expect(DARK_THEME.colors.text).toBe('#f9fafb');
|
|
224
|
+
expect(DARK_THEME.colors.background).toBe('#111827');
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
describe('public exports completeness', () => {
|
|
229
|
+
it('exports all core functions', () => {
|
|
230
|
+
const pkg = require('./index');
|
|
231
|
+
expect(typeof pkg.toBS).toBe('function');
|
|
232
|
+
expect(typeof pkg.toAD).toBe('function');
|
|
233
|
+
expect(typeof pkg.todayBS).toBe('function');
|
|
234
|
+
expect(typeof pkg.isValidBSDate).toBe('function');
|
|
235
|
+
expect(typeof pkg.isValidADDate).toBe('function');
|
|
236
|
+
expect(typeof pkg.getBSMonthLength).toBe('function');
|
|
237
|
+
expect(typeof pkg.compareBS).toBe('function');
|
|
238
|
+
expect(typeof pkg.addBSDays).toBe('function');
|
|
239
|
+
expect(typeof pkg.subBSDays).toBe('function');
|
|
240
|
+
expect(typeof pkg.createBSDateKey).toBe('function');
|
|
241
|
+
expect(typeof pkg.parseBSDateKey).toBe('function');
|
|
242
|
+
expect(typeof pkg.getSupportedBSRange).toBe('function');
|
|
243
|
+
expect(typeof pkg.formatBS).toBe('function');
|
|
244
|
+
expect(typeof pkg.parseBS).toBe('function');
|
|
245
|
+
expect(typeof pkg.toNepaliNumerals).toBe('function');
|
|
246
|
+
expect(typeof pkg.toLatinNumerals).toBe('function');
|
|
247
|
+
expect(typeof pkg.getCalendarMonthGrid).toBe('function');
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it('exports all components', () => {
|
|
251
|
+
const pkg = require('./index');
|
|
252
|
+
expect(typeof pkg.NepaliCalendar).toBe('function');
|
|
253
|
+
expect(typeof pkg.NepaliDatePicker).toBe('function');
|
|
254
|
+
expect(typeof pkg.DatePickerModal).toBe('function');
|
|
255
|
+
expect(typeof pkg.NepaliRangePicker).toBe('function');
|
|
256
|
+
expect(typeof pkg.RangePickerModal).toBe('function');
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('exports all types', () => {
|
|
260
|
+
const pkg = require('./index');
|
|
261
|
+
expect(pkg.BSDateValue).toBeUndefined();
|
|
262
|
+
expect(pkg.ADDateValue).toBeUndefined();
|
|
263
|
+
expect(pkg.DateRangeValue).toBeUndefined();
|
|
264
|
+
expect(pkg.CalendarTheme).toBeUndefined();
|
|
265
|
+
expect(pkg.CalendarMarkedDate).toBeUndefined();
|
|
266
|
+
expect(pkg.NepaliCalendarProps).toBeUndefined();
|
|
267
|
+
expect(pkg.NepaliDatePickerProps).toBeUndefined();
|
|
268
|
+
expect(pkg.DatePickerModalProps).toBeUndefined();
|
|
269
|
+
expect(pkg.NepaliRangePickerProps).toBeUndefined();
|
|
270
|
+
expect(pkg.RangePickerModalProps).toBeUndefined();
|
|
271
|
+
expect(pkg.CalendarLocale).toBeUndefined();
|
|
272
|
+
expect(pkg.LocaleCode).toBeUndefined();
|
|
273
|
+
expect(pkg.NumeralSystem).toBeUndefined();
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
it('exports safe UI helpers', () => {
|
|
277
|
+
const pkg = require('./index');
|
|
278
|
+
expect(typeof pkg.safeFormatBSDate).toBe('function');
|
|
279
|
+
expect(typeof pkg.getSafeInitialBSDate).toBe('function');
|
|
280
|
+
expect(typeof pkg.isDateDisabled).toBe('function');
|
|
281
|
+
expect(typeof pkg.createDateAccessibilityLabel).toBe('function');
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
it('exports range utils', () => {
|
|
285
|
+
const pkg = require('./index');
|
|
286
|
+
expect(typeof pkg.isDateInRange).toBe('function');
|
|
287
|
+
expect(typeof pkg.isRangeStart).toBe('function');
|
|
288
|
+
expect(typeof pkg.isRangeEnd).toBe('function');
|
|
289
|
+
expect(typeof pkg.normalizeRange).toBe('function');
|
|
290
|
+
expect(typeof pkg.selectRangeDate).toBe('function');
|
|
291
|
+
expect(typeof pkg.getRangeDateKey).toBe('function');
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
it('exports theme utilities', () => {
|
|
295
|
+
const pkg = require('./index');
|
|
296
|
+
expect(pkg.LIGHT_THEME).toBeDefined();
|
|
297
|
+
expect(pkg.DARK_THEME).toBeDefined();
|
|
298
|
+
expect(typeof pkg.useCalendarTheme).toBe('function');
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it('exports accessibility labels', () => {
|
|
302
|
+
const pkg = require('./index');
|
|
303
|
+
expect(typeof pkg.getDayAccessibilityLabel).toBe('function');
|
|
304
|
+
expect(pkg.HEADER_PREV_MONTH_LABEL).toBe('Previous month');
|
|
305
|
+
expect(pkg.HEADER_NEXT_MONTH_LABEL).toBe('Next month');
|
|
306
|
+
});
|
|
307
|
+
});
|