react-native-hilal 0.0.0-stage → 0.2.0

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 (95) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +300 -2
  3. package/lib/module/calendar/Appear.js +75 -0
  4. package/lib/module/calendar/Appear.js.map +1 -0
  5. package/lib/module/calendar/Chevron.js +60 -0
  6. package/lib/module/calendar/Chevron.js.map +1 -0
  7. package/lib/module/calendar/DayCell.js +51 -0
  8. package/lib/module/calendar/DayCell.js.map +1 -0
  9. package/lib/module/calendar/HilalCalendar.js +565 -0
  10. package/lib/module/calendar/HilalCalendar.js.map +1 -0
  11. package/lib/module/calendar/PickerGrid.js +66 -0
  12. package/lib/module/calendar/PickerGrid.js.map +1 -0
  13. package/lib/module/calendar/index.js +5 -0
  14. package/lib/module/calendar/index.js.map +1 -0
  15. package/lib/module/calendar/month.js +291 -0
  16. package/lib/module/calendar/month.js.map +1 -0
  17. package/lib/module/calendar/styles.js +338 -0
  18. package/lib/module/calendar/styles.js.map +1 -0
  19. package/lib/module/calendar/theme.js +49 -0
  20. package/lib/module/calendar/theme.js.map +1 -0
  21. package/lib/module/calendar/types.js +4 -0
  22. package/lib/module/calendar/types.js.map +1 -0
  23. package/lib/module/core/convert.js +191 -0
  24. package/lib/module/core/convert.js.map +1 -0
  25. package/lib/module/core/days.js +61 -0
  26. package/lib/module/core/days.js.map +1 -0
  27. package/lib/module/core/format.js +37 -0
  28. package/lib/module/core/format.js.map +1 -0
  29. package/lib/module/core/index.js +6 -0
  30. package/lib/module/core/index.js.map +1 -0
  31. package/lib/module/core/locale.js +62 -0
  32. package/lib/module/core/locale.js.map +1 -0
  33. package/lib/module/core/types.js +2 -0
  34. package/lib/module/core/types.js.map +1 -0
  35. package/lib/module/core/umalqura-data.js +24 -0
  36. package/lib/module/core/umalqura-data.js.map +1 -0
  37. package/lib/module/index.js +5 -0
  38. package/lib/module/index.js.map +1 -0
  39. package/lib/module/package.json +1 -0
  40. package/lib/typescript/package.json +1 -0
  41. package/lib/typescript/src/calendar/Appear.d.ts +22 -0
  42. package/lib/typescript/src/calendar/Appear.d.ts.map +1 -0
  43. package/lib/typescript/src/calendar/Chevron.d.ts +13 -0
  44. package/lib/typescript/src/calendar/Chevron.d.ts.map +1 -0
  45. package/lib/typescript/src/calendar/DayCell.d.ts +24 -0
  46. package/lib/typescript/src/calendar/DayCell.d.ts.map +1 -0
  47. package/lib/typescript/src/calendar/HilalCalendar.d.ts +7 -0
  48. package/lib/typescript/src/calendar/HilalCalendar.d.ts.map +1 -0
  49. package/lib/typescript/src/calendar/PickerGrid.d.ts +28 -0
  50. package/lib/typescript/src/calendar/PickerGrid.d.ts.map +1 -0
  51. package/lib/typescript/src/calendar/index.d.ts +4 -0
  52. package/lib/typescript/src/calendar/index.d.ts.map +1 -0
  53. package/lib/typescript/src/calendar/month.d.ts +86 -0
  54. package/lib/typescript/src/calendar/month.d.ts.map +1 -0
  55. package/lib/typescript/src/calendar/styles.d.ts +206 -0
  56. package/lib/typescript/src/calendar/styles.d.ts.map +1 -0
  57. package/lib/typescript/src/calendar/theme.d.ts +51 -0
  58. package/lib/typescript/src/calendar/theme.d.ts.map +1 -0
  59. package/lib/typescript/src/calendar/types.d.ts +162 -0
  60. package/lib/typescript/src/calendar/types.d.ts.map +1 -0
  61. package/lib/typescript/src/core/convert.d.ts +77 -0
  62. package/lib/typescript/src/core/convert.d.ts.map +1 -0
  63. package/lib/typescript/src/core/days.d.ts +24 -0
  64. package/lib/typescript/src/core/days.d.ts.map +1 -0
  65. package/lib/typescript/src/core/format.d.ts +23 -0
  66. package/lib/typescript/src/core/format.d.ts.map +1 -0
  67. package/lib/typescript/src/core/index.d.ts +5 -0
  68. package/lib/typescript/src/core/index.d.ts.map +1 -0
  69. package/lib/typescript/src/core/locale.d.ts +21 -0
  70. package/lib/typescript/src/core/locale.d.ts.map +1 -0
  71. package/lib/typescript/src/core/types.d.ts +7 -0
  72. package/lib/typescript/src/core/types.d.ts.map +1 -0
  73. package/lib/typescript/src/core/umalqura-data.d.ts +15 -0
  74. package/lib/typescript/src/core/umalqura-data.d.ts.map +1 -0
  75. package/lib/typescript/src/index.d.ts +3 -0
  76. package/lib/typescript/src/index.d.ts.map +1 -0
  77. package/package.json +180 -4
  78. package/src/calendar/Appear.tsx +94 -0
  79. package/src/calendar/Chevron.tsx +55 -0
  80. package/src/calendar/DayCell.tsx +89 -0
  81. package/src/calendar/HilalCalendar.tsx +728 -0
  82. package/src/calendar/PickerGrid.tsx +99 -0
  83. package/src/calendar/index.ts +13 -0
  84. package/src/calendar/month.ts +364 -0
  85. package/src/calendar/styles.ts +357 -0
  86. package/src/calendar/theme.ts +89 -0
  87. package/src/calendar/types.ts +168 -0
  88. package/src/core/convert.ts +256 -0
  89. package/src/core/days.ts +64 -0
  90. package/src/core/format.ts +65 -0
  91. package/src/core/index.ts +19 -0
  92. package/src/core/locale.ts +141 -0
  93. package/src/core/types.ts +6 -0
  94. package/src/core/umalqura-data.ts +34 -0
  95. package/src/index.tsx +2 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PickerGrid.d.ts","sourceRoot":"","sources":["../../../../src/calendar/PickerGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAU,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,8DAA8D;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,MAAM,EAAE,cAAc,CAAC;IACvB,wDAAwD;IACxD,GAAG,EAAE,KAAK,GAAG,aAAa,CAAC;IAC3B,iDAAiD;IACjD,IAAI,EAAE,OAAO,CAAC;IACd,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAAC;AAYF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,MAAM,EACN,GAAG,EACH,IAAI,EACJ,YAAY,EACZ,QAAQ,GACT,EAAE,eAAe,+BAmDjB"}
