@react-fabric/date 1.0.0-beta.6 → 1.0.0-beta.61

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