react-native-hilal 0.1.0 → 0.3.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.
- package/README.md +165 -49
- package/lib/module/calendar/Appear.js +75 -0
- package/lib/module/calendar/Appear.js.map +1 -0
- package/lib/module/calendar/DayCell.js +32 -5
- package/lib/module/calendar/DayCell.js.map +1 -1
- package/lib/module/calendar/HilalCalendar.js +434 -76
- package/lib/module/calendar/HilalCalendar.js.map +1 -1
- package/lib/module/calendar/PickerGrid.js +66 -0
- package/lib/module/calendar/PickerGrid.js.map +1 -0
- package/lib/module/calendar/month.js +135 -22
- package/lib/module/calendar/month.js.map +1 -1
- package/lib/module/calendar/range.js +103 -0
- package/lib/module/calendar/range.js.map +1 -0
- package/lib/module/calendar/styles.js +233 -7
- package/lib/module/calendar/styles.js.map +1 -1
- package/lib/module/calendar/theme.js +3 -3
- package/lib/module/calendar/theme.js.map +1 -1
- package/lib/module/core/convert.js +52 -21
- package/lib/module/core/convert.js.map +1 -1
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/locale.js +5 -2
- package/lib/module/core/locale.js.map +1 -1
- package/lib/typescript/src/calendar/Appear.d.ts +22 -0
- package/lib/typescript/src/calendar/Appear.d.ts.map +1 -0
- package/lib/typescript/src/calendar/DayCell.d.ts +8 -1
- package/lib/typescript/src/calendar/DayCell.d.ts.map +1 -1
- package/lib/typescript/src/calendar/HilalCalendar.d.ts +1 -1
- package/lib/typescript/src/calendar/HilalCalendar.d.ts.map +1 -1
- package/lib/typescript/src/calendar/PickerGrid.d.ts +28 -0
- package/lib/typescript/src/calendar/PickerGrid.d.ts.map +1 -0
- package/lib/typescript/src/calendar/index.d.ts +1 -1
- package/lib/typescript/src/calendar/index.d.ts.map +1 -1
- package/lib/typescript/src/calendar/month.d.ts +30 -7
- package/lib/typescript/src/calendar/month.d.ts.map +1 -1
- package/lib/typescript/src/calendar/range.d.ts +39 -0
- package/lib/typescript/src/calendar/range.d.ts.map +1 -0
- package/lib/typescript/src/calendar/styles.d.ts +207 -113
- package/lib/typescript/src/calendar/styles.d.ts.map +1 -1
- package/lib/typescript/src/calendar/theme.d.ts +21 -1
- package/lib/typescript/src/calendar/theme.d.ts.map +1 -1
- package/lib/typescript/src/calendar/types.d.ts +153 -2
- package/lib/typescript/src/calendar/types.d.ts.map +1 -1
- package/lib/typescript/src/core/convert.d.ts +38 -15
- package/lib/typescript/src/core/convert.d.ts.map +1 -1
- package/lib/typescript/src/core/index.d.ts +1 -1
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/core/locale.d.ts +1 -1
- package/lib/typescript/src/core/locale.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/calendar/Appear.tsx +94 -0
- package/src/calendar/DayCell.tsx +41 -1
- package/src/calendar/HilalCalendar.tsx +541 -85
- package/src/calendar/PickerGrid.tsx +99 -0
- package/src/calendar/index.ts +8 -1
- package/src/calendar/month.ts +174 -23
- package/src/calendar/range.ts +114 -0
- package/src/calendar/styles.ts +249 -6
- package/src/calendar/theme.ts +23 -3
- package/src/calendar/types.ts +156 -2
- package/src/core/convert.ts +87 -23
- package/src/core/index.ts +1 -0
- package/src/core/locale.ts +4 -1
|
@@ -1,8 +1,155 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { StyleSheet } from 'react-native';
|
|
4
|
+
/** Fills the parent; left/right are both 0, so RTL mirroring can't move it. */
|
|
5
|
+
const fill = {
|
|
6
|
+
bottom: 0,
|
|
7
|
+
left: 0,
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
right: 0,
|
|
10
|
+
top: 0
|
|
11
|
+
};
|
|
12
|
+
/** Space above and below each day cell. */
|
|
13
|
+
const SLOT_PADDING_VERTICAL = 2;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* How far the phone's text size setting may grow the text of day cells,
|
|
17
|
+
* weekday names and picker buttons, which have a fixed size: up to 1.3 a
|
|
18
|
+
* day number and the date under it still fit a 48 pt cell.
|
|
19
|
+
*/
|
|
20
|
+
export const MAX_CELL_FONT_SCALE = 1.3;
|
|
21
|
+
/** The same for the header and the toggle, which have room to grow. */
|
|
22
|
+
export const MAX_HEADER_FONT_SCALE = 2;
|
|
23
|
+
|
|
24
|
+
/** The text styles, which take the theme's fonts and font scale. */
|
|
25
|
+
const TEXT_STYLES = ['toggleText', 'title', 'subtitle', 'weekday', 'dayText', 'secondaryText', 'pickerText',
|
|
26
|
+
// Only a weight, for the bold font.
|
|
27
|
+
'selectedText', 'todayText'];
|
|
28
|
+
|
|
29
|
+
/** Text in columns of a fixed width: shrinks with the font scale only. */
|
|
30
|
+
const FIXED_WIDTH_TEXT = new Set(['weekday', 'pickerText']);
|
|
4
31
|
export function createStyles(theme) {
|
|
5
|
-
return StyleSheet.create(
|
|
32
|
+
return StyleSheet.create(applyFonts(baseStyles(theme), theme));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Applies `fontFamily`, `fontFamilyBold` and `fontScale`. Only adds keys
|
|
37
|
+
* when the theme sets them, so a theme without fonts gives exactly the
|
|
38
|
+
* base styles.
|
|
39
|
+
*/
|
|
40
|
+
function applyFonts(styles, theme) {
|
|
41
|
+
const scale = theme.fontScale ?? 1;
|
|
42
|
+
if (!(Number.isFinite(scale) && scale > 0)) {
|
|
43
|
+
throw new RangeError(`HilalCalendar: theme.fontScale must be a positive number, got ${scale}`);
|
|
44
|
+
}
|
|
45
|
+
const {
|
|
46
|
+
fontFamily,
|
|
47
|
+
fontFamilyBold
|
|
48
|
+
} = theme;
|
|
49
|
+
if (scale === 1 && !fontFamily && !fontFamilyBold) {
|
|
50
|
+
return styles;
|
|
51
|
+
}
|
|
52
|
+
const out = {
|
|
53
|
+
...styles
|
|
54
|
+
};
|
|
55
|
+
for (const key of TEXT_STYLES) {
|
|
56
|
+
const style = {
|
|
57
|
+
...styles[key]
|
|
58
|
+
};
|
|
59
|
+
// Weekday names (أربعاء خميس) only just fit seven columns on small
|
|
60
|
+
// phones, and long month names (Dhu al-Qi'dah) three, so these never
|
|
61
|
+
// grow.
|
|
62
|
+
const factor = FIXED_WIDTH_TEXT.has(key) ? Math.min(scale, 1) : scale;
|
|
63
|
+
if (factor !== 1) {
|
|
64
|
+
if (style.fontSize) style.fontSize = round(style.fontSize * factor);
|
|
65
|
+
if (style.lineHeight) style.lineHeight = round(style.lineHeight * factor);
|
|
66
|
+
}
|
|
67
|
+
const bold = style.fontWeight === '600' || style.fontWeight === '700';
|
|
68
|
+
if (bold && fontFamilyBold) {
|
|
69
|
+
// A bold font file plus a bold weight would be bolded twice.
|
|
70
|
+
style.fontFamily = fontFamilyBold;
|
|
71
|
+
style.fontWeight = 'normal';
|
|
72
|
+
} else if (fontFamily) {
|
|
73
|
+
style.fontFamily = fontFamily;
|
|
74
|
+
}
|
|
75
|
+
out[key] = style;
|
|
76
|
+
}
|
|
77
|
+
if (scale > 1) {
|
|
78
|
+
// Larger text needs larger day cells.
|
|
79
|
+
const day = styles.day;
|
|
80
|
+
out.day = {
|
|
81
|
+
...day,
|
|
82
|
+
height: round(day.height * scale),
|
|
83
|
+
maxWidth: round(day.maxWidth * scale)
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
const round = n => Math.round(n * 10) / 10;
|
|
89
|
+
|
|
90
|
+
/** The calendar style each `styles` slot is merged into. */
|
|
91
|
+
const SLOTS = {
|
|
92
|
+
container: 'container',
|
|
93
|
+
toggle: 'toggle',
|
|
94
|
+
toggleOption: 'toggleOption',
|
|
95
|
+
toggleText: 'toggleText',
|
|
96
|
+
header: 'header',
|
|
97
|
+
title: 'title',
|
|
98
|
+
subtitle: 'subtitle',
|
|
99
|
+
arrow: 'arrow',
|
|
100
|
+
weekdayText: 'weekday',
|
|
101
|
+
day: 'day',
|
|
102
|
+
dayText: 'dayText',
|
|
103
|
+
secondaryDayText: 'secondaryText',
|
|
104
|
+
pickerItem: 'pickerItem',
|
|
105
|
+
pickerText: 'pickerText',
|
|
106
|
+
rangeBand: 'rangeBand'
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The slots for day states. The picker shares these calendar styles, so
|
|
111
|
+
* they are merged into a copy used only by the day cells.
|
|
112
|
+
*/
|
|
113
|
+
const DAY_SLOTS = {
|
|
114
|
+
selectedDay: 'selected',
|
|
115
|
+
selectedDayText: 'selectedText',
|
|
116
|
+
today: 'today',
|
|
117
|
+
disabledDayText: 'disabledText',
|
|
118
|
+
todayDayText: 'todayText'
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Merges the `styles` prop over the calendar styles: `styles` for the
|
|
123
|
+
* calendar and the picker, `dayStyles` for the day cells. Slots that are
|
|
124
|
+
* not set leave the calendar styles as they are.
|
|
125
|
+
*/
|
|
126
|
+
export function withSlots(styles, slots) {
|
|
127
|
+
if (!slots) {
|
|
128
|
+
return {
|
|
129
|
+
styles,
|
|
130
|
+
dayStyles: styles
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const merge = (target, map) => {
|
|
134
|
+
const out = {
|
|
135
|
+
...target
|
|
136
|
+
};
|
|
137
|
+
for (const [slot, key] of Object.entries(map)) {
|
|
138
|
+
const style = slots[slot];
|
|
139
|
+
if (style) {
|
|
140
|
+
out[key] = StyleSheet.flatten([target[key], style]);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return out;
|
|
144
|
+
};
|
|
145
|
+
const merged = merge(styles, SLOTS);
|
|
146
|
+
return {
|
|
147
|
+
styles: merged,
|
|
148
|
+
dayStyles: merge(merged, DAY_SLOTS)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function baseStyles(theme) {
|
|
152
|
+
return {
|
|
6
153
|
container: {
|
|
7
154
|
backgroundColor: theme.background,
|
|
8
155
|
borderRadius: 20,
|
|
@@ -61,7 +208,7 @@ export function createStyles(theme) {
|
|
|
61
208
|
backgroundColor: theme.border
|
|
62
209
|
},
|
|
63
210
|
weekdays: {
|
|
64
|
-
marginBottom:
|
|
211
|
+
marginBottom: 8
|
|
65
212
|
},
|
|
66
213
|
weekday: {
|
|
67
214
|
color: theme.textSecondary,
|
|
@@ -78,7 +225,16 @@ export function createStyles(theme) {
|
|
|
78
225
|
// than 7 full-size cells, so today's ring never touches the
|
|
79
226
|
// selected day.
|
|
80
227
|
paddingHorizontal: 3,
|
|
81
|
-
paddingVertical:
|
|
228
|
+
paddingVertical: SLOT_PADDING_VERTICAL
|
|
229
|
+
},
|
|
230
|
+
// The band behind a range: as tall as a day, across the whole slot so
|
|
231
|
+
// neighbouring days join. A layer with opacity, so any color works.
|
|
232
|
+
rangeBand: {
|
|
233
|
+
backgroundColor: theme.primary,
|
|
234
|
+
bottom: SLOT_PADDING_VERTICAL,
|
|
235
|
+
opacity: 0.15,
|
|
236
|
+
position: 'absolute',
|
|
237
|
+
top: SLOT_PADDING_VERTICAL
|
|
82
238
|
},
|
|
83
239
|
day: {
|
|
84
240
|
alignItems: 'center',
|
|
@@ -100,18 +256,27 @@ export function createStyles(theme) {
|
|
|
100
256
|
pressed: {
|
|
101
257
|
backgroundColor: theme.border
|
|
102
258
|
},
|
|
259
|
+
// Medium, so the selected day and today stand out in bold. Fixed line
|
|
260
|
+
// heights: fonts with tall lines (Noto Naskh, many custom fonts) would
|
|
261
|
+
// otherwise push the date under the number to the next row.
|
|
103
262
|
dayText: {
|
|
104
263
|
color: theme.text,
|
|
105
264
|
fontSize: 16,
|
|
106
|
-
fontWeight: '
|
|
265
|
+
fontWeight: '500',
|
|
266
|
+
lineHeight: 20
|
|
107
267
|
},
|
|
108
268
|
secondaryText: {
|
|
109
269
|
color: theme.textSecondary,
|
|
110
|
-
fontSize:
|
|
270
|
+
fontSize: 11,
|
|
271
|
+
lineHeight: 14,
|
|
111
272
|
marginTop: 1
|
|
112
273
|
},
|
|
113
274
|
selectedText: {
|
|
114
|
-
color: theme.onPrimary
|
|
275
|
+
color: theme.onPrimary,
|
|
276
|
+
fontWeight: '700'
|
|
277
|
+
},
|
|
278
|
+
todayText: {
|
|
279
|
+
fontWeight: '700'
|
|
115
280
|
},
|
|
116
281
|
selectedSecondaryText: {
|
|
117
282
|
color: theme.onPrimary,
|
|
@@ -119,7 +284,68 @@ export function createStyles(theme) {
|
|
|
119
284
|
},
|
|
120
285
|
disabledText: {
|
|
121
286
|
color: theme.disabled
|
|
287
|
+
},
|
|
288
|
+
// Month and year picker.
|
|
289
|
+
titleButton: {
|
|
290
|
+
alignItems: 'center',
|
|
291
|
+
borderRadius: 10,
|
|
292
|
+
overflow: 'hidden',
|
|
293
|
+
paddingHorizontal: 10,
|
|
294
|
+
paddingVertical: 2
|
|
295
|
+
},
|
|
296
|
+
// The title inside the button: centered and shrinkable when a long
|
|
297
|
+
// name wraps on a narrow phone.
|
|
298
|
+
titleInButton: {
|
|
299
|
+
flexShrink: 1,
|
|
300
|
+
textAlign: 'center'
|
|
301
|
+
},
|
|
302
|
+
// The title of the year picker, which is not a button.
|
|
303
|
+
titleStatic: {
|
|
304
|
+
paddingVertical: 2
|
|
305
|
+
},
|
|
306
|
+
titleButtonPressed: {
|
|
307
|
+
backgroundColor: theme.border
|
|
308
|
+
},
|
|
309
|
+
// Tints are layers with opacity, so any theme color format works.
|
|
310
|
+
titleTint: {
|
|
311
|
+
...fill,
|
|
312
|
+
backgroundColor: theme.primary,
|
|
313
|
+
opacity: 0.1
|
|
314
|
+
},
|
|
315
|
+
picker: {
|
|
316
|
+
marginTop: 4
|
|
317
|
+
},
|
|
318
|
+
pickerSlot: {
|
|
319
|
+
flex: 1,
|
|
320
|
+
padding: 3
|
|
321
|
+
},
|
|
322
|
+
pickerItem: {
|
|
323
|
+
alignItems: 'center',
|
|
324
|
+
borderColor: 'transparent',
|
|
325
|
+
borderRadius: theme.radius,
|
|
326
|
+
borderWidth: 1.5,
|
|
327
|
+
justifyContent: 'center',
|
|
328
|
+
minHeight: 52,
|
|
329
|
+
overflow: 'hidden',
|
|
330
|
+
paddingHorizontal: 4,
|
|
331
|
+
paddingVertical: 6
|
|
332
|
+
},
|
|
333
|
+
// Grows into the free height of its parent.
|
|
334
|
+
grow: {
|
|
335
|
+
flexGrow: 1
|
|
336
|
+
},
|
|
337
|
+
pickerItemTint: {
|
|
338
|
+
...fill,
|
|
339
|
+
backgroundColor: theme.text,
|
|
340
|
+
opacity: 0.05
|
|
341
|
+
},
|
|
342
|
+
pickerText: {
|
|
343
|
+
color: theme.text,
|
|
344
|
+
fontSize: 14,
|
|
345
|
+
fontWeight: '600',
|
|
346
|
+
lineHeight: 18,
|
|
347
|
+
textAlign: 'center'
|
|
122
348
|
}
|
|
123
|
-
}
|
|
349
|
+
};
|
|
124
350
|
}
|
|
125
351
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StyleSheet","createStyles","theme","create","
|
|
1
|
+
{"version":3,"names":["StyleSheet","fill","bottom","left","position","right","top","SLOT_PADDING_VERTICAL","MAX_CELL_FONT_SCALE","MAX_HEADER_FONT_SCALE","TEXT_STYLES","FIXED_WIDTH_TEXT","Set","createStyles","theme","create","applyFonts","baseStyles","styles","scale","fontScale","Number","isFinite","RangeError","fontFamily","fontFamilyBold","out","key","style","factor","has","Math","min","fontSize","round","lineHeight","bold","fontWeight","day","height","maxWidth","n","SLOTS","container","toggle","toggleOption","toggleText","header","title","subtitle","arrow","weekdayText","dayText","secondaryDayText","pickerItem","pickerText","rangeBand","DAY_SLOTS","selectedDay","selectedDayText","today","disabledDayText","todayDayText","withSlots","slots","dayStyles","merge","target","map","slot","Object","entries","flatten","merged","backgroundColor","background","borderRadius","padding","alignSelf","borderColor","border","borderWidth","marginBottom","paddingHorizontal","paddingVertical","toggleOptionActive","primary","color","textSecondary","toggleTextActive","onPrimary","alignItems","titles","flex","text","marginTop","justifyContent","width","arrowPressed","weekdays","weekday","textAlign","week","opacity","radius","selected","pressed","secondaryText","selectedText","todayText","selectedSecondaryText","disabledText","disabled","titleButton","overflow","titleInButton","flexShrink","titleStatic","titleButtonPressed","titleTint","picker","pickerSlot","minHeight","grow","flexGrow","pickerItemTint"],"sourceRoot":"../../../src","sources":["calendar/styles.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAKzC;AACA,MAAMC,IAAI,GAAG;EACXC,MAAM,EAAE,CAAC;EACTC,IAAI,EAAE,CAAC;EACPC,QAAQ,EAAE,UAAU;EACpBC,KAAK,EAAE,CAAC;EACRC,GAAG,EAAE;AACP,CAAU;AAIV;AACA,MAAMC,qBAAqB,GAAG,CAAC;;AAE/B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,GAAG;AACtC;AACA,OAAO,MAAMC,qBAAqB,GAAG,CAAC;;AAEtC;AACA,MAAMC,WAAW,GAAG,CAClB,YAAY,EACZ,OAAO,EACP,UAAU,EACV,SAAS,EACT,SAAS,EACT,eAAe,EACf,YAAY;AACZ;AACA,cAAc,EACd,WAAW,CACH;;AAEV;AACA,MAAMC,gBAAgB,GAAG,IAAIC,GAAG,CAAS,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AASnE,OAAO,SAASC,YAAYA,CAACC,KAAiB,EAAE;EAC9C,OAAOd,UAAU,CAACe,MAAM,CAACC,UAAU,CAACC,UAAU,CAACH,KAAK,CAAC,EAAEA,KAAK,CAAC,CAAC;AAChE;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASE,UAAUA,CACjBE,MAAS,EACTJ,KAAiB,EACd;EACH,MAAMK,KAAK,GAAGL,KAAK,CAACM,SAAS,IAAI,CAAC;EAClC,IAAI,EAAEC,MAAM,CAACC,QAAQ,CAACH,KAAK,CAAC,IAAIA,KAAK,GAAG,CAAC,CAAC,EAAE;IAC1C,MAAM,IAAII,UAAU,CAClB,iEAAiEJ,KAAK,EACxE,CAAC;EACH;EACA,MAAM;IAAEK,UAAU;IAAEC;EAAe,CAAC,GAAGX,KAAK;EAC5C,IAAIK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ACnB,CAAC;IACDkC,kBAAkB,EAAE;MAClB5C,eAAe,EAAE5D,KAAK,CAACkE;IACzB,CAAC;IACD;IACAuC,SAAS,EAAE;MACT,GAAGtH,IAAI;MACPyE,eAAe,EAAE5D,KAAK,CAACwE,OAAO;MAC9BiB,OAAO,EAAE;IACX,CAAC;IACDiB,MAAM,EAAE;MACNzB,SAAS,EAAE;IACb,CAAC;IACD0B,UAAU,EAAE;MACV5B,IAAI,EAAE,CAAC;MACPhB,OAAO,EAAE;IACX,CAAC;IACDvB,UAAU,EAAE;MACVqC,UAAU,EAAE,QAAQ;MACpBZ,WAAW,EAAE,aAAa;MAC1BH,YAAY,EAAE9D,KAAK,CAAC0F,MAAM;MAC1BvB,WAAW,EAAE,GAAG;MAChBe,cAAc,EAAE,QAAQ;MACxB0B,SAAS,EAAE,EAAE;MACbR,QAAQ,EAAE,QAAQ;MAClB/B,iBAAiB,EAAE,CAAC;MACpBC,eAAe,EAAE;IACnB,CAAC;IACD;IACAuC,IAAI,EAAE;MACJC,QAAQ,EAAE;IACZ,CAAC;IACDC,cAAc,EAAE;MACd,GAAG5H,IAAI;MACPyE,eAAe,EAAE5D,KAAK,CAACgF,IAAI;MAC3BS,OAAO,EAAE;IACX,CAAC;IACDhD,UAAU,EAAE;MACVgC,KAAK,EAAEzE,KAAK,CAACgF,IAAI;MACjB7D,QAAQ,EAAE,EAAE;MACZI,UAAU,EAAE,KAAK;MACjBF,UAAU,EAAE,EAAE;MACdkE,SAAS,EAAE;IACb;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/** Colors and shape of the calendar. */
|
|
3
|
+
/** Colors, fonts and shape of the calendar. */
|
|
4
4
|
|
|
5
5
|
export const lightTheme = {
|
|
6
6
|
background: '#FFFFFF',
|
|
@@ -9,7 +9,7 @@ export const lightTheme = {
|
|
|
9
9
|
primary: '#0F766E',
|
|
10
10
|
onPrimary: '#FFFFFF',
|
|
11
11
|
today: '#0F766E',
|
|
12
|
-
disabled: '#
|
|
12
|
+
disabled: '#9EA5AF',
|
|
13
13
|
border: '#E3E6EA',
|
|
14
14
|
radius: 12
|
|
15
15
|
};
|
|
@@ -20,7 +20,7 @@ export const darkTheme = {
|
|
|
20
20
|
primary: '#2DD4BF',
|
|
21
21
|
onPrimary: '#042F2C',
|
|
22
22
|
today: '#2DD4BF',
|
|
23
|
-
disabled: '#
|
|
23
|
+
disabled: '#56606B',
|
|
24
24
|
border: '#2A3038',
|
|
25
25
|
radius: 12
|
|
26
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["lightTheme","background","text","textSecondary","primary","onPrimary","today","disabled","border","radius","darkTheme","resolveTheme","theme","colorScheme","system"],"sourceRoot":"../../../src","sources":["calendar/theme.ts"],"mappings":";;AAAA;;
|
|
1
|
+
{"version":3,"names":["lightTheme","background","text","textSecondary","primary","onPrimary","today","disabled","border","radius","darkTheme","resolveTheme","theme","colorScheme","system"],"sourceRoot":"../../../src","sources":["calendar/theme.ts"],"mappings":";;AAAA;;AA4CA,OAAO,MAAMA,UAAsB,GAAG;EACpCC,UAAU,EAAE,SAAS;EACrBC,IAAI,EAAE,SAAS;EACfC,aAAa,EAAE,SAAS;EACxBC,OAAO,EAAE,SAAS;EAClBC,SAAS,EAAE,SAAS;EACpBC,KAAK,EAAE,SAAS;EAChBC,QAAQ,EAAE,SAAS;EACnBC,MAAM,EAAE,SAAS;EACjBC,MAAM,EAAE;AACV,CAAC;AAED,OAAO,MAAMC,SAAqB,GAAG;EACnCT,UAAU,EAAE,SAAS;EACrBC,IAAI,EAAE,SAAS;EACfC,aAAa,EAAE,SAAS;EACxBC,OAAO,EAAE,SAAS;EAClBC,SAAS,EAAE,SAAS;EACpBC,KAAK,EAAE,SAAS;EAChBC,QAAQ,EAAE,SAAS;EACnBC,MAAM,EAAE,SAAS;EACjBC,MAAM,EAAE;AACV,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,YAAYA,CAC1BC,KAAgB,EAChBC,WAAsC,EAC1B;EACZ,MAAMC,MAAM,GAAGD,WAAW,KAAK,MAAM,GAAGH,SAAS,GAAGV,UAAU;EAC9D,IAAIY,KAAK,KAAK,OAAO,EAAE;IACrB,OAAOZ,UAAU;EACnB;EACA,IAAIY,KAAK,KAAK,MAAM,EAAE;IACpB,OAAOF,SAAS;EAClB;EACA,IAAIE,KAAK,KAAK,MAAM,EAAE;IACpB,OAAOE,MAAM;EACf;EACA,OAAO;IAAE,GAAGA,MAAM;IAAE,GAAGF;EAAM,CAAC;AAChC","ignoreList":[]}
|
|
@@ -21,9 +21,35 @@ const MONTH_STARTS = (() => {
|
|
|
21
21
|
return starts;
|
|
22
22
|
})();
|
|
23
23
|
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* First and last epoch day of the Umm al-Qura table (both inclusive). With
|
|
26
|
+
* a Hijri adjustment of `n` days, the supported Gregorian days move by
|
|
27
|
+
* `-n`: see `supportedEpochDays`.
|
|
28
|
+
*/
|
|
25
29
|
export const FIRST_DAY = MONTH_STARTS[0];
|
|
26
30
|
export const LAST_DAY = MONTH_STARTS[MONTH_STARTS.length - 1] - 1;
|
|
31
|
+
|
|
32
|
+
/** The largest Hijri adjustment accepted, in days, in either direction. */
|
|
33
|
+
export const MAX_HIJRI_ADJUSTMENT = 2;
|
|
34
|
+
/**
|
|
35
|
+
* Checks a Hijri adjustment and returns it.
|
|
36
|
+
*
|
|
37
|
+
* @throws {RangeError} unless it is an integer from -2 to 2.
|
|
38
|
+
*/
|
|
39
|
+
export function checkAdjustment(adjustment, caller) {
|
|
40
|
+
if (!Number.isInteger(adjustment) || Math.abs(adjustment) > MAX_HIJRI_ADJUSTMENT) {
|
|
41
|
+
throw new RangeError(`${caller}: the Hijri adjustment must be an integer from ` + `-${MAX_HIJRI_ADJUSTMENT} to ${MAX_HIJRI_ADJUSTMENT}, got ${adjustment}`);
|
|
42
|
+
}
|
|
43
|
+
return adjustment;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** First and last epoch day that have a Hijri date, for an adjustment. */
|
|
47
|
+
export function supportedEpochDays(adjustment = 0) {
|
|
48
|
+
return {
|
|
49
|
+
min: FIRST_DAY - adjustment,
|
|
50
|
+
max: LAST_DAY - adjustment
|
|
51
|
+
};
|
|
52
|
+
}
|
|
27
53
|
function monthIndex(year, month) {
|
|
28
54
|
return (year - UMALQURA_MIN_YEAR) * 12 + (month - 1);
|
|
29
55
|
}
|
|
@@ -35,12 +61,13 @@ function formatIso({
|
|
|
35
61
|
const pad = n => String(n).padStart(2, '0');
|
|
36
62
|
return `${year}-${pad(month)}-${pad(day)}`;
|
|
37
63
|
}
|
|
38
|
-
function supportedRangeText() {
|
|
64
|
+
function supportedRangeText(adjustment) {
|
|
39
65
|
const {
|
|
40
66
|
min,
|
|
41
67
|
max
|
|
42
68
|
} = getSupportedRange();
|
|
43
|
-
|
|
69
|
+
const days = supportedEpochDays(adjustment);
|
|
70
|
+
return `${formatIso(min)} to ${formatIso(max)} AH ` + `(${formatIso(civilFromDays(days.min))} to ` + `${formatIso(civilFromDays(days.max))})`;
|
|
44
71
|
}
|
|
45
72
|
|
|
46
73
|
/** First and last Hijri dates the table covers. */
|
|
@@ -90,14 +117,15 @@ export function isValidHijri(hijri) {
|
|
|
90
117
|
}
|
|
91
118
|
|
|
92
119
|
/**
|
|
93
|
-
* Hijri date of an epoch day. Internal: the
|
|
94
|
-
* `toHijri`.
|
|
120
|
+
* Hijri date of an epoch day, shifted by `adjustment` days. Internal: the
|
|
121
|
+
* public entry point is `toHijri`.
|
|
95
122
|
*
|
|
96
123
|
* @throws {RangeError} if the day is outside the supported range.
|
|
97
124
|
*/
|
|
98
|
-
export function hijriOfEpochDay(epochDay, caller = 'toHijri') {
|
|
99
|
-
|
|
100
|
-
|
|
125
|
+
export function hijriOfEpochDay(epochDay, caller = 'toHijri', adjustment = 0) {
|
|
126
|
+
const tableDay = epochDay + adjustment;
|
|
127
|
+
if (!Number.isInteger(epochDay) || tableDay < FIRST_DAY || tableDay > LAST_DAY) {
|
|
128
|
+
throw new RangeError(`${caller}: ${formatIso(civilFromDays(epochDay))} is outside the ` + `supported range ${supportedRangeText(adjustment)}`);
|
|
101
129
|
}
|
|
102
130
|
|
|
103
131
|
// Last month that starts on or before `epochDay`.
|
|
@@ -105,7 +133,7 @@ export function hijriOfEpochDay(epochDay, caller = 'toHijri') {
|
|
|
105
133
|
let high = MONTH_STARTS.length - 2;
|
|
106
134
|
while (low < high) {
|
|
107
135
|
const mid = low + high + 1 >> 1; // eslint-disable-line no-bitwise
|
|
108
|
-
if (MONTH_STARTS[mid] <=
|
|
136
|
+
if (MONTH_STARTS[mid] <= tableDay) {
|
|
109
137
|
low = mid;
|
|
110
138
|
} else {
|
|
111
139
|
high = mid - 1;
|
|
@@ -114,23 +142,23 @@ export function hijriOfEpochDay(epochDay, caller = 'toHijri') {
|
|
|
114
142
|
return {
|
|
115
143
|
year: UMALQURA_MIN_YEAR + Math.floor(low / 12),
|
|
116
144
|
month: low % 12 + 1,
|
|
117
|
-
day:
|
|
145
|
+
day: tableDay - MONTH_STARTS[low] + 1
|
|
118
146
|
};
|
|
119
147
|
}
|
|
120
148
|
|
|
121
149
|
/**
|
|
122
|
-
* Epoch day of a Hijri date. Internal: the
|
|
123
|
-
* `toGregorian`.
|
|
150
|
+
* Epoch day of a Hijri date, shifted by `adjustment` days. Internal: the
|
|
151
|
+
* public entry point is `toGregorian`.
|
|
124
152
|
*
|
|
125
153
|
* @throws {RangeError} if `hijri` is not a valid date in the supported
|
|
126
154
|
* range.
|
|
127
155
|
*/
|
|
128
|
-
export function epochDayOfHijri(hijri, caller = 'toGregorian') {
|
|
156
|
+
export function epochDayOfHijri(hijri, caller = 'toGregorian', adjustment = 0) {
|
|
129
157
|
if (!isValidHijri(hijri)) {
|
|
130
158
|
const text = typeof hijri === 'object' && hijri !== null ? `${hijri.year}-${hijri.month}-${hijri.day}` : String(hijri);
|
|
131
|
-
throw new RangeError(`${caller}: ${text} is not a valid Hijri date in the supported ` + `range ${supportedRangeText()}`);
|
|
159
|
+
throw new RangeError(`${caller}: ${text} is not a valid Hijri date in the supported ` + `range ${supportedRangeText(adjustment)}`);
|
|
132
160
|
}
|
|
133
|
-
return MONTH_STARTS[monthIndex(hijri.year, hijri.month)] + hijri.day - 1;
|
|
161
|
+
return MONTH_STARTS[monthIndex(hijri.year, hijri.month)] + hijri.day - 1 - adjustment;
|
|
134
162
|
}
|
|
135
163
|
|
|
136
164
|
/**
|
|
@@ -138,13 +166,15 @@ export function epochDayOfHijri(hijri, caller = 'toGregorian') {
|
|
|
138
166
|
* day and the time zone offset are ignored: 23:59 and 00:00 on the same
|
|
139
167
|
* local day give the same result.
|
|
140
168
|
*
|
|
141
|
-
* @throws {RangeError} if `date` is invalid or outside the supported
|
|
169
|
+
* @throws {RangeError} if `date` is invalid or outside the supported
|
|
170
|
+
* range, or the adjustment is not an integer from -2 to 2.
|
|
142
171
|
*/
|
|
143
|
-
export function toHijri(date) {
|
|
172
|
+
export function toHijri(date, options = {}) {
|
|
173
|
+
const adjustment = checkAdjustment(options.adjustment ?? 0, 'toHijri');
|
|
144
174
|
if (!(date instanceof Date) || Number.isNaN(date.getTime())) {
|
|
145
175
|
throw new RangeError('toHijri: expected a valid Date');
|
|
146
176
|
}
|
|
147
|
-
return hijriOfEpochDay(epochDayOfLocalDate(date));
|
|
177
|
+
return hijriOfEpochDay(epochDayOfLocalDate(date), 'toHijri', adjustment);
|
|
148
178
|
}
|
|
149
179
|
|
|
150
180
|
/**
|
|
@@ -152,9 +182,10 @@ export function toHijri(date) {
|
|
|
152
182
|
* Gregorian day.
|
|
153
183
|
*
|
|
154
184
|
* @throws {RangeError} if `hijri` is not a valid date in the supported
|
|
155
|
-
* range.
|
|
185
|
+
* range, or the adjustment is not an integer from -2 to 2.
|
|
156
186
|
*/
|
|
157
|
-
export function toGregorian(hijri) {
|
|
158
|
-
|
|
187
|
+
export function toGregorian(hijri, options = {}) {
|
|
188
|
+
const adjustment = checkAdjustment(options.adjustment ?? 0, 'toGregorian');
|
|
189
|
+
return localDateOfEpochDay(epochDayOfHijri(hijri, 'toGregorian', adjustment));
|
|
159
190
|
}
|
|
160
191
|
//# sourceMappingURL=convert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["civilFromDays","epochDayOfLocalDate","localDateOfEpochDay","UMALQURA_MAX_YEAR","UMALQURA_MIN_YEAR","UMALQURA_MONTH_LENGTH_MASKS","UMALQURA_START_EPOCH_DAY","MONTH_STARTS","starts","epochDay","mask","month","push","FIRST_DAY","LAST_DAY","length","
|
|
1
|
+
{"version":3,"names":["civilFromDays","epochDayOfLocalDate","localDateOfEpochDay","UMALQURA_MAX_YEAR","UMALQURA_MIN_YEAR","UMALQURA_MONTH_LENGTH_MASKS","UMALQURA_START_EPOCH_DAY","MONTH_STARTS","starts","epochDay","mask","month","push","FIRST_DAY","LAST_DAY","length","MAX_HIJRI_ADJUSTMENT","checkAdjustment","adjustment","caller","Number","isInteger","Math","abs","RangeError","supportedEpochDays","min","max","monthIndex","year","formatIso","day","pad","n","String","padStart","supportedRangeText","getSupportedRange","days","getHijriMonthLength","index","isValidHijri","hijri","hijriOfEpochDay","tableDay","low","high","mid","floor","epochDayOfHijri","text","toHijri","date","options","Date","isNaN","getTime","toGregorian"],"sourceRoot":"../../../src","sources":["core/convert.ts"],"mappings":";;AAAA,SACEA,aAAa,EACbC,mBAAmB,EACnBC,mBAAmB,QACd,WAAQ;AAEf,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,2BAA2B,EAC3BC,wBAAwB,QACnB,oBAAiB;;AAExB;AACA;AACA;AACA;AACA;AACA,MAAMC,YAA+B,GAAG,CAAC,MAAM;EAC7C,MAAMC,MAAM,GAAG,CAACF,wBAAwB,CAAC;EACzC,IAAIG,QAAQ,GAAGH,wBAAwB;EACvC,KAAK,MAAMI,IAAI,IAAIL,2BAA2B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,8CAA8C,GAC9D,SAASd,kBAAkB,CAAClB,UAAU,CAAC,EAC3C,CAAC;EACH;EACA,OACEX,YAAY,CAACqB,UAAU,CAACc,KAAK,CAACb,IAAI,EAAEa,KAAK,CAAC/B,KAAK,CAAC,CAAC,GACjD+B,KAAK,CAACX,GAAG,GACT,CAAC,GACDb,UAAU;AAEd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASiC,OAAOA,CACrBC,IAAU,EACVC,OAA+B,GAAG,CAAC,CAAC,EACzB;EACX,MAAMnC,UAAU,GAAGD,eAAe,CAACoC,OAAO,CAACnC,UAAU,IAAI,CAAC,EAAE,SAAS,CAAC;EACtE,IAAI,EAAEkC,IAAI,YAAYE,IAAI,CAAC,IAAIlC,MAAM,CAACmC,KAAK,CAACH,IAAI,CAACI,OAAO,CAAC,CAAC,CAAC,EAAE;IAC3D,MAAM,IAAIhC,UAAU,CAAC,gCAAgC,CAAC;EACxD;EACA,OAAOmB,eAAe,CAAC1C,mBAAmB,CAACmD,IAAI,CAAC,EAAE,SAAS,EAAElC,UAAU,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASuC,WAAWA,CACzBf,KAAgB,EAChBW,OAA+B,GAAG,CAAC,CAAC,EAC9B;EACN,MAAMnC,UAAU,GAAGD,eAAe,CAACoC,OAAO,CAACnC,UAAU,IAAI,CAAC,EAAE,aAAa,CAAC;EAC1E,OAAOhB,mBAAmB,CAAC+C,eAAe,CAACP,KAAK,EAAE,aAAa,EAAExB,UAAU,CAAC,CAAC;AAC/E","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getHijriMonthLength","getSupportedRange","isValidHijri","toGregorian","toHijri","formatHijri","getMonthNames","getWeekdayNames","toArabicDigits"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;AAAA,SACEA,mBAAmB,EACnBC,iBAAiB,EACjBC,YAAY,EACZC,WAAW,EACXC,OAAO,
|
|
1
|
+
{"version":3,"names":["getHijriMonthLength","getSupportedRange","isValidHijri","toGregorian","toHijri","formatHijri","getMonthNames","getWeekdayNames","toArabicDigits"],"sourceRoot":"../../../src","sources":["core/index.ts"],"mappings":";;AAAA,SACEA,mBAAmB,EACnBC,iBAAiB,EACjBC,YAAY,EACZC,WAAW,EACXC,OAAO,QAEF,cAAW;AAClB,SAASC,WAAW,QAAiC,aAAU;AAC/D,SACEC,aAAa,EACbC,eAAe,EACfC,cAAc,QAKT,aAAU","ignoreList":[]}
|
|
@@ -16,11 +16,14 @@ const GREGORIAN_MONTHS = {
|
|
|
16
16
|
const WEEKDAYS = {
|
|
17
17
|
ar: {
|
|
18
18
|
long: ['الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'],
|
|
19
|
-
short: ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت']
|
|
19
|
+
short: ['أحد', 'اثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت'],
|
|
20
|
+
// The same letters as ICU's narrow format.
|
|
21
|
+
narrow: ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س']
|
|
20
22
|
},
|
|
21
23
|
en: {
|
|
22
24
|
long: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
|
23
|
-
short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
|
25
|
+
short: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
26
|
+
narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
|
|
24
27
|
}
|
|
25
28
|
};
|
|
26
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HIJRI_MONTHS","ar","en","GREGORIAN_MONTHS","WEEKDAYS","long","short","getMonthNames","calendar","locale","names","getWeekdayNames","format","ARABIC_INDIC_ZERO","toArabicDigits","input","String","replace","digit","fromCharCode","Number","defaultDigits","formatNumber","value","digits"],"sourceRoot":"../../../src","sources":["core/locale.ts"],"mappings":";;AAKA,MAAMA,YAA+C,GAAG;EACtDC,EAAE,EAAE,CACF,MAAM,EACN,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,WAAW,EACX,UAAU,CACX;EACDC,EAAE,EAAE,CACF,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAS,EACT,eAAe,EACf,eAAe;AAEnB,CAAC;;AAED;AACA;AACA,MAAMC,gBAAmD,GAAG;EAC1DF,EAAE,EAAE,CACF,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,CACT;EACDC,EAAE,EAAE,CACF,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU;AAEd,CAAC;;AAED;AACA,MAAME,QAAkE,GAAG;EACzEH,EAAE,EAAE;IACFI,IAAI,EAAE,CACJ,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,OAAO,CACR;IACDC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;
|
|
1
|
+
{"version":3,"names":["HIJRI_MONTHS","ar","en","GREGORIAN_MONTHS","WEEKDAYS","long","short","narrow","getMonthNames","calendar","locale","names","getWeekdayNames","format","ARABIC_INDIC_ZERO","toArabicDigits","input","String","replace","digit","fromCharCode","Number","defaultDigits","formatNumber","value","digits"],"sourceRoot":"../../../src","sources":["core/locale.ts"],"mappings":";;AAKA,MAAMA,YAA+C,GAAG;EACtDC,EAAE,EAAE,CACF,MAAM,EACN,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,EACN,WAAW,EACX,UAAU,CACX;EACDC,EAAE,EAAE,CACF,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAS,EACT,eAAe,EACf,eAAe;AAEnB,CAAC;;AAED;AACA;AACA,MAAMC,gBAAmD,GAAG;EAC1DF,EAAE,EAAE,CACF,OAAO,EACP,QAAQ,EACR,MAAM,EACN,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,CACT;EACDC,EAAE,EAAE,CACF,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU;AAEd,CAAC;;AAED;AACA,MAAME,QAAkE,GAAG;EACzEH,EAAE,EAAE;IACFI,IAAI,EAAE,CACJ,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,OAAO,CACR;IACDC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;IAClE;IACAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;EAC5C,CAAC;EACDL,EAAE,EAAE;IACFG,IAAI,EAAE,CACJ,QAAQ,EACR,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[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type LayoutChangeEvent, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
type AppearProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Fade and zoom in on mount. False renders a plain View. Read once, on
|
|
6
|
+
* mount, so the content never remounts when it changes.
|
|
7
|
+
*/
|
|
8
|
+
animate: boolean;
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
onLayout?: (event: LayoutChangeEvent) => void;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Fades its content in with a slight zoom when it mounts, so switching
|
|
15
|
+
* between the days and the month or year picker is not an abrupt jump.
|
|
16
|
+
* Give it a new `key` to play it again.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Appear({ animate, style, onLayout, children }: AppearProps): import("react").JSX.Element;
|
|
19
|
+
/** Whether the user asked the system to reduce motion. */
|
|
20
|
+
export declare function useReduceMotion(): boolean;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=Appear.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Appear.d.ts","sourceRoot":"","sources":["../../../../src/calendar/Appear.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAML,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAMtB,KAAK,WAAW,GAAG;IACjB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,WAAW,+BAwCzE;AAED,0DAA0D;AAC1D,wBAAgB,eAAe,YAkB9B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import type { RangePosition } from './range.js';
|
|
2
3
|
import type { CalendarStyles } from './styles.js';
|
|
3
4
|
export type DayCellProps = {
|
|
4
5
|
epochDay: number;
|
|
@@ -6,10 +7,16 @@ export type DayCellProps = {
|
|
|
6
7
|
secondaryLabel: string | null;
|
|
7
8
|
accessibilityLabel: string;
|
|
8
9
|
selected: boolean;
|
|
10
|
+
/** Where the day sits in a picked range, or null outside one. */
|
|
11
|
+
rangePosition: RangePosition | null;
|
|
12
|
+
/** The side of the cell where the next day is: 'start' or 'end'. */
|
|
13
|
+
nextSide: 'start' | 'end';
|
|
9
14
|
today: boolean;
|
|
10
15
|
disabled: boolean;
|
|
11
16
|
styles: CalendarStyles;
|
|
12
17
|
dayStyle: StyleProp<ViewStyle>;
|
|
18
|
+
/** maxFontSizeMultiplier of the texts. */
|
|
19
|
+
maxFontScale: number;
|
|
13
20
|
onSelect: (epochDay: number) => void;
|
|
14
21
|
};
|
|
15
22
|
/**
|
|
@@ -17,6 +24,6 @@ export type DayCellProps = {
|
|
|
17
24
|
* stable by the calendar, so pressing a day only re-renders the old and
|
|
18
25
|
* the new selected day.
|
|
19
26
|
*/
|
|
20
|
-
export declare function DayCellView({ epochDay, label, secondaryLabel, accessibilityLabel, selected, today, disabled, styles, dayStyle, onSelect, }: DayCellProps): import("react").JSX.Element;
|
|
27
|
+
export declare function DayCellView({ epochDay, label, secondaryLabel, accessibilityLabel, selected, rangePosition, nextSide, today, disabled, styles, dayStyle, maxFontScale, onSelect, }: DayCellProps): import("react").JSX.Element;
|
|
21
28
|
export declare const DayCell: import("react").MemoExoticComponent<typeof DayCellView>;
|
|
22
29
|
//# sourceMappingURL=DayCell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DayCell.d.ts","sourceRoot":"","sources":["../../../../src/calendar/DayCell.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAU,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/B,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,GACT,EAAE,YAAY,+
|
|
1
|
+
{"version":3,"file":"DayCell.d.ts","sourceRoot":"","sources":["../../../../src/calendar/DayCell.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAU,CAAC;AAE/C,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAA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