@react-fabric/date 1.0.0-beta.5 → 1.0.0-beta.51
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/DatePage.js +2 -3
- package/dist/cjs/components/TimeSliders.js +5 -6
- package/dist/cjs/display/DateDisplay.js +7 -2
- package/dist/cjs/display/DateDuration.js +127 -0
- package/dist/cjs/hijri/DateConverter.js +154 -0
- package/dist/cjs/hijri/FormatDate.js +115 -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/{superdate → panels}/EventPanel.js +16 -4
- package/dist/cjs/utils/dateUtil.js +3 -3
- package/dist/esm/components/DatePage.js +2 -3
- package/dist/esm/components/TimeSliders.js +5 -6
- package/dist/esm/display/DateDisplay.js +7 -2
- package/dist/esm/display/DateDuration.js +127 -0
- package/dist/esm/hijri/DateConverter.js +152 -0
- package/dist/esm/hijri/FormatDate.js +112 -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/{superdate → panels}/EventPanel.js +17 -5
- package/dist/esm/utils/dateUtil.js +3 -3
- package/dist/types/display/DateDisplay.d.ts +4 -3
- package/dist/types/display/DateDuration.d.ts +15 -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/EventPanel.d.ts +17 -0
- package/dist/types/types/index.d.ts +8 -35
- package/dist/types/utils/dateUtil.d.ts +1 -1
- package/package.json +11 -11
- package/src/components/DatePage.tsx +2 -3
- package/src/components/TimeSliders.tsx +5 -6
- package/src/display/DateDisplay.tsx +15 -4
- package/src/display/DateDuration.tsx +164 -0
- package/src/hijri/DateConverter.js +175 -0
- package/src/hijri/FormatDate.js +132 -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/{superdate → panels}/EventPanel.tsx +41 -6
- package/src/types/index.ts +8 -38
- package/src/utils/dateUtil.ts +4 -7
- 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 -169
- 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 -168
- 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 -186
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
export const dateProps: string[];
|
|
2
|
+
export default HijriDate;
|
|
3
|
+
/**
|
|
4
|
+
The class which handles Hijri 🌙 instances
|
|
5
|
+
|
|
6
|
+
@example new HijriDate(); //now
|
|
7
|
+
new HijriDate(1438, 12, 10) ; // يوم عيد الأضحى لسنة ١٤٣٨
|
|
8
|
+
new HijriDate(1438,7, 20, 18, 50, 44, 333); // Monday Rajab 20 1438 18:50:44
|
|
9
|
+
new HijriDate({year:1355, hours:17}); // Tue Muharram 01 1355 17:00:00
|
|
10
|
+
new HijriDate(1484408713014);
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
new HijriDate().toGregorian(); // === new Date();
|
|
14
|
+
new Date().toHijri(); // === new HijriDate();
|
|
15
|
+
*/
|
|
16
|
+
declare class HijriDate {
|
|
17
|
+
static now(): number;
|
|
18
|
+
static today(): HijriDate;
|
|
19
|
+
static yesterday(): HijriDate;
|
|
20
|
+
static tomorrow(): HijriDate;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param {number} time numeric value of the specified date as the number of milliseconds since Shawwal 23, 1389, 00:00:00 UTC (January 1, 1970, 00:00:00 UTC)
|
|
24
|
+
* @example new HijriDate(1435454346342) // Sunday Ramadan 12 1436 04:19:06
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* @param {number} year the hijri year .
|
|
28
|
+
* @param {number} month [1, 12] range .
|
|
29
|
+
* @param {number} [date=1] the date of the month🌔 ∈ {1, 30} .
|
|
30
|
+
* @param {number} [hours=0] ⏰ ∈ {0, 23} .
|
|
31
|
+
* @param {number} [minutes=0] 🕔 ∈ {0,59} .
|
|
32
|
+
* @param {number} [seconds=0] 🕰 ∈ {0,59} .
|
|
33
|
+
* @param {number} [milliseconds 0] 🕰 ∈ {0,999} .
|
|
34
|
+
*
|
|
35
|
+
* @example new HijriDate(1450, 3) ; //Sun Rabee1 01 1450 00:00:00
|
|
36
|
+
new HijriDate(1450, 3, 5) ; //Thu Rabee1 05 1450 00:00:00
|
|
37
|
+
new HijriDate(1450, 3, 5, 17) ; //Thu Rabee1 05 1450 17:00:00
|
|
38
|
+
new HijriDate(1450, 3, 5, 16, 44) ; //Thu Rabee1 05 1450 16:44:00
|
|
39
|
+
new HijriDate(1450, 3, 5, 16, 44, 58) ; //Thu Rabee1 05 1450 16:44:58
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* @param {string} date stringified date
|
|
43
|
+
* @param {string} [format = 'yyyy/mm/dd'] a compatible format with the date passed as string in the 1ˢᵗ argument.
|
|
44
|
+
* @example new HijriDate('10-09-1538', 'dd-mm-yyyy'); // Thu Rmdn 10 1538 00:00:00
|
|
45
|
+
new HijriDate('100 years since 04-1348','100 years since mm-yyyy' ); // Wed Rab2 01 1338 00:00:00
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* @param {Object} dateProps literal object contains date properties .
|
|
49
|
+
* @param {number} dateProps.year the year is required .
|
|
50
|
+
* @param {number} [dateProps.month = 1] [1, 12] range .
|
|
51
|
+
* @param {number} [dateProps.date = 1] the date of the month🌔 ∈ {1, 30} .
|
|
52
|
+
* @param {number} [dateProps.hours = 0] ⏰ ∈ {0, 23} .
|
|
53
|
+
* @param {number} [dateProps.minutes = 0] 🕔 ∈ {0,59} .
|
|
54
|
+
* @param {number} [dateProps.seconds = 0] 🕰 ∈ {0,59} .
|
|
55
|
+
* @param {number} [dateProps.milliseconds = 0] 🕰 ∈ {0,999} .
|
|
56
|
+
*
|
|
57
|
+
* @example new HijriDate({year: 1430, minutes: 54}) // 01-01-1430 00:54:00
|
|
58
|
+
new HijriDate({year: 1504, hours: 17, seconds:44}) // 01-01-1504 17:00:44
|
|
59
|
+
*/
|
|
60
|
+
constructor(...args: any[]);
|
|
61
|
+
init(...args: any[]): this;
|
|
62
|
+
__proxy__: any;
|
|
63
|
+
initDayOfWeek(): void;
|
|
64
|
+
_day: any;
|
|
65
|
+
_dayName: any;
|
|
66
|
+
/**
|
|
67
|
+
* Set the year
|
|
68
|
+
* @param {number} newYear year modifier of the instance.
|
|
69
|
+
* @returns {undefined} nothing
|
|
70
|
+
*
|
|
71
|
+
* @example const d1 = new HijriDate(1399, 10, 25);
|
|
72
|
+
d1.year += 2;
|
|
73
|
+
assertEqual(d1.year === 1401);
|
|
74
|
+
*/
|
|
75
|
+
set year(newYear: number);
|
|
76
|
+
/**
|
|
77
|
+
* Get the year
|
|
78
|
+
* @returns {number} the year
|
|
79
|
+
*/
|
|
80
|
+
get year(): number;
|
|
81
|
+
_year: number | undefined;
|
|
82
|
+
set month(newMonth: any);
|
|
83
|
+
get month(): any;
|
|
84
|
+
_month: any;
|
|
85
|
+
set date(newDate: any);
|
|
86
|
+
get date(): any;
|
|
87
|
+
_date: any;
|
|
88
|
+
set time(newTime: any);
|
|
89
|
+
get time(): any;
|
|
90
|
+
set hours(hours: any);
|
|
91
|
+
get hours(): any;
|
|
92
|
+
set minutes(minutes: any);
|
|
93
|
+
get minutes(): any;
|
|
94
|
+
set seconds(seconds: any);
|
|
95
|
+
get seconds(): any;
|
|
96
|
+
set milliseconds(milliseconds: any);
|
|
97
|
+
get milliseconds(): any;
|
|
98
|
+
get timezoneOffset(): any;
|
|
99
|
+
_hours: any;
|
|
100
|
+
_minutes: any;
|
|
101
|
+
_seconds: any;
|
|
102
|
+
_milliseconds: any;
|
|
103
|
+
get day(): any;
|
|
104
|
+
get dayName(): any;
|
|
105
|
+
getFullYear(): number;
|
|
106
|
+
getMonthIndex(): number;
|
|
107
|
+
getMonth(): any;
|
|
108
|
+
getDate(): any;
|
|
109
|
+
getDay(): any;
|
|
110
|
+
getHours(): any;
|
|
111
|
+
getMinutes(): any;
|
|
112
|
+
getSeconds(): any;
|
|
113
|
+
getMilliseconds(): any;
|
|
114
|
+
getTime(): any;
|
|
115
|
+
getTimezoneOffset(): any;
|
|
116
|
+
/**
|
|
117
|
+
* This method adds 1 day (24 hours) to the instance.
|
|
118
|
+
* @returns {HijriDate} the instance itself after adding 1 day.
|
|
119
|
+
*/
|
|
120
|
+
addDay(): HijriDate;
|
|
121
|
+
/**
|
|
122
|
+
* This method adds n day(s) to the instance.
|
|
123
|
+
* @param {number} days number of days to add .
|
|
124
|
+
* @returns {HijriDate} the instance itself after adding n day(s).
|
|
125
|
+
*/
|
|
126
|
+
addDays(days: number): HijriDate;
|
|
127
|
+
/**
|
|
128
|
+
* TODO
|
|
129
|
+
*/
|
|
130
|
+
addHours(n: any): this;
|
|
131
|
+
/**
|
|
132
|
+
* TODO
|
|
133
|
+
*/
|
|
134
|
+
addMinutes(n: any): this;
|
|
135
|
+
/**
|
|
136
|
+
* TODO
|
|
137
|
+
*/
|
|
138
|
+
addSeconds(n: any): this;
|
|
139
|
+
/**
|
|
140
|
+
* TODO
|
|
141
|
+
*/
|
|
142
|
+
addMilliseconds(n: any): this;
|
|
143
|
+
/**
|
|
144
|
+
* TODO
|
|
145
|
+
*/
|
|
146
|
+
subtractDays(days: any): this;
|
|
147
|
+
/**
|
|
148
|
+
* TODO
|
|
149
|
+
*/
|
|
150
|
+
subtractDay(): this;
|
|
151
|
+
/**
|
|
152
|
+
* TODO
|
|
153
|
+
*/
|
|
154
|
+
subtractHours(n: any): this;
|
|
155
|
+
/**
|
|
156
|
+
* TODO
|
|
157
|
+
*/
|
|
158
|
+
subtractMinutes(n: any): this;
|
|
159
|
+
/**
|
|
160
|
+
* TODO
|
|
161
|
+
*/
|
|
162
|
+
subtractSeconds(n: any): this;
|
|
163
|
+
/**
|
|
164
|
+
* TODO
|
|
165
|
+
*/
|
|
166
|
+
subtractMilliseconds(n: any): this;
|
|
167
|
+
/**
|
|
168
|
+
* TODO
|
|
169
|
+
*/
|
|
170
|
+
updateProxy(): this;
|
|
171
|
+
/**
|
|
172
|
+
* TODO
|
|
173
|
+
*/
|
|
174
|
+
toGregorian(): any;
|
|
175
|
+
/**
|
|
176
|
+
* TODO
|
|
177
|
+
*/
|
|
178
|
+
format(mask: any, options: any, ...args: any[]): any;
|
|
179
|
+
/**
|
|
180
|
+
* TODO
|
|
181
|
+
*/
|
|
182
|
+
ignoreTime(): this;
|
|
183
|
+
/**
|
|
184
|
+
* TODO
|
|
185
|
+
*/
|
|
186
|
+
clone(): HijriDate;
|
|
187
|
+
/**
|
|
188
|
+
* TODO
|
|
189
|
+
*/
|
|
190
|
+
is(...args: any[]): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* TODO
|
|
193
|
+
*/
|
|
194
|
+
isToday(): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* TODO
|
|
197
|
+
*/
|
|
198
|
+
isYesterday(): boolean;
|
|
199
|
+
/**
|
|
200
|
+
* TODO
|
|
201
|
+
*/
|
|
202
|
+
isTomorrow(): boolean;
|
|
203
|
+
valueOf(): any;
|
|
204
|
+
toString(): any;
|
|
205
|
+
}
|
|
206
|
+
declare namespace HijriDate {
|
|
207
|
+
namespace locales {
|
|
208
|
+
export { ar };
|
|
209
|
+
export { en };
|
|
210
|
+
}
|
|
211
|
+
let defaultLocale: string;
|
|
212
|
+
}
|
|
213
|
+
import { ar } from './locales';
|
|
214
|
+
import { en } from './locales';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default StringDateParser;
|
|
2
|
+
declare class StringDateParser {
|
|
3
|
+
static extract(string: any, format: any, formatChunk: any, ignoreCase?: boolean): number | undefined;
|
|
4
|
+
static extractYear(dateString: any, format: any, ...args: any[]): number | undefined;
|
|
5
|
+
static extractMonth(dateString: any, format: any, ...args: any[]): number;
|
|
6
|
+
static extractDate(dateString: any, format: any, ...args: any[]): number;
|
|
7
|
+
static extractHours(dateString: any, format: any, ...args: any[]): number;
|
|
8
|
+
static extractMinutes(dateString: any, format: any, ...args: any[]): number;
|
|
9
|
+
static extractSeconds(dateString: any, format: any, ...args: any[]): number;
|
|
10
|
+
static extractMilliseconds(dateString: any, format: any, ...args: any[]): number;
|
|
11
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export default HijriDate;
|
|
2
|
+
import HijriDate from './safe';
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export default Initializer;
|
|
2
|
+
declare class Initializer {
|
|
3
|
+
static initDefault(): {
|
|
4
|
+
year: number;
|
|
5
|
+
month: number;
|
|
6
|
+
date: number;
|
|
7
|
+
hours: any;
|
|
8
|
+
minutes: any;
|
|
9
|
+
seconds: any;
|
|
10
|
+
milliseconds: any;
|
|
11
|
+
day: number;
|
|
12
|
+
dayName: string;
|
|
13
|
+
};
|
|
14
|
+
static init_number(number: any): {
|
|
15
|
+
year: number;
|
|
16
|
+
month: number;
|
|
17
|
+
date: number;
|
|
18
|
+
hours: any;
|
|
19
|
+
minutes: any;
|
|
20
|
+
seconds: any;
|
|
21
|
+
milliseconds: any;
|
|
22
|
+
day: number;
|
|
23
|
+
dayName: string;
|
|
24
|
+
};
|
|
25
|
+
static init_number_number(year: any, month: any): {
|
|
26
|
+
year: any;
|
|
27
|
+
month: any;
|
|
28
|
+
date: any;
|
|
29
|
+
hours: number;
|
|
30
|
+
minutes: number;
|
|
31
|
+
seconds: number;
|
|
32
|
+
milliseconds: number;
|
|
33
|
+
};
|
|
34
|
+
static init_number_number_number(...args: any[]): {
|
|
35
|
+
year: any;
|
|
36
|
+
month: any;
|
|
37
|
+
date: any;
|
|
38
|
+
hours: number;
|
|
39
|
+
minutes: number;
|
|
40
|
+
seconds: number;
|
|
41
|
+
milliseconds: number;
|
|
42
|
+
};
|
|
43
|
+
static init_number_number_number_number(...args: any[]): {
|
|
44
|
+
year: any;
|
|
45
|
+
month: any;
|
|
46
|
+
date: any;
|
|
47
|
+
hours: number;
|
|
48
|
+
minutes: number;
|
|
49
|
+
seconds: number;
|
|
50
|
+
milliseconds: number;
|
|
51
|
+
};
|
|
52
|
+
static init_number_number_number_number_number(...args: any[]): {
|
|
53
|
+
year: any;
|
|
54
|
+
month: any;
|
|
55
|
+
date: any;
|
|
56
|
+
hours: number;
|
|
57
|
+
minutes: number;
|
|
58
|
+
seconds: number;
|
|
59
|
+
milliseconds: number;
|
|
60
|
+
};
|
|
61
|
+
static init_number_number_number_number_number_number(...args: any[]): {
|
|
62
|
+
year: any;
|
|
63
|
+
month: any;
|
|
64
|
+
date: any;
|
|
65
|
+
hours: number;
|
|
66
|
+
minutes: number;
|
|
67
|
+
seconds: number;
|
|
68
|
+
milliseconds: number;
|
|
69
|
+
};
|
|
70
|
+
static init_number_number_number_number_number_number_number(...args: any[]): {
|
|
71
|
+
year: any;
|
|
72
|
+
month: any;
|
|
73
|
+
date: any;
|
|
74
|
+
hours: number;
|
|
75
|
+
minutes: number;
|
|
76
|
+
seconds: number;
|
|
77
|
+
milliseconds: number;
|
|
78
|
+
};
|
|
79
|
+
static init_string(...args: any[]): {
|
|
80
|
+
month: number;
|
|
81
|
+
date: number;
|
|
82
|
+
hours: number;
|
|
83
|
+
minutes: number;
|
|
84
|
+
seconds: number;
|
|
85
|
+
milliseconds: number;
|
|
86
|
+
} & {
|
|
87
|
+
year: number | undefined;
|
|
88
|
+
month: number;
|
|
89
|
+
date: number;
|
|
90
|
+
};
|
|
91
|
+
static init_string_string(...args: any[]): {
|
|
92
|
+
month: number;
|
|
93
|
+
date: number;
|
|
94
|
+
hours: number;
|
|
95
|
+
minutes: number;
|
|
96
|
+
seconds: number;
|
|
97
|
+
milliseconds: number;
|
|
98
|
+
} & {
|
|
99
|
+
year: number | undefined;
|
|
100
|
+
month: number;
|
|
101
|
+
date: number;
|
|
102
|
+
};
|
|
103
|
+
static init_object(object: any): any;
|
|
104
|
+
static initFromNumbers(year: any, month: any, date: any, hours?: number, minutes?: number, seconds?: number, milliseconds?: number, ...args: any[]): {
|
|
105
|
+
year: any;
|
|
106
|
+
month: any;
|
|
107
|
+
date: any;
|
|
108
|
+
hours: number;
|
|
109
|
+
minutes: number;
|
|
110
|
+
seconds: number;
|
|
111
|
+
milliseconds: number;
|
|
112
|
+
};
|
|
113
|
+
static initFromStrings(dateString: any, format?: string): {
|
|
114
|
+
month: number;
|
|
115
|
+
date: number;
|
|
116
|
+
hours: number;
|
|
117
|
+
minutes: number;
|
|
118
|
+
seconds: number;
|
|
119
|
+
milliseconds: number;
|
|
120
|
+
} & {
|
|
121
|
+
year: number | undefined;
|
|
122
|
+
month: number;
|
|
123
|
+
date: number;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
declare namespace Initializer {
|
|
127
|
+
export { defaultFormat };
|
|
128
|
+
}
|
|
129
|
+
declare const defaultFormat: "yyyy/mm/dd";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export namespace ar {
|
|
2
|
+
let dayNames: string[];
|
|
3
|
+
let monthNames: string[];
|
|
4
|
+
let separator: string;
|
|
5
|
+
let am: string;
|
|
6
|
+
let pm: string;
|
|
7
|
+
}
|
|
8
|
+
export namespace en {
|
|
9
|
+
let dayNames_1: string[];
|
|
10
|
+
export { dayNames_1 as dayNames };
|
|
11
|
+
let monthNames_1: string[];
|
|
12
|
+
export { monthNames_1 as monthNames };
|
|
13
|
+
let separator_1: string;
|
|
14
|
+
export { separator_1 as separator };
|
|
15
|
+
let am_1: string;
|
|
16
|
+
export { am_1 as am };
|
|
17
|
+
let pm_1: string;
|
|
18
|
+
export { pm_1 as pm };
|
|
19
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import "./hijri";
|
|
2
2
|
import "./i18n";
|
|
3
|
+
export { DateHeader } from "./components/DateHeader";
|
|
4
|
+
export { DecadePage } from "./components/DecadePage";
|
|
5
|
+
export { YearPage } from "./components/YearPage";
|
|
3
6
|
export { DateDisplay } from "./display/DateDisplay";
|
|
7
|
+
export { DateDuration } from "./display/DateDuration";
|
|
4
8
|
export { DatePanel } from "./panels/DatePanel";
|
|
9
|
+
export { EventPanel } from "./panels/EventPanel";
|
|
5
10
|
export { RangePanel } from "./panels/RangePanel";
|
|
6
|
-
export { SuperDate } from "./superdate/Superdate";
|
|
7
11
|
export { DateUtil } from "./utils/dateUtil";
|
|
12
|
+
export * from "./types";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type EventType } from "../types";
|
|
2
|
+
export interface EventProps {
|
|
3
|
+
isHijri?: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* list of calendar events
|
|
6
|
+
*/
|
|
7
|
+
events?: EventType[];
|
|
8
|
+
/**
|
|
9
|
+
* list of calendar events
|
|
10
|
+
*/
|
|
11
|
+
recurringEvents?: EventType[];
|
|
12
|
+
/**
|
|
13
|
+
* change handler
|
|
14
|
+
*/
|
|
15
|
+
onChange?: (value: string, dates: [string, string]) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const EventPanel: ({ isHijri, onChange, events, recurringEvents, }: EventProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type CssProp, type TestProps } from "@react-fabric/core/dist/types/types";
|
|
2
2
|
export type DateLike = Date | string | number;
|
|
3
3
|
export type DateParsed = Date | undefined;
|
|
4
4
|
export declare enum PageType {
|
|
@@ -18,6 +18,13 @@ export declare enum DatePart {
|
|
|
18
18
|
YEAR = "$year",
|
|
19
19
|
DECADE = "$decade"
|
|
20
20
|
}
|
|
21
|
+
export interface EventType<D = DateLike> {
|
|
22
|
+
label: string;
|
|
23
|
+
icon?: string;
|
|
24
|
+
start: D;
|
|
25
|
+
end: D;
|
|
26
|
+
hijri?: boolean;
|
|
27
|
+
}
|
|
21
28
|
export interface BaseProps {
|
|
22
29
|
min?: DateLike;
|
|
23
30
|
max?: DateLike;
|
|
@@ -34,37 +41,3 @@ export interface RangeProps extends BaseProps, CssProp, TestProps {
|
|
|
34
41
|
onChange?: (dates: [start: string, end: string]) => void;
|
|
35
42
|
presets?: Record<string, [DateLike, DateLike]>;
|
|
36
43
|
}
|
|
37
|
-
export interface EventType<D = DateLike> {
|
|
38
|
-
label: string;
|
|
39
|
-
icon?: string;
|
|
40
|
-
start: D;
|
|
41
|
-
end: D;
|
|
42
|
-
hijri?: boolean;
|
|
43
|
-
}
|
|
44
|
-
export interface PresetType {
|
|
45
|
-
value: string;
|
|
46
|
-
label: string;
|
|
47
|
-
}
|
|
48
|
-
export interface SuperDateProps {
|
|
49
|
-
as?: "button" | "chip";
|
|
50
|
-
color?: ColorType;
|
|
51
|
-
variant?: "solid" | "outline" | "link";
|
|
52
|
-
/**
|
|
53
|
-
* relative date value
|
|
54
|
-
*/
|
|
55
|
-
value?: string;
|
|
56
|
-
/**
|
|
57
|
-
* change handler
|
|
58
|
-
*/
|
|
59
|
-
onChange?: (value: string, dates: [string, string]) => void;
|
|
60
|
-
/**
|
|
61
|
-
* list of calendar events
|
|
62
|
-
*/
|
|
63
|
-
events?: EventType[];
|
|
64
|
-
/**
|
|
65
|
-
* list of relative presets
|
|
66
|
-
*
|
|
67
|
-
* {value:'$year-5|$year', label:'last 5 years'}
|
|
68
|
-
*/
|
|
69
|
-
presets?: PresetType[];
|
|
70
|
-
}
|
|
@@ -23,7 +23,7 @@ export declare namespace DateUtil {
|
|
|
23
23
|
const isSameMonth: (date: Date, compare: Date, isHijri?: boolean) => boolean;
|
|
24
24
|
const isSameYear: (date: Date, compare: Date, isHijri?: boolean) => boolean;
|
|
25
25
|
const isDisabled: (date: Date, page: PageType, min?: DateLike, max?: DateLike) => boolean;
|
|
26
|
-
const parseDate: (datelike:
|
|
26
|
+
const parseDate: (datelike: DateLike) => Date;
|
|
27
27
|
const parseRange: (datelike: string) => [Date, Date];
|
|
28
28
|
const relativeTooltip: (datelike?: string, isHijri?: boolean) => string;
|
|
29
29
|
const relativeLabel: (datelike?: string, isHijri?: boolean) => string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/date",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.51",
|
|
4
4
|
"description": "RUF: Date package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
"types": "dist/types/index.d.ts",
|
|
12
12
|
"directories": {
|
|
13
13
|
"src": "src",
|
|
14
|
+
"styles": "css",
|
|
14
15
|
"test": "tests"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
18
|
+
"css",
|
|
17
19
|
"src",
|
|
18
20
|
"dist"
|
|
19
21
|
],
|
|
@@ -33,19 +35,17 @@
|
|
|
33
35
|
"watch": "npm-run-all -p watch:rollup watch:dts"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"@react-fabric/
|
|
38
|
-
"@react-fabric/form": "^1.0.0-beta.5",
|
|
39
|
-
"@react-fabric/utilities": "^1.0.0-beta.5",
|
|
38
|
+
"@react-fabric/core": "^1.0.0-beta.51",
|
|
39
|
+
"@react-fabric/utilities": "^1.0.0-beta.50",
|
|
40
40
|
"classnames": "^2.5.1",
|
|
41
|
-
"date-fns": "^4.
|
|
41
|
+
"date-fns": "^4.1.0",
|
|
42
42
|
"resize-observer-polyfill": "^1.5.1"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"i18next": "^
|
|
46
|
-
"react": "
|
|
47
|
-
"react-dom": "
|
|
48
|
-
"react-i18next": "^15.
|
|
45
|
+
"i18next": "^25.2.1",
|
|
46
|
+
"react": "^19.0.0",
|
|
47
|
+
"react-dom": "^19.0.0",
|
|
48
|
+
"react-i18next": "^15.5.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/react-color": "^3.0.12"
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"node": ">=18.12.0",
|
|
55
55
|
"npm": ">=8.19.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "a1b04de4663045f82992bff2aef8db26608eac74"
|
|
58
58
|
}
|
|
@@ -28,7 +28,6 @@ import { DateUtil } from "../utils/dateUtil";
|
|
|
28
28
|
import { DateCell, type DateCellProps } from "./DateCell";
|
|
29
29
|
import classNames from "classnames";
|
|
30
30
|
import { PageType } from "../types";
|
|
31
|
-
import classes from "./Date.module.css";
|
|
32
31
|
|
|
33
32
|
const rows = [0, 1, 2, 3, 4, 5];
|
|
34
33
|
const cols = [0, 1, 2, 3, 4, 5, 6];
|
|
@@ -57,7 +56,7 @@ export const DatePage = ({ pageDate, isHijri, ...props }: Props) => {
|
|
|
57
56
|
>
|
|
58
57
|
<div
|
|
59
58
|
className={classNames(
|
|
60
|
-
|
|
59
|
+
"fabric-dateHeader",
|
|
61
60
|
"px-1 text-center bg-tint-50 h-7",
|
|
62
61
|
)}
|
|
63
62
|
></div>
|
|
@@ -67,7 +66,7 @@ export const DatePage = ({ pageDate, isHijri, ...props }: Props) => {
|
|
|
67
66
|
<div
|
|
68
67
|
key={dt.toISOString()}
|
|
69
68
|
className={classNames(
|
|
70
|
-
|
|
69
|
+
"fabric-dateHeader",
|
|
71
70
|
"font-medium text-sm p-1 mx-px text-center text-muted bg-tint-50 h-7",
|
|
72
71
|
)}
|
|
73
72
|
>
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
import { useDebounce } from "@react-fabric/core";
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
27
|
-
import classes from "./Date.module.css";
|
|
28
27
|
|
|
29
28
|
interface Props {
|
|
30
29
|
hour: number;
|
|
@@ -80,7 +79,7 @@ export const TimeSlider = ({ hour = 0, minute = 0, onTimeChange }: Props) => {
|
|
|
80
79
|
<div className="flex">
|
|
81
80
|
<div
|
|
82
81
|
className={classNames(
|
|
83
|
-
|
|
82
|
+
"fabric-dateHeader",
|
|
84
83
|
"flex-1 font-medium text-muted text-sm p-1 mx-px text-center bg-tint-50",
|
|
85
84
|
)}
|
|
86
85
|
>
|
|
@@ -88,18 +87,18 @@ export const TimeSlider = ({ hour = 0, minute = 0, onTimeChange }: Props) => {
|
|
|
88
87
|
</div>
|
|
89
88
|
<div
|
|
90
89
|
className={classNames(
|
|
91
|
-
|
|
90
|
+
"fabric-dateHeader",
|
|
92
91
|
"flex-1 font-medium text-muted text-sm p-1 mx-px text-center bg-tint-50",
|
|
93
92
|
)}
|
|
94
93
|
>
|
|
95
94
|
M
|
|
96
95
|
</div>
|
|
97
96
|
</div>
|
|
98
|
-
<div className="flex flex-1 flex-nowrap overflow-hidden relative">
|
|
97
|
+
<div className="flex flex-1 flex-nowrap items-stretch overflow-hidden relative">
|
|
99
98
|
<div
|
|
100
99
|
className={classNames(
|
|
101
100
|
"flex-1 overflow-auto scroll-hide snap-y snap-mandatory",
|
|
102
|
-
|
|
101
|
+
"fabric-date-timeSlider",
|
|
103
102
|
)}
|
|
104
103
|
onScroll={calculateTime}
|
|
105
104
|
ref={hourRef}
|
|
@@ -144,7 +143,7 @@ export const TimeSlider = ({ hour = 0, minute = 0, onTimeChange }: Props) => {
|
|
|
144
143
|
<div
|
|
145
144
|
className={classNames(
|
|
146
145
|
"flex-1 overflow-auto scroll-hide snap-y snap-mandatory",
|
|
147
|
-
|
|
146
|
+
"fabric-date-timeSlider",
|
|
148
147
|
)}
|
|
149
148
|
onScroll={calculateTime}
|
|
150
149
|
ref={minuteRef}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { Dropdown, Tooltip, useGlobals } from "@react-fabric/core";
|
|
25
|
-
import { type
|
|
25
|
+
import { type MenuProps } from "@react-fabric/core/dist/types/components/menu/types";
|
|
26
26
|
import {
|
|
27
27
|
type AriaProps,
|
|
28
28
|
type ChildrenProp,
|
|
@@ -32,12 +32,13 @@ import {
|
|
|
32
32
|
import { type ElementType } from "react";
|
|
33
33
|
import { type DateLike } from "../types";
|
|
34
34
|
import { DateUtil } from "../utils/dateUtil";
|
|
35
|
+
import classNames from "classnames";
|
|
35
36
|
|
|
36
37
|
export interface Props
|
|
37
38
|
extends CssProp,
|
|
38
39
|
AriaProps,
|
|
39
40
|
TestProps,
|
|
40
|
-
Partial<ChildrenProp<ElementType<
|
|
41
|
+
Partial<ChildrenProp<ElementType<MenuProps>>> {
|
|
41
42
|
/**
|
|
42
43
|
* date like value
|
|
43
44
|
*/
|
|
@@ -46,6 +47,8 @@ export interface Props
|
|
|
46
47
|
* date format
|
|
47
48
|
*/
|
|
48
49
|
format?: string;
|
|
50
|
+
|
|
51
|
+
showAlternateDate?: boolean;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
export const DateDisplay = ({
|
|
@@ -53,12 +56,14 @@ export const DateDisplay = ({
|
|
|
53
56
|
className,
|
|
54
57
|
format = "eee, PPpp",
|
|
55
58
|
children,
|
|
59
|
+
showAlternateDate,
|
|
56
60
|
...aria
|
|
57
61
|
}: Props) => {
|
|
58
62
|
const { currentCalendar, currentLocale } = useGlobals();
|
|
59
63
|
|
|
60
64
|
const dtLabel = (
|
|
61
65
|
<Tooltip
|
|
66
|
+
disabled={!showAlternateDate}
|
|
62
67
|
content={DateUtil.format(
|
|
63
68
|
date,
|
|
64
69
|
format,
|
|
@@ -66,7 +71,13 @@ export const DateDisplay = ({
|
|
|
66
71
|
currentCalendar !== "hijri",
|
|
67
72
|
)}
|
|
68
73
|
>
|
|
69
|
-
<span
|
|
74
|
+
<span
|
|
75
|
+
className={classNames(
|
|
76
|
+
className,
|
|
77
|
+
!!children && "underline decoration-dotted cursor-pointer",
|
|
78
|
+
)}
|
|
79
|
+
{...aria}
|
|
80
|
+
>
|
|
70
81
|
{DateUtil.format(
|
|
71
82
|
date,
|
|
72
83
|
format,
|
|
@@ -78,7 +89,7 @@ export const DateDisplay = ({
|
|
|
78
89
|
);
|
|
79
90
|
|
|
80
91
|
return children ? (
|
|
81
|
-
<Dropdown>
|
|
92
|
+
<Dropdown showArrow closeOnClick>
|
|
82
93
|
{dtLabel}
|
|
83
94
|
{children}
|
|
84
95
|
</Dropdown>
|