@react-fabric/date 1.0.0-beta.8 → 1.0.1

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.
Files changed (139) hide show
  1. package/README.md +2 -9
  2. package/{src/components/Date.module.css → css/_date.css} +5 -5
  3. package/{src/superdate/SuperDate.module.css → css/styles.css} +2 -8
  4. package/dist/cjs/components/DateCell.js +5 -7
  5. package/dist/cjs/components/DateHeader.js +27 -20
  6. package/dist/cjs/components/DatePage.js +10 -12
  7. package/dist/cjs/components/DecadePage.js +3 -3
  8. package/dist/cjs/components/MonthPage.js +3 -3
  9. package/dist/cjs/components/TimeSliders.js +36 -35
  10. package/dist/cjs/components/YearPage.js +3 -3
  11. package/dist/cjs/display/DateDisplay.js +25 -8
  12. package/dist/cjs/display/DateDuration.js +155 -0
  13. package/dist/cjs/hijri/DateConverter.js +154 -0
  14. package/dist/cjs/hijri/FormatDate.js +116 -0
  15. package/dist/cjs/hijri/HijriDate.js +531 -0
  16. package/dist/cjs/hijri/StringDateParser.js +74 -0
  17. package/dist/cjs/hijri/index.js +15 -1025
  18. package/dist/cjs/hijri/initializer.js +113 -0
  19. package/dist/cjs/hijri/locales.js +19 -0
  20. package/dist/cjs/hijri/safe.js +17 -0
  21. package/dist/cjs/i18n/ar/date.json.js +213 -0
  22. package/dist/cjs/i18n/en/date.json.js +83 -0
  23. package/dist/cjs/i18n/index.js +4 -10
  24. package/dist/cjs/index.js +41 -2
  25. package/dist/cjs/panels/BasePanel.js +6 -5
  26. package/dist/cjs/panels/DatePanel.js +45 -21
  27. package/dist/cjs/{superdate → panels}/EventPanel.js +28 -12
  28. package/dist/cjs/panels/RangePanel.js +49 -19
  29. package/dist/cjs/utils/dateUtil.js +3 -5
  30. package/dist/esm/components/DateCell.js +6 -8
  31. package/dist/esm/components/DateHeader.js +28 -21
  32. package/dist/esm/components/DatePage.js +11 -13
  33. package/dist/esm/components/DecadePage.js +3 -3
  34. package/dist/esm/components/MonthPage.js +3 -3
  35. package/dist/esm/components/TimeSliders.js +38 -37
  36. package/dist/esm/components/YearPage.js +3 -3
  37. package/dist/esm/display/DateDisplay.js +26 -9
  38. package/dist/esm/display/DateDuration.js +155 -0
  39. package/dist/esm/hijri/DateConverter.js +152 -0
  40. package/dist/esm/hijri/FormatDate.js +113 -0
  41. package/dist/esm/hijri/HijriDate.js +528 -0
  42. package/dist/esm/hijri/StringDateParser.js +74 -0
  43. package/dist/esm/hijri/index.js +15 -1025
  44. package/dist/esm/hijri/initializer.js +113 -0
  45. package/dist/esm/hijri/locales.js +18 -0
  46. package/dist/esm/hijri/safe.js +14 -0
  47. package/dist/esm/i18n/ar/date.json.js +209 -0
  48. package/dist/esm/i18n/en/date.json.js +79 -0
  49. package/dist/esm/i18n/index.js +2 -8
  50. package/dist/esm/index.js +36 -1
  51. package/dist/esm/panels/BasePanel.js +6 -5
  52. package/dist/esm/panels/DatePanel.js +48 -24
  53. package/dist/esm/{superdate → panels}/EventPanel.js +29 -13
  54. package/dist/esm/panels/RangePanel.js +52 -22
  55. package/dist/esm/utils/dateUtil.js +4 -6
  56. package/dist/types/components/DateCell.d.ts +1 -1
  57. package/dist/types/components/DateHeader.d.ts +1 -1
  58. package/dist/types/components/DatePage.d.ts +1 -1
  59. package/dist/types/components/DecadePage.d.ts +1 -1
  60. package/dist/types/components/MonthPage.d.ts +1 -1
  61. package/dist/types/components/TimeSliders.d.ts +1 -1
  62. package/dist/types/components/YearPage.d.ts +1 -1
  63. package/dist/types/display/DateDisplay.d.ts +17 -4
  64. package/dist/types/display/DateDuration.d.ts +25 -0
  65. package/dist/types/hijri/DateConverter.d.ts +13 -0
  66. package/dist/types/hijri/FormatDate.d.ts +19 -0
  67. package/dist/types/hijri/HijriDate.d.ts +214 -0
  68. package/dist/types/hijri/StringDateParser.d.ts +11 -0
  69. package/dist/types/hijri/index.d.ts +2 -2
  70. package/dist/types/hijri/initializer.d.ts +129 -0
  71. package/dist/types/hijri/locales.d.ts +19 -0
  72. package/dist/types/hijri/safe.d.ts +3 -0
  73. package/dist/types/index.d.ts +32 -1
  74. package/dist/types/panels/BasePanel.d.ts +1 -1
  75. package/dist/types/panels/DatePanel.d.ts +22 -1
  76. package/dist/types/panels/EventPanel.d.ts +17 -0
  77. package/dist/types/panels/RangePanel.d.ts +19 -1
  78. package/dist/types/types/index.d.ts +8 -40
  79. package/package.json +14 -21
  80. package/src/components/DateCell.tsx +20 -75
  81. package/src/components/DateHeader.tsx +27 -78
  82. package/src/components/DatePage.tsx +11 -36
  83. package/src/components/DecadePage.tsx +2 -2
  84. package/src/components/MonthPage.tsx +2 -2
  85. package/src/components/TimeSliders.tsx +20 -60
  86. package/src/components/YearPage.tsx +2 -2
  87. package/src/display/DateDisplay.tsx +26 -38
  88. package/src/display/DateDuration.tsx +170 -0
  89. package/src/hijri/DateConverter.js +175 -0
  90. package/src/hijri/FormatDate.js +134 -0
  91. package/src/hijri/HijriDate.js +477 -0
  92. package/src/hijri/StringDateParser.js +68 -0
  93. package/src/hijri/index.js +16 -1535
  94. package/src/hijri/initializer.js +96 -0
  95. package/src/hijri/locales.js +109 -0
  96. package/src/hijri/safe.js +16 -0
  97. package/src/i18n/ar/date.json +203 -0
  98. package/src/i18n/en/date.json +73 -0
  99. package/src/i18n/index.ts +2 -5
  100. package/src/index.ts +29 -18
  101. package/src/panels/BasePanel.tsx +7 -10
  102. package/src/panels/DatePanel.tsx +41 -33
  103. package/src/{superdate → panels}/EventPanel.tsx +52 -53
  104. package/src/panels/RangePanel.tsx +54 -60
  105. package/src/types/index.ts +8 -43
  106. package/src/utils/dateUtil.ts +26 -82
  107. package/dist/cjs/components/Date.module.css +0 -1
  108. package/dist/cjs/i18n/ar.json.js +0 -25
  109. package/dist/cjs/i18n/en.json.js +0 -21
  110. package/dist/cjs/i18n/superdate/ar.json.js +0 -86
  111. package/dist/cjs/i18n/superdate/en.json.js +0 -93
  112. package/dist/cjs/superdate/QuickSelect.js +0 -134
  113. package/dist/cjs/superdate/RelativeInput.js +0 -79
  114. package/dist/cjs/superdate/RelativePanel.js +0 -91
  115. package/dist/cjs/superdate/SuperDate.module.css +0 -1
  116. package/dist/cjs/superdate/Superdate.js +0 -177
  117. package/dist/esm/components/Date.module.css +0 -1
  118. package/dist/esm/i18n/ar.json.js +0 -21
  119. package/dist/esm/i18n/en.json.js +0 -18
  120. package/dist/esm/i18n/superdate/ar.json.js +0 -79
  121. package/dist/esm/i18n/superdate/en.json.js +0 -85
  122. package/dist/esm/superdate/QuickSelect.js +0 -134
  123. package/dist/esm/superdate/RelativeInput.js +0 -79
  124. package/dist/esm/superdate/RelativePanel.js +0 -91
  125. package/dist/esm/superdate/SuperDate.module.css +0 -1
  126. package/dist/esm/superdate/Superdate.js +0 -176
  127. package/dist/types/superdate/EventPanel.d.ts +0 -4
  128. package/dist/types/superdate/QuickSelect.d.ts +0 -1
  129. package/dist/types/superdate/RelativeInput.d.ts +0 -1
  130. package/dist/types/superdate/RelativePanel.d.ts +0 -1
  131. package/dist/types/superdate/Superdate.d.ts +0 -17
  132. package/src/i18n/ar.json +0 -14
  133. package/src/i18n/en.json +0 -13
  134. package/src/i18n/superdate/ar.json +0 -70
  135. package/src/i18n/superdate/en.json +0 -75
  136. package/src/superdate/QuickSelect.tsx +0 -121
  137. package/src/superdate/RelativeInput.tsx +0 -64
  138. package/src/superdate/RelativePanel.tsx +0 -103
  139. package/src/superdate/Superdate.tsx +0 -198
