@react-fabric/date 1.0.0-beta.6 → 1.0.0-beta.60
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 +2 -9
- package/{src/components/Date.module.css → css/_date.css} +5 -5
- package/{src/superdate/SuperDate.module.css → css/styles.css} +2 -8
- package/dist/cjs/components/DateHeader.js +16 -8
- package/dist/cjs/components/DatePage.js +2 -3
- package/dist/cjs/components/TimeSliders.js +5 -6
- package/dist/cjs/display/DateDisplay.js +24 -2
- package/dist/cjs/display/DateDuration.js +143 -0
- package/dist/cjs/hijri/DateConverter.js +154 -0
- package/dist/cjs/hijri/FormatDate.js +116 -0
- package/dist/cjs/hijri/HijriDate.js +531 -0
- package/dist/cjs/hijri/StringDateParser.js +74 -0
- package/dist/cjs/hijri/index.js +17 -1025
- package/dist/cjs/hijri/initializer.js +113 -0
- package/dist/cjs/hijri/locales.js +19 -0
- package/dist/cjs/hijri/safe.js +17 -0
- package/dist/cjs/i18n/ar.json.js +191 -3
- package/dist/cjs/i18n/en.json.js +63 -1
- package/dist/cjs/i18n/index.js +0 -6
- package/dist/cjs/index.js +13 -2
- package/dist/cjs/panels/DatePanel.js +26 -0
- package/dist/cjs/{superdate → panels}/EventPanel.js +2 -1
- package/dist/cjs/panels/RangePanel.js +23 -0
- package/dist/cjs/utils/dateUtil.js +1 -4
- package/dist/esm/components/DateHeader.js +16 -8
- package/dist/esm/components/DatePage.js +2 -3
- package/dist/esm/components/TimeSliders.js +5 -6
- package/dist/esm/display/DateDisplay.js +24 -2
- package/dist/esm/display/DateDuration.js +143 -0
- package/dist/esm/hijri/DateConverter.js +152 -0
- package/dist/esm/hijri/FormatDate.js +113 -0
- package/dist/esm/hijri/HijriDate.js +528 -0
- package/dist/esm/hijri/StringDateParser.js +74 -0
- package/dist/esm/hijri/index.js +17 -1025
- package/dist/esm/hijri/initializer.js +113 -0
- package/dist/esm/hijri/locales.js +18 -0
- package/dist/esm/hijri/safe.js +14 -0
- package/dist/esm/i18n/ar.json.js +191 -3
- package/dist/esm/i18n/en.json.js +63 -2
- package/dist/esm/i18n/index.js +0 -6
- package/dist/esm/index.js +6 -1
- package/dist/esm/panels/DatePanel.js +26 -0
- package/dist/esm/{superdate → panels}/EventPanel.js +2 -1
- package/dist/esm/panels/RangePanel.js +23 -0
- package/dist/esm/utils/dateUtil.js +1 -4
- package/dist/types/display/DateDisplay.d.ts +21 -3
- package/dist/types/display/DateDuration.d.ts +31 -0
- package/dist/types/hijri/DateConverter.d.ts +13 -0
- package/dist/types/hijri/FormatDate.d.ts +19 -0
- package/dist/types/hijri/HijriDate.d.ts +214 -0
- package/dist/types/hijri/StringDateParser.d.ts +11 -0
- package/dist/types/hijri/index.d.ts +2 -2
- package/dist/types/hijri/initializer.d.ts +129 -0
- package/dist/types/hijri/locales.d.ts +19 -0
- package/dist/types/hijri/safe.d.ts +3 -0
- package/dist/types/index.d.ts +6 -1
- package/dist/types/panels/DatePanel.d.ts +26 -0
- package/dist/types/panels/EventPanel.d.ts +17 -0
- package/dist/types/panels/RangePanel.d.ts +22 -0
- package/dist/types/types/index.d.ts +8 -40
- package/package.json +13 -16
- package/src/components/DateHeader.tsx +4 -8
- package/src/components/DatePage.tsx +2 -3
- package/src/components/TimeSliders.tsx +5 -6
- package/src/display/DateDisplay.tsx +32 -4
- package/src/display/DateDuration.tsx +180 -0
- package/src/hijri/DateConverter.js +175 -0
- package/src/hijri/FormatDate.js +134 -0
- package/src/hijri/HijriDate.js +477 -0
- package/src/hijri/StringDateParser.js +68 -0
- package/src/hijri/index.js +16 -1535
- package/src/hijri/initializer.js +96 -0
- package/src/hijri/locales.js +109 -0
- package/src/hijri/safe.js +16 -0
- package/src/i18n/ar.json +190 -1
- package/src/i18n/en.json +60 -0
- package/src/i18n/index.ts +0 -3
- package/src/index.ts +7 -1
- package/src/panels/DatePanel.tsx +26 -0
- package/src/{superdate → panels}/EventPanel.tsx +21 -3
- package/src/panels/RangePanel.tsx +23 -0
- package/src/types/index.ts +8 -43
- package/src/utils/dateUtil.ts +1 -5
- package/dist/cjs/components/Date.module.css +0 -1
- package/dist/cjs/i18n/superdate/ar.json.js +0 -86
- package/dist/cjs/i18n/superdate/en.json.js +0 -93
- package/dist/cjs/superdate/QuickSelect.js +0 -134
- package/dist/cjs/superdate/RelativeInput.js +0 -79
- package/dist/cjs/superdate/RelativePanel.js +0 -91
- package/dist/cjs/superdate/SuperDate.module.css +0 -1
- package/dist/cjs/superdate/Superdate.js +0 -177
- package/dist/esm/components/Date.module.css +0 -1
- package/dist/esm/i18n/superdate/ar.json.js +0 -79
- package/dist/esm/i18n/superdate/en.json.js +0 -85
- package/dist/esm/superdate/QuickSelect.js +0 -134
- package/dist/esm/superdate/RelativeInput.js +0 -79
- package/dist/esm/superdate/RelativePanel.js +0 -91
- package/dist/esm/superdate/SuperDate.module.css +0 -1
- package/dist/esm/superdate/Superdate.js +0 -176
- package/dist/types/superdate/EventPanel.d.ts +0 -4
- package/dist/types/superdate/QuickSelect.d.ts +0 -1
- package/dist/types/superdate/RelativeInput.d.ts +0 -1
- package/dist/types/superdate/RelativePanel.d.ts +0 -1
- package/dist/types/superdate/Superdate.d.ts +0 -17
- package/src/i18n/superdate/ar.json +0 -70
- package/src/i18n/superdate/en.json +0 -75
- package/src/superdate/QuickSelect.tsx +0 -121
- package/src/superdate/RelativeInput.tsx +0 -64
- package/src/superdate/RelativePanel.tsx +0 -103
- package/src/superdate/Superdate.tsx +0 -198
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GregToHijri
|
|
3
|
+
} from './DateConverter';
|
|
4
|
+
import StringDateParser from './StringDateParser';
|
|
5
|
+
|
|
6
|
+
const defaultFormat = 'yyyy/mm/dd';
|
|
7
|
+
const defaultProps ={
|
|
8
|
+
month:1,
|
|
9
|
+
date:1,
|
|
10
|
+
hours:0,
|
|
11
|
+
minutes:0,
|
|
12
|
+
seconds:0,
|
|
13
|
+
milliseconds:0
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
class Initializer {
|
|
17
|
+
|
|
18
|
+
static initDefault() {
|
|
19
|
+
return GregToHijri(new Date());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static init_number (number) {
|
|
23
|
+
return GregToHijri(new Date(number));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static init_number_number (year, month) {
|
|
27
|
+
|
|
28
|
+
return this.init_number_number_number(year, month, 1);
|
|
29
|
+
}
|
|
30
|
+
static init_number_number_number () {
|
|
31
|
+
return this.initFromNumbers(...arguments);
|
|
32
|
+
}
|
|
33
|
+
static init_number_number_number_number () {
|
|
34
|
+
return this.initFromNumbers(...arguments);
|
|
35
|
+
}
|
|
36
|
+
static init_number_number_number_number_number () {
|
|
37
|
+
return this.initFromNumbers(...arguments);
|
|
38
|
+
}
|
|
39
|
+
static init_number_number_number_number_number_number () {
|
|
40
|
+
return this.initFromNumbers(...arguments);
|
|
41
|
+
}
|
|
42
|
+
static init_number_number_number_number_number_number_number () {
|
|
43
|
+
return this.initFromNumbers(...arguments);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static init_string() {
|
|
47
|
+
return this.initFromStrings(...arguments);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static init_string_string() {
|
|
51
|
+
return this.initFromStrings(...arguments);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static init_object(object) {
|
|
55
|
+
return Object.assign({}, defaultProps, object);
|
|
56
|
+
}
|
|
57
|
+
static initFromNumbers(year,
|
|
58
|
+
month,
|
|
59
|
+
date,
|
|
60
|
+
hours = 0,
|
|
61
|
+
minutes = 0,
|
|
62
|
+
seconds = 0,
|
|
63
|
+
milliseconds = 0)
|
|
64
|
+
{
|
|
65
|
+
Array.from(arguments).forEach((arg, index) => {
|
|
66
|
+
arguments[index] = parseInt(arg);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
year,
|
|
71
|
+
month,
|
|
72
|
+
date,
|
|
73
|
+
hours,
|
|
74
|
+
minutes,
|
|
75
|
+
seconds,
|
|
76
|
+
milliseconds
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
//TODO
|
|
82
|
+
static initFromStrings(dateString, format = defaultFormat) {
|
|
83
|
+
const props = {};
|
|
84
|
+
props.year= StringDateParser.extractYear(dateString, format);
|
|
85
|
+
props.month= StringDateParser.extractMonth(dateString, format);
|
|
86
|
+
props.date= StringDateParser.extractDate(dateString, format);
|
|
87
|
+
return Object.assign({}, defaultProps, props);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
Initializer.defaultFormat = defaultFormat;
|
|
95
|
+
|
|
96
|
+
export default Initializer;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
export const ar = {
|
|
2
|
+
dayNames: [
|
|
3
|
+
"ح",
|
|
4
|
+
"ن",
|
|
5
|
+
"ث",
|
|
6
|
+
"ر",
|
|
7
|
+
"خ",
|
|
8
|
+
"ج",
|
|
9
|
+
"س",
|
|
10
|
+
"أحد",
|
|
11
|
+
"اثن",
|
|
12
|
+
"ثلا",
|
|
13
|
+
"ارب",
|
|
14
|
+
"خم",
|
|
15
|
+
"جم",
|
|
16
|
+
"سبت",
|
|
17
|
+
"الأحد",
|
|
18
|
+
"الإثنين",
|
|
19
|
+
"الثلاثاء",
|
|
20
|
+
"الإربعاء",
|
|
21
|
+
"الخميس",
|
|
22
|
+
"الجمعة",
|
|
23
|
+
"السبت",
|
|
24
|
+
],
|
|
25
|
+
monthNames: [
|
|
26
|
+
"مح",
|
|
27
|
+
"صف",
|
|
28
|
+
"ربع١",
|
|
29
|
+
"ربع٢",
|
|
30
|
+
"جم١",
|
|
31
|
+
"جم٢",
|
|
32
|
+
"رجب",
|
|
33
|
+
"شعب",
|
|
34
|
+
"رمض",
|
|
35
|
+
"شو",
|
|
36
|
+
"ذو ق",
|
|
37
|
+
"ذو ح",
|
|
38
|
+
"محرّم",
|
|
39
|
+
"صفر",
|
|
40
|
+
"ربيع أول",
|
|
41
|
+
"ربيع الآخر",
|
|
42
|
+
"جمادى أولى",
|
|
43
|
+
"جمادى الآخرة",
|
|
44
|
+
"رجب",
|
|
45
|
+
"شعبان",
|
|
46
|
+
"رمضان",
|
|
47
|
+
"شوال",
|
|
48
|
+
"ذو القعدة",
|
|
49
|
+
"ذو الحجّة",
|
|
50
|
+
],
|
|
51
|
+
separator: "عند",
|
|
52
|
+
am: "ص",
|
|
53
|
+
pm: "م",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const en = {
|
|
57
|
+
dayNames: [
|
|
58
|
+
"Su",
|
|
59
|
+
"Mo",
|
|
60
|
+
"Tu",
|
|
61
|
+
"We",
|
|
62
|
+
"Th",
|
|
63
|
+
"Fr",
|
|
64
|
+
"Sa",
|
|
65
|
+
"Sun",
|
|
66
|
+
"Mon",
|
|
67
|
+
"Tue",
|
|
68
|
+
"Wed",
|
|
69
|
+
"Thu",
|
|
70
|
+
"Fri",
|
|
71
|
+
"Sat",
|
|
72
|
+
"Sunday",
|
|
73
|
+
"Monday",
|
|
74
|
+
"Tuesday",
|
|
75
|
+
"Wednesday",
|
|
76
|
+
"Thursday",
|
|
77
|
+
"Friday",
|
|
78
|
+
"Saturday",
|
|
79
|
+
],
|
|
80
|
+
monthNames: [
|
|
81
|
+
"Muha",
|
|
82
|
+
"Saf",
|
|
83
|
+
"Rab1",
|
|
84
|
+
"Rab2",
|
|
85
|
+
"Jumd1",
|
|
86
|
+
"Jumd2",
|
|
87
|
+
"Rajb",
|
|
88
|
+
"Shbn",
|
|
89
|
+
"Rmdn",
|
|
90
|
+
"Shwl",
|
|
91
|
+
"Qada",
|
|
92
|
+
"Hija",
|
|
93
|
+
"Muharram",
|
|
94
|
+
"Safar",
|
|
95
|
+
"Rabi'ul Awwal",
|
|
96
|
+
"Rabi'ul Akhir",
|
|
97
|
+
"Jumadal Ula",
|
|
98
|
+
"Jumadal Akhira",
|
|
99
|
+
"Rajab",
|
|
100
|
+
"Sha'ban",
|
|
101
|
+
"Ramadan",
|
|
102
|
+
"Shawwal",
|
|
103
|
+
"Dhul Qa'ada",
|
|
104
|
+
"Dhul Hijja",
|
|
105
|
+
],
|
|
106
|
+
separator: "at",
|
|
107
|
+
am: "am",
|
|
108
|
+
pm: "pm",
|
|
109
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import HijriDate from './HijriDate';
|
|
2
|
+
import {GregToHijri} from './DateConverter';
|
|
3
|
+
|
|
4
|
+
export const toHijri = ((gregDate) => {
|
|
5
|
+
const {year, month, date} = GregToHijri(gregDate);
|
|
6
|
+
return new HijriDate(
|
|
7
|
+
year,
|
|
8
|
+
month,
|
|
9
|
+
date,
|
|
10
|
+
gregDate.getHours(),
|
|
11
|
+
gregDate.getMinutes(),
|
|
12
|
+
gregDate.getSeconds(),
|
|
13
|
+
gregDate.getMilliseconds()
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
export default HijriDate;
|
package/src/i18n/ar.json
CHANGED
|
@@ -10,5 +10,194 @@
|
|
|
10
10
|
"hijri": "هجري",
|
|
11
11
|
"gregorian": "ميلادي"
|
|
12
12
|
},
|
|
13
|
-
"
|
|
13
|
+
"relative": {
|
|
14
|
+
"before": {
|
|
15
|
+
"now": "الآن",
|
|
16
|
+
"years": "{{count}} منذ عام",
|
|
17
|
+
"months": "{{count}} منذ شهر",
|
|
18
|
+
"weeks": "{{count}} قبل أسبوع",
|
|
19
|
+
"days": "{{count}} منذ يوم",
|
|
20
|
+
"hours": "{{count}} منذ ساعة",
|
|
21
|
+
"minutes": "{{count}} منذ دقيقة",
|
|
22
|
+
"seconds": "{{count}} قبل الثاني",
|
|
23
|
+
"yearsX": "بالكاد {{count}} منذ عام",
|
|
24
|
+
"monthsX": "بالكاد {{count}} منذ شهر",
|
|
25
|
+
"weeksX": "بالكاد {{count}} قبل أسبوع",
|
|
26
|
+
"daysX": "بالكاد {{count}} منذ يوم",
|
|
27
|
+
"hoursX": "بالكاد {{count}} منذ ساعة",
|
|
28
|
+
"minutesX": "بالكاد {{count}} منذ دقيقة",
|
|
29
|
+
"years_zero": "{{count}} منذ سنوات",
|
|
30
|
+
"years_one": "{{count}} منذ عام",
|
|
31
|
+
"years_two": "{{count}} منذ سنوات",
|
|
32
|
+
"years_few": "{{count}} منذ سنوات",
|
|
33
|
+
"years_many": "{{count}} منذ سنوات",
|
|
34
|
+
"years_other": "{{count}} منذ سنوات",
|
|
35
|
+
"months_zero": "{{count}} منذ أشهر",
|
|
36
|
+
"months_one": "{{count}} منذ شهر",
|
|
37
|
+
"months_two": "{{count}} منذ أشهر",
|
|
38
|
+
"months_few": "{{count}} منذ أشهر",
|
|
39
|
+
"months_many": "{{count}} منذ أشهر",
|
|
40
|
+
"months_other": "{{count}} منذ أشهر",
|
|
41
|
+
"weeks_zero": "{{count}} منذ أسابيع",
|
|
42
|
+
"weeks_one": "{{count}} قبل أسبوع",
|
|
43
|
+
"weeks_two": "{{count}} منذ أسابيع",
|
|
44
|
+
"weeks_few": "{{count}} منذ أسابيع",
|
|
45
|
+
"weeks_many": "{{count}} منذ أسابيع",
|
|
46
|
+
"weeks_other": "{{count}} منذ أسابيع",
|
|
47
|
+
"days_zero": "{{count}} منذ أيام",
|
|
48
|
+
"days_one": "{{count}} منذ يوم",
|
|
49
|
+
"days_two": "{{count}} منذ أيام",
|
|
50
|
+
"days_few": "{{count}} منذ أيام",
|
|
51
|
+
"days_many": "{{count}} منذ أيام",
|
|
52
|
+
"days_other": "{{count}} منذ أيام",
|
|
53
|
+
"hours_zero": "{{count}} منذ ساعات",
|
|
54
|
+
"hours_one": "{{count}} منذ ساعة",
|
|
55
|
+
"hours_two": "{{count}} منذ ساعات",
|
|
56
|
+
"hours_few": "{{count}} منذ ساعات",
|
|
57
|
+
"hours_many": "{{count}} منذ ساعات",
|
|
58
|
+
"hours_other": "{{count}} منذ ساعات",
|
|
59
|
+
"minutes_zero": "{{count}} منذ دقائق",
|
|
60
|
+
"minutes_one": "{{count}} منذ دقيقة",
|
|
61
|
+
"minutes_two": "{{count}} منذ دقائق",
|
|
62
|
+
"minutes_few": "{{count}} منذ دقائق",
|
|
63
|
+
"minutes_many": "{{count}} منذ دقائق",
|
|
64
|
+
"minutes_other": "{{count}} منذ دقائق",
|
|
65
|
+
"seconds_zero": "{{count}} قبل ثوان",
|
|
66
|
+
"seconds_one": "{{count}} قبل الثاني",
|
|
67
|
+
"seconds_two": "{{count}} قبل ثوان",
|
|
68
|
+
"seconds_few": "{{count}} قبل ثوان",
|
|
69
|
+
"seconds_many": "{{count}} قبل ثوان",
|
|
70
|
+
"seconds_other": "{{count}} قبل ثوان",
|
|
71
|
+
"yearsX_zero": "بالكاد {{count}} منذ سنوات",
|
|
72
|
+
"yearsX_one": "بالكاد {{count}} منذ عام",
|
|
73
|
+
"yearsX_two": "بالكاد {{count}} منذ سنوات",
|
|
74
|
+
"yearsX_few": "بالكاد {{count}} منذ سنوات",
|
|
75
|
+
"yearsX_many": "بالكاد {{count}} منذ سنوات",
|
|
76
|
+
"yearsX_other": "بالكاد {{count}} منذ سنوات",
|
|
77
|
+
"monthsX_zero": "بالكاد {{count}} منذ أشهر",
|
|
78
|
+
"monthsX_one": "بالكاد {{count}} منذ شهر",
|
|
79
|
+
"monthsX_two": "بالكاد {{count}} منذ أشهر",
|
|
80
|
+
"monthsX_few": "بالكاد {{count}} منذ أشهر",
|
|
81
|
+
"monthsX_many": "بالكاد {{count}} منذ أشهر",
|
|
82
|
+
"monthsX_other": "بالكاد {{count}} منذ أشهر",
|
|
83
|
+
"weeksX_zero": "بالكاد {{count}} منذ أسابيع",
|
|
84
|
+
"weeksX_one": "بالكاد {{count}} قبل أسبوع",
|
|
85
|
+
"weeksX_two": "بالكاد {{count}} منذ أسابيع",
|
|
86
|
+
"weeksX_few": "بالكاد {{count}} منذ أسابيع",
|
|
87
|
+
"weeksX_many": "بالكاد {{count}} منذ أسابيع",
|
|
88
|
+
"weeksX_other": "بالكاد {{count}} منذ أسابيع",
|
|
89
|
+
"daysX_zero": "بالكاد {{count}} منذ أيام",
|
|
90
|
+
"daysX_one": "بالكاد {{count}} منذ يوم",
|
|
91
|
+
"daysX_two": "بالكاد {{count}} منذ أيام",
|
|
92
|
+
"daysX_few": "بالكاد {{count}} منذ أيام",
|
|
93
|
+
"daysX_many": "بالكاد {{count}} منذ أيام",
|
|
94
|
+
"daysX_other": "بالكاد {{count}} منذ أيام",
|
|
95
|
+
"hoursX_zero": "بالكاد {{count}} منذ ساعات",
|
|
96
|
+
"hoursX_one": "بالكاد {{count}} منذ ساعة",
|
|
97
|
+
"hoursX_two": "بالكاد {{count}} منذ ساعات",
|
|
98
|
+
"hoursX_few": "بالكاد {{count}} منذ ساعات",
|
|
99
|
+
"hoursX_many": "بالكاد {{count}} منذ ساعات",
|
|
100
|
+
"hoursX_other": "بالكاد {{count}} منذ ساعات",
|
|
101
|
+
"minutesX_zero": "بالكاد {{count}} منذ دقائق",
|
|
102
|
+
"minutesX_one": "بالكاد {{count}} منذ دقيقة",
|
|
103
|
+
"minutesX_two": "بالكاد {{count}} منذ دقائق",
|
|
104
|
+
"minutesX_few": "بالكاد {{count}} منذ دقائق",
|
|
105
|
+
"minutesX_many": "بالكاد {{count}} منذ دقائق",
|
|
106
|
+
"minutesX_other": "بالكاد {{count}} منذ دقائق"
|
|
107
|
+
},
|
|
108
|
+
"after": {
|
|
109
|
+
"now": "قريباً",
|
|
110
|
+
"years": "{{count}} بعد عام",
|
|
111
|
+
"months": "{{count}} بعد شهر",
|
|
112
|
+
"weeks": "{{count}} بعد أسبوع",
|
|
113
|
+
"days": "{{count}} بعد يوم",
|
|
114
|
+
"hours": "{{count}} بعد ساعة",
|
|
115
|
+
"minutes": "{{count}} بعد دقيقة",
|
|
116
|
+
"seconds": "{{count}} الثاني في وقت لاحق",
|
|
117
|
+
"yearsX": "بالكاد {{count}} بعد عام",
|
|
118
|
+
"monthsX": "بالكاد {{count}} بعد شهر",
|
|
119
|
+
"weeksX": "بالكاد {{count}} بعد أسبوع",
|
|
120
|
+
"daysX": "بالكاد {{count}} بعد يوم",
|
|
121
|
+
"hoursX": "بالكاد {{count}} بعد ساعة",
|
|
122
|
+
"minutesX": "بالكاد {{count}} بعد دقيقة",
|
|
123
|
+
"years_zero": "{{count}} بعد سنوات",
|
|
124
|
+
"years_one": "{{count}} بعد عام",
|
|
125
|
+
"years_two": "{{count}} بعد سنوات",
|
|
126
|
+
"years_few": "{{count}} بعد سنوات",
|
|
127
|
+
"years_many": "{{count}} بعد سنوات",
|
|
128
|
+
"years_other": "{{count}} بعد سنوات",
|
|
129
|
+
"months_zero": "{{count}} بعد أشهر",
|
|
130
|
+
"months_one": "{{count}} بعد شهر",
|
|
131
|
+
"months_two": "{{count}} بعد أشهر",
|
|
132
|
+
"months_few": "{{count}} بعد أشهر",
|
|
133
|
+
"months_many": "{{count}} بعد أشهر",
|
|
134
|
+
"months_other": "{{count}} بعد أشهر",
|
|
135
|
+
"weeks_zero": "{{count}} بعد أسابيع",
|
|
136
|
+
"weeks_one": "{{count}} بعد أسبوع",
|
|
137
|
+
"weeks_two": "{{count}} بعد أسابيع",
|
|
138
|
+
"weeks_few": "{{count}} بعد أسابيع",
|
|
139
|
+
"weeks_many": "{{count}} بعد أسابيع",
|
|
140
|
+
"weeks_other": "{{count}} بعد أسابيع",
|
|
141
|
+
"days_zero": "{{count}} بعد أيام",
|
|
142
|
+
"days_one": "{{count}} بعد يوم",
|
|
143
|
+
"days_two": "{{count}} بعد أيام",
|
|
144
|
+
"days_few": "{{count}} بعد أيام",
|
|
145
|
+
"days_many": "{{count}} بعد أيام",
|
|
146
|
+
"days_other": "{{count}} بعد أيام",
|
|
147
|
+
"hours_zero": "{{count}} بعد ساعات",
|
|
148
|
+
"hours_one": "{{count}} بعد ساعة",
|
|
149
|
+
"hours_two": "{{count}} بعد ساعات",
|
|
150
|
+
"hours_few": "{{count}} بعد ساعات",
|
|
151
|
+
"hours_many": "{{count}} بعد ساعات",
|
|
152
|
+
"hours_other": "{{count}} بعد ساعات",
|
|
153
|
+
"minutes_zero": "{{count}} بعد دقائق",
|
|
154
|
+
"minutes_one": "{{count}} بعد دقيقة",
|
|
155
|
+
"minutes_two": "{{count}} بعد دقائق",
|
|
156
|
+
"minutes_few": "{{count}} بعد دقائق",
|
|
157
|
+
"minutes_many": "{{count}} بعد دقائق",
|
|
158
|
+
"minutes_other": "{{count}} بعد دقائق",
|
|
159
|
+
"seconds_zero": "{{count}} بعد ثوان",
|
|
160
|
+
"seconds_one": "{{count}} الثاني في وقت لاحق",
|
|
161
|
+
"seconds_two": "{{count}} بعد ثوان",
|
|
162
|
+
"seconds_few": "{{count}} بعد ثوان",
|
|
163
|
+
"seconds_many": "{{count}} بعد ثوان",
|
|
164
|
+
"seconds_other": "{{count}} بعد ثوان",
|
|
165
|
+
"yearsX_zero": "بالكاد {{count}} بعد سنوات",
|
|
166
|
+
"yearsX_one": "بالكاد {{count}} بعد عام",
|
|
167
|
+
"yearsX_two": "بالكاد {{count}} بعد سنوات",
|
|
168
|
+
"yearsX_few": "بالكاد {{count}} بعد سنوات",
|
|
169
|
+
"yearsX_many": "بالكاد {{count}} بعد سنوات",
|
|
170
|
+
"yearsX_other": "بالكاد {{count}} بعد سنوات",
|
|
171
|
+
"monthsX_zero": "بالكاد {{count}} بعد أشهر",
|
|
172
|
+
"monthsX_one": "بالكاد {{count}} بعد شهر",
|
|
173
|
+
"monthsX_two": "بالكاد {{count}} بعد أشهر",
|
|
174
|
+
"monthsX_few": "بالكاد {{count}} بعد أشهر",
|
|
175
|
+
"monthsX_many": "بالكاد {{count}} بعد أشهر",
|
|
176
|
+
"monthsX_other": "بالكاد {{count}} بعد أشهر",
|
|
177
|
+
"weeksX_zero": "بالكاد {{count}} بعد أسابيع",
|
|
178
|
+
"weeksX_one": "بالكاد {{count}} بعد أسبوع",
|
|
179
|
+
"weeksX_two": "بالكاد {{count}} بعد أسابيع",
|
|
180
|
+
"weeksX_few": "بالكاد {{count}} بعد أسابيع",
|
|
181
|
+
"weeksX_many": "بالكاد {{count}} بعد أسابيع",
|
|
182
|
+
"weeksX_other": "بالكاد {{count}} بعد أسابيع",
|
|
183
|
+
"daysX_zero": "بالكاد {{count}} بعد أيام",
|
|
184
|
+
"daysX_one": "بالكاد {{count}} بعد يوم",
|
|
185
|
+
"daysX_two": "بالكاد {{count}} بعد أيام",
|
|
186
|
+
"daysX_few": "بالكاد {{count}} بعد أيام",
|
|
187
|
+
"daysX_many": "بالكاد {{count}} بعد أيام",
|
|
188
|
+
"daysX_other": "بالكاد {{count}} بعد أيام",
|
|
189
|
+
"hoursX_zero": "بالكاد {{count}} بعد ساعات",
|
|
190
|
+
"hoursX_one": "بالكاد {{count}} بعد ساعة",
|
|
191
|
+
"hoursX_two": "بالكاد {{count}} بعد ساعات",
|
|
192
|
+
"hoursX_few": "بالكاد {{count}} بعد ساعات",
|
|
193
|
+
"hoursX_many": "بالكاد {{count}} بعد ساعات",
|
|
194
|
+
"hoursX_other": "بالكاد {{count}} بعد ساعات",
|
|
195
|
+
"minutesX_zero": "بالكاد {{count}} بعد دقائق",
|
|
196
|
+
"minutesX_one": "بالكاد {{count}} بعد دقيقة",
|
|
197
|
+
"minutesX_two": "بالكاد {{count}} بعد دقائق",
|
|
198
|
+
"minutesX_few": "بالكاد {{count}} بعد دقائق",
|
|
199
|
+
"minutesX_many": "بالكاد {{count}} بعد دقائق",
|
|
200
|
+
"minutesX_other": "بالكاد {{count}} بعد دقائق"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
14
203
|
}
|
package/src/i18n/en.json
CHANGED
|
@@ -9,5 +9,65 @@
|
|
|
9
9
|
"today": "Today",
|
|
10
10
|
"hijri": "Hijri",
|
|
11
11
|
"gregorian": "Gregorian"
|
|
12
|
+
},
|
|
13
|
+
"relative": {
|
|
14
|
+
"before": {
|
|
15
|
+
"now": "Just now",
|
|
16
|
+
"years": "Last year",
|
|
17
|
+
"years_other": "{{count}} years ago",
|
|
18
|
+
"months": "Last month",
|
|
19
|
+
"months_other": "{{count}} months ago",
|
|
20
|
+
"weeks": "Last week",
|
|
21
|
+
"weeks_other": "{{count}} weeks ago",
|
|
22
|
+
"days": "Yesterday",
|
|
23
|
+
"days_other": "{{count}} days ago",
|
|
24
|
+
"hours": "{{count}} hour ago",
|
|
25
|
+
"hours_other": "{{count}} hours ago",
|
|
26
|
+
"minutes": "{{count}} minute ago",
|
|
27
|
+
"minutes_other": "{{count}} minutes ago",
|
|
28
|
+
"seconds": "{{count}} second ago",
|
|
29
|
+
"seconds_other": "{{count}} seconds ago",
|
|
30
|
+
"yearsX": "Almost {{count}} year ago",
|
|
31
|
+
"yearsX_other": "Almost {{count}} years ago",
|
|
32
|
+
"monthsX": "Almost {{count}} month ago",
|
|
33
|
+
"monthsX_other": "Almost {{count}} months ago",
|
|
34
|
+
"weeksX": "Almost {{count}} week ago",
|
|
35
|
+
"weeksX_other": "Almost {{count}} weeks ago",
|
|
36
|
+
"daysX": "Almost {{count}} day ago",
|
|
37
|
+
"daysX_other": "Almost {{count}} days ago",
|
|
38
|
+
"hoursX": "Almost {{count}} hour ago",
|
|
39
|
+
"hoursX_other": "Almost {{count}} hours ago",
|
|
40
|
+
"minutesX": "Almost {{count}} minute ago",
|
|
41
|
+
"minutesX_other": "Almost {{count}} minutes ago"
|
|
42
|
+
},
|
|
43
|
+
"after": {
|
|
44
|
+
"now": "Soon",
|
|
45
|
+
"years": "Next year",
|
|
46
|
+
"years_other": "{{count}} years later",
|
|
47
|
+
"months": "Next month",
|
|
48
|
+
"months_other": "{{count}} months later",
|
|
49
|
+
"weeks": "Next week",
|
|
50
|
+
"weeks_other": "{{count}} weeks later",
|
|
51
|
+
"days": "Tomorrow",
|
|
52
|
+
"days_other": "{{count}} days later",
|
|
53
|
+
"hours": "{{count}} hour later",
|
|
54
|
+
"hours_other": "{{count}} hours later",
|
|
55
|
+
"minutes": "{{count}} minute later",
|
|
56
|
+
"minutes_other": "{{count}} minutes later",
|
|
57
|
+
"seconds": "{{count}} second later",
|
|
58
|
+
"seconds_other": "{{count}} seconds later",
|
|
59
|
+
"yearsX": "Almost {{count}} year later",
|
|
60
|
+
"yearsX_other": "Almost {{count}} years later",
|
|
61
|
+
"monthsX": "Almost {{count}} month later",
|
|
62
|
+
"monthsX_other": "Almost {{count}} months later",
|
|
63
|
+
"weeksX": "Almost {{count}} week later",
|
|
64
|
+
"weeksX_other": "Almost {{count}} weeks later",
|
|
65
|
+
"daysX": "Almost {{count}} day later",
|
|
66
|
+
"daysX_other": "Almost {{count}} days later",
|
|
67
|
+
"hoursX": "Almost {{count}} hour later",
|
|
68
|
+
"hoursX_other": "Almost {{count}} hours later",
|
|
69
|
+
"minutesX": "Almost {{count}} minute later",
|
|
70
|
+
"minutesX_other": "Almost {{count}} minutes later"
|
|
71
|
+
}
|
|
12
72
|
}
|
|
13
73
|
}
|
package/src/i18n/index.ts
CHANGED
|
@@ -24,8 +24,5 @@
|
|
|
24
24
|
import { addTranslationBundle } from "@react-fabric/core";
|
|
25
25
|
import ar from "./ar.json";
|
|
26
26
|
import en from "./en.json";
|
|
27
|
-
import arSuper from "./superdate/ar.json";
|
|
28
|
-
import enSuper from "./superdate/en.json";
|
|
29
27
|
|
|
30
28
|
addTranslationBundle("date", { en, ar });
|
|
31
|
-
addTranslationBundle("superdate", { en: enSuper, ar: arSuper });
|
package/src/index.ts
CHANGED
|
@@ -24,9 +24,15 @@
|
|
|
24
24
|
import "./hijri";
|
|
25
25
|
import "./i18n";
|
|
26
26
|
|
|
27
|
+
export { DateHeader } from "./components/DateHeader";
|
|
28
|
+
export { DecadePage } from "./components/DecadePage";
|
|
29
|
+
export { YearPage } from "./components/YearPage";
|
|
27
30
|
export { DateDisplay } from "./display/DateDisplay";
|
|
31
|
+
export { DateDuration } from "./display/DateDuration";
|
|
28
32
|
export { DatePanel } from "./panels/DatePanel";
|
|
33
|
+
export { EventPanel } from "./panels/EventPanel";
|
|
29
34
|
export { RangePanel } from "./panels/RangePanel";
|
|
30
|
-
export { SuperDate } from "./superdate/Superdate";
|
|
31
35
|
|
|
32
36
|
export { DateUtil } from "./utils/dateUtil";
|
|
37
|
+
|
|
38
|
+
export * from "./types";
|
package/src/panels/DatePanel.tsx
CHANGED
|
@@ -46,6 +46,32 @@ type PanelActions =
|
|
|
46
46
|
| { type: "changePage"; page: PageType }
|
|
47
47
|
| { type: "changePageDate"; date: Date; pageChange: boolean };
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* DatePanel component to display a date picker with options for selecting a date and time.
|
|
51
|
+
* It allows switching between Gregorian and Hijri calendars, and includes buttons for selecting today or canceling the selection.
|
|
52
|
+
* It uses the current calendar and locale from the global context.
|
|
53
|
+
* It handles date selection, time changes, and page navigation within the date picker.
|
|
54
|
+
* It also supports disabling specific dates and setting minimum and maximum date limits.
|
|
55
|
+
*
|
|
56
|
+
* @param {DateProps} props - The properties for the DatePanel component.
|
|
57
|
+
* @return {JSX.Element} The rendered DatePanel component.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```jsx
|
|
61
|
+
* <DatePanel
|
|
62
|
+
* className="my-date-panel"
|
|
63
|
+
* max="2025-12-31"
|
|
64
|
+
* min="2020-01-01"
|
|
65
|
+
* dateDisabled={["2023-01-01", "2023-12-25"]}
|
|
66
|
+
* onChange={(date) => console.log("Selected date:", date)}
|
|
67
|
+
* showHijriToggle={true}
|
|
68
|
+
* value={new Date()}
|
|
69
|
+
* withTime={true}
|
|
70
|
+
* />
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/date-date-panel--datepanels}
|
|
74
|
+
*/
|
|
49
75
|
export const DatePanel = ({
|
|
50
76
|
className,
|
|
51
77
|
max,
|
|
@@ -30,7 +30,7 @@ import { useTranslation } from "react-i18next";
|
|
|
30
30
|
import { DateHeader } from "../components/DateHeader";
|
|
31
31
|
import { DecadePage } from "../components/DecadePage";
|
|
32
32
|
import { YearPage } from "../components/YearPage";
|
|
33
|
-
import { type EventType, PageType
|
|
33
|
+
import { type EventType, PageType } from "../types";
|
|
34
34
|
import { DateUtil } from "../utils/dateUtil";
|
|
35
35
|
|
|
36
36
|
interface EventState {
|
|
@@ -90,12 +90,29 @@ const makeList = (
|
|
|
90
90
|
});
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
+
export interface EventProps {
|
|
94
|
+
isHijri?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* list of calendar events
|
|
97
|
+
*/
|
|
98
|
+
events?: EventType[];
|
|
99
|
+
/**
|
|
100
|
+
* list of calendar events
|
|
101
|
+
*/
|
|
102
|
+
recurringEvents?: EventType[];
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* change handler
|
|
106
|
+
*/
|
|
107
|
+
onChange?: (value: string, dates: [string, string]) => void;
|
|
108
|
+
}
|
|
109
|
+
|
|
93
110
|
export const EventPanel = ({
|
|
94
111
|
isHijri,
|
|
95
112
|
onChange,
|
|
96
113
|
events = EMPTY_ARRAY,
|
|
97
114
|
recurringEvents = EMPTY_ARRAY,
|
|
98
|
-
}:
|
|
115
|
+
}: EventProps) => {
|
|
99
116
|
const { t } = useTranslation();
|
|
100
117
|
const [predefined, setPredefined] = useState<
|
|
101
118
|
KeyValue<Array<EventType<Date>>>
|
|
@@ -114,7 +131,7 @@ export const EventPanel = ({
|
|
|
114
131
|
if (action.type === "changePageDate") {
|
|
115
132
|
resetList = true;
|
|
116
133
|
state.pageDate = action.date;
|
|
117
|
-
if (action.changePage
|
|
134
|
+
if (action.changePage) {
|
|
118
135
|
state.page = Math.max(state.page - 1, PageType.MONTH);
|
|
119
136
|
}
|
|
120
137
|
}
|
|
@@ -172,6 +189,7 @@ export const EventPanel = ({
|
|
|
172
189
|
<div
|
|
173
190
|
role="none"
|
|
174
191
|
key={evt.label}
|
|
192
|
+
data-dropdown-dismiss="true"
|
|
175
193
|
onClick={() => {
|
|
176
194
|
onChange?.(
|
|
177
195
|
`${evt.start.toISOString()}|${evt.end.toISOString()}`,
|
|
@@ -58,6 +58,28 @@ type PanelActions =
|
|
|
58
58
|
pageChange?: boolean;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* RangePanel component to display a date range picker with options for selecting a start and end date.
|
|
63
|
+
* It allows switching between Gregorian and Hijri calendars, and includes buttons for applying or canceling the selection.
|
|
64
|
+
* It uses the current calendar and locale from the global context.
|
|
65
|
+
* It handles date selection, time changes, and page navigation within the date picker.
|
|
66
|
+
* It also supports disabling specific dates and setting minimum and maximum date limits.
|
|
67
|
+
*
|
|
68
|
+
* @param {RangeProps} props - The properties for the RangePanel component.
|
|
69
|
+
* @return {JSX.Element} The rendered RangePanel component.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```jsx
|
|
73
|
+
* <RangePanel
|
|
74
|
+
* className="my-range-panel"
|
|
75
|
+
* max="2025-12-31"
|
|
76
|
+
* min="2020-01-01"
|
|
77
|
+
* dateDisabled={["2023-01-01", "2023-12-25"]}
|
|
78
|
+
* onChange={(dateRange) => console.log("Selected date range:", dateRange)}
|
|
79
|
+
* />
|
|
80
|
+
* ```
|
|
81
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/date-date-panel--range-panel}
|
|
82
|
+
*/
|
|
61
83
|
export const RangePanel = ({
|
|
62
84
|
className,
|
|
63
85
|
max,
|
|
@@ -383,6 +405,7 @@ export const RangePanel = ({
|
|
|
383
405
|
variant="solid"
|
|
384
406
|
color="primary"
|
|
385
407
|
disabled={!state.selected}
|
|
408
|
+
data-dropdown-dismiss="true"
|
|
386
409
|
className="my-1"
|
|
387
410
|
onClick={() =>
|
|
388
411
|
fireChange?.([
|