react-native-bikram-sambat 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -213
- package/lib/commonjs/accessibility/labels.js +1 -2
- package/lib/commonjs/accessibility/labels.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/CalendarDay.js +8 -41
- package/lib/commonjs/components/NepaliCalendar/CalendarDay.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js +7 -24
- package/lib/commonjs/components/NepaliCalendar/CalendarGrid.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js +18 -6
- package/lib/commonjs/components/NepaliCalendar/CalendarHeader.js.map +1 -1
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js +93 -61
- package/lib/commonjs/components/NepaliCalendar/NepaliCalendar.js.map +1 -1
- package/lib/commonjs/index.js +0 -22
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/theme/default-theme.js +2 -22
- package/lib/commonjs/theme/default-theme.js.map +1 -1
- package/lib/commonjs/utils/date-helpers.js +0 -8
- package/lib/commonjs/utils/date-helpers.js.map +1 -1
- package/lib/module/accessibility/labels.js +1 -2
- package/lib/module/accessibility/labels.js.map +1 -1
- package/lib/module/components/NepaliCalendar/CalendarDay.js +8 -41
- package/lib/module/components/NepaliCalendar/CalendarDay.js.map +1 -1
- package/lib/module/components/NepaliCalendar/CalendarGrid.js +7 -24
- package/lib/module/components/NepaliCalendar/CalendarGrid.js.map +1 -1
- package/lib/module/components/NepaliCalendar/CalendarHeader.js +18 -6
- package/lib/module/components/NepaliCalendar/CalendarHeader.js.map +1 -1
- package/lib/module/components/NepaliCalendar/NepaliCalendar.js +96 -64
- package/lib/module/components/NepaliCalendar/NepaliCalendar.js.map +1 -1
- package/lib/module/index.js +0 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/theme/default-theme.js +2 -22
- package/lib/module/theme/default-theme.js.map +1 -1
- package/lib/module/utils/date-helpers.js +0 -8
- package/lib/module/utils/date-helpers.js.map +1 -1
- package/lib/typescript/src/accessibility/labels.d.ts +1 -1
- package/lib/typescript/src/accessibility/labels.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts +1 -5
- package/lib/typescript/src/components/NepaliCalendar/CalendarDay.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts +1 -4
- package/lib/typescript/src/components/NepaliCalendar/CalendarGrid.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts +1 -0
- package/lib/typescript/src/components/NepaliCalendar/CalendarHeader.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts +1 -1
- package/lib/typescript/src/components/NepaliCalendar/NepaliCalendar.d.ts.map +1 -1
- package/lib/typescript/src/components/NepaliCalendar/types.d.ts +6 -10
- package/lib/typescript/src/components/NepaliCalendar/types.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/default-theme.d.ts.map +1 -1
- package/lib/typescript/src/theme/types.d.ts +0 -10
- package/lib/typescript/src/theme/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/date-helpers.d.ts +0 -4
- package/lib/typescript/src/utils/date-helpers.d.ts.map +1 -1
- package/package.json +2 -6
- package/src/accessibility/labels.ts +0 -2
- package/src/components/NepaliCalendar/CalendarDay.tsx +6 -65
- package/src/components/NepaliCalendar/CalendarGrid.tsx +12 -32
- package/src/components/NepaliCalendar/CalendarHeader.tsx +18 -2
- package/src/components/NepaliCalendar/NepaliCalendar.tsx +128 -56
- package/src/components/NepaliCalendar/types.ts +3 -12
- package/src/index.ts +0 -2
- package/src/theme/default-theme.ts +0 -20
- package/src/theme/types.ts +0 -10
- package/src/utils/date-helpers.ts +0 -12
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js +0 -185
- package/lib/commonjs/components/NepaliDatePicker/DatePickerModal.js.map +0 -1
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js +0 -148
- package/lib/commonjs/components/NepaliDatePicker/NepaliDatePicker.js.map +0 -1
- package/lib/commonjs/components/NepaliDatePicker/index.js +0 -20
- package/lib/commonjs/components/NepaliDatePicker/index.js.map +0 -1
- package/lib/commonjs/components/NepaliDatePicker/types.js +0 -6
- package/lib/commonjs/components/NepaliDatePicker/types.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js +0 -187
- package/lib/commonjs/components/NepaliRangePicker/NepaliRangePicker.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js +0 -275
- package/lib/commonjs/components/NepaliRangePicker/RangePickerModal.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/index.js +0 -57
- package/lib/commonjs/components/NepaliRangePicker/index.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js +0 -70
- package/lib/commonjs/components/NepaliRangePicker/range-utils.js.map +0 -1
- package/lib/commonjs/components/NepaliRangePicker/types.js +0 -6
- package/lib/commonjs/components/NepaliRangePicker/types.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/DatePickerModal.js +0 -180
- package/lib/module/components/NepaliDatePicker/DatePickerModal.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js +0 -143
- package/lib/module/components/NepaliDatePicker/NepaliDatePicker.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/index.js +0 -5
- package/lib/module/components/NepaliDatePicker/index.js.map +0 -1
- package/lib/module/components/NepaliDatePicker/types.js +0 -4
- package/lib/module/components/NepaliDatePicker/types.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js +0 -182
- package/lib/module/components/NepaliRangePicker/NepaliRangePicker.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js +0 -270
- package/lib/module/components/NepaliRangePicker/RangePickerModal.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/index.js +0 -6
- package/lib/module/components/NepaliRangePicker/index.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/range-utils.js +0 -61
- package/lib/module/components/NepaliRangePicker/range-utils.js.map +0 -1
- package/lib/module/components/NepaliRangePicker/types.js +0 -4
- package/lib/module/components/NepaliRangePicker/types.js.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts +0 -4
- package/lib/typescript/src/components/NepaliDatePicker/DatePickerModal.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts +0 -4
- package/lib/typescript/src/components/NepaliDatePicker/NepaliDatePicker.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/index.d.ts +0 -4
- package/lib/typescript/src/components/NepaliDatePicker/index.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliDatePicker/types.d.ts +0 -50
- package/lib/typescript/src/components/NepaliDatePicker/types.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts +0 -4
- package/lib/typescript/src/components/NepaliRangePicker/NepaliRangePicker.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts +0 -4
- package/lib/typescript/src/components/NepaliRangePicker/RangePickerModal.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/index.d.ts +0 -5
- package/lib/typescript/src/components/NepaliRangePicker/index.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts +0 -13
- package/lib/typescript/src/components/NepaliRangePicker/range-utils.d.ts.map +0 -1
- package/lib/typescript/src/components/NepaliRangePicker/types.d.ts +0 -61
- package/lib/typescript/src/components/NepaliRangePicker/types.d.ts.map +0 -1
- package/src/components/NepaliDatePicker/DatePickerModal.tsx +0 -220
- package/src/components/NepaliDatePicker/NepaliDatePicker.tsx +0 -171
- package/src/components/NepaliDatePicker/index.ts +0 -3
- package/src/components/NepaliDatePicker/types.ts +0 -70
- package/src/components/NepaliRangePicker/NepaliRangePicker.tsx +0 -206
- package/src/components/NepaliRangePicker/RangePickerModal.tsx +0 -336
- package/src/components/NepaliRangePicker/index.ts +0 -11
- package/src/components/NepaliRangePicker/range-utils.ts +0 -75
- package/src/components/NepaliRangePicker/types.ts +0 -84
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { compareBS } from '../../core';
|
|
4
|
-
export function isDateInRange(date, range) {
|
|
5
|
-
if (!range.start || !range.end) return false;
|
|
6
|
-
const cmpStart = compareBS(date, range.start);
|
|
7
|
-
const cmpEnd = compareBS(date, range.end);
|
|
8
|
-
return cmpStart >= 0 && cmpEnd <= 0;
|
|
9
|
-
}
|
|
10
|
-
export function isRangeStart(date, range) {
|
|
11
|
-
if (!range.start) return false;
|
|
12
|
-
return compareBS(date, range.start) === 0;
|
|
13
|
-
}
|
|
14
|
-
export function isRangeEnd(date, range) {
|
|
15
|
-
if (!range.end) return false;
|
|
16
|
-
return compareBS(date, range.end) === 0;
|
|
17
|
-
}
|
|
18
|
-
export function normalizeRange(start, end, options) {
|
|
19
|
-
const allowSameDay = options?.allowSameDay ?? true;
|
|
20
|
-
if (!allowSameDay && compareBS(start, end) === 0) {
|
|
21
|
-
return {
|
|
22
|
-
start,
|
|
23
|
-
end: null
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
if (compareBS(start, end) <= 0) {
|
|
27
|
-
return {
|
|
28
|
-
start,
|
|
29
|
-
end
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
start: end,
|
|
34
|
-
end: start
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export function selectRangeDate(currentRange, date, options) {
|
|
38
|
-
const allowSameDay = options?.allowSameDay ?? true;
|
|
39
|
-
if (!currentRange.start) {
|
|
40
|
-
return {
|
|
41
|
-
start: date,
|
|
42
|
-
end: null
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
if (!currentRange.end) {
|
|
46
|
-
return normalizeRange(currentRange.start, date, {
|
|
47
|
-
allowSameDay
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
start: date,
|
|
52
|
-
end: null
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
export function getRangeDateKey(range, date) {
|
|
56
|
-
if (isRangeStart(date, range)) return 'start';
|
|
57
|
-
if (isRangeEnd(date, range)) return 'end';
|
|
58
|
-
if (isDateInRange(date, range)) return 'in-range';
|
|
59
|
-
return 'none';
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=range-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["compareBS","isDateInRange","date","range","start","end","cmpStart","cmpEnd","isRangeStart","isRangeEnd","normalizeRange","options","allowSameDay","selectRangeDate","currentRange","getRangeDateKey"],"sourceRoot":"../../../../src","sources":["components/NepaliRangePicker/range-utils.ts"],"mappings":";;AACA,SAASA,SAAS,QAAQ,YAAY;AAGtC,OAAO,SAASC,aAAaA,CAC3BC,IAAiB,EACjBC,KAAqB,EACZ;EACT,IAAI,CAACA,KAAK,CAACC,KAAK,IAAI,CAACD,KAAK,CAACE,GAAG,EAAE,OAAO,KAAK;EAC5C,MAAMC,QAAQ,GAAGN,SAAS,CAACE,IAAI,EAAEC,KAAK,CAACC,KAAK,CAAC;EAC7C,MAAMG,MAAM,GAAGP,SAAS,CAACE,IAAI,EAAEC,KAAK,CAACE,GAAG,CAAC;EACzC,OAAOC,QAAQ,IAAI,CAAC,IAAIC,MAAM,IAAI,CAAC;AACrC;AAEA,OAAO,SAASC,YAAYA,CAC1BN,IAAiB,EACjBC,KAAqB,EACZ;EACT,IAAI,CAACA,KAAK,CAACC,KAAK,EAAE,OAAO,KAAK;EAC9B,OAAOJ,SAAS,CAACE,IAAI,EAAEC,KAAK,CAACC,KAAK,CAAC,KAAK,CAAC;A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AAI,EAAEC,KAAK,CAAC,EAAE,OAAO,OAAO;EAC7C,IAAIM,UAAU,CAACP,IAAI,EAAEC,KAAK,CAAC,EAAE,OAAO,KAAK;EACzC,IAAIF,aAAa,CAACC,IAAI,EAAEC,KAAK,CAAC,EAAE,OAAO,UAAU;EACjD,OAAO,MAAM;AACf","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/NepaliRangePicker/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { DatePickerModalProps } from './types';
|
|
3
|
-
export declare function DatePickerModal({ visible, value, defaultValue, onChange, onConfirm, onCancel, onClose, locale, numerals, minDate, maxDate, markedDates, disabledDates, weekStartsOn, theme, colorScheme, title, confirmText, cancelText, testID, }: DatePickerModalProps): React.JSX.Element;
|
|
4
|
-
//# sourceMappingURL=DatePickerModal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DatePickerModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/NepaliDatePicker/DatePickerModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAazE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,aAAa,EACb,YAAY,EACZ,KAAK,EACL,WAAW,EACX,KAAqB,EACrB,WAAuB,EACvB,UAAqB,EACrB,MAAM,GACP,EAAE,oBAAoB,qBAmItB"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { NepaliDatePickerProps } from './types';
|
|
3
|
-
export declare function NepaliDatePicker({ value, defaultValue, onChange, placeholder, disabled, locale, numerals, displayFormat, minDate, maxDate, markedDates, disabledDates, weekStartsOn, theme, colorScheme, modalTitle, confirmText, cancelText, onOpen, onClose, testID, }: NepaliDatePickerProps): React.JSX.Element;
|
|
4
|
-
//# sourceMappingURL=NepaliDatePicker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NepaliDatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/NepaliDatePicker/NepaliDatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAOzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,WAA2B,EAC3B,QAAgB,EAChB,MAAM,EACN,QAAQ,EACR,aAA4B,EAC5B,OAAO,EACP,OAAO,EACP,WAAW,EACX,aAAa,EACb,YAAY,EACZ,KAAK,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,OAAO,EACP,MAAM,GACP,EAAE,qBAAqB,qBA0HvB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/NepaliDatePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { BSDateValue } from '../../core/types';
|
|
2
|
-
import type { LocaleCode, CalendarLocale, NumeralSystem } from '../../core/locale';
|
|
3
|
-
import type { CalendarTheme } from '../../theme/types';
|
|
4
|
-
import type { CalendarMarkedDate } from '../NepaliCalendar/types';
|
|
5
|
-
export type NepaliDatePickerProps = {
|
|
6
|
-
value?: BSDateValue | null;
|
|
7
|
-
defaultValue?: BSDateValue;
|
|
8
|
-
onChange?: (date: BSDateValue) => void;
|
|
9
|
-
placeholder?: string;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
locale?: LocaleCode | CalendarLocale;
|
|
12
|
-
numerals?: NumeralSystem;
|
|
13
|
-
displayFormat?: string;
|
|
14
|
-
minDate?: BSDateValue;
|
|
15
|
-
maxDate?: BSDateValue;
|
|
16
|
-
markedDates?: Record<string, CalendarMarkedDate>;
|
|
17
|
-
disabledDates?: string[] | ((date: BSDateValue) => boolean);
|
|
18
|
-
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
19
|
-
theme?: Partial<CalendarTheme>;
|
|
20
|
-
colorScheme?: 'light' | 'dark' | 'system';
|
|
21
|
-
modalTitle?: string;
|
|
22
|
-
confirmText?: string;
|
|
23
|
-
cancelText?: string;
|
|
24
|
-
onOpen?: () => void;
|
|
25
|
-
onClose?: () => void;
|
|
26
|
-
testID?: string;
|
|
27
|
-
};
|
|
28
|
-
export type DatePickerModalProps = {
|
|
29
|
-
visible: boolean;
|
|
30
|
-
value?: BSDateValue | null;
|
|
31
|
-
defaultValue?: BSDateValue;
|
|
32
|
-
onChange?: (date: BSDateValue) => void;
|
|
33
|
-
onConfirm?: (date: BSDateValue) => void;
|
|
34
|
-
onCancel?: () => void;
|
|
35
|
-
onClose?: () => void;
|
|
36
|
-
locale?: LocaleCode | CalendarLocale;
|
|
37
|
-
numerals?: NumeralSystem;
|
|
38
|
-
minDate?: BSDateValue;
|
|
39
|
-
maxDate?: BSDateValue;
|
|
40
|
-
markedDates?: Record<string, CalendarMarkedDate>;
|
|
41
|
-
disabledDates?: string[] | ((date: BSDateValue) => boolean);
|
|
42
|
-
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
43
|
-
theme?: Partial<CalendarTheme>;
|
|
44
|
-
colorScheme?: 'light' | 'dark' | 'system';
|
|
45
|
-
title?: string;
|
|
46
|
-
confirmText?: string;
|
|
47
|
-
cancelText?: string;
|
|
48
|
-
testID?: string;
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/NepaliDatePicker/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAEvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,MAAM,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC;IACrC,QAAQ,CAAC,EAAE,aAAa,CAAC;IAEzB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACjD,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC;IAE5D,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAA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a,CAAC,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IAE1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { NepaliRangePickerProps } from './types';
|
|
3
|
-
export declare function NepaliRangePicker({ value, defaultValue, onChange, placeholder, disabled, locale, numerals, displayFormat, minDate, maxDate, markedDates, disabledDates, weekStartsOn, allowSameDay, theme, colorScheme, modalTitle, confirmText, cancelText, clearText, onOpen, onClose, testID, }: NepaliRangePickerProps): React.JSX.Element;
|
|
4
|
-
//# sourceMappingURL=NepaliRangePicker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NepaliRangePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/NepaliRangePicker/NepaliRangePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAMzE,OAAO,KAAK,EAAE,sBAAsB,EAAkB,MAAM,SAAS,CAAC;AAEtE,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,WAAiC,EACjC,QAAgB,EAChB,MAAM,EACN,QAAQ,EACR,aAA4B,EAC5B,OAAO,EACP,OAAO,EACP,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAmB,EACnB,KAAK,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM,EACN,OAAO,EACP,MAAM,GACP,EAAE,sBAAsB,qBA4JxB"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { RangePickerModalProps } from './types';
|
|
3
|
-
export declare function RangePickerModal({ visible, value, defaultValue, onChange, onConfirm, onCancel, onClose, onClear, locale, numerals, minDate, maxDate, markedDates, disabledDates, weekStartsOn, theme, colorScheme, title, confirmText, cancelText, clearText, allowSameDay, testID, }: RangePickerModalProps): React.JSX.Element;
|
|
4
|
-
//# sourceMappingURL=RangePickerModal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RangePickerModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/NepaliRangePicker/RangePickerModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAazE,OAAO,KAAK,EAAE,qBAAqB,EAAkB,MAAM,SAAS,CAAC;AA4BrE,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,aAAa,EACb,YAAY,EACZ,KAAK,EACL,WAAW,EACX,KAA2B,EAC3B,WAAuB,EACvB,UAAqB,EACrB,SAAmB,EACnB,YAAmB,EACnB,MAAM,GACP,EAAE,qBAAqB,qBAyMvB"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { NepaliRangePicker } from './NepaliRangePicker';
|
|
2
|
-
export { RangePickerModal } from './RangePickerModal';
|
|
3
|
-
export type { NepaliRangePickerProps, RangePickerModalProps, DateRangeValue } from './types';
|
|
4
|
-
export { isDateInRange, isRangeStart, isRangeEnd, normalizeRange, selectRangeDate, getRangeDateKey, } from './range-utils';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/NepaliRangePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC7F,OAAO,EACL,aAAa,EACb,YAAY,EACZ,UAAU,EACV,cAAc,EACd,eAAe,EACf,eAAe,GAChB,MAAM,eAAe,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { BSDateValue } from '../../core/types';
|
|
2
|
-
import type { DateRangeValue } from './types';
|
|
3
|
-
export declare function isDateInRange(date: BSDateValue, range: DateRangeValue): boolean;
|
|
4
|
-
export declare function isRangeStart(date: BSDateValue, range: DateRangeValue): boolean;
|
|
5
|
-
export declare function isRangeEnd(date: BSDateValue, range: DateRangeValue): boolean;
|
|
6
|
-
export declare function normalizeRange(start: BSDateValue, end: BSDateValue, options?: {
|
|
7
|
-
allowSameDay?: boolean;
|
|
8
|
-
}): DateRangeValue;
|
|
9
|
-
export declare function selectRangeDate(currentRange: DateRangeValue, date: BSDateValue, options?: {
|
|
10
|
-
allowSameDay?: boolean;
|
|
11
|
-
}): DateRangeValue;
|
|
12
|
-
export declare function getRangeDateKey(range: DateRangeValue, date: BSDateValue): 'start' | 'end' | 'in-range' | 'none';
|
|
13
|
-
//# sourceMappingURL=range-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"range-utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/NepaliRangePicker/range-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,aAAa,CAC3B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,cAAc,GACpB,OAAO,CAKT;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,cAAc,GACpB,OAAO,CAGT;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,cAAc,GACpB,OAAO,CAGT;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,WAAW,EAChB,OAAO,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GACnC,cAAc,CAYhB;AAED,wBAAgB,eAAe,CAC7B,YAAY,EAAE,cAAc,EAC5B,IAAI,EAAE,WAAW,EACjB,OAAO,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GACnC,cAAc,CAYhB;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,WAAW,GAChB,OAAO,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,CAKvC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { BSDateValue } from '../../core/types';
|
|
2
|
-
import type { LocaleCode, CalendarLocale, NumeralSystem } from '../../core/locale';
|
|
3
|
-
import type { CalendarTheme } from '../../theme/types';
|
|
4
|
-
import type { CalendarMarkedDate } from '../NepaliCalendar/types';
|
|
5
|
-
export type DateRangeValue = {
|
|
6
|
-
start: BSDateValue | null;
|
|
7
|
-
end: BSDateValue | null;
|
|
8
|
-
};
|
|
9
|
-
export type NepaliRangePickerProps = {
|
|
10
|
-
value?: DateRangeValue;
|
|
11
|
-
defaultValue?: DateRangeValue;
|
|
12
|
-
onChange?: (range: DateRangeValue) => void;
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
startPlaceholder?: string;
|
|
15
|
-
endPlaceholder?: string;
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
locale?: LocaleCode | CalendarLocale;
|
|
18
|
-
numerals?: NumeralSystem;
|
|
19
|
-
displayFormat?: string;
|
|
20
|
-
minDate?: BSDateValue;
|
|
21
|
-
maxDate?: BSDateValue;
|
|
22
|
-
markedDates?: Record<string, CalendarMarkedDate>;
|
|
23
|
-
disabledDates?: string[] | ((date: BSDateValue) => boolean);
|
|
24
|
-
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
25
|
-
allowSameDay?: boolean;
|
|
26
|
-
theme?: Partial<CalendarTheme>;
|
|
27
|
-
colorScheme?: 'light' | 'dark' | 'system';
|
|
28
|
-
modalTitle?: string;
|
|
29
|
-
confirmText?: string;
|
|
30
|
-
cancelText?: string;
|
|
31
|
-
clearText?: string;
|
|
32
|
-
onOpen?: () => void;
|
|
33
|
-
onClose?: () => void;
|
|
34
|
-
testID?: string;
|
|
35
|
-
};
|
|
36
|
-
export type RangePickerModalProps = {
|
|
37
|
-
visible: boolean;
|
|
38
|
-
value?: DateRangeValue;
|
|
39
|
-
defaultValue?: DateRangeValue;
|
|
40
|
-
onChange?: (range: DateRangeValue) => void;
|
|
41
|
-
onConfirm?: (range: DateRangeValue) => void;
|
|
42
|
-
onCancel?: () => void;
|
|
43
|
-
onClose?: () => void;
|
|
44
|
-
onClear?: () => void;
|
|
45
|
-
locale?: LocaleCode | CalendarLocale;
|
|
46
|
-
numerals?: NumeralSystem;
|
|
47
|
-
minDate?: BSDateValue;
|
|
48
|
-
maxDate?: BSDateValue;
|
|
49
|
-
markedDates?: Record<string, CalendarMarkedDate>;
|
|
50
|
-
disabledDates?: string[] | ((date: BSDateValue) => boolean);
|
|
51
|
-
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
52
|
-
allowSameDay?: boolean;
|
|
53
|
-
theme?: Partial<CalendarTheme>;
|
|
54
|
-
colorScheme?: 'light' | 'dark' | 'system';
|
|
55
|
-
title?: string;
|
|
56
|
-
confirmText?: string;
|
|
57
|
-
cancelText?: string;
|
|
58
|
-
clearText?: string;
|
|
59
|
-
testID?: string;
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/NepaliRangePicker/types.ts"],"names":[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AAY,CAAC,EAAE,OAAO,CAAC;IAEvB,KAAK,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IAE1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useMemo, useCallback } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
Text,
|
|
5
|
-
Pressable,
|
|
6
|
-
Modal,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
TouchableWithoutFeedback,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import type { BSDateValue } from '../../core/types';
|
|
11
|
-
import { useCalendarTheme } from '../../theme';
|
|
12
|
-
import { getSafeInitialBSDate } from '../../utils';
|
|
13
|
-
import { NepaliCalendar } from '../NepaliCalendar';
|
|
14
|
-
import type { DatePickerModalProps } from './types';
|
|
15
|
-
|
|
16
|
-
export function DatePickerModal({
|
|
17
|
-
visible,
|
|
18
|
-
value,
|
|
19
|
-
defaultValue,
|
|
20
|
-
onChange,
|
|
21
|
-
onConfirm,
|
|
22
|
-
onCancel,
|
|
23
|
-
onClose,
|
|
24
|
-
locale,
|
|
25
|
-
numerals,
|
|
26
|
-
minDate,
|
|
27
|
-
maxDate,
|
|
28
|
-
markedDates,
|
|
29
|
-
disabledDates,
|
|
30
|
-
weekStartsOn,
|
|
31
|
-
theme,
|
|
32
|
-
colorScheme,
|
|
33
|
-
title = 'Select Date',
|
|
34
|
-
confirmText = 'Confirm',
|
|
35
|
-
cancelText = 'Cancel',
|
|
36
|
-
testID,
|
|
37
|
-
}: DatePickerModalProps) {
|
|
38
|
-
const calendarTheme = useCalendarTheme({ colorScheme, theme });
|
|
39
|
-
|
|
40
|
-
const [tempDate, setTempDate] = useState<BSDateValue>(() =>
|
|
41
|
-
getSafeInitialBSDate(value, defaultValue)
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (visible) {
|
|
46
|
-
setTempDate(getSafeInitialBSDate(value, defaultValue));
|
|
47
|
-
}
|
|
48
|
-
}, [visible, value, defaultValue]);
|
|
49
|
-
|
|
50
|
-
const handleConfirm = useCallback(() => {
|
|
51
|
-
onConfirm?.(tempDate);
|
|
52
|
-
onChange?.(tempDate);
|
|
53
|
-
onClose?.();
|
|
54
|
-
}, [tempDate, onConfirm, onChange, onClose]);
|
|
55
|
-
|
|
56
|
-
const handleCancel = useCallback(() => {
|
|
57
|
-
onCancel?.();
|
|
58
|
-
onClose?.();
|
|
59
|
-
}, [onCancel, onClose]);
|
|
60
|
-
|
|
61
|
-
const handleBackdropPress = useCallback(() => {
|
|
62
|
-
onCancel?.();
|
|
63
|
-
onClose?.();
|
|
64
|
-
}, [onCancel, onClose]);
|
|
65
|
-
|
|
66
|
-
const modalContent = useMemo(
|
|
67
|
-
() => (
|
|
68
|
-
<View
|
|
69
|
-
style={[
|
|
70
|
-
styles.modalContent,
|
|
71
|
-
{ backgroundColor: calendarTheme.colors.modalBackground },
|
|
72
|
-
]}
|
|
73
|
-
testID={testID}
|
|
74
|
-
>
|
|
75
|
-
<Text
|
|
76
|
-
style={[
|
|
77
|
-
styles.title,
|
|
78
|
-
{
|
|
79
|
-
color: calendarTheme.colors.text,
|
|
80
|
-
borderBottomColor: calendarTheme.colors.border,
|
|
81
|
-
},
|
|
82
|
-
]}
|
|
83
|
-
>
|
|
84
|
-
{title}
|
|
85
|
-
</Text>
|
|
86
|
-
|
|
87
|
-
<View style={styles.calendarWrapper}>
|
|
88
|
-
<NepaliCalendar
|
|
89
|
-
value={tempDate}
|
|
90
|
-
onChange={setTempDate}
|
|
91
|
-
locale={locale}
|
|
92
|
-
numerals={numerals}
|
|
93
|
-
minDate={minDate}
|
|
94
|
-
maxDate={maxDate}
|
|
95
|
-
markedDates={markedDates}
|
|
96
|
-
disabledDates={disabledDates}
|
|
97
|
-
weekStartsOn={weekStartsOn}
|
|
98
|
-
theme={theme}
|
|
99
|
-
colorScheme={colorScheme}
|
|
100
|
-
/>
|
|
101
|
-
</View>
|
|
102
|
-
|
|
103
|
-
<View
|
|
104
|
-
style={[
|
|
105
|
-
styles.buttonRow,
|
|
106
|
-
{ borderTopColor: calendarTheme.colors.border },
|
|
107
|
-
]}
|
|
108
|
-
>
|
|
109
|
-
<Pressable
|
|
110
|
-
style={[styles.button, styles.cancelButton]}
|
|
111
|
-
onPress={handleCancel}
|
|
112
|
-
accessibilityRole="button"
|
|
113
|
-
accessibilityLabel={cancelText}
|
|
114
|
-
>
|
|
115
|
-
<Text style={[styles.cancelText, { color: calendarTheme.colors.mutedText }]}>
|
|
116
|
-
{cancelText}
|
|
117
|
-
</Text>
|
|
118
|
-
</Pressable>
|
|
119
|
-
|
|
120
|
-
<Pressable
|
|
121
|
-
style={[styles.button, { backgroundColor: calendarTheme.colors.primary }]}
|
|
122
|
-
onPress={handleConfirm}
|
|
123
|
-
accessibilityRole="button"
|
|
124
|
-
accessibilityLabel="Confirm selected date"
|
|
125
|
-
>
|
|
126
|
-
<Text style={[styles.confirmText, { color: calendarTheme.colors.primaryText }]}>
|
|
127
|
-
{confirmText}
|
|
128
|
-
</Text>
|
|
129
|
-
</Pressable>
|
|
130
|
-
</View>
|
|
131
|
-
</View>
|
|
132
|
-
),
|
|
133
|
-
[
|
|
134
|
-
tempDate,
|
|
135
|
-
title,
|
|
136
|
-
locale,
|
|
137
|
-
numerals,
|
|
138
|
-
minDate,
|
|
139
|
-
maxDate,
|
|
140
|
-
markedDates,
|
|
141
|
-
disabledDates,
|
|
142
|
-
weekStartsOn,
|
|
143
|
-
theme,
|
|
144
|
-
colorScheme,
|
|
145
|
-
testID,
|
|
146
|
-
cancelText,
|
|
147
|
-
confirmText,
|
|
148
|
-
calendarTheme,
|
|
149
|
-
handleCancel,
|
|
150
|
-
handleConfirm,
|
|
151
|
-
]
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
<Modal
|
|
156
|
-
visible={visible}
|
|
157
|
-
transparent
|
|
158
|
-
animationType="fade"
|
|
159
|
-
onRequestClose={handleCancel}
|
|
160
|
-
>
|
|
161
|
-
<TouchableWithoutFeedback onPress={handleBackdropPress}>
|
|
162
|
-
<View style={[styles.backdrop, { backgroundColor: calendarTheme.colors.overlay }]}>
|
|
163
|
-
<TouchableWithoutFeedback>{modalContent}</TouchableWithoutFeedback>
|
|
164
|
-
</View>
|
|
165
|
-
</TouchableWithoutFeedback>
|
|
166
|
-
</Modal>
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const styles = StyleSheet.create({
|
|
171
|
-
backdrop: {
|
|
172
|
-
flex: 1,
|
|
173
|
-
justifyContent: 'center',
|
|
174
|
-
alignItems: 'center',
|
|
175
|
-
paddingHorizontal: 20,
|
|
176
|
-
},
|
|
177
|
-
modalContent: {
|
|
178
|
-
borderRadius: 16,
|
|
179
|
-
overflow: 'hidden',
|
|
180
|
-
width: '100%',
|
|
181
|
-
maxWidth: 400,
|
|
182
|
-
},
|
|
183
|
-
title: {
|
|
184
|
-
fontSize: 18,
|
|
185
|
-
fontWeight: '600',
|
|
186
|
-
textAlign: 'center',
|
|
187
|
-
paddingVertical: 16,
|
|
188
|
-
paddingHorizontal: 16,
|
|
189
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
190
|
-
},
|
|
191
|
-
calendarWrapper: {
|
|
192
|
-
padding: 8,
|
|
193
|
-
},
|
|
194
|
-
buttonRow: {
|
|
195
|
-
flexDirection: 'row',
|
|
196
|
-
justifyContent: 'flex-end',
|
|
197
|
-
paddingHorizontal: 16,
|
|
198
|
-
paddingVertical: 12,
|
|
199
|
-
gap: 12,
|
|
200
|
-
borderTopWidth: StyleSheet.hairlineWidth,
|
|
201
|
-
},
|
|
202
|
-
button: {
|
|
203
|
-
paddingVertical: 10,
|
|
204
|
-
paddingHorizontal: 20,
|
|
205
|
-
borderRadius: 8,
|
|
206
|
-
minWidth: 80,
|
|
207
|
-
alignItems: 'center',
|
|
208
|
-
},
|
|
209
|
-
cancelButton: {
|
|
210
|
-
backgroundColor: 'transparent',
|
|
211
|
-
},
|
|
212
|
-
cancelText: {
|
|
213
|
-
fontSize: 16,
|
|
214
|
-
fontWeight: '600',
|
|
215
|
-
},
|
|
216
|
-
confirmText: {
|
|
217
|
-
fontSize: 16,
|
|
218
|
-
fontWeight: '600',
|
|
219
|
-
},
|
|
220
|
-
});
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import React, { useState, useMemo, useCallback, useEffect } from 'react';
|
|
2
|
-
import { Pressable, Text, StyleSheet } from 'react-native';
|
|
3
|
-
import type { BSDateValue } from '../../core/types';
|
|
4
|
-
import { isValidBSDate, isBSDateInSupportedRange } from '../../core/validation';
|
|
5
|
-
import { useCalendarTheme } from '../../theme';
|
|
6
|
-
import { safeFormatBSDate, warnOutOfRangeInDev, warnMinMaxInDev } from '../../utils';
|
|
7
|
-
import { DatePickerModal } from './DatePickerModal';
|
|
8
|
-
import type { NepaliDatePickerProps } from './types';
|
|
9
|
-
|
|
10
|
-
export function NepaliDatePicker({
|
|
11
|
-
value,
|
|
12
|
-
defaultValue,
|
|
13
|
-
onChange,
|
|
14
|
-
placeholder = 'Select date',
|
|
15
|
-
disabled = false,
|
|
16
|
-
locale,
|
|
17
|
-
numerals,
|
|
18
|
-
displayFormat = 'yyyy-MM-dd',
|
|
19
|
-
minDate,
|
|
20
|
-
maxDate,
|
|
21
|
-
markedDates,
|
|
22
|
-
disabledDates,
|
|
23
|
-
weekStartsOn,
|
|
24
|
-
theme,
|
|
25
|
-
colorScheme,
|
|
26
|
-
modalTitle,
|
|
27
|
-
confirmText,
|
|
28
|
-
cancelText,
|
|
29
|
-
onOpen,
|
|
30
|
-
onClose,
|
|
31
|
-
testID,
|
|
32
|
-
}: NepaliDatePickerProps) {
|
|
33
|
-
const [modalVisible, setModalVisible] = useState(false);
|
|
34
|
-
const calendarTheme = useCalendarTheme({ colorScheme, theme });
|
|
35
|
-
|
|
36
|
-
const isControlled = value !== undefined;
|
|
37
|
-
const [internalValue, setInternalValue] = useState<BSDateValue | null>(
|
|
38
|
-
defaultValue ?? null
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (value) {
|
|
43
|
-
if (!isValidBSDate(value)) {
|
|
44
|
-
if (__DEV__) {
|
|
45
|
-
console.warn(
|
|
46
|
-
'react-native-bikram-sambat: Invalid date value provided to NepaliDatePicker.',
|
|
47
|
-
value
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
} else if (!isBSDateInSupportedRange(value)) {
|
|
51
|
-
warnOutOfRangeInDev(value, { min: 2000, max: 2090 });
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}, [value]);
|
|
55
|
-
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
warnMinMaxInDev(minDate, maxDate);
|
|
58
|
-
}, [minDate, maxDate]);
|
|
59
|
-
|
|
60
|
-
const currentValue = isControlled
|
|
61
|
-
? (value && isValidBSDate(value) && isBSDateInSupportedRange(value) ? value : null)
|
|
62
|
-
: internalValue;
|
|
63
|
-
|
|
64
|
-
const displayText = useMemo(() => {
|
|
65
|
-
if (!currentValue) return placeholder;
|
|
66
|
-
|
|
67
|
-
const formatted = safeFormatBSDate(currentValue, displayFormat, locale, numerals);
|
|
68
|
-
return formatted ?? placeholder;
|
|
69
|
-
}, [currentValue, placeholder, displayFormat, locale, numerals]);
|
|
70
|
-
|
|
71
|
-
const handleOpen = useCallback(() => {
|
|
72
|
-
if (disabled) return;
|
|
73
|
-
setModalVisible(true);
|
|
74
|
-
onOpen?.();
|
|
75
|
-
}, [disabled, onOpen]);
|
|
76
|
-
|
|
77
|
-
const handleClose = useCallback(() => {
|
|
78
|
-
setModalVisible(false);
|
|
79
|
-
onClose?.();
|
|
80
|
-
}, [onClose]);
|
|
81
|
-
|
|
82
|
-
const handleChange = useCallback(
|
|
83
|
-
(date: BSDateValue) => {
|
|
84
|
-
if (!isControlled) {
|
|
85
|
-
setInternalValue(date);
|
|
86
|
-
}
|
|
87
|
-
onChange?.(date);
|
|
88
|
-
},
|
|
89
|
-
[isControlled, onChange]
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
const accessibilityLabel = useMemo(() => {
|
|
93
|
-
if (disabled) return `${placeholder}, disabled`;
|
|
94
|
-
if (currentValue) {
|
|
95
|
-
const formatted = safeFormatBSDate(currentValue, displayFormat, locale, numerals);
|
|
96
|
-
return formatted ?? placeholder;
|
|
97
|
-
}
|
|
98
|
-
return placeholder;
|
|
99
|
-
}, [currentValue, placeholder, displayFormat, locale, numerals, disabled]);
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<>
|
|
103
|
-
<Pressable
|
|
104
|
-
style={[
|
|
105
|
-
styles.field,
|
|
106
|
-
{
|
|
107
|
-
borderColor: calendarTheme.colors.fieldBorder,
|
|
108
|
-
backgroundColor: calendarTheme.colors.fieldBackground,
|
|
109
|
-
},
|
|
110
|
-
disabled && styles.fieldDisabled,
|
|
111
|
-
]}
|
|
112
|
-
onPress={handleOpen}
|
|
113
|
-
disabled={disabled}
|
|
114
|
-
accessibilityRole="button"
|
|
115
|
-
accessibilityLabel={accessibilityLabel}
|
|
116
|
-
accessibilityState={{ disabled }}
|
|
117
|
-
testID={testID}
|
|
118
|
-
>
|
|
119
|
-
<Text
|
|
120
|
-
style={[
|
|
121
|
-
styles.fieldText,
|
|
122
|
-
{
|
|
123
|
-
color: currentValue
|
|
124
|
-
? calendarTheme.colors.text
|
|
125
|
-
: calendarTheme.colors.placeholderText,
|
|
126
|
-
},
|
|
127
|
-
]}
|
|
128
|
-
>
|
|
129
|
-
{displayText}
|
|
130
|
-
</Text>
|
|
131
|
-
</Pressable>
|
|
132
|
-
|
|
133
|
-
<DatePickerModal
|
|
134
|
-
visible={modalVisible}
|
|
135
|
-
value={currentValue}
|
|
136
|
-
defaultValue={defaultValue}
|
|
137
|
-
onChange={handleChange}
|
|
138
|
-
onClose={handleClose}
|
|
139
|
-
locale={locale}
|
|
140
|
-
numerals={numerals}
|
|
141
|
-
minDate={minDate}
|
|
142
|
-
maxDate={maxDate}
|
|
143
|
-
markedDates={markedDates}
|
|
144
|
-
disabledDates={disabledDates}
|
|
145
|
-
weekStartsOn={weekStartsOn}
|
|
146
|
-
theme={theme}
|
|
147
|
-
colorScheme={colorScheme}
|
|
148
|
-
title={modalTitle}
|
|
149
|
-
confirmText={confirmText}
|
|
150
|
-
cancelText={cancelText}
|
|
151
|
-
/>
|
|
152
|
-
</>
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const styles = StyleSheet.create({
|
|
157
|
-
field: {
|
|
158
|
-
borderWidth: 1,
|
|
159
|
-
borderRadius: 10,
|
|
160
|
-
paddingHorizontal: 16,
|
|
161
|
-
paddingVertical: 14,
|
|
162
|
-
alignItems: 'center',
|
|
163
|
-
},
|
|
164
|
-
fieldDisabled: {
|
|
165
|
-
opacity: 0.5,
|
|
166
|
-
},
|
|
167
|
-
fieldText: {
|
|
168
|
-
fontSize: 16,
|
|
169
|
-
fontWeight: '500',
|
|
170
|
-
},
|
|
171
|
-
});
|