@@ -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
- declare const _exports: any;
2
- export = _exports;
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
+ }
@@ -0,0 +1,3 @@
1
+ export function toHijri(gregDate: any): HijriDate;
2
+ export default HijriDate;
3
+ import HijriDate from './HijriDate';
@@ -1,7 +1,38 @@
1
+ /**
2
+ * React Fabric
3
+ * @version 1.0.0
4
+ * @license MIT
5
+ * @copyright 2024 Adarsh Pastakia
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in all
15
+ * copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ * SOFTWARE.
24
+ */
25
+ export declare const DATE_PACKAGE = "@react-fabric/date";
26
+ export declare const DATE_VERSION = "1.0.0";
1
27
  import "./hijri";
2
28
  import "./i18n";
29
+ export { DateHeader } from "./components/DateHeader";
30
+ export { DecadePage } from "./components/DecadePage";
31
+ export { YearPage } from "./components/YearPage";
3
32
  export { DateDisplay } from "./display/DateDisplay";
33
+ export { DateDuration } from "./display/DateDuration";
4
34
  export { DatePanel } from "./panels/DatePanel";
35
+ export { EventPanel } from "./panels/EventPanel";
5
36
  export { RangePanel } from "./panels/RangePanel";
6
- export { SuperDate } from "./superdate/Superdate";
7
37
  export { DateUtil } from "./utils/dateUtil";
