@react-fabric/date 1.0.0-beta.5 → 1.0.0-beta.52
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 +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 +16 -4
- package/dist/cjs/panels/RangePanel.js +22 -0
- 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 +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 +17 -5
- package/dist/esm/panels/RangePanel.js +22 -0
- package/dist/esm/utils/dateUtil.js +3 -3
- 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 -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 +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 +41 -6
- package/src/panels/RangePanel.tsx +22 -0
- 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,31 @@
|
|
|
1
|
+
import { type MenuProps } from "@react-fabric/core/dist/types/components/menu/types";
|
|
2
|
+
import { type AriaProps, type ChildrenProp, type CssProp, type TestProps } from "@react-fabric/core/dist/types/types";
|
|
3
|
+
import { type ElementType } from "react";
|
|
4
|
+
import { type DateLike } from "../types";
|
|
5
|
+
export interface Props extends CssProp, AriaProps, TestProps, Partial<ChildrenProp<ElementType<MenuProps>>> {
|
|
6
|
+
/**
|
|
7
|
+
* date like value
|
|
8
|
+
*/
|
|
9
|
+
date: DateLike;
|
|
10
|
+
/**
|
|
11
|
+
* date format
|
|
12
|
+
*/
|
|
13
|
+
format?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* DateDuration component to display the duration from a given date to now.
|
|
17
|
+
* It calculates the difference in years, months, weeks, days, hours, minutes, and seconds,
|
|
18
|
+
* and displays it in a human-readable format.
|
|
19
|
+
* It uses the current locale for translations.
|
|
20
|
+
*
|
|
21
|
+
* @param {Props} props - The properties for the component.
|
|
22
|
+
* @returns {JSX.Element} The rendered component.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```jsx
|
|
26
|
+
* <DateDuration date={new Date("2020-01-01")} />
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/date-date-display--docs}
|
|
30
|
+
*/
|
|
31
|
+
export declare const DateDuration: ({ date, children, className, format, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function weekDay(wdn: any): "Mon" | "Tue" | "Wed" | "Thu" | "Fri" | "Sat" | "Sun" | "";
|
|
2
|
+
export function GregToHijri(gregDate: any): {
|
|
3
|
+
year: number;
|
|
4
|
+
month: number;
|
|
5
|
+
date: number;
|
|
6
|
+
hours: any;
|
|
7
|
+
minutes: any;
|
|
8
|
+
seconds: any;
|
|
9
|
+
milliseconds: any;
|
|
10
|
+
day: number;
|
|
11
|
+
dayName: string;
|
|
12
|
+
};
|
|
13
|
+
export function HijriToGreg(hijriDate: any): Date;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export namespace masks {
|
|
2
|
+
let _default: string;
|
|
3
|
+
export { _default as default };
|
|
4
|
+
export let shortDate: string;
|
|
5
|
+
export let mediumDate: string;
|
|
6
|
+
export let longDate: string;
|
|
7
|
+
export let fullDate: string;
|
|
8
|
+
export let shortTime: string;
|
|
9
|
+
export let mediumTime: string;
|
|
10
|
+
export let longTime: string;
|
|
11
|
+
export let isoDate: string;
|
|
12
|
+
export let isoTime: string;
|
|
13
|
+
export let isoDateTime: string;
|
|
14
|
+
export let isoUtcDateTime: string;
|
|
15
|
+
}
|
|
16
|
+
export default dateFormat;
|
|
17
|
+
declare function dateFormat(date: any, mask: any, options?: {
|
|
18
|
+
utc: boolean;
|
|
19
|
+
}, ...args: any[]): any;
|
|
@@ -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";
|
|
@@ -1,2 +1,28 @@
|
|
|
1
1
|
import { type DateProps } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* DatePanel component to display a date picker with options for selecting a date and time.
|
|
4
|
+
* It allows switching between Gregorian and Hijri calendars, and includes buttons for selecting today or canceling the selection.
|
|
5
|
+
* It uses the current calendar and locale from the global context.
|
|
6
|
+
* It handles date selection, time changes, and page navigation within the date picker.
|
|
7
|
+
* It also supports disabling specific dates and setting minimum and maximum date limits.
|
|
8
|
+
*
|
|
9
|
+
* @param {DateProps} props - The properties for the DatePanel component.
|
|
10
|
+
* @return {JSX.Element} The rendered DatePanel component.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```jsx
|
|
14
|
+
* <DatePanel
|
|
15
|
+
* className="my-date-panel"
|
|
16
|
+
* max="2025-12-31"
|
|
17
|
+
* min="2020-01-01"
|
|
18
|
+
* dateDisabled={["2023-01-01", "2023-12-25"]}
|
|
19
|
+
* onChange={(date) => console.log("Selected date:", date)}
|
|
20
|
+
* showHijriToggle={true}
|
|
21
|
+
* value={new Date()}
|
|
22
|
+
* withTime={true}
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/date-date-panel--datepanels}
|
|
27
|
+
*/
|
|
2
28
|
export declare const DatePanel: ({ className, max, min, dateDisabled, onChange, showHijriToggle, value, withTime, ...rest }: DateProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -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,2 +1,24 @@
|
|
|
1
1
|
import { type RangeProps } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* RangePanel component to display a date range picker with options for selecting a start and end date.
|
|
4
|
+
* It allows switching between Gregorian and Hijri calendars, and includes buttons for applying or canceling the selection.
|
|
5
|
+
* It uses the current calendar and locale from the global context.
|
|
6
|
+
* It handles date selection, time changes, and page navigation within the date picker.
|
|
7
|
+
* It also supports disabling specific dates and setting minimum and maximum date limits.
|
|
8
|
+
*
|
|
9
|
+
* @param {RangeProps} props - The properties for the RangePanel component.
|
|
10
|
+
* @return {JSX.Element} The rendered RangePanel component.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```jsx
|
|
14
|
+
* <RangePanel
|
|
15
|
+
* className="my-range-panel"
|
|
16
|
+
* max="2025-12-31"
|
|
17
|
+
* min="2020-01-01"
|
|
18
|
+
* dateDisabled={["2023-01-01", "2023-12-25"]}
|
|
19
|
+
* onChange={(dateRange) => console.log("Selected date range:", dateRange)}
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/date-date-panel--range-panel}
|
|
23
|
+
*/
|
|
2
24
|
export declare const RangePanel: ({ className, max, min, dateDisabled, onChange, showHijriToggle, value, withTime, showApply, ...rest }: RangeProps) => 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.52",
|
|
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.52",
|
|
39
|
+
"@react-fabric/utilities": "^1.0.0-beta.52",
|
|
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": "0eabb9d88d91af93d657bcc209b226fd576e8260"
|
|
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
|
>
|