@@ -0,0 +1,4 @@
1
+ export { HilalCalendar } from './HilalCalendar.js';
2
+ export { darkTheme, lightTheme, type HilalTheme, type ThemeProp, } from './theme.js';
3
+ export type { HilalCalendarProps, HilalLabels, HilalStyles, SelectedDate, } from './types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/calendar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAiB,CAAC;AAChD,OAAO,EACL,SAAS,EACT,UAAU,EACV,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,YAAS,CAAC;AACjB,YAAY,EACV,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,YAAS,CAAC"}
@@ -0,0 +1,86 @@
1
+ import { type CalendarType, type Digits, type Locale } from '../core/locale.js';
2
+ /** A month of either calendar. `month` is 1-12. */
3
+ export type CalendarMonth = {
4
+ calendar: CalendarType;
5
+ year: number;
6
+ month: number;
7
+ };
8
+ export type DayCell = {
9
+ epochDay: number;
10
+ /** Day of the month in the primary calendar. */
11
+ day: number;
12
+ /**
13
+ * Day of the month in the other calendar, or null when the day is
14
+ * outside the supported Hijri range (possible in the first and last
15
+ * Gregorian months).
16
+ */
17
+ secondaryDay: number | null;
18
+ };
19
+ /** A month as weeks of 7 slots; null slots pad the first and last week. */
20
+ export type MonthGrid = Array<Array<DayCell | null>>;
21
+ /** Inclusive range of epoch days. */
22
+ export type DayRange = {
23
+ min: number;
24
+ max: number;
25
+ };
26
+ /** The days the calendar can ever show: the supported Hijri range. */
27
+ export declare const SUPPORTED_DAYS: DayRange;
28
+ export declare function otherCalendar(calendar: CalendarType): CalendarType;
29
+ /** Epoch day of the first day of a month. */
30
+ export declare function monthStart({ calendar, year, month }: CalendarMonth, adjustment?: number): number;
31
+ /** Number of days in a month. */
32
+ export declare function monthLength(m: CalendarMonth): number;
33
+ /** Year, month and day of an epoch day in either calendar. */
34
+ export declare function dateInCalendar(epochDay: number, calendar: CalendarType, adjustment?: number): import("../core/days.js").CivilDate;
35
+ /**
36
+ * The month of `calendar` that contains `epochDay`. Days outside the
37
+ * supported range are clamped to it first.
38
+ */
39
+ export declare function monthContaining(epochDay: number, calendar: CalendarType, adjustment?: number): CalendarMonth;
40
+ export declare function addMonths(m: CalendarMonth, delta: number): CalendarMonth;
41
+ export declare function clampDay(epochDay: number, range: DayRange): number;
42
+ /**
43
+ * The days that may be selected: `minDay`/`maxDay` (when given)
44
+ * intersected with the supported range.
45
+ */
46
+ export declare function selectableRange(minDay: number | undefined, maxDay: number | undefined, adjustment?: number): DayRange;
47
+ /** Whether any day of month `m` falls inside `range`. */
48
+ export declare function monthOverlaps(m: CalendarMonth, range: DayRange, adjustment?: number): boolean;
49
+ /**
50
+ * Lays out month `m` in weeks starting on `firstDayOfWeek` (0 = Sunday,
51
+ * 1 = Monday, 6 = Saturday).
52
+ */
53
+ export declare function buildMonthGrid(m: CalendarMonth, firstDayOfWeek: number, adjustment?: number): MonthGrid;
54
+ /** "رمضان ١٤٤٦" / "Ramadan 1446" / "March 2025". */
55
+ export declare function monthTitle(m: CalendarMonth, locale: Locale, digits: Digits): string;
56
+ /**
57
+ * The months of the other calendar that month `m` overlaps, for example
58
+ * "مارس – أبريل ٢٠٢٤" for Ramadan 1445, "ديسمبر ٢٠٢٤ – يناير ٢٠٢٥" across
59
+ * a year boundary, or a single month. Only days in the supported range
60
+ * count.
61
+ */
62
+ export declare function secondaryTitle(m: CalendarMonth, locale: Locale, digits: Digits, adjustment?: number): string;
63
+ /** Years shown on one page of the year picker. */
64
+ export declare const YEARS_PER_PAGE = 12;
65
+ /** A month (1-12) or a year in the picker, and whether it can be picked. */
66
+ export type PickerItem = {
67
+ value: number;
68
+ disabled: boolean;
69
+ };
70
+ /** Whether any day of `year` falls inside `range`. */
71
+ export declare function yearOverlaps(calendar: CalendarType, year: number, range: DayRange, adjustment?: number): boolean;
72
+ /** The 12 months of `year`, disabled when none of their days is in `range`. */
73
+ export declare function monthsOfYear(calendar: CalendarType, year: number, range: DayRange, adjustment?: number): PickerItem[];
74
+ /** First year of the year-picker page that contains `year`. */
75
+ export declare function yearPageStart(year: number): number;
76
+ /** The years of the page starting at `pageStart`. */
77
+ export declare function yearsOnPage(calendar: CalendarType, pageStart: number, range: DayRange, adjustment?: number): PickerItem[];
78
+ /** Whether the page starting at `pageStart` has any year that can be picked. */
79
+ export declare function pageOverlaps(calendar: CalendarType, pageStart: number, range: DayRange, adjustment?: number): boolean;
80
+ /**
81
+ * The years of the other calendar that years `fromYear` to `toYear`
82
+ * overlap, for example "٢٠٢٣ – ٢٠٢٤" for 1445 AH, or a single year. Only
83
+ * days in the supported range count.
84
+ */
85
+ export declare function yearsSecondaryTitle(calendar: CalendarType, fromYear: number, toYear: number, digits: Digits, adjustment?: number): string;
86
+ //# sourceMappingURL=month.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"month.d.ts","sourceRoot":"","sources":["../../../../src/calendar/month.ts"],"names":[],"mappings":"AAcA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,MAAM,EACZ,MAAM,mBAAgB,CAAC;AAExB,mDAAmD;AACnD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,YAAY,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,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AU,SAAI,WAKf;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,UAAU,SAAI,UAYf"}
@@ -0,0 +1,206 @@
1
+ import type { HilalTheme } from './theme.js';
2
+ import type { HilalStyles } from './types.js';
3
+ export type CalendarStyles = ReturnType<typeof createStyles>;
4
+ /**
5
+ * How far the phone's text size setting may grow the text of day cells,
6
+ * weekday names and picker buttons, which have a fixed size: up to 1.3 a
7
+ * day number and the date under it still fit a 48 pt cell.
8
+ */
9
+ export declare const MAX_CELL_FONT_SCALE = 1.3;
10
+ /** The same for the header and the toggle, which have room to grow. */
11
+ export declare const MAX_HEADER_FONT_SCALE = 2;
12
+ export declare function createStyles(theme: HilalTheme): Readonly<{
13
+ readonly container: {
14
+ readonly backgroundColor: string;
15
+ readonly borderRadius: 20;
16
+ readonly padding: 12;
17
+ };
18
+ readonly toggle: {
19
+ readonly alignSelf: "center";
20
+ readonly borderColor: string;
21
+ readonly borderRadius: 999;
22
+ readonly borderWidth: 1;
23
+ readonly marginBottom: 12;
24
+ readonly padding: 3;
25
+ };
26
+ readonly toggleOption: {
27
+ readonly borderRadius: 999;
28
+ readonly paddingHorizontal: 16;
29
+ readonly paddingVertical: 6;
30
+ };
31
+ readonly toggleOptionActive: {
32
+ readonly backgroundColor: string;
33
+ };
34
+ readonly toggleText: {
35
+ readonly color: string;
36
+ readonly fontSize: 14;
37
+ readonly fontWeight: "600";
38
+ };
39
+ readonly toggleTextActive: {
40
+ readonly color: string;
41
+ };
42
+ readonly header: {
43
+ readonly alignItems: "center";
44
+ readonly marginBottom: 8;
45
+ };
46
+ readonly titles: {
47
+ readonly alignItems: "center";
48
+ readonly flex: 1;
49
+ };
50
+ readonly title: {
51
+ readonly color: string;
52
+ readonly fontSize: 18;
53
+ readonly fontWeight: "700";
54
+ };
55
+ readonly subtitle: {
56
+ readonly color: string;
57
+ readonly fontSize: 13;
58
+ readonly marginTop: 2;
59
+ };
60
+ readonly arrow: {
61
+ readonly alignItems: "center";
62
+ readonly borderRadius: 999;
63
+ readonly height: 40;
64
+ readonly justifyContent: "center";
65
+ readonly width: 40;
66
+ };
67
+ readonly arrowPressed: {
68
+ readonly backgroundColor: string;
69
+ };
70
+ readonly weekdays: {
71
+ readonly marginBottom: 8;
72
+ };
73
+ readonly weekday: {
74
+ readonly color: string;
75
+ readonly flex: 1;
76
+ readonly fontSize: 12;
77
+ readonly fontWeight: "600";
78
+ readonly textAlign: "center";
79
+ };
80
+ readonly week: {};
81
+ readonly slot: {
82
+ readonly alignItems: "center";
83
+ readonly flex: 1;
84
+ readonly paddingHorizontal: 3;
85
+ readonly paddingVertical: 2;
86
+ };
87
+ readonly day: {
88
+ readonly alignItems: "center";
89
+ readonly borderColor: "transparent";
90
+ readonly borderRadius: number;
91
+ readonly borderWidth: 1.5;
92
+ readonly height: 48;
93
+ readonly justifyContent: "center";
94
+ readonly maxWidth: 48;
95
+ readonly width: "100%";
96
+ };
97
+ readonly today: {
98
+ readonly borderColor: string;
99
+ };
100
+ readonly selected: {
101
+ readonly backgroundColor: string;
102
+ readonly borderColor: string;
103
+ };
104
+ readonly pressed: {
105
+ readonly backgroundColor: string;
106
+ };
107
+ readonly dayText: {
108
+ readonly color: string;
109
+ readonly fontSize: 16;
110
+ readonly fontWeight: "500";
111
+ readonly lineHeight: 20;
112
+ };
113
+ readonly secondaryText: {
114
+ readonly color: string;
115
+ readonly fontSize: 11;
116
+ readonly lineHeight: 14;
117
+ readonly marginTop: 1;
118
+ };
119
+ readonly selectedText: {
120
+ readonly color: string;
121
+ readonly fontWeight: "700";
122
+ };
123
+ readonly todayText: {
124
+ readonly fontWeight: "700";
125
+ };
126
+ readonly selectedSecondaryText: {
127
+ readonly color: string;
128
+ readonly opacity: 0.8;
129
+ };
130
+ readonly disabledText: {
131
+ readonly color: string;
132
+ };
133
+ readonly titleButton: {
134
+ readonly alignItems: "center";
135
+ readonly borderRadius: 10;
136
+ readonly overflow: "hidden";
137
+ readonly paddingHorizontal: 10;
138
+ readonly paddingVertical: 2;
139
+ };
140
+ readonly titleInButton: {
141
+ readonly flexShrink: 1;
142
+ readonly textAlign: "center";
143
+ };
144
+ readonly titleStatic: {
145
+ readonly paddingVertical: 2;
146
+ };
147
+ readonly titleButtonPressed: {
148
+ readonly backgroundColor: string;
149
+ };
150
+ readonly titleTint: {
151
+ readonly backgroundColor: string;
152
+ readonly opacity: 0.1;
153
+ readonly bottom: 0;
154
+ readonly left: 0;
155
+ readonly position: "absolute";
156
+ readonly right: 0;
157
+ readonly top: 0;
158
+ };
159
+ readonly picker: {
160
+ readonly marginTop: 4;
161
+ };
162
+ readonly pickerSlot: {
163
+ readonly flex: 1;
164
+ readonly padding: 3;
165
+ };
166
+ readonly pickerItem: {
167
+ readonly alignItems: "center";
168
+ readonly borderColor: "transparent";
169
+ readonly borderRadius: number;
170
+ readonly borderWidth: 1.5;
171
+ readonly justifyContent: "center";
172
+ readonly minHeight: 52;
173
+ readonly overflow: "hidden";
174
+ readonly paddingHorizontal: 4;
175
+ readonly paddingVertical: 6;
176
+ };
177
+ readonly grow: {
178
+ readonly flexGrow: 1;
179
+ };
180
+ readonly pickerItemTint: {
181
+ readonly backgroundColor: string;
182
+ readonly opacity: 0.05;
183
+ readonly bottom: 0;
184
+ readonly left: 0;
185
+ readonly position: "absolute";
186
+ readonly right: 0;
187
+ readonly top: 0;
188
+ };
189
+ readonly pickerText: {
190
+ readonly color: string;
191
+ readonly fontSize: 14;
192
+ readonly fontWeight: "600";
193
+ readonly lineHeight: 18;
194
+ readonly textAlign: "center";
195
+ };
196
+ }>;
197
+ /**
198
+ * Merges the `styles` prop over the calendar styles: `styles` for the
199
+ * calendar and the picker, `dayStyles` for the day cells. Slots that are
200
+ * not set leave the calendar styles as they are.
201
+ */
202
+ export declare function withSlots(styles: CalendarStyles, slots: HilalStyles | undefined): {
203
+ styles: CalendarStyles;
204
+ dayStyles: CalendarStyles;
205
+ };
206
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/calendar/styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAS,CAAC;AAW3C,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AA0BvC,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE7C;AAsFD;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,WAAW,GAAG,SAAS,GAC7B;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,SAAS,EAAE,cAAc,CAAA;CAAE,CAmBvD"}
@@ -0,0 +1,51 @@
1
+ /** Colors, fonts and shape of the calendar. */
2
+ export type HilalTheme = {
3
+ /** Calendar background. */
4
+ background: string;
5
+ /** Day numbers, month title, arrows. */
6
+ text: string;
7
+ /** Secondary-calendar dates and weekday names. */
8
+ textSecondary: string;
9
+ /** Selected day and active calendar toggle. */
10
+ primary: string;
11
+ /** Text on `primary`. */
12
+ onPrimary: string;
13
+ /** Ring around today's date. */
14
+ today: string;
15
+ /** Days that can't be selected, and disabled arrows. */
16
+ disabled: string;
17
+ /** Toggle outline. */
18
+ border: string;
19
+ /** Corner radius of a day cell. */
20
+ radius: number;
21
+ /** Month arrows. Default: `text`. */
22
+ arrow?: string;
23
+ /**
24
+ * Font of all text, for example 'Cairo-Regular'. Default: the system
25
+ * font.
26
+ */
27
+ fontFamily?: string;
28
+ /**
29
+ * Font of the bold text (month title, selected day and today, toggle,
30
+ * weekdays, picker), for example 'Cairo-Bold'. When set, it is used as is,
31
+ * without a fontWeight on top. Default: `fontFamily` with a bold weight.
32
+ */
33
+ fontFamilyBold?: string;
34
+ /**
35
+ * Multiplies every font size, for example 1.15 for larger text. Day
36
+ * cells grow with it. Weekday names and the picker's month and year
37
+ * names shrink with it but never grow, so they still fit their columns
38
+ * on small phones. Default 1.
39
+ */
40
+ fontScale?: number;
41
+ };
42
+ export type ThemeProp = 'light' | 'dark' | 'auto' | Partial<HilalTheme>;
43
+ export declare const lightTheme: HilalTheme;
44
+ export declare const darkTheme: HilalTheme;
45
+ /**
46
+ * The theme to render with. 'auto' follows the system color scheme. A
47
+ * partial theme is merged over the 'auto' theme, so a custom `primary`
48
+ * color works in both light and dark mode.
49
+ */
50
+ export declare function resolveTheme(theme: ThemeProp, colorScheme: string | null | undefined): HilalTheme;
51
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/calendar/theme.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,MAAM,MAAM,UAAU,GAAG;IACvB,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAExE,eAAO,MAAM,UAAU,EAAE,UAUxB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,UAUvB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACrC,UAAU,CAYZ"}
@@ -0,0 +1,162 @@
1
+ import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
+ import type { CalendarType, Digits, Locale } from '../core/locale.js';
3
+ import type { HijriDate } from '../core/types.js';
4
+ import type { ThemeProp } from './theme.js';
5
+ /** A day picked in the calendar, in both calendars. */
6
+ export type SelectedDate = {
7
+ /** Local midnight of the day. */
8
+ gregorian: Date;
9
+ hijri: HijriDate;
10
+ /** Both dates as text in the calendar's locale and digits. */
11
+ formatted: {
12
+ gregorian: string;
13
+ hijri: string;
14
+ };
15
+ };
16
+ type ViewSlot = StyleProp<ViewStyle>;
17
+ type TextSlot = StyleProp<TextStyle>;
18
+ /**
19
+ * Styles for parts of the calendar, merged over the theme's styles. Each
20
+ * is optional.
21
+ */
22
+ export type HilalStyles = {
23
+ /** The outer container (the same as the `style` prop). */
24
+ container?: ViewSlot;
25
+ /** The Hijri / Gregorian toggle. */
26
+ toggle?: ViewSlot;
27
+ /** Each option of the toggle. */
28
+ toggleOption?: ViewSlot;
29
+ toggleText?: TextSlot;
30
+ /** The row of arrows and titles. */
31
+ header?: ViewSlot;
32
+ /** The month title. */
33
+ title?: TextSlot;
34
+ /** The other calendar's months under the title. */
35
+ subtitle?: TextSlot;
36
+ /** Each arrow button. */
37
+ arrow?: ViewSlot;
38
+ /** Each weekday name. */
39
+ weekdayText?: TextSlot;
40
+ /** Each day cell (the pressable circle). */
41
+ day?: ViewSlot;
42
+ /** The day number. */
43
+ dayText?: TextSlot;
44
+ /** The other calendar's day under the day number. */
45
+ secondaryDayText?: TextSlot;
46
+ /** The selected day cell. */
47
+ selectedDay?: ViewSlot;
48
+ /** The selected day's number. */
49
+ selectedDayText?: TextSlot;
50
+ /** Today's day cell. */
51
+ today?: ViewSlot;
52
+ /** Today's day number, bold by default. */
53
+ todayDayText?: TextSlot;
54
+ /** Both texts of a disabled day. */
55
+ disabledDayText?: TextSlot;
56
+ /** Each month or year in the month and year picker. */
57
+ pickerItem?: ViewSlot;
58
+ pickerText?: TextSlot;
59
+ };
60
+ /**
61
+ * Texts of the calendar's buttons, read by screen readers too. Each is
62
+ * optional; the rest come from the locale.
63
+ */
64
+ export type HilalLabels = {
65
+ /** The toggle's Hijri option. */
66
+ hijri?: string;
67
+ /** The toggle's Gregorian option. */
68
+ gregorian?: string;
69
+ /** Read by screen readers after today's date. */
70
+ today?: string;
71
+ /** Read after the current month in the month picker. */
72
+ thisMonth?: string;
73
+ /** Read after the current year in the year picker. */
74
+ thisYear?: string;
75
+ /** Arrows, read by screen readers. */
76
+ previousMonth?: string;
77
+ nextMonth?: string;
78
+ previousYear?: string;
79
+ nextYear?: string;
80
+ previousYears?: string;
81
+ nextYears?: string;
82
+ /** The month title button, read by screen readers before the title. */
83
+ chooseMonth?: string;
84
+ /** The year title button in the month picker. */
85
+ chooseYear?: string;
86
+ };
87
+ export type HilalCalendarProps = {
88
+ /** Selected day (controlled). Only the local calendar day is used. */
89
+ value?: Date;
90
+ /** Initially selected day (uncontrolled). */
91
+ defaultValue?: Date;
92
+ /** Called when the user picks a day. */
93
+ onChange?: (date: SelectedDate) => void;
94
+ /** Calendar of the month grid. Default 'hijri'. */
95
+ calendar?: CalendarType;
96
+ /** Called when the user switches calendars with the toggle. */
97
+ onCalendarChange?: (calendar: CalendarType) => void;
98
+ /** Show the Hijri / Gregorian toggle. Default true. */
99
+ showCalendarToggle?: boolean;
100
+ /** Show the other calendar's day under each day. Default true. */
101
+ showSecondaryDate?: boolean;
102
+ /** Language of names and labels. Default 'ar'. */
103
+ locale?: Locale;
104
+ /** Default 'arabic' when locale is 'ar', otherwise 'latin'. */
105
+ digits?: Digits;
106
+ /**
107
+ * Layout direction. 'auto' (default) is right-to-left when the app runs
108
+ * right-to-left (`I18nManager.isRTL`) or the locale is 'ar'.
109
+ */
110
+ direction?: 'rtl' | 'ltr' | 'auto';
111
+ /** 0 = Sunday (default), 1 = Monday, 6 = Saturday. */
112
+ firstDayOfWeek?: 0 | 1 | 6;
113
+ /**
114
+ * Weekday names above the days: 'short' (default, أحد / Sun) or
115
+ * 'narrow' (ح / S). Full names don't fit seven columns on a phone.
116
+ */
117
+ weekdayFormat?: 'short' | 'narrow';
118
+ /** Earliest selectable day. */
119
+ minDate?: Date;
120
+ /** Latest selectable day. */
121
+ maxDate?: Date;
122
+ /** Return true to disable a day. */
123
+ isDateDisabled?: (date: SelectedDate) => boolean;
124
+ /**
125
+ * Shift the Hijri calendar by whole days, from -2 to 2, for places where
126
+ * the month started before or after Umm al-Qura. `1` makes every Hijri
127
+ * date one day later. Gregorian dates never change. Default 0.
128
+ */
129
+ hijriAdjustment?: number;
130
+ /**
131
+ * Pressing the month title opens a grid of months, and from there a
132
+ * grid of years, to jump far without paging month by month. Default
133
+ * true.
134
+ */
135
+ showMonthYearPicker?: boolean;
136
+ /**
137
+ * 'light', 'dark', 'auto' (default, follows the system color scheme),
138
+ * or a partial theme merged over the 'auto' theme.
139
+ */
140
+ theme?: ThemeProp;
141
+ /** Texts of the toggle and buttons, see `HilalLabels`. */
142
+ labels?: HilalLabels;
143
+ /** Styles for parts of the calendar, see `HilalStyles`. */
144
+ styles?: HilalStyles;
145
+ /** Style of the outer container. */
146
+ style?: StyleProp<ViewStyle>;
147
+ /**
148
+ * Style of every day cell (the pressable circle). Unlike `styles.day`,
149
+ * it also wins over the selected and today styles.
150
+ */
151
+ dayStyle?: StyleProp<ViewStyle>;
152
+ /**
153
+ * How far the phone's text size setting may grow the calendar's text,
154
+ * like React Native's prop of the same name: `1` turns it off, `0`
155
+ * removes the limit. By default, text in day cells, weekday names and
156
+ * picker buttons grows up to 1.3 times (as far as it fits a cell), and
157
+ * the header and toggle up to 2 times.
158
+ */
159
+ maxFontSizeMultiplier?: number;
160
+ };
161
+ export {};
162
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/calendar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAS,CAAC;AAEzC,uDAAuD;AACvD,MAAM,MAAM,YAAY,GAAG;IACzB,iCAAiC;IACjC,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;IACjB,8DAA8D;IAC9D,SAAS,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD,CAAC;AAEF,KAAK,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;AACrC,KAAK,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;AAErC;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,0DAA0D;I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AAE,IAAI,CAAC;IACf,oCAAoC;IACpC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;IAEjD;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,oCAAoC;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChC;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC"}
@@ -0,0 +1,77 @@
1
+ import type { HijriDate } from './types.js';
2
+ /**
3
+ * First and last epoch day of the Umm al-Qura table (both inclusive). With
4
+ * a Hijri adjustment of `n` days, the supported Gregorian days move by
5
+ * `-n`: see `supportedEpochDays`.
6
+ */
7
+ export declare const FIRST_DAY: number;
8
+ export declare const LAST_DAY: number;
9
+ /** The largest Hijri adjustment accepted, in days, in either direction. */
10
+ export declare const MAX_HIJRI_ADJUSTMENT = 2;
11
+ export type HijriConversionOptions = {
12
+ /**
13
+ * Days to shift the Hijri calendar by, from -2 to 2. `1` makes every
14
+ * Hijri date one day later than Umm al-Qura (Umm al-Qura's 29 Sha'ban
15
+ * becomes 30 Sha'ban), for places where the month started a day
16
+ * earlier. Default 0.
17
+ */
18
+ adjustment?: number;
19
+ };
20
+ /**
21
+ * Checks a Hijri adjustment and returns it.
22
+ *
23
+ * @throws {RangeError} unless it is an integer from -2 to 2.
24
+ */
25
+ export declare function checkAdjustment(adjustment: number, caller: string): number;
26
+ /** First and last epoch day that have a Hijri date, for an adjustment. */
27
+ export declare function supportedEpochDays(adjustment?: number): {
28
+ min: number;
29
+ max: number;
30
+ };
31
+ /** First and last Hijri dates the table covers. */
32
+ export declare function getSupportedRange(): {
33
+ min: HijriDate;
34
+ max: HijriDate;
35
+ };
36
+ /**
37
+ * Number of days in a Hijri month.
38
+ *
39
+ * @throws {RangeError} if the year is outside the supported range or the
40
+ * month is not an integer from 1 to 12.
41
+ */
42
+ export declare function getHijriMonthLength(year: number, month: number): 29 | 30;
43
+ /** Whether `hijri` is a real day within the supported range. */
44
+ export declare function isValidHijri(hijri: HijriDate): boolean;
45
+ /**
46
+ * Hijri date of an epoch day, shifted by `adjustment` days. Internal: the
47
+ * public entry point is `toHijri`.
48
+ *
49
+ * @throws {RangeError} if the day is outside the supported range.
50
+ */
51
+ export declare function hijriOfEpochDay(epochDay: number, caller?: string, adjustment?: number): HijriDate;
52
+ /**
53
+ * Epoch day of a Hijri date, shifted by `adjustment` days. Internal: the
54
+ * public entry point is `toGregorian`.
55
+ *
56
+ * @throws {RangeError} if `hijri` is not a valid date in the supported
57
+ * range.
58
+ */
59
+ export declare function epochDayOfHijri(hijri: HijriDate, caller?: string, adjustment?: number): number;
60
+ /**
61
+ * Converts the local calendar day of `date` to a Hijri date. The time of
62
+ * day and the time zone offset are ignored: 23:59 and 00:00 on the same
63
+ * local day give the same result.
64
+ *
65
+ * @throws {RangeError} if `date` is invalid or outside the supported
66
+ * range, or the adjustment is not an integer from -2 to 2.
67
+ */
68
+ export declare function toHijri(date: Date, options?: HijriConversionOptions): HijriDate;
69
+ /**
70
+ * Converts a Hijri date to a `Date` at local midnight of the matching
71
+ * Gregorian day.
72
+ *
73
+ * @throws {RangeError} if `hijri` is not a valid date in the supported
74
+ * range, or the adjustment is not an integer from -2 to 2.
75
+ */
76
+ export declare function toGregorian(hijri: HijriDate, options?: HijriConversionOptions): Date;
77
+ //# sourceMappingURL=convert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../../src/core/convert.ts"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@@
1
+ /**
2
+ * Calendar-day arithmetic on plain year/month/day numbers.
3
+ *
4
+ * Days are counted from 1970-01-01 in the proleptic Gregorian calendar
5
+ * ("epoch days"). The algorithms are Howard Hinnant's `days_from_civil`
6
+ * and `civil_from_days`, which use integer math only and never touch a
7
+ * time zone.
8
+ */
9
+ export type CivilDate = {
10
+ year: number;
11
+ month: number;
12
+ day: number;
13
+ };
14
+ /** Epoch day of a Gregorian year/month/day (month is 1-12). */
15
+ export declare function daysFromCivil(year: number, month: number, day: number): number;
16
+ /** Gregorian year/month/day (month is 1-12) of an epoch day. */
17
+ export declare function civilFromDays(epochDay: number): CivilDate;
18
+ /** Epoch day of the local calendar day `date` falls on. */
19
+ export declare function epochDayOfLocalDate(date: Date): number;
20
+ /** A `Date` at local midnight (start of day) of an epoch day. */
21
+ export declare function localDateOfEpochDay(epochDay: number): Date;
22
+ /** Day of the week of an epoch day, 0 = Sunday (like `Date#getDay()`). */
23
+ export declare function weekdayOfEpochDay(epochDay: number): number;
24
+ //# sourceMappingURL=days.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"days.d.ts","sourceRoot":"","sources":["../../../../src/core/days.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAYrE;AAED,gEAAgE;AAChE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAmBzD;AAED,2DAA2D;AAC3D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,UAE7C;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,QAGnD;AAED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,UAGjD"}