38
+ export * from "./types";
@@ -22,4 +22,4 @@ export interface PanelProps {
22
22
  selectDate: (date: Date) => void;
23
23
  isDateDisabled: (date: Date) => boolean;
24
24
  }
25
- export declare const BasePanel: ({ min, max, isHijri, withTime, hideNext, hidePrevious, changePage, changePageDate, changeTime, selectDate, isDateDisabled, ...state }: PanelProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare function BasePanel({ min, max, isHijri, withTime, hideNext, hidePrevious, changePage, changePageDate, changeTime, selectDate, isDateDisabled, ...state }: PanelProps): import("react").JSX.Element;
@@ -1,2 +1,23 @@
1
1
  import { type DateProps } from "../types";
2
- export declare const DatePanel: ({ className, max, min, dateDisabled, onChange, showHijriToggle, value, withTime, ...rest }: DateProps) => import("react/jsx-runtime").JSX.Element;
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
+ * @example
10
+ * ```jsx
11
+ * <DatePanel
12
+ * className="my-date-panel"
13
+ * max="2025-12-31"
14
+ * min="2020-01-01"
15
+ * dateDisabled={["2023-01-01", "2023-12-25"]}
16
+ * onChange={(date) => console.log("Selected date:", date)}
17
+ * showHijriToggle={true}
18
+ * value={new Date()}
19
+ * withTime={true}
20
+ * />
21
+ * ```
22
+ */
23
+ export declare function DatePanel({ className, max, min, dateDisabled, onChange, showHijriToggle, value, withTime, ...rest }: DateProps): import("react").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 function EventPanel({ isHijri, onChange, events, recurringEvents }: EventProps): import("react").JSX.Element;
@@ -1,2 +1,20 @@
1
1
  import { type RangeProps } from "../types";
2
- export declare const RangePanel: ({ className, max, min, dateDisabled, onChange, showHijriToggle, value, withTime, showApply, ...rest }: RangeProps) => import("react/jsx-runtime").JSX.Element;
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
+ * @example
10
+ * ```jsx
11
+ * <RangePanel
12
+ * className="my-range-panel"
13
+ * max="2025-12-31"
14
+ * min="2020-01-01"
15
+ * dateDisabled={["2023-01-01", "2023-12-25"]}
16
+ * onChange={(dateRange) => console.log("Selected date range:", dateRange)}
17
+ * />
18
+ * ```
19
+ */
20
+ export declare function RangePanel({ className, max, min, dateDisabled, onChange, showHijriToggle, value, withTime, showApply, ...rest }: RangeProps): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { type ColorType, type CssProp, type TestProps } from "@react-fabric/core/dist/types/types";
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,42 +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 extends TestProps {
49
- as?: "button" | "chip";
50
- color?: ColorType;
51
- variant?: "solid" | "outline" | "link";
52
- disabled?: boolean;
53
- /**
54
- * relative date value
55
- */
56
- value?: string;
57
- /**
58
- * change handler
59
- */
60
- onChange?: (value: string, dates: [string, string]) => void;
61
- /**
62
- * list of calendar events
63
- */
64
- events?: EventType[];
65
- /**
66
- * list of calendar events
67
- */
68
- recurringEvents?: EventType[];
69
- /**
70
- * list of relative presets
71
- *
72
- * {value:'$year-5|$year', label:'last 5 years'}
73
- */
74
- presets?: PresetType[];
75
- }
package/package.json CHANGED
@@ -1,19 +1,21 @@
1
1
  {
2
2
  "name": "@react-fabric/date",
3
- "version": "1.0.0-beta.8",
3
+ "version": "1.0.1",
4
4
  "description": "RUF: Date package",
5
5
  "author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
6
6
  "license": "MIT",
7
- "repository": "https://github.com/adarshpastakia/react-ui-framework/tree/main/packages/date",
7
+ "repository": "https://github.com/adarshpastakia/react-fabric/tree/main/packages/date",
8
8
  "source": "src/index.ts",
9
9
  "main": "dist/cjs/index.js",
10
10
  "module": "dist/esm/index.js",
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
  ],
@@ -22,8 +24,6 @@
22
24
  "registry": "https://registry.npmjs.org/"
23
25
  },
24
26
  "scripts": {
25
- "makelink": "yarn link",
26
- "removelink": "yarn unlink",
27
27
  "prebuild": "rm -rf ./dist",
28
28
  "build:dts": "tsc -p ./tsconfig.build.json",
29
29
  "build:rollup": "rollup -c ../../rollup.config.mjs",
@@ -33,26 +33,19 @@
33
33
  "watch": "npm-run-all -p watch:rollup watch:dts"
34
34
  },
35
35
  "dependencies": {
36
- "@floating-ui/react": "^0.26.24",
37
- "@react-fabric/core": "^1.0.0-beta.8",
38
- "@react-fabric/form": "^1.0.0-beta.8",
39
- "@react-fabric/utilities": "^1.0.0-beta.8",
40
- "classnames": "^2.5.1",
41
- "date-fns": "^4.0.0",
42
- "resize-observer-polyfill": "^1.5.1"
36
+ "@react-fabric/core": "^1.0.1",
37
+ "@react-fabric/utilities": "^1.0.1",
38
+ "date-fns": "~4.4.0"
43
39
  },
44
40
  "peerDependencies": {
45
- "i18next": "^23.15.1",
46
- "react": ">=18.0.0 <20.0.0",
47
- "react-dom": ">=18.0.0 <20.0.0",
48
- "react-i18next": "^15.0.2"
49
- },
50
- "devDependencies": {
51
- "@types/react-color": "^3.0.12"
41
+ "i18next": "~26.3.6",
42
+ "react": "~19.3.0",
43
+ "react-dom": "~19.3.0",
44
+ "react-i18next": "~17.0.11"
52
45
  },
53
46
  "engines": {
54
- "node": ">=18.12.0",
55
- "npm": ">=8.19.0"
47
+ "node": ">=24.0.0",
48
+ "npm": ">=11.0.0"
56
49
  },
57
- "gitHead": "9f1ede6e9629c9e79121354332cdebabad5878c5"
50
+ "gitHead": "1419a9df05b5e3850e1d2b4e896ab63df702c7e8"
58
51
  }