@tesouro/embedded-components-loader 0.11.309 → 0.11.311
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/dist/index.js +1 -1
- package/dist/react/index.d.ts +2450 -1
- package/dist/react/lib/ReceivablesWidget.d.ts +2450 -1
- package/dist/react/lib/WidgetSuite.d.ts +2450 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo } from 'react';
|
|
2
|
+
import React__default, { HTMLAttributes, ButtonHTMLAttributes, SelectHTMLAttributes, TableHTMLAttributes, MouseEventHandler, OptionHTMLAttributes, Ref, ThHTMLAttributes, CSSProperties, ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
@@ -907,6 +907,2453 @@ declare type FallbackProps = {
|
|
|
907
907
|
resetErrorBoundary: (...args: unknown[]) => void;
|
|
908
908
|
};
|
|
909
909
|
|
|
910
|
+
/**
|
|
911
|
+
* The locale object with all functions and data needed to parse and format
|
|
912
|
+
* dates. This is what each locale implements and exports.
|
|
913
|
+
*/
|
|
914
|
+
interface Locale {
|
|
915
|
+
/** The locale code (ISO 639-1 + optional country code) */
|
|
916
|
+
code: string;
|
|
917
|
+
/** The function to format distance */
|
|
918
|
+
formatDistance: FormatDistanceFn;
|
|
919
|
+
/** The function to relative time */
|
|
920
|
+
formatRelative: FormatRelativeFn;
|
|
921
|
+
/** The object with functions used to localize various values */
|
|
922
|
+
localize: Localize;
|
|
923
|
+
/** The object with functions that return localized formats */
|
|
924
|
+
formatLong: FormatLong;
|
|
925
|
+
/** The object with functions used to match and parse various localized values */
|
|
926
|
+
match: Match;
|
|
927
|
+
/** An object with locale options */
|
|
928
|
+
options?: LocaleOptions;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* The locale options.
|
|
932
|
+
*/
|
|
933
|
+
interface LocaleOptions
|
|
934
|
+
extends WeekOptions,
|
|
935
|
+
FirstWeekContainsDateOptions {}
|
|
936
|
+
/**
|
|
937
|
+
* The function that takes a token (i.e. halfAMinute) passed by `formatDistance`
|
|
938
|
+
* or `formatDistanceStrict` and payload, and returns localized distance.
|
|
939
|
+
*
|
|
940
|
+
* @param token - The token to localize
|
|
941
|
+
* @param count - The distance number
|
|
942
|
+
* @param options - The object with options
|
|
943
|
+
*
|
|
944
|
+
* @returns The localized distance in words
|
|
945
|
+
*/
|
|
946
|
+
type FormatDistanceFn = (
|
|
947
|
+
token: FormatDistanceToken,
|
|
948
|
+
count: number,
|
|
949
|
+
options?: FormatDistanceFnOptions,
|
|
950
|
+
) => string;
|
|
951
|
+
/**
|
|
952
|
+
* The {@link FormatDistanceFn} function options.
|
|
953
|
+
*/
|
|
954
|
+
interface FormatDistanceFnOptions {
|
|
955
|
+
/** Add "X ago"/"in X" in the locale language */
|
|
956
|
+
addSuffix?: boolean;
|
|
957
|
+
/** The distance vector. -1 represents past and 1 future. Tells which suffix
|
|
958
|
+
* to use. */
|
|
959
|
+
comparison?: -1 | 0 | 1;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* The token used in the format distance function. Represents the distance unit
|
|
963
|
+
* with prespecified precision.
|
|
964
|
+
*/
|
|
965
|
+
type FormatDistanceToken =
|
|
966
|
+
| "lessThanXSeconds"
|
|
967
|
+
| "xSeconds"
|
|
968
|
+
| "halfAMinute"
|
|
969
|
+
| "lessThanXMinutes"
|
|
970
|
+
| "xMinutes"
|
|
971
|
+
| "aboutXHours"
|
|
972
|
+
| "xHours"
|
|
973
|
+
| "xDays"
|
|
974
|
+
| "aboutXWeeks"
|
|
975
|
+
| "xWeeks"
|
|
976
|
+
| "aboutXMonths"
|
|
977
|
+
| "xMonths"
|
|
978
|
+
| "aboutXYears"
|
|
979
|
+
| "xYears"
|
|
980
|
+
| "overXYears"
|
|
981
|
+
| "almostXYears";
|
|
982
|
+
/**
|
|
983
|
+
* The locale function that does the work for the `formatRelative` function.
|
|
984
|
+
*
|
|
985
|
+
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
986
|
+
*
|
|
987
|
+
* @param token - The token to localize
|
|
988
|
+
* @param date - The date to format
|
|
989
|
+
* @param baseDate - The date to compare with
|
|
990
|
+
* @param options - The object with options
|
|
991
|
+
*
|
|
992
|
+
* @returns The localized relative date format
|
|
993
|
+
*/
|
|
994
|
+
type FormatRelativeFn = <DateType extends Date>(
|
|
995
|
+
token: FormatRelativeToken,
|
|
996
|
+
date: DateType,
|
|
997
|
+
baseDate: DateType,
|
|
998
|
+
options?: FormatRelativeFnOptions,
|
|
999
|
+
) => string;
|
|
1000
|
+
/**
|
|
1001
|
+
* The {@link FormatRelativeFn} function options.
|
|
1002
|
+
*/
|
|
1003
|
+
interface FormatRelativeFnOptions
|
|
1004
|
+
extends WeekOptions,
|
|
1005
|
+
LocalizedOptions<"options" | "formatRelative"> {}
|
|
1006
|
+
/**
|
|
1007
|
+
* The token used in format relative function. Represents the time unit.
|
|
1008
|
+
*/
|
|
1009
|
+
type FormatRelativeToken =
|
|
1010
|
+
| "lastWeek"
|
|
1011
|
+
| "yesterday"
|
|
1012
|
+
| "today"
|
|
1013
|
+
| "tomorrow"
|
|
1014
|
+
| "nextWeek"
|
|
1015
|
+
| "other";
|
|
1016
|
+
/**
|
|
1017
|
+
* A format part that represents a token or string literal, used by format parser/tokenizer
|
|
1018
|
+
*/
|
|
1019
|
+
interface FormatPart {
|
|
1020
|
+
/** If the part is a format token. */
|
|
1021
|
+
isToken: boolean;
|
|
1022
|
+
/** The format part value (i.e. `"do"`). */
|
|
1023
|
+
value: string;
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* The object with functions used to localize various values. Part of the public
|
|
1027
|
+
* locale API.
|
|
1028
|
+
*/
|
|
1029
|
+
interface Localize {
|
|
1030
|
+
/** The function that localizes an ordinal number */
|
|
1031
|
+
ordinalNumber: LocalizeFn<number>;
|
|
1032
|
+
/** The function that localized the era */
|
|
1033
|
+
era: LocalizeFn<Era>;
|
|
1034
|
+
/** The function that localizes the quarter */
|
|
1035
|
+
quarter: LocalizeFn<Quarter>;
|
|
1036
|
+
/** The function that localizes the month */
|
|
1037
|
+
month: LocalizeFn<Month$1>;
|
|
1038
|
+
/** The function that localizes the day of the week */
|
|
1039
|
+
day: LocalizeFn<Day$1>;
|
|
1040
|
+
/** The function that localizes the day period */
|
|
1041
|
+
dayPeriod: LocalizeFn<LocaleDayPeriod>;
|
|
1042
|
+
/** The function that can preprocess parts/tokens **/
|
|
1043
|
+
preprocessor?: <DateType extends Date>(
|
|
1044
|
+
date: DateType,
|
|
1045
|
+
parts: FormatPart[],
|
|
1046
|
+
) => FormatPart[];
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Individual localize function. Part of {@link Localize}.
|
|
1050
|
+
*
|
|
1051
|
+
* @typeParam Value - The value type to localize.
|
|
1052
|
+
*
|
|
1053
|
+
* @param value - The value to localize
|
|
1054
|
+
* @param options - The object with options
|
|
1055
|
+
*
|
|
1056
|
+
* @returns The localized string
|
|
1057
|
+
*/
|
|
1058
|
+
type LocalizeFn<Value extends LocaleUnitValue | number> = (
|
|
1059
|
+
value: Value,
|
|
1060
|
+
options?: LocalizeFnOptions,
|
|
1061
|
+
) => string;
|
|
1062
|
+
/**
|
|
1063
|
+
* The {@link LocalizeFn} function options.
|
|
1064
|
+
*/
|
|
1065
|
+
interface LocalizeFnOptions {
|
|
1066
|
+
/** The width to use formatting the value, defines how short or long
|
|
1067
|
+
* the formatted string might be. */
|
|
1068
|
+
width?: LocaleWidth;
|
|
1069
|
+
/** The context where the formatted value is used - standalone: the result
|
|
1070
|
+
* should make grammatical sense as is and formatting: the result is a part
|
|
1071
|
+
* of the formatted string. See: https://date-fns.org/docs/I18n-Contribution-Guide */
|
|
1072
|
+
context?: "formatting" | "standalone";
|
|
1073
|
+
/** The unit to format */
|
|
1074
|
+
unit?: LocaleUnit;
|
|
1075
|
+
}
|
|
1076
|
+
/**
|
|
1077
|
+
* The object with functions used to match and parse various localized values.
|
|
1078
|
+
*/
|
|
1079
|
+
interface Match {
|
|
1080
|
+
/** The function that parses a localized ordinal number. */
|
|
1081
|
+
ordinalNumber: MatchFn<
|
|
1082
|
+
number,
|
|
1083
|
+
{
|
|
1084
|
+
unit: LocaleUnit;
|
|
1085
|
+
}
|
|
1086
|
+
>;
|
|
1087
|
+
/** The function that parses a localized era. */
|
|
1088
|
+
era: MatchFn<Era>;
|
|
1089
|
+
/** The function that parses a localized quarter. */
|
|
1090
|
+
quarter: MatchFn<Quarter>;
|
|
1091
|
+
/** The function that parses a localized month. */
|
|
1092
|
+
month: MatchFn<Month$1>;
|
|
1093
|
+
/** The function that parses a localized day of the week. */
|
|
1094
|
+
day: MatchFn<Day$1>;
|
|
1095
|
+
/** The function that parses a localized time of the day. */
|
|
1096
|
+
dayPeriod: MatchFn<LocaleDayPeriod>;
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* The match function. Part of {@link Match}. Implements matcher for particular
|
|
1100
|
+
* unit type.
|
|
1101
|
+
*
|
|
1102
|
+
* @typeParam Result - The matched value type.
|
|
1103
|
+
* @typeParam ExtraOptions - The the extra options type.
|
|
1104
|
+
*
|
|
1105
|
+
* @param str - The string to match
|
|
1106
|
+
* @param options - The object with options
|
|
1107
|
+
*
|
|
1108
|
+
* @returns The match result or null if match failed
|
|
1109
|
+
*/
|
|
1110
|
+
type MatchFn<Result, ExtraOptions = Record<string, unknown>> = (
|
|
1111
|
+
str: string,
|
|
1112
|
+
options?: MatchFnOptions<Result> & ExtraOptions,
|
|
1113
|
+
) => MatchFnResult<Result> | null;
|
|
1114
|
+
/**
|
|
1115
|
+
* The {@link MatchFn} function options.
|
|
1116
|
+
*
|
|
1117
|
+
* @typeParam Result - The matched value type.
|
|
1118
|
+
*/
|
|
1119
|
+
interface MatchFnOptions<Result> {
|
|
1120
|
+
/** The width to use matching the value, defines how short or long
|
|
1121
|
+
* the matched string might be. */
|
|
1122
|
+
width?: LocaleWidth;
|
|
1123
|
+
/**
|
|
1124
|
+
* @deprecated Map the value manually instead.
|
|
1125
|
+
* @example
|
|
1126
|
+
* const matchResult = locale.match.ordinalNumber('1st')
|
|
1127
|
+
* if (matchResult) {
|
|
1128
|
+
* matchResult.value = valueCallback(matchResult.value)
|
|
1129
|
+
* }
|
|
1130
|
+
*/
|
|
1131
|
+
valueCallback?: MatchValueCallback<string, Result>;
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* The function that allows to map the matched value to the actual type.
|
|
1135
|
+
*
|
|
1136
|
+
* @typeParam Arg - The argument type.
|
|
1137
|
+
* @typeParam Result - The matched value type.
|
|
1138
|
+
*
|
|
1139
|
+
* @param arg - The value to match
|
|
1140
|
+
*
|
|
1141
|
+
* @returns The matched value
|
|
1142
|
+
*/
|
|
1143
|
+
type MatchValueCallback<Arg, Result> = (value: Arg) => Result;
|
|
1144
|
+
/**
|
|
1145
|
+
* The {@link MatchFn} function result.
|
|
1146
|
+
*
|
|
1147
|
+
* @typeParam Result - The matched value type.
|
|
1148
|
+
*/
|
|
1149
|
+
interface MatchFnResult<Result> {
|
|
1150
|
+
/** The matched value parsed as the corresponding unit type */
|
|
1151
|
+
value: Result;
|
|
1152
|
+
/** The remaining string after parsing */
|
|
1153
|
+
rest: string;
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* The object with functions that return localized formats. Long stands for
|
|
1157
|
+
* sequence of tokens (i.e. PPpp) that allows to define how format both date
|
|
1158
|
+
* and time at once. Part of the public locale API.
|
|
1159
|
+
*/
|
|
1160
|
+
interface FormatLong {
|
|
1161
|
+
/** The function that returns a localized long date format */
|
|
1162
|
+
date: FormatLongFn;
|
|
1163
|
+
/** The function that returns a localized long time format */
|
|
1164
|
+
time: FormatLongFn;
|
|
1165
|
+
/** The function that returns a localized format of date and time combined */
|
|
1166
|
+
dateTime: FormatLongFn;
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* The format long function. Formats date, time or both.
|
|
1170
|
+
*
|
|
1171
|
+
* @param options - The object with options
|
|
1172
|
+
*
|
|
1173
|
+
* @returns The localized string
|
|
1174
|
+
*/
|
|
1175
|
+
type FormatLongFn = (options: FormatLongFnOptions) => string;
|
|
1176
|
+
/**
|
|
1177
|
+
* The {@link FormatLongFn} function options.
|
|
1178
|
+
*/
|
|
1179
|
+
interface FormatLongFnOptions {
|
|
1180
|
+
/** Format width to set */
|
|
1181
|
+
width?: FormatLongWidth;
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* The format long width token, defines how short or long the formnatted value
|
|
1185
|
+
* might be. The actual result length is defined by the locale.
|
|
1186
|
+
*/
|
|
1187
|
+
type FormatLongWidth = "full" | "long" | "medium" | "short" | "any";
|
|
1188
|
+
/**
|
|
1189
|
+
* The formatting unit value, represents the raw value that can be formatted.
|
|
1190
|
+
*/
|
|
1191
|
+
type LocaleUnitValue = Era | Quarter | Month$1 | Day$1 | LocaleDayPeriod;
|
|
1192
|
+
/**
|
|
1193
|
+
* The format width. Defines how short or long the formatted string might be.
|
|
1194
|
+
* The actual result length depends on the locale.
|
|
1195
|
+
*/
|
|
1196
|
+
type LocaleWidth = "narrow" | "short" | "abbreviated" | "wide" | "any";
|
|
1197
|
+
/**
|
|
1198
|
+
* Token representing particular period of the day.
|
|
1199
|
+
*/
|
|
1200
|
+
type LocaleDayPeriod =
|
|
1201
|
+
| "am"
|
|
1202
|
+
| "pm"
|
|
1203
|
+
| "midnight"
|
|
1204
|
+
| "noon"
|
|
1205
|
+
| "morning"
|
|
1206
|
+
| "afternoon"
|
|
1207
|
+
| "evening"
|
|
1208
|
+
| "night";
|
|
1209
|
+
/**
|
|
1210
|
+
* The units commonly used in the date formatting or parsing.
|
|
1211
|
+
*/
|
|
1212
|
+
type LocaleUnit =
|
|
1213
|
+
| "second"
|
|
1214
|
+
| "minute"
|
|
1215
|
+
| "hour"
|
|
1216
|
+
| "day"
|
|
1217
|
+
| "dayOfYear"
|
|
1218
|
+
| "date"
|
|
1219
|
+
| "week"
|
|
1220
|
+
| "month"
|
|
1221
|
+
| "quarter"
|
|
1222
|
+
| "year";
|
|
1223
|
+
|
|
1224
|
+
/**
|
|
1225
|
+
* The argument type.
|
|
1226
|
+
*/
|
|
1227
|
+
type DateArg<DateType extends Date> = DateType | number | string;
|
|
1228
|
+
/**
|
|
1229
|
+
* An object that combines two dates to represent the time interval.
|
|
1230
|
+
*
|
|
1231
|
+
* @typeParam StartDate - The start `Date` type.
|
|
1232
|
+
* @typeParam EndDate - The end `Date` type.
|
|
1233
|
+
*/
|
|
1234
|
+
interface Interval<
|
|
1235
|
+
StartType extends DateArg<Date> = DateArg<Date>,
|
|
1236
|
+
EndType extends DateArg<Date> = DateArg<Date>,
|
|
1237
|
+
> {
|
|
1238
|
+
/** The start of the interval. */
|
|
1239
|
+
start: StartType;
|
|
1240
|
+
/** The end of the interval. */
|
|
1241
|
+
end: EndType;
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* The era. Can be either 0 (AD - Anno Domini) or 1 (BC - Before Christ).
|
|
1245
|
+
*/
|
|
1246
|
+
type Era = 0 | 1;
|
|
1247
|
+
/**
|
|
1248
|
+
* The year quarter. Goes from 1 to 4.
|
|
1249
|
+
*/
|
|
1250
|
+
type Quarter = 1 | 2 | 3 | 4;
|
|
1251
|
+
/**
|
|
1252
|
+
* The day of the week type alias. Unlike the date (the number of days since
|
|
1253
|
+
* the beginning of the month), which begins with 1 and is dynamic (can go up to
|
|
1254
|
+
* 28, 30, or 31), the day starts with 0 and static (always ends at 6). Look at
|
|
1255
|
+
* it as an index in an array where Sunday is the first element and Saturday
|
|
1256
|
+
* is the last.
|
|
1257
|
+
*/
|
|
1258
|
+
type Day$1 = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
1259
|
+
/**
|
|
1260
|
+
* The month type alias. Goes from 0 to 11, where 0 is January and 11 is
|
|
1261
|
+
* December.
|
|
1262
|
+
*/
|
|
1263
|
+
type Month$1 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
|
|
1264
|
+
/**
|
|
1265
|
+
* FirstWeekContainsDate is used to determine which week is the first week of
|
|
1266
|
+
* the year, based on what day the January, 1 is in that week.
|
|
1267
|
+
*
|
|
1268
|
+
* The day in that week can only be 1 (Monday) or 4 (Thursday).
|
|
1269
|
+
*
|
|
1270
|
+
* Please see https://en.wikipedia.org/wiki/Week#The_ISO_week_date_system for more information.
|
|
1271
|
+
*/
|
|
1272
|
+
type FirstWeekContainsDate = 1 | 4;
|
|
1273
|
+
/**
|
|
1274
|
+
* The week function options. Used to build function options.
|
|
1275
|
+
*/
|
|
1276
|
+
interface WeekOptions {
|
|
1277
|
+
/** Which day the week starts on. */
|
|
1278
|
+
weekStartsOn?: Day$1;
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* The first week contains date options. Used to build function options.
|
|
1282
|
+
*/
|
|
1283
|
+
interface FirstWeekContainsDateOptions {
|
|
1284
|
+
/** See {@link FirstWeekContainsDate} for more details. */
|
|
1285
|
+
firstWeekContainsDate?: FirstWeekContainsDate;
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* The localized function options. Used to build function options.
|
|
1289
|
+
*
|
|
1290
|
+
* @typeParam LocaleFields - The locale fields used in the relevant function. Defines the minimum set of locale fields that must be provided.
|
|
1291
|
+
*/
|
|
1292
|
+
interface LocalizedOptions<LocaleFields extends keyof Locale> {
|
|
1293
|
+
/** The locale to use in the function. */
|
|
1294
|
+
locale?: Pick<Locale, LocaleFields>;
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Additional tokens options. Used to build function options.
|
|
1298
|
+
*/
|
|
1299
|
+
interface AdditionalTokensOptions {
|
|
1300
|
+
/** If true, allows usage of the week-numbering year tokens `YY` and `YYYY`.
|
|
1301
|
+
* See: https://date-fns.org/docs/Unicode-Tokens */
|
|
1302
|
+
useAdditionalWeekYearTokens?: boolean;
|
|
1303
|
+
/** If true, allows usage of the day of year tokens `D` and `DD`.
|
|
1304
|
+
* See: https://date-fns.org/docs/Unicode-Tokens */
|
|
1305
|
+
useAdditionalDayOfYearTokens?: boolean;
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* The context options. Used to build function options.
|
|
1309
|
+
*/
|
|
1310
|
+
interface ContextOptions<DateType extends Date> {
|
|
1311
|
+
/**
|
|
1312
|
+
* The context to use in the function. It allows to normalize the arguments
|
|
1313
|
+
* to a specific date instance, which is useful for extensions like [`TZDate`](https://github.com/date-fns/tz).
|
|
1314
|
+
*/
|
|
1315
|
+
in?: ContextFn<DateType> | undefined;
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
/**
|
|
1319
|
+
* The context function type. It's used to normalize the input arguments to
|
|
1320
|
+
* a specific date instance, which is useful for extensions like [`TZDate`](https://github.com/date-fns/tz).
|
|
1321
|
+
*/
|
|
1322
|
+
type ContextFn<DateType extends Date> = (
|
|
1323
|
+
value: DateArg<Date> & {},
|
|
1324
|
+
) => DateType;
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* The {@link endOfWeek} function options.
|
|
1328
|
+
*/
|
|
1329
|
+
interface EndOfWeekOptions<DateType extends Date = Date>
|
|
1330
|
+
extends WeekOptions,
|
|
1331
|
+
LocalizedOptions<"options">,
|
|
1332
|
+
ContextOptions<DateType> {}
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* The {@link format} function options.
|
|
1336
|
+
*/
|
|
1337
|
+
interface FormatOptions
|
|
1338
|
+
extends LocalizedOptions<"options" | "localize" | "formatLong">,
|
|
1339
|
+
WeekOptions,
|
|
1340
|
+
FirstWeekContainsDateOptions,
|
|
1341
|
+
AdditionalTokensOptions,
|
|
1342
|
+
ContextOptions<Date> {}
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* The {@link getMonth} function options.
|
|
1346
|
+
*/
|
|
1347
|
+
interface GetMonthOptions extends ContextOptions<Date> {}
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* The {@link getWeek} function options.
|
|
1351
|
+
*/
|
|
1352
|
+
interface GetWeekOptions
|
|
1353
|
+
extends LocalizedOptions<"options">,
|
|
1354
|
+
WeekOptions,
|
|
1355
|
+
FirstWeekContainsDateOptions,
|
|
1356
|
+
ContextOptions<Date> {}
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* The {@link getYear} function options.
|
|
1360
|
+
*/
|
|
1361
|
+
interface GetYearOptions extends ContextOptions<Date> {}
|
|
1362
|
+
|
|
1363
|
+
/**
|
|
1364
|
+
* The {@link startOfWeek} function options.
|
|
1365
|
+
*/
|
|
1366
|
+
interface StartOfWeekOptions<DateType extends Date = Date>
|
|
1367
|
+
extends LocalizedOptions<"options">,
|
|
1368
|
+
WeekOptions,
|
|
1369
|
+
ContextOptions<DateType> {}
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Render the label in the month caption.
|
|
1373
|
+
*
|
|
1374
|
+
* @group Components
|
|
1375
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
1376
|
+
*/
|
|
1377
|
+
declare function CaptionLabel(props: HTMLAttributes<HTMLSpanElement>): React__default.JSX.Element;
|
|
1378
|
+
|
|
1379
|
+
/**
|
|
1380
|
+
* Render the chevron icon used in the navigation buttons and dropdowns.
|
|
1381
|
+
*
|
|
1382
|
+
* @group Components
|
|
1383
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
1384
|
+
*/
|
|
1385
|
+
declare function Chevron(props: {
|
|
1386
|
+
className?: string;
|
|
1387
|
+
style?: React__default.CSSProperties;
|
|
1388
|
+
/**
|
|
1389
|
+
* The size of the chevron.
|
|
1390
|
+
*
|
|
1391
|
+
* @defaultValue 24
|
|
1392
|
+
*/
|
|
1393
|
+
size?: number;
|
|
1394
|
+
/** Set to `true` to disable the chevron. */
|
|
1395
|
+
disabled?: boolean;
|
|
1396
|
+
/** The orientation of the chevron. */
|
|
1397
|
+
orientation?: "up" | "down" | "left" | "right";
|
|
1398
|
+
}): React__default.JSX.Element;
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* The props for the `<DayPicker />` component.
|
|
1402
|
+
*
|
|
1403
|
+
* @group DayPicker
|
|
1404
|
+
*/
|
|
1405
|
+
type DayPickerProps = PropsBase & (PropsSingle | PropsSingleRequired | PropsMulti | PropsMultiRequired | PropsRange | PropsRangeRequired | {
|
|
1406
|
+
mode?: undefined;
|
|
1407
|
+
required?: undefined;
|
|
1408
|
+
});
|
|
1409
|
+
/**
|
|
1410
|
+
* Props for customizing the calendar, handling localization, and managing
|
|
1411
|
+
* events. These exclude the selection mode props.
|
|
1412
|
+
*
|
|
1413
|
+
* @group DayPicker
|
|
1414
|
+
* @see https://daypicker.dev/api/interfaces/PropsBase
|
|
1415
|
+
*/
|
|
1416
|
+
interface PropsBase {
|
|
1417
|
+
/**
|
|
1418
|
+
* Enable the selection of a single day, multiple days, or a range of days.
|
|
1419
|
+
*
|
|
1420
|
+
* @see https://daypicker.dev/docs/selection-modes
|
|
1421
|
+
*/
|
|
1422
|
+
mode?: Mode | undefined;
|
|
1423
|
+
/**
|
|
1424
|
+
* Whether the selection is required.
|
|
1425
|
+
*
|
|
1426
|
+
* @see https://daypicker.dev/docs/selection-modes
|
|
1427
|
+
*/
|
|
1428
|
+
required?: boolean | undefined;
|
|
1429
|
+
/** Class name to add to the root element. */
|
|
1430
|
+
className?: string;
|
|
1431
|
+
/**
|
|
1432
|
+
* Change the class names used by DayPicker.
|
|
1433
|
+
*
|
|
1434
|
+
* Use this prop when you need to change the default class names — for
|
|
1435
|
+
* example, when importing the style via CSS modules or when using a CSS
|
|
1436
|
+
* framework.
|
|
1437
|
+
*
|
|
1438
|
+
* @see https://daypicker.dev/docs/styling
|
|
1439
|
+
*/
|
|
1440
|
+
classNames?: Partial<ClassNames>;
|
|
1441
|
+
/**
|
|
1442
|
+
* Change the class name for the day matching the `modifiers`.
|
|
1443
|
+
*
|
|
1444
|
+
* @see https://daypicker.dev/guides/custom-modifiers
|
|
1445
|
+
*/
|
|
1446
|
+
modifiersClassNames?: ModifiersClassNames;
|
|
1447
|
+
/** Style to apply to the root element. */
|
|
1448
|
+
style?: React__default.CSSProperties;
|
|
1449
|
+
/**
|
|
1450
|
+
* Change the inline styles of the HTML elements.
|
|
1451
|
+
*
|
|
1452
|
+
* @see https://daypicker.dev/docs/styling
|
|
1453
|
+
*/
|
|
1454
|
+
styles?: Partial<Styles>;
|
|
1455
|
+
/**
|
|
1456
|
+
* Change the class name for the day matching the {@link modifiers}.
|
|
1457
|
+
*
|
|
1458
|
+
* @see https://daypicker.dev/guides/custom-modifiers
|
|
1459
|
+
*/
|
|
1460
|
+
modifiersStyles?: ModifiersStyles;
|
|
1461
|
+
/** A unique id to add to the root element. */
|
|
1462
|
+
id?: string;
|
|
1463
|
+
/**
|
|
1464
|
+
* The initial month to show in the calendar.
|
|
1465
|
+
*
|
|
1466
|
+
* Use this prop to let DayPicker control the current month. If you need to
|
|
1467
|
+
* set the month programmatically, use {@link month} and {@link onMonthChange}.
|
|
1468
|
+
*
|
|
1469
|
+
* @defaultValue The current month
|
|
1470
|
+
* @see https://daypicker.dev/docs/navigation
|
|
1471
|
+
*/
|
|
1472
|
+
defaultMonth?: Date;
|
|
1473
|
+
/**
|
|
1474
|
+
* The month displayed in the calendar.
|
|
1475
|
+
*
|
|
1476
|
+
* As opposed to `defaultMonth`, use this prop with `onMonthChange` to change
|
|
1477
|
+
* the month programmatically.
|
|
1478
|
+
*
|
|
1479
|
+
* @see https://daypicker.dev/docs/navigation
|
|
1480
|
+
*/
|
|
1481
|
+
month?: Date;
|
|
1482
|
+
/**
|
|
1483
|
+
* The number of displayed months.
|
|
1484
|
+
*
|
|
1485
|
+
* @defaultValue 1
|
|
1486
|
+
* @see https://daypicker.dev/docs/customization#multiplemonths
|
|
1487
|
+
*/
|
|
1488
|
+
numberOfMonths?: number;
|
|
1489
|
+
/**
|
|
1490
|
+
* The earliest month to start the month navigation.
|
|
1491
|
+
*
|
|
1492
|
+
* @since 9.0.0
|
|
1493
|
+
* @see https://daypicker.dev/docs/navigation#start-and-end-dates
|
|
1494
|
+
*/
|
|
1495
|
+
startMonth?: Date | undefined;
|
|
1496
|
+
/**
|
|
1497
|
+
* The latest month to end the month navigation.
|
|
1498
|
+
*
|
|
1499
|
+
* @since 9.0.0
|
|
1500
|
+
* @see https://daypicker.dev/docs/navigation#start-and-end-dates
|
|
1501
|
+
*/
|
|
1502
|
+
endMonth?: Date;
|
|
1503
|
+
/**
|
|
1504
|
+
* Paginate the month navigation displaying the `numberOfMonths` at a time.
|
|
1505
|
+
*
|
|
1506
|
+
* @see https://daypicker.dev/docs/customization#multiplemonths
|
|
1507
|
+
*/
|
|
1508
|
+
pagedNavigation?: boolean;
|
|
1509
|
+
/**
|
|
1510
|
+
* Render the months in reversed order (when {@link numberOfMonths} is set) to
|
|
1511
|
+
* display the most recent month first.
|
|
1512
|
+
*
|
|
1513
|
+
* @see https://daypicker.dev/docs/customization#multiplemonths
|
|
1514
|
+
*/
|
|
1515
|
+
reverseMonths?: boolean;
|
|
1516
|
+
/**
|
|
1517
|
+
* Hide the navigation buttons. This prop won't disable the navigation: to
|
|
1518
|
+
* disable the navigation, use {@link disableNavigation}.
|
|
1519
|
+
*
|
|
1520
|
+
* @since 9.0.0
|
|
1521
|
+
* @see https://daypicker.dev/docs/navigation#hidenavigation
|
|
1522
|
+
*/
|
|
1523
|
+
hideNavigation?: boolean;
|
|
1524
|
+
/**
|
|
1525
|
+
* Disable the navigation between months. This prop won't hide the navigation:
|
|
1526
|
+
* to hide the navigation, use {@link hideNavigation}.
|
|
1527
|
+
*
|
|
1528
|
+
* @see https://daypicker.dev/docs/navigation#disablenavigation
|
|
1529
|
+
*/
|
|
1530
|
+
disableNavigation?: boolean;
|
|
1531
|
+
/**
|
|
1532
|
+
* Show dropdowns to navigate between months or years.
|
|
1533
|
+
*
|
|
1534
|
+
* - `label`: Displays the month and year as a label. Default value.
|
|
1535
|
+
* - `dropdown`: Displays dropdowns for both month and year navigation.
|
|
1536
|
+
* - `dropdown-months`: Displays a dropdown only for the month navigation.
|
|
1537
|
+
* - `dropdown-years`: Displays a dropdown only for the year navigation.
|
|
1538
|
+
*
|
|
1539
|
+
* **Note:** By default, showing the dropdown will set the {@link startMonth}
|
|
1540
|
+
* to 100 years ago and {@link endMonth} to the end of the current year. You
|
|
1541
|
+
* can override this behavior by explicitly setting `startMonth` and
|
|
1542
|
+
* `endMonth`.
|
|
1543
|
+
*
|
|
1544
|
+
* @see https://daypicker.dev/docs/customization#caption-layouts
|
|
1545
|
+
*/
|
|
1546
|
+
captionLayout?: "label" | "dropdown" | "dropdown-months" | "dropdown-years";
|
|
1547
|
+
/**
|
|
1548
|
+
* Reverse the order of years in the dropdown when using
|
|
1549
|
+
* `captionLayout="dropdown"` or `captionLayout="dropdown-years"`.
|
|
1550
|
+
*
|
|
1551
|
+
* @since 9.9.0
|
|
1552
|
+
* @see https://daypicker.dev/docs/customization#caption-layouts
|
|
1553
|
+
*/
|
|
1554
|
+
reverseYears?: boolean;
|
|
1555
|
+
/**
|
|
1556
|
+
* Adjust the positioning of the navigation buttons.
|
|
1557
|
+
*
|
|
1558
|
+
* - `around`: Displays the buttons on either side of the caption.
|
|
1559
|
+
* - `after`: Displays the buttons after the caption. This ensures the tab order
|
|
1560
|
+
* matches the visual order.
|
|
1561
|
+
*
|
|
1562
|
+
* If not set, DayPicker preserves its legacy layout, but the tab order may
|
|
1563
|
+
* not align with the visual order when using `captionLayout="dropdown"`.
|
|
1564
|
+
*
|
|
1565
|
+
* @since 9.7.0
|
|
1566
|
+
* @see https://daypicker.dev/docs/customization#navigation-layouts
|
|
1567
|
+
*/
|
|
1568
|
+
navLayout?: "around" | "after" | undefined;
|
|
1569
|
+
/**
|
|
1570
|
+
* Display always 6 weeks per each month, regardless of the month’s number of
|
|
1571
|
+
* weeks. Weeks will be filled with the days from the next month.
|
|
1572
|
+
*
|
|
1573
|
+
* @see https://daypicker.dev/docs/customization#fixed-weeks
|
|
1574
|
+
*/
|
|
1575
|
+
fixedWeeks?: boolean;
|
|
1576
|
+
/**
|
|
1577
|
+
* Hide the row displaying the weekday row header.
|
|
1578
|
+
*
|
|
1579
|
+
* @since 9.0.0
|
|
1580
|
+
*/
|
|
1581
|
+
hideWeekdays?: boolean;
|
|
1582
|
+
/**
|
|
1583
|
+
* Show the outside days (days falling in the next or the previous month).
|
|
1584
|
+
*
|
|
1585
|
+
* **Note:** when a {@link broadcastCalendar} is set, this prop defaults to
|
|
1586
|
+
* true.
|
|
1587
|
+
*
|
|
1588
|
+
* @see https://daypicker.dev/docs/customization#outside-days
|
|
1589
|
+
*/
|
|
1590
|
+
showOutsideDays?: boolean;
|
|
1591
|
+
/**
|
|
1592
|
+
* Show the week numbers column. Weeks are numbered according to the local
|
|
1593
|
+
* week index.
|
|
1594
|
+
*
|
|
1595
|
+
* @see https://daypicker.dev/docs/customization#showweeknumber
|
|
1596
|
+
*/
|
|
1597
|
+
showWeekNumber?: boolean;
|
|
1598
|
+
/**
|
|
1599
|
+
* Animate navigating between months.
|
|
1600
|
+
*
|
|
1601
|
+
* @since 9.6.0
|
|
1602
|
+
* @see https://daypicker.dev/docs/navigation#animate
|
|
1603
|
+
*/
|
|
1604
|
+
animate?: boolean;
|
|
1605
|
+
/**
|
|
1606
|
+
* Display the weeks in the month following the broadcast calendar. Setting
|
|
1607
|
+
* this prop will ignore {@link weekStartsOn} (always Monday) and
|
|
1608
|
+
* {@link showOutsideDays} will default to true.
|
|
1609
|
+
*
|
|
1610
|
+
* @since 9.4.0
|
|
1611
|
+
* @see https://daypicker.dev/docs/localization#broadcast-calendar
|
|
1612
|
+
* @see https://en.wikipedia.org/wiki/Broadcast_calendar
|
|
1613
|
+
*/
|
|
1614
|
+
broadcastCalendar?: boolean;
|
|
1615
|
+
/**
|
|
1616
|
+
* Use ISO week dates instead of the locale setting. Setting this prop will
|
|
1617
|
+
* ignore `weekStartsOn` and `firstWeekContainsDate`.
|
|
1618
|
+
*
|
|
1619
|
+
* @see https://daypicker.dev/docs/localization#iso-week-dates
|
|
1620
|
+
* @see https://en.wikipedia.org/wiki/ISO_week_date
|
|
1621
|
+
*/
|
|
1622
|
+
ISOWeek?: boolean;
|
|
1623
|
+
/**
|
|
1624
|
+
* The time zone (IANA or UTC offset) to use in the calendar (experimental).
|
|
1625
|
+
*
|
|
1626
|
+
* See
|
|
1627
|
+
* [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
|
|
1628
|
+
* for the possible values.
|
|
1629
|
+
*
|
|
1630
|
+
* @since 9.1.1
|
|
1631
|
+
* @see https://daypicker.dev/localization/setting-time-zone
|
|
1632
|
+
*/
|
|
1633
|
+
timeZone?: string | undefined;
|
|
1634
|
+
/**
|
|
1635
|
+
* Keep calendar math at noon in the configured {@link timeZone} to avoid
|
|
1636
|
+
* historical second-level offsets drifting dates across midnight.
|
|
1637
|
+
*
|
|
1638
|
+
* This prop sets the time of the dates to noon (12:00).
|
|
1639
|
+
*
|
|
1640
|
+
* @since 9.13.0
|
|
1641
|
+
* @experimental
|
|
1642
|
+
* @see https://daypicker.dev/localization/setting-time-zone#noonsafe
|
|
1643
|
+
*/
|
|
1644
|
+
noonSafe?: boolean | undefined;
|
|
1645
|
+
/**
|
|
1646
|
+
* Change the components used for rendering the calendar elements.
|
|
1647
|
+
*
|
|
1648
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
1649
|
+
*/
|
|
1650
|
+
components?: Partial<CustomComponents>;
|
|
1651
|
+
/**
|
|
1652
|
+
* Add a footer to the calendar, acting as a live region.
|
|
1653
|
+
*
|
|
1654
|
+
* Use this prop to communicate the calendar's status to screen readers.
|
|
1655
|
+
* Prefer strings over complex UI elements.
|
|
1656
|
+
*
|
|
1657
|
+
* @see https://daypicker.dev/guides/accessibility#footer
|
|
1658
|
+
*/
|
|
1659
|
+
footer?: React__default.ReactNode | string;
|
|
1660
|
+
/**
|
|
1661
|
+
* When a selection mode is set, DayPicker will focus the first selected day
|
|
1662
|
+
* (if set) or today's date (if not disabled).
|
|
1663
|
+
*
|
|
1664
|
+
* Use this prop when you need to focus DayPicker after a user action, for
|
|
1665
|
+
* improved accessibility.
|
|
1666
|
+
*
|
|
1667
|
+
* @see https://daypicker.dev/guides/accessibility#autofocus
|
|
1668
|
+
*/
|
|
1669
|
+
autoFocus?: boolean;
|
|
1670
|
+
/**
|
|
1671
|
+
* Apply the `disabled` modifier to the matching days. Disabled days cannot be
|
|
1672
|
+
* selected when in a selection mode is set.
|
|
1673
|
+
*
|
|
1674
|
+
* @see https://daypicker.dev/docs/selection-modes#disabled
|
|
1675
|
+
*/
|
|
1676
|
+
disabled?: Matcher | Matcher[] | undefined;
|
|
1677
|
+
/**
|
|
1678
|
+
* Apply the `hidden` modifier to the matching days. Will hide them from the
|
|
1679
|
+
* calendar.
|
|
1680
|
+
*
|
|
1681
|
+
* @see https://daypicker.dev/guides/custom-modifiers#hidden-modifier
|
|
1682
|
+
*/
|
|
1683
|
+
hidden?: Matcher | Matcher[] | undefined;
|
|
1684
|
+
/**
|
|
1685
|
+
* The today’s date. Default is the current date. This date will get the
|
|
1686
|
+
* `today` modifier to style the day.
|
|
1687
|
+
*
|
|
1688
|
+
* @see https://daypicker.dev/guides/custom-modifiers#today-modifier
|
|
1689
|
+
*/
|
|
1690
|
+
today?: Date;
|
|
1691
|
+
/**
|
|
1692
|
+
* Add modifiers to the matching days.
|
|
1693
|
+
*
|
|
1694
|
+
* @example
|
|
1695
|
+
* const modifiers = {
|
|
1696
|
+
* weekend: { dayOfWeek: [0, 6] }, // Match weekends
|
|
1697
|
+
* holiday: [new Date(2023, 11, 25)] // Match Christmas
|
|
1698
|
+
* };
|
|
1699
|
+
* <DayPicker modifiers={modifiers} />
|
|
1700
|
+
*
|
|
1701
|
+
* @see https://daypicker.dev/guides/custom-modifiers
|
|
1702
|
+
*/
|
|
1703
|
+
modifiers?: Record<string, Matcher | Matcher[] | undefined> | undefined;
|
|
1704
|
+
/**
|
|
1705
|
+
* Labels creators to override the defaults. Use this prop to customize the
|
|
1706
|
+
* aria-label attributes in DayPicker.
|
|
1707
|
+
*
|
|
1708
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
1709
|
+
*/
|
|
1710
|
+
labels?: Partial<Labels>;
|
|
1711
|
+
/**
|
|
1712
|
+
* Formatters used to format dates to strings. Use this prop to override the
|
|
1713
|
+
* default functions.
|
|
1714
|
+
*
|
|
1715
|
+
* @see https://daypicker.dev/docs/translation#custom-formatters
|
|
1716
|
+
*/
|
|
1717
|
+
formatters?: Partial<Formatters>;
|
|
1718
|
+
/**
|
|
1719
|
+
* The text direction of the calendar. Use `ltr` for left-to-right (default)
|
|
1720
|
+
* or `rtl` for right-to-left.
|
|
1721
|
+
*
|
|
1722
|
+
* @see https://daypicker.dev/docs/translation#rtl-text-direction
|
|
1723
|
+
*/
|
|
1724
|
+
dir?: HTMLDivElement["dir"];
|
|
1725
|
+
/**
|
|
1726
|
+
* The aria-label attribute to add to the container element.
|
|
1727
|
+
*
|
|
1728
|
+
* @since 9.4.1
|
|
1729
|
+
* @see https://daypicker.dev/guides/accessibility
|
|
1730
|
+
*/
|
|
1731
|
+
"aria-label"?: string;
|
|
1732
|
+
/**
|
|
1733
|
+
* The aria-labelledby attribute to add to the container element.
|
|
1734
|
+
*
|
|
1735
|
+
* @since 9.11.0
|
|
1736
|
+
* @see https://daypicker.dev/guides/accessibility
|
|
1737
|
+
*/
|
|
1738
|
+
"aria-labelledby"?: string;
|
|
1739
|
+
/**
|
|
1740
|
+
* The role attribute to add to the container element.
|
|
1741
|
+
*
|
|
1742
|
+
* @since 9.4.1
|
|
1743
|
+
* @see https://daypicker.dev/guides/accessibility
|
|
1744
|
+
*/
|
|
1745
|
+
role?: "application" | "dialog" | undefined;
|
|
1746
|
+
/**
|
|
1747
|
+
* A cryptographic nonce ("number used once") which can be used by Content
|
|
1748
|
+
* Security Policy for the inline `style` attributes.
|
|
1749
|
+
*/
|
|
1750
|
+
nonce?: HTMLDivElement["nonce"];
|
|
1751
|
+
/** Add a `title` attribute to the container element. */
|
|
1752
|
+
title?: HTMLDivElement["title"];
|
|
1753
|
+
/**
|
|
1754
|
+
* Add the language tag to the container element.
|
|
1755
|
+
*
|
|
1756
|
+
* When omitted, DayPicker uses the active locale code (`locale.code`). Set
|
|
1757
|
+
* this prop to override the language tag.
|
|
1758
|
+
*/
|
|
1759
|
+
lang?: HTMLDivElement["lang"];
|
|
1760
|
+
/**
|
|
1761
|
+
* The locale object used to localize dates. Pass a locale from
|
|
1762
|
+
* `react-day-picker/locale/<code>` to localize the calendar.
|
|
1763
|
+
*
|
|
1764
|
+
* @example
|
|
1765
|
+
* import { es } from "react-day-picker/locale/es";
|
|
1766
|
+
* <DayPicker locale={es} />
|
|
1767
|
+
*
|
|
1768
|
+
* @defaultValue enUS - The English locale default of `date-fns`.
|
|
1769
|
+
* @see https://daypicker.dev/docs/localization
|
|
1770
|
+
* @see https://github.com/date-fns/date-fns/tree/main/src/locale for a list of the supported locales
|
|
1771
|
+
*/
|
|
1772
|
+
locale?: Partial<DayPickerLocale> | undefined;
|
|
1773
|
+
/**
|
|
1774
|
+
* The numeral system to use when formatting dates.
|
|
1775
|
+
*
|
|
1776
|
+
* - `latn`: Latin (Western Arabic)
|
|
1777
|
+
* - `arab`: Arabic-Indic
|
|
1778
|
+
* - `arabext`: Eastern Arabic-Indic (Persian)
|
|
1779
|
+
* - `deva`: Devanagari
|
|
1780
|
+
* - `beng`: Bengali
|
|
1781
|
+
* - `guru`: Gurmukhi
|
|
1782
|
+
* - `gujr`: Gujarati
|
|
1783
|
+
* - `orya`: Oriya
|
|
1784
|
+
* - `tamldec`: Tamil
|
|
1785
|
+
* - `telu`: Telugu
|
|
1786
|
+
* - `knda`: Kannada
|
|
1787
|
+
* - `mlym`: Malayalam
|
|
1788
|
+
*
|
|
1789
|
+
* @defaultValue `latn` Latin (Western Arabic)
|
|
1790
|
+
* @see https://daypicker.dev/docs/translation#numeral-systems
|
|
1791
|
+
*/
|
|
1792
|
+
numerals?: Numerals | undefined;
|
|
1793
|
+
/**
|
|
1794
|
+
* The index of the first day of the week (0 - Sunday). Overrides the locale's
|
|
1795
|
+
* default.
|
|
1796
|
+
*
|
|
1797
|
+
* @see https://daypicker.dev/docs/localization#first-date-of-the-week
|
|
1798
|
+
*/
|
|
1799
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
|
|
1800
|
+
/**
|
|
1801
|
+
* The day of January that is always in the first week of the year.
|
|
1802
|
+
*
|
|
1803
|
+
* @see https://daypicker.dev/docs/localization#first-week-contains-date
|
|
1804
|
+
*/
|
|
1805
|
+
firstWeekContainsDate?: 1 | 4;
|
|
1806
|
+
/**
|
|
1807
|
+
* Enable `DD` and `DDDD` for week year tokens when formatting or parsing
|
|
1808
|
+
* dates.
|
|
1809
|
+
*
|
|
1810
|
+
* @see https://date-fns.org/docs/Unicode-Tokens
|
|
1811
|
+
*/
|
|
1812
|
+
useAdditionalWeekYearTokens?: boolean | undefined;
|
|
1813
|
+
/**
|
|
1814
|
+
* Enable `YY` and `YYYY` for day of year tokens when formatting or parsing
|
|
1815
|
+
* dates.
|
|
1816
|
+
*
|
|
1817
|
+
* @see https://date-fns.org/docs/Unicode-Tokens
|
|
1818
|
+
*/
|
|
1819
|
+
useAdditionalDayOfYearTokens?: boolean | undefined;
|
|
1820
|
+
/**
|
|
1821
|
+
* Event fired when the user navigates between months.
|
|
1822
|
+
*
|
|
1823
|
+
* @see https://daypicker.dev/docs/navigation#onmonthchange
|
|
1824
|
+
*/
|
|
1825
|
+
onMonthChange?: MonthChangeEventHandler;
|
|
1826
|
+
/**
|
|
1827
|
+
* Event handler when the next month button is clicked.
|
|
1828
|
+
*
|
|
1829
|
+
* @see https://daypicker.dev/docs/navigation
|
|
1830
|
+
*/
|
|
1831
|
+
onNextClick?: MonthChangeEventHandler;
|
|
1832
|
+
/**
|
|
1833
|
+
* Event handler when the previous month button is clicked.
|
|
1834
|
+
*
|
|
1835
|
+
* @see https://daypicker.dev/docs/navigation
|
|
1836
|
+
*/
|
|
1837
|
+
onPrevClick?: MonthChangeEventHandler;
|
|
1838
|
+
/** Event handler when a day is clicked. */
|
|
1839
|
+
onDayClick?: DayEventHandler<React__default.MouseEvent>;
|
|
1840
|
+
/** Event handler when a day is focused. */
|
|
1841
|
+
onDayFocus?: DayEventHandler<React__default.FocusEvent>;
|
|
1842
|
+
/** Event handler when a day is blurred. */
|
|
1843
|
+
onDayBlur?: DayEventHandler<React__default.FocusEvent>;
|
|
1844
|
+
/** Event handler when a key is pressed on a day. */
|
|
1845
|
+
onDayKeyDown?: DayEventHandler<React__default.KeyboardEvent>;
|
|
1846
|
+
/** Event handler when the mouse enters a day. */
|
|
1847
|
+
onDayMouseEnter?: DayEventHandler<React__default.MouseEvent>;
|
|
1848
|
+
/** Event handler when the mouse leaves a day. */
|
|
1849
|
+
onDayMouseLeave?: DayEventHandler<React__default.MouseEvent>;
|
|
1850
|
+
/**
|
|
1851
|
+
* Replace the default date library with a custom one. Experimental: not
|
|
1852
|
+
* guaranteed to be stable (may not respect semver).
|
|
1853
|
+
*
|
|
1854
|
+
* @since 9.0.0
|
|
1855
|
+
* @experimental
|
|
1856
|
+
*/
|
|
1857
|
+
dateLib?: Partial<typeof DateLib.prototype> | undefined;
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Shared handler type for `onSelect` callback when a selection mode is set.
|
|
1861
|
+
*
|
|
1862
|
+
* @example
|
|
1863
|
+
* const handleSelect: OnSelectHandler<Date> = (
|
|
1864
|
+
* selected,
|
|
1865
|
+
* triggerDate,
|
|
1866
|
+
* modifiers,
|
|
1867
|
+
* e,
|
|
1868
|
+
* ) => {
|
|
1869
|
+
* console.log("Selected:", selected);
|
|
1870
|
+
* console.log("Triggered by:", triggerDate);
|
|
1871
|
+
* };
|
|
1872
|
+
*
|
|
1873
|
+
* @template T - The type of the selected item.
|
|
1874
|
+
* @callback OnSelectHandler
|
|
1875
|
+
* @param {T} selected - The selected item after the event.
|
|
1876
|
+
* @param {Date} triggerDate - The date when the event was triggered. This is
|
|
1877
|
+
* typically the day clicked or interacted with.
|
|
1878
|
+
* @param {Modifiers} modifiers - The modifiers associated with the event.
|
|
1879
|
+
* @param {React.MouseEvent | React.KeyboardEvent} e - The event object.
|
|
1880
|
+
*/
|
|
1881
|
+
type OnSelectHandler<T> = (selected: T, triggerDate: Date, modifiers: Modifiers, e: React__default.MouseEvent | React__default.KeyboardEvent) => void;
|
|
1882
|
+
/**
|
|
1883
|
+
* The props when the single selection is required.
|
|
1884
|
+
*
|
|
1885
|
+
* @group DayPicker
|
|
1886
|
+
* @see https://daypicker.dev/docs/selection-modes#single-mode
|
|
1887
|
+
*/
|
|
1888
|
+
interface PropsSingleRequired {
|
|
1889
|
+
mode: "single";
|
|
1890
|
+
required: true;
|
|
1891
|
+
/** The selected date. */
|
|
1892
|
+
selected: Date | undefined;
|
|
1893
|
+
/** Event handler when a day is selected. */
|
|
1894
|
+
onSelect?: OnSelectHandler<Date>;
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
* The props when the single selection is optional.
|
|
1898
|
+
*
|
|
1899
|
+
* @group DayPicker
|
|
1900
|
+
* @see https://daypicker.dev/docs/selection-modes#single-mode
|
|
1901
|
+
*/
|
|
1902
|
+
interface PropsSingle {
|
|
1903
|
+
mode: "single";
|
|
1904
|
+
required?: false | undefined;
|
|
1905
|
+
/** The selected date. */
|
|
1906
|
+
selected?: Date | undefined;
|
|
1907
|
+
/** Event handler when a day is selected. */
|
|
1908
|
+
onSelect?: OnSelectHandler<Date | undefined>;
|
|
1909
|
+
}
|
|
1910
|
+
/**
|
|
1911
|
+
* The props when the multiple selection is required.
|
|
1912
|
+
*
|
|
1913
|
+
* @group DayPicker
|
|
1914
|
+
* @see https://daypicker.dev/docs/selection-modes#multiple-mode
|
|
1915
|
+
*/
|
|
1916
|
+
interface PropsMultiRequired {
|
|
1917
|
+
mode: "multiple";
|
|
1918
|
+
required: true;
|
|
1919
|
+
/** The selected dates. */
|
|
1920
|
+
selected: Date[] | undefined;
|
|
1921
|
+
/** Event handler when days are selected. */
|
|
1922
|
+
onSelect?: OnSelectHandler<Date[]>;
|
|
1923
|
+
/** The minimum number of selectable days. */
|
|
1924
|
+
min?: number;
|
|
1925
|
+
/** The maximum number of selectable days. */
|
|
1926
|
+
max?: number;
|
|
1927
|
+
}
|
|
1928
|
+
/**
|
|
1929
|
+
* The props when the multiple selection is optional.
|
|
1930
|
+
*
|
|
1931
|
+
* @group DayPicker
|
|
1932
|
+
* @see https://daypicker.dev/docs/selection-modes#multiple-mode
|
|
1933
|
+
*/
|
|
1934
|
+
interface PropsMulti {
|
|
1935
|
+
mode: "multiple";
|
|
1936
|
+
required?: false | undefined;
|
|
1937
|
+
/** The selected dates. */
|
|
1938
|
+
selected?: Date[] | undefined;
|
|
1939
|
+
/** Event handler when days are selected. */
|
|
1940
|
+
onSelect?: OnSelectHandler<Date[] | undefined>;
|
|
1941
|
+
/** The minimum number of selectable days. */
|
|
1942
|
+
min?: number;
|
|
1943
|
+
/** The maximum number of selectable days. */
|
|
1944
|
+
max?: number;
|
|
1945
|
+
}
|
|
1946
|
+
/**
|
|
1947
|
+
* The props when the range selection is required.
|
|
1948
|
+
*
|
|
1949
|
+
* @group DayPicker
|
|
1950
|
+
* @see https://daypicker.dev/docs/selection-modes#range-mode
|
|
1951
|
+
*/
|
|
1952
|
+
interface PropsRangeRequired {
|
|
1953
|
+
mode: "range";
|
|
1954
|
+
required: true;
|
|
1955
|
+
/**
|
|
1956
|
+
* Apply the `disabled` modifier to the matching days. Disabled days cannot be
|
|
1957
|
+
* selected when in a selection mode is set.
|
|
1958
|
+
*
|
|
1959
|
+
* @see https://daypicker.dev/docs/selection-modes#disabled
|
|
1960
|
+
*/
|
|
1961
|
+
disabled?: Matcher | Matcher[] | undefined;
|
|
1962
|
+
/**
|
|
1963
|
+
* When `true`, the range will reset when including a disabled day.
|
|
1964
|
+
*
|
|
1965
|
+
* @since 9.0.2
|
|
1966
|
+
*/
|
|
1967
|
+
excludeDisabled?: boolean | undefined;
|
|
1968
|
+
/**
|
|
1969
|
+
* When `true`, clicking a day starts a new range if there is no current start
|
|
1970
|
+
* date or if a range is already complete. In those cases, the clicked day
|
|
1971
|
+
* becomes the start of the new range.
|
|
1972
|
+
*
|
|
1973
|
+
* @since 9.14
|
|
1974
|
+
* @see https://daypicker.dev/selections/range-mode#reset-selection
|
|
1975
|
+
*/
|
|
1976
|
+
resetOnSelect?: boolean | undefined;
|
|
1977
|
+
/** The selected range. */
|
|
1978
|
+
selected: DateRange | undefined;
|
|
1979
|
+
/** Event handler when a range is selected. */
|
|
1980
|
+
onSelect?: OnSelectHandler<DateRange>;
|
|
1981
|
+
/** The minimum number of days to include in the range. */
|
|
1982
|
+
min?: number;
|
|
1983
|
+
/** The maximum number of days to include in the range. */
|
|
1984
|
+
max?: number;
|
|
1985
|
+
}
|
|
1986
|
+
/**
|
|
1987
|
+
* The props when the range selection is optional.
|
|
1988
|
+
*
|
|
1989
|
+
* @group DayPicker
|
|
1990
|
+
* @see https://daypicker.dev/docs/selection-modes#range-mode
|
|
1991
|
+
*/
|
|
1992
|
+
interface PropsRange {
|
|
1993
|
+
mode: "range";
|
|
1994
|
+
required?: false | undefined;
|
|
1995
|
+
/**
|
|
1996
|
+
* Apply the `disabled` modifier to the matching days. Disabled days cannot be
|
|
1997
|
+
* selected when in a selection mode is set.
|
|
1998
|
+
*
|
|
1999
|
+
* @see https://daypicker.dev/docs/selection-modes#disabled
|
|
2000
|
+
*/
|
|
2001
|
+
disabled?: Matcher | Matcher[] | undefined;
|
|
2002
|
+
/**
|
|
2003
|
+
* When `true`, the range will reset when including a disabled day.
|
|
2004
|
+
*
|
|
2005
|
+
* @since 9.0.2
|
|
2006
|
+
* @see https://daypicker.dev/docs/selection-modes#exclude-disabled
|
|
2007
|
+
*/
|
|
2008
|
+
excludeDisabled?: boolean | undefined;
|
|
2009
|
+
/**
|
|
2010
|
+
* When `true`, clicking a day starts a new range if there is no current start
|
|
2011
|
+
* date or if a range is already complete. In those cases, the clicked day
|
|
2012
|
+
* becomes the start of the new range. When `required` is `false`, clicking
|
|
2013
|
+
* the same day of a single-day range clears the selection.
|
|
2014
|
+
*
|
|
2015
|
+
* @since 9.14
|
|
2016
|
+
* @see https://daypicker.dev/selections/range-mode#reset-selection
|
|
2017
|
+
*/
|
|
2018
|
+
resetOnSelect?: boolean | undefined;
|
|
2019
|
+
/** The selected range. */
|
|
2020
|
+
selected?: DateRange | undefined;
|
|
2021
|
+
/** Event handler when the selection changes. */
|
|
2022
|
+
onSelect?: OnSelectHandler<DateRange | undefined>;
|
|
2023
|
+
/** The minimum number of days to include in the range. */
|
|
2024
|
+
min?: number;
|
|
2025
|
+
/** The maximum number of days to include in the range. */
|
|
2026
|
+
max?: number;
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
/**
|
|
2030
|
+
* Render a grid cell for a specific day in the calendar.
|
|
2031
|
+
*
|
|
2032
|
+
* Handles interaction and focus for the day. If you only need to change the
|
|
2033
|
+
* content of the day cell, consider swapping the `DayButton` component
|
|
2034
|
+
* instead.
|
|
2035
|
+
*
|
|
2036
|
+
* @group Components
|
|
2037
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2038
|
+
*/
|
|
2039
|
+
declare function Day(props: {
|
|
2040
|
+
/** The day to render. */
|
|
2041
|
+
day: CalendarDay;
|
|
2042
|
+
/** The modifiers to apply to the day. */
|
|
2043
|
+
modifiers: Modifiers;
|
|
2044
|
+
} & HTMLAttributes<HTMLDivElement>): React__default.JSX.Element;
|
|
2045
|
+
|
|
2046
|
+
/**
|
|
2047
|
+
* Render a button for a specific day in the calendar.
|
|
2048
|
+
*
|
|
2049
|
+
* @group Components
|
|
2050
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2051
|
+
*/
|
|
2052
|
+
declare function DayButton(props: {
|
|
2053
|
+
/** The day to render. */
|
|
2054
|
+
day: CalendarDay;
|
|
2055
|
+
/** The modifiers to apply to the day. */
|
|
2056
|
+
modifiers: Modifiers;
|
|
2057
|
+
} & ButtonHTMLAttributes<HTMLButtonElement>): React__default.JSX.Element;
|
|
2058
|
+
|
|
2059
|
+
/** An option to use in the dropdown. Maps to the `<option>` HTML element. */
|
|
2060
|
+
type DropdownOption = {
|
|
2061
|
+
/** The value of the option. */
|
|
2062
|
+
value: number;
|
|
2063
|
+
/** The label of the option. */
|
|
2064
|
+
label: string;
|
|
2065
|
+
/** Whether the dropdown option is disabled (e.g., out of the calendar range). */
|
|
2066
|
+
disabled: boolean;
|
|
2067
|
+
};
|
|
2068
|
+
/**
|
|
2069
|
+
* Render a dropdown component for navigation in the calendar.
|
|
2070
|
+
*
|
|
2071
|
+
* @group Components
|
|
2072
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2073
|
+
*/
|
|
2074
|
+
declare function Dropdown(props: {
|
|
2075
|
+
/** The options to display in the dropdown. */
|
|
2076
|
+
options?: DropdownOption[] | undefined;
|
|
2077
|
+
} & Omit<SelectHTMLAttributes<HTMLSelectElement>, "children">): React__default.JSX.Element;
|
|
2078
|
+
/** Props accepted by the {@link Dropdown} component. */
|
|
2079
|
+
type DropdownProps = Parameters<typeof Dropdown>[0];
|
|
2080
|
+
|
|
2081
|
+
/**
|
|
2082
|
+
* Render the navigation dropdowns for the calendar.
|
|
2083
|
+
*
|
|
2084
|
+
* @group Components
|
|
2085
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2086
|
+
*/
|
|
2087
|
+
declare function DropdownNav(props: HTMLAttributes<HTMLDivElement>): React__default.JSX.Element;
|
|
2088
|
+
|
|
2089
|
+
/**
|
|
2090
|
+
* Render the footer of the calendar.
|
|
2091
|
+
*
|
|
2092
|
+
* @group Components
|
|
2093
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2094
|
+
*/
|
|
2095
|
+
declare function Footer(props: HTMLAttributes<HTMLDivElement>): React__default.JSX.Element;
|
|
2096
|
+
|
|
2097
|
+
/**
|
|
2098
|
+
* Represents a week in a calendar month.
|
|
2099
|
+
*
|
|
2100
|
+
* A `CalendarWeek` contains the days within the week and the week number.
|
|
2101
|
+
*/
|
|
2102
|
+
declare class CalendarWeek {
|
|
2103
|
+
constructor(weekNumber: number, days: CalendarDay[]);
|
|
2104
|
+
/** The number of the week within the year. */
|
|
2105
|
+
weekNumber: number;
|
|
2106
|
+
/** The days that belong to this week. */
|
|
2107
|
+
days: CalendarDay[];
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
/**
|
|
2111
|
+
* Represents a month in a calendar year.
|
|
2112
|
+
*
|
|
2113
|
+
* A `CalendarMonth` contains the weeks within the month and the date of the
|
|
2114
|
+
* month.
|
|
2115
|
+
*/
|
|
2116
|
+
declare class CalendarMonth {
|
|
2117
|
+
constructor(month: Date, weeks: CalendarWeek[]);
|
|
2118
|
+
/** The date representing the first day of the month. */
|
|
2119
|
+
date: Date;
|
|
2120
|
+
/** The weeks that belong to this month. */
|
|
2121
|
+
weeks: CalendarWeek[];
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
/**
|
|
2125
|
+
* Render the grid with the weekday header row and the weeks for a specific
|
|
2126
|
+
* month.
|
|
2127
|
+
*
|
|
2128
|
+
* @group Components
|
|
2129
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2130
|
+
*/
|
|
2131
|
+
declare function Month(props: {
|
|
2132
|
+
/** The month to display in the grid. */
|
|
2133
|
+
calendarMonth: CalendarMonth;
|
|
2134
|
+
/** The index of the month being displayed. */
|
|
2135
|
+
displayIndex: number;
|
|
2136
|
+
} & HTMLAttributes<HTMLDivElement>): React__default.JSX.Element;
|
|
2137
|
+
|
|
2138
|
+
/**
|
|
2139
|
+
* Render the caption for a month in the calendar.
|
|
2140
|
+
*
|
|
2141
|
+
* @group Components
|
|
2142
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2143
|
+
*/
|
|
2144
|
+
declare function MonthCaption(props: {
|
|
2145
|
+
/** The month to display in the caption. */
|
|
2146
|
+
calendarMonth: CalendarMonth;
|
|
2147
|
+
/** The index of the month being displayed. */
|
|
2148
|
+
displayIndex: number;
|
|
2149
|
+
} & HTMLAttributes<HTMLDivElement>): React__default.JSX.Element;
|
|
2150
|
+
|
|
2151
|
+
/**
|
|
2152
|
+
* Render the grid of days for a specific month.
|
|
2153
|
+
*
|
|
2154
|
+
* @group Components
|
|
2155
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2156
|
+
*/
|
|
2157
|
+
declare function MonthGrid(props: TableHTMLAttributes<HTMLTableElement>): React__default.JSX.Element;
|
|
2158
|
+
|
|
2159
|
+
/**
|
|
2160
|
+
* Render a container wrapping the month grids.
|
|
2161
|
+
*
|
|
2162
|
+
* @group Components
|
|
2163
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2164
|
+
*/
|
|
2165
|
+
declare function Months(props: HTMLAttributes<HTMLDivElement>): React__default.JSX.Element;
|
|
2166
|
+
|
|
2167
|
+
/**
|
|
2168
|
+
* Render a dropdown to navigate between months in the calendar.
|
|
2169
|
+
*
|
|
2170
|
+
* @group Components
|
|
2171
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2172
|
+
*/
|
|
2173
|
+
declare function MonthsDropdown(props: DropdownProps): React__default.JSX.Element;
|
|
2174
|
+
|
|
2175
|
+
/**
|
|
2176
|
+
* Render the navigation toolbar with buttons to navigate between months.
|
|
2177
|
+
*
|
|
2178
|
+
* @group Components
|
|
2179
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2180
|
+
*/
|
|
2181
|
+
declare function Nav(props: {
|
|
2182
|
+
/** Handler for the previous month button click. */
|
|
2183
|
+
onPreviousClick?: MouseEventHandler<HTMLButtonElement>;
|
|
2184
|
+
/** Handler for the next month button click. */
|
|
2185
|
+
onNextClick?: MouseEventHandler<HTMLButtonElement>;
|
|
2186
|
+
/** The date of the previous month, if available. */
|
|
2187
|
+
previousMonth?: Date | undefined;
|
|
2188
|
+
/** The date of the next month, if available. */
|
|
2189
|
+
nextMonth?: Date | undefined;
|
|
2190
|
+
} & HTMLAttributes<HTMLElement>): React__default.JSX.Element;
|
|
2191
|
+
|
|
2192
|
+
/**
|
|
2193
|
+
* Render the button to navigate to the next month in the calendar.
|
|
2194
|
+
*
|
|
2195
|
+
* @group Components
|
|
2196
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2197
|
+
*/
|
|
2198
|
+
declare function NextMonthButton(props: ButtonHTMLAttributes<HTMLButtonElement>): React__default.JSX.Element;
|
|
2199
|
+
|
|
2200
|
+
/**
|
|
2201
|
+
* Render an `option` element.
|
|
2202
|
+
*
|
|
2203
|
+
* @group Components
|
|
2204
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2205
|
+
*/
|
|
2206
|
+
declare function Option(props: OptionHTMLAttributes<HTMLOptionElement>): React__default.JSX.Element;
|
|
2207
|
+
|
|
2208
|
+
/**
|
|
2209
|
+
* Render the button to navigate to the previous month in the calendar.
|
|
2210
|
+
*
|
|
2211
|
+
* @group Components
|
|
2212
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2213
|
+
*/
|
|
2214
|
+
declare function PreviousMonthButton(props: ButtonHTMLAttributes<HTMLButtonElement>): React__default.JSX.Element;
|
|
2215
|
+
|
|
2216
|
+
/**
|
|
2217
|
+
* Render the root element of the calendar.
|
|
2218
|
+
*
|
|
2219
|
+
* @group Components
|
|
2220
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2221
|
+
*/
|
|
2222
|
+
declare function Root(props: {
|
|
2223
|
+
/** Ref for the root element, used when `animate` is `true`. */
|
|
2224
|
+
rootRef?: Ref<HTMLDivElement>;
|
|
2225
|
+
} & HTMLAttributes<HTMLDivElement>): React__default.JSX.Element;
|
|
2226
|
+
|
|
2227
|
+
/**
|
|
2228
|
+
* Render a `select` element.
|
|
2229
|
+
*
|
|
2230
|
+
* @group Components
|
|
2231
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2232
|
+
*/
|
|
2233
|
+
declare function Select(props: SelectHTMLAttributes<HTMLSelectElement>): React__default.JSX.Element;
|
|
2234
|
+
|
|
2235
|
+
/**
|
|
2236
|
+
* Render a table row representing a week in the calendar.
|
|
2237
|
+
*
|
|
2238
|
+
* @group Components
|
|
2239
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2240
|
+
*/
|
|
2241
|
+
declare function Week(props: {
|
|
2242
|
+
/** The week to render. */
|
|
2243
|
+
week: CalendarWeek;
|
|
2244
|
+
} & HTMLAttributes<HTMLTableRowElement>): React__default.JSX.Element;
|
|
2245
|
+
|
|
2246
|
+
/**
|
|
2247
|
+
* Render a table header cell with the name of a weekday (e.g., "Mo", "Tu").
|
|
2248
|
+
*
|
|
2249
|
+
* @group Components
|
|
2250
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2251
|
+
*/
|
|
2252
|
+
declare function Weekday(props: ThHTMLAttributes<HTMLTableCellElement>): React__default.JSX.Element;
|
|
2253
|
+
|
|
2254
|
+
/**
|
|
2255
|
+
* Render the table row containing the weekday names.
|
|
2256
|
+
*
|
|
2257
|
+
* @group Components
|
|
2258
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2259
|
+
*/
|
|
2260
|
+
declare function Weekdays(props: HTMLAttributes<HTMLTableRowElement>): React__default.JSX.Element;
|
|
2261
|
+
|
|
2262
|
+
/**
|
|
2263
|
+
* Render a table cell displaying the number of the week.
|
|
2264
|
+
*
|
|
2265
|
+
* @group Components
|
|
2266
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2267
|
+
*/
|
|
2268
|
+
declare function WeekNumber(props: {
|
|
2269
|
+
/** The week to display. */
|
|
2270
|
+
week: CalendarWeek;
|
|
2271
|
+
} & ThHTMLAttributes<HTMLTableCellElement>): React__default.JSX.Element;
|
|
2272
|
+
|
|
2273
|
+
/**
|
|
2274
|
+
* Render the header cell for the week numbers column.
|
|
2275
|
+
*
|
|
2276
|
+
* @group Components
|
|
2277
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2278
|
+
*/
|
|
2279
|
+
declare function WeekNumberHeader(props: ThHTMLAttributes<HTMLTableCellElement>): React__default.JSX.Element;
|
|
2280
|
+
|
|
2281
|
+
/**
|
|
2282
|
+
* Render the container for the weeks in the month grid.
|
|
2283
|
+
*
|
|
2284
|
+
* @group Components
|
|
2285
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2286
|
+
*/
|
|
2287
|
+
declare function Weeks(props: HTMLAttributes<HTMLTableSectionElement>): React__default.JSX.Element;
|
|
2288
|
+
|
|
2289
|
+
/**
|
|
2290
|
+
* Render a dropdown to navigate between years in the calendar.
|
|
2291
|
+
*
|
|
2292
|
+
* @group Components
|
|
2293
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2294
|
+
*/
|
|
2295
|
+
declare function YearsDropdown(props: DropdownProps): React__default.JSX.Element;
|
|
2296
|
+
|
|
2297
|
+
/**
|
|
2298
|
+
* Formats the caption of the month.
|
|
2299
|
+
*
|
|
2300
|
+
* @defaultValue Locale-specific month/year order (e.g., "November 2022").
|
|
2301
|
+
* @param month The date representing the month.
|
|
2302
|
+
* @param options Configuration options for the date library.
|
|
2303
|
+
* @param dateLib The date library to use for formatting. If not provided, a new
|
|
2304
|
+
* instance is created.
|
|
2305
|
+
* @returns The formatted caption as a string.
|
|
2306
|
+
* @group Formatters
|
|
2307
|
+
* @see https://daypicker.dev/docs/translation#custom-formatters
|
|
2308
|
+
*/
|
|
2309
|
+
declare function formatCaption(month: Date, options?: DateLibOptions, dateLib?: DateLib): string;
|
|
2310
|
+
|
|
2311
|
+
/**
|
|
2312
|
+
* Formats the day date shown in the day cell.
|
|
2313
|
+
*
|
|
2314
|
+
* @defaultValue `d` (e.g., "1").
|
|
2315
|
+
* @param date The date to format.
|
|
2316
|
+
* @param options Configuration options for the date library.
|
|
2317
|
+
* @param dateLib The date library to use for formatting. If not provided, a new
|
|
2318
|
+
* instance is created.
|
|
2319
|
+
* @returns The formatted day as a string.
|
|
2320
|
+
* @group Formatters
|
|
2321
|
+
* @see https://daypicker.dev/docs/translation#custom-formatters
|
|
2322
|
+
*/
|
|
2323
|
+
declare function formatDay(date: Date, options?: DateLibOptions, dateLib?: DateLib): string;
|
|
2324
|
+
|
|
2325
|
+
/**
|
|
2326
|
+
* Formats the month for the dropdown option label.
|
|
2327
|
+
*
|
|
2328
|
+
* @defaultValue The localized full month name.
|
|
2329
|
+
* @param month The date representing the month.
|
|
2330
|
+
* @param dateLib The date library to use for formatting. Defaults to
|
|
2331
|
+
* `defaultDateLib`.
|
|
2332
|
+
* @returns The formatted month name as a string.
|
|
2333
|
+
* @group Formatters
|
|
2334
|
+
* @see https://daypicker.dev/docs/translation#custom-formatters
|
|
2335
|
+
*/
|
|
2336
|
+
declare function formatMonthDropdown(month: Date, dateLib?: DateLib): string;
|
|
2337
|
+
|
|
2338
|
+
/**
|
|
2339
|
+
* Formats the name of a weekday to be displayed in the weekdays header.
|
|
2340
|
+
*
|
|
2341
|
+
* @defaultValue `cccccc` (e.g., "Mo" for Monday).
|
|
2342
|
+
* @param weekday The date representing the weekday.
|
|
2343
|
+
* @param options Configuration options for the date library.
|
|
2344
|
+
* @param dateLib The date library to use for formatting. If not provided, a new
|
|
2345
|
+
* instance is created.
|
|
2346
|
+
* @returns The formatted weekday name as a string.
|
|
2347
|
+
* @group Formatters
|
|
2348
|
+
* @see https://daypicker.dev/docs/translation#custom-formatters
|
|
2349
|
+
*/
|
|
2350
|
+
declare function formatWeekdayName(weekday: Date, options?: DateLibOptions, dateLib?: DateLib): string;
|
|
2351
|
+
|
|
2352
|
+
/**
|
|
2353
|
+
* Formats the week number.
|
|
2354
|
+
*
|
|
2355
|
+
* @defaultValue The week number as a string, with a leading zero for single-digit numbers.
|
|
2356
|
+
* @param weekNumber The week number to format.
|
|
2357
|
+
* @param dateLib The date library to use for formatting. Defaults to
|
|
2358
|
+
* `defaultDateLib`.
|
|
2359
|
+
* @returns The formatted week number as a string.
|
|
2360
|
+
* @group Formatters
|
|
2361
|
+
* @see https://daypicker.dev/docs/translation#custom-formatters
|
|
2362
|
+
*/
|
|
2363
|
+
declare function formatWeekNumber(weekNumber: number, dateLib?: DateLib): string;
|
|
2364
|
+
|
|
2365
|
+
/**
|
|
2366
|
+
* Formats the header for the week number column.
|
|
2367
|
+
*
|
|
2368
|
+
* @defaultValue An empty string `""`.
|
|
2369
|
+
* @returns The formatted week number header as a string.
|
|
2370
|
+
* @group Formatters
|
|
2371
|
+
* @see https://daypicker.dev/docs/translation#custom-formatters
|
|
2372
|
+
*/
|
|
2373
|
+
declare function formatWeekNumberHeader(): string;
|
|
2374
|
+
|
|
2375
|
+
/**
|
|
2376
|
+
* Formats the year for the dropdown option label.
|
|
2377
|
+
*
|
|
2378
|
+
* @param year The year to format.
|
|
2379
|
+
* @param dateLib The date library to use for formatting. Defaults to
|
|
2380
|
+
* `defaultDateLib`.
|
|
2381
|
+
* @returns The formatted year as a string.
|
|
2382
|
+
* @group Formatters
|
|
2383
|
+
* @see https://daypicker.dev/docs/translation#custom-formatters
|
|
2384
|
+
*/
|
|
2385
|
+
declare function formatYearDropdown(year: Date, dateLib?: DateLib): string;
|
|
2386
|
+
|
|
2387
|
+
/**
|
|
2388
|
+
* Generates the ARIA label for a day button.
|
|
2389
|
+
*
|
|
2390
|
+
* Use the `modifiers` argument to provide additional context for the label,
|
|
2391
|
+
* such as indicating if the day is "today" or "selected."
|
|
2392
|
+
*
|
|
2393
|
+
* @defaultValue The formatted date.
|
|
2394
|
+
* @param date - The date to format.
|
|
2395
|
+
* @param modifiers - The modifiers providing context for the day.
|
|
2396
|
+
* @param options - Optional configuration for the date formatting library.
|
|
2397
|
+
* @param dateLib - An optional instance of the date formatting library.
|
|
2398
|
+
* @returns The ARIA label for the day button.
|
|
2399
|
+
* @group Labels
|
|
2400
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
2401
|
+
*/
|
|
2402
|
+
declare function labelDayButton(date: Date, modifiers: Modifiers, options?: DateLibOptions, dateLib?: DateLib): string;
|
|
2403
|
+
|
|
2404
|
+
/**
|
|
2405
|
+
* Generates the ARIA label for the month grid, which is announced when entering
|
|
2406
|
+
* the grid.
|
|
2407
|
+
*
|
|
2408
|
+
* @defaultValue Locale-specific month/year order (e.g., "November 2022").
|
|
2409
|
+
* @param date - The date representing the month.
|
|
2410
|
+
* @param options - Optional configuration for the date formatting library.
|
|
2411
|
+
* @param dateLib - An optional instance of the date formatting library.
|
|
2412
|
+
* @returns The ARIA label for the month grid.
|
|
2413
|
+
* @group Labels
|
|
2414
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
2415
|
+
*/
|
|
2416
|
+
declare function labelGrid(date: Date, options?: DateLibOptions, dateLib?: DateLib): string;
|
|
2417
|
+
|
|
2418
|
+
/**
|
|
2419
|
+
* Generates the label for a day grid cell when the calendar is not interactive.
|
|
2420
|
+
*
|
|
2421
|
+
* @param date - The date to format.
|
|
2422
|
+
* @param modifiers - Optional modifiers providing context for the day.
|
|
2423
|
+
* @param options - Optional configuration for the date formatting library.
|
|
2424
|
+
* @param dateLib - An optional instance of the date formatting library.
|
|
2425
|
+
* @returns The label for the day grid cell.
|
|
2426
|
+
* @group Labels
|
|
2427
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
2428
|
+
*/
|
|
2429
|
+
declare function labelGridcell(date: Date, modifiers?: Modifiers, options?: DateLibOptions, dateLib?: DateLib): string;
|
|
2430
|
+
|
|
2431
|
+
/**
|
|
2432
|
+
* Generates the ARIA label for the months dropdown.
|
|
2433
|
+
*
|
|
2434
|
+
* @defaultValue `"Choose the Month"`
|
|
2435
|
+
* @param options - Optional configuration for the date formatting library.
|
|
2436
|
+
* @returns The ARIA label for the months dropdown.
|
|
2437
|
+
* @group Labels
|
|
2438
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
2439
|
+
*/
|
|
2440
|
+
declare function labelMonthDropdown(_options?: DateLibOptions): string;
|
|
2441
|
+
|
|
2442
|
+
/**
|
|
2443
|
+
* Generates the ARIA label for the navigation toolbar.
|
|
2444
|
+
*
|
|
2445
|
+
* @defaultValue `""`
|
|
2446
|
+
* @returns The ARIA label for the navigation toolbar.
|
|
2447
|
+
* @group Labels
|
|
2448
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
2449
|
+
*/
|
|
2450
|
+
declare function labelNav(): string;
|
|
2451
|
+
|
|
2452
|
+
/**
|
|
2453
|
+
* Generates the ARIA label for the "next month" button.
|
|
2454
|
+
*
|
|
2455
|
+
* @defaultValue `"Go to the Next Month"`
|
|
2456
|
+
* @param month - The date representing the next month, or `undefined` if there
|
|
2457
|
+
* is no next month.
|
|
2458
|
+
* @returns The ARIA label for the "next month" button.
|
|
2459
|
+
* @group Labels
|
|
2460
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
2461
|
+
*/
|
|
2462
|
+
declare function labelNext(_month: Date | undefined, _options?: DateLibOptions): string;
|
|
2463
|
+
|
|
2464
|
+
/**
|
|
2465
|
+
* Generates the ARIA label for the "previous month" button.
|
|
2466
|
+
*
|
|
2467
|
+
* @defaultValue `"Go to the Previous Month"`
|
|
2468
|
+
* @param month - The date representing the previous month, or `undefined` if
|
|
2469
|
+
* there is no previous month.
|
|
2470
|
+
* @returns The ARIA label for the "previous month" button.
|
|
2471
|
+
* @group Labels
|
|
2472
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
2473
|
+
*/
|
|
2474
|
+
declare function labelPrevious(_month: Date | undefined): string;
|
|
2475
|
+
|
|
2476
|
+
/**
|
|
2477
|
+
* Generates the ARIA label for a weekday column header.
|
|
2478
|
+
*
|
|
2479
|
+
* @defaultValue `"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"`
|
|
2480
|
+
* @param date - The date representing the weekday.
|
|
2481
|
+
* @param options - Optional configuration for the date formatting library.
|
|
2482
|
+
* @param dateLib - An optional instance of the date formatting library.
|
|
2483
|
+
* @returns The ARIA label for the weekday column header.
|
|
2484
|
+
* @group Labels
|
|
2485
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
2486
|
+
*/
|
|
2487
|
+
declare function labelWeekday(date: Date, options?: DateLibOptions, dateLib?: DateLib): string;
|
|
2488
|
+
|
|
2489
|
+
/**
|
|
2490
|
+
* Generates the ARIA label for the week number cell (the first cell in a row).
|
|
2491
|
+
*
|
|
2492
|
+
* @defaultValue `Week ${weekNumber}`
|
|
2493
|
+
* @param weekNumber - The number of the week.
|
|
2494
|
+
* @param options - Optional configuration for the date formatting library.
|
|
2495
|
+
* @returns The ARIA label for the week number cell.
|
|
2496
|
+
* @group Labels
|
|
2497
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
2498
|
+
*/
|
|
2499
|
+
declare function labelWeekNumber(weekNumber: number, _options?: DateLibOptions): string;
|
|
2500
|
+
|
|
2501
|
+
/**
|
|
2502
|
+
* Generates the ARIA label for the week number header element.
|
|
2503
|
+
*
|
|
2504
|
+
* @defaultValue `"Week Number"`
|
|
2505
|
+
* @param options - Optional configuration for the date formatting library.
|
|
2506
|
+
* @returns The ARIA label for the week number header.
|
|
2507
|
+
* @group Labels
|
|
2508
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
2509
|
+
*/
|
|
2510
|
+
declare function labelWeekNumberHeader(_options?: DateLibOptions): string;
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* Generates the ARIA label for the years dropdown.
|
|
2514
|
+
*
|
|
2515
|
+
* @defaultValue `"Choose the Year"`
|
|
2516
|
+
* @param options - Optional configuration for the date formatting library.
|
|
2517
|
+
* @returns The ARIA label for the years dropdown.
|
|
2518
|
+
* @group Labels
|
|
2519
|
+
* @see https://daypicker.dev/docs/translation#aria-labels
|
|
2520
|
+
*/
|
|
2521
|
+
declare function labelYearDropdown(_options?: DateLibOptions): string;
|
|
2522
|
+
|
|
2523
|
+
/**
|
|
2524
|
+
* Enum representing the UI elements composing DayPicker. These elements are
|
|
2525
|
+
* mapped to {@link CustomComponents}, {@link ClassNames}, and {@link Styles}.
|
|
2526
|
+
*
|
|
2527
|
+
* Some elements are extended by flags and modifiers.
|
|
2528
|
+
*/
|
|
2529
|
+
declare enum UI {
|
|
2530
|
+
/** The root component displaying the months and the navigation bar. */
|
|
2531
|
+
Root = "root",
|
|
2532
|
+
/** The Chevron SVG element used by navigation buttons and dropdowns. */
|
|
2533
|
+
Chevron = "chevron",
|
|
2534
|
+
/**
|
|
2535
|
+
* The grid cell with the day's date. Extended by {@link DayFlag} and
|
|
2536
|
+
* {@link SelectionState}.
|
|
2537
|
+
*/
|
|
2538
|
+
Day = "day",
|
|
2539
|
+
/** The button containing the formatted day's date, inside the grid cell. */
|
|
2540
|
+
DayButton = "day_button",
|
|
2541
|
+
/** The caption label of the month (when not showing the dropdown navigation). */
|
|
2542
|
+
CaptionLabel = "caption_label",
|
|
2543
|
+
/** The container of the dropdown navigation (when enabled). */
|
|
2544
|
+
Dropdowns = "dropdowns",
|
|
2545
|
+
/** The dropdown element to select for years and months. */
|
|
2546
|
+
Dropdown = "dropdown",
|
|
2547
|
+
/** The container element of the dropdown. */
|
|
2548
|
+
DropdownRoot = "dropdown_root",
|
|
2549
|
+
/** The root element of the footer. */
|
|
2550
|
+
Footer = "footer",
|
|
2551
|
+
/** The month grid. */
|
|
2552
|
+
MonthGrid = "month_grid",
|
|
2553
|
+
/** Contains the dropdown navigation or the caption label. */
|
|
2554
|
+
MonthCaption = "month_caption",
|
|
2555
|
+
/** The dropdown with the months. */
|
|
2556
|
+
MonthsDropdown = "months_dropdown",
|
|
2557
|
+
/** Wrapper of the month grid. */
|
|
2558
|
+
Month = "month",
|
|
2559
|
+
/** The container of the displayed months. */
|
|
2560
|
+
Months = "months",
|
|
2561
|
+
/** The navigation bar with the previous and next buttons. */
|
|
2562
|
+
Nav = "nav",
|
|
2563
|
+
/**
|
|
2564
|
+
* The next month button in the navigation. *
|
|
2565
|
+
*
|
|
2566
|
+
* @since 9.1.0
|
|
2567
|
+
*/
|
|
2568
|
+
NextMonthButton = "button_next",
|
|
2569
|
+
/**
|
|
2570
|
+
* The previous month button in the navigation.
|
|
2571
|
+
*
|
|
2572
|
+
* @since 9.1.0
|
|
2573
|
+
*/
|
|
2574
|
+
PreviousMonthButton = "button_previous",
|
|
2575
|
+
/** The row containing the week. */
|
|
2576
|
+
Week = "week",
|
|
2577
|
+
/** The group of row weeks in a month (`tbody`). */
|
|
2578
|
+
Weeks = "weeks",
|
|
2579
|
+
/** The column header with the weekday. */
|
|
2580
|
+
Weekday = "weekday",
|
|
2581
|
+
/** The row grouping the weekdays in the column headers. */
|
|
2582
|
+
Weekdays = "weekdays",
|
|
2583
|
+
/** The cell containing the week number. */
|
|
2584
|
+
WeekNumber = "week_number",
|
|
2585
|
+
/** The cell header of the week numbers column. */
|
|
2586
|
+
WeekNumberHeader = "week_number_header",
|
|
2587
|
+
/** The dropdown with the years. */
|
|
2588
|
+
YearsDropdown = "years_dropdown"
|
|
2589
|
+
}
|
|
2590
|
+
/** Enum representing flags for the {@link UI | UI.Day} element. */
|
|
2591
|
+
declare enum DayFlag {
|
|
2592
|
+
/** The day is disabled. */
|
|
2593
|
+
disabled = "disabled",
|
|
2594
|
+
/** The day is hidden. */
|
|
2595
|
+
hidden = "hidden",
|
|
2596
|
+
/** The day is outside the current month. */
|
|
2597
|
+
outside = "outside",
|
|
2598
|
+
/** The day is focused. */
|
|
2599
|
+
focused = "focused",
|
|
2600
|
+
/** The day is today. */
|
|
2601
|
+
today = "today"
|
|
2602
|
+
}
|
|
2603
|
+
/**
|
|
2604
|
+
* Enum representing selection states that can be applied to the
|
|
2605
|
+
* {@link UI | UI.Day} element in selection mode.
|
|
2606
|
+
*/
|
|
2607
|
+
declare enum SelectionState {
|
|
2608
|
+
/** The day is at the end of a selected range. */
|
|
2609
|
+
range_end = "range_end",
|
|
2610
|
+
/** The day is at the middle of a selected range. */
|
|
2611
|
+
range_middle = "range_middle",
|
|
2612
|
+
/** The day is at the start of a selected range. */
|
|
2613
|
+
range_start = "range_start",
|
|
2614
|
+
/** The day is selected. */
|
|
2615
|
+
selected = "selected"
|
|
2616
|
+
}
|
|
2617
|
+
/**
|
|
2618
|
+
* Enum representing different animation states for transitioning between
|
|
2619
|
+
* months.
|
|
2620
|
+
*/
|
|
2621
|
+
declare enum Animation {
|
|
2622
|
+
/** The entering weeks when they appear before the exiting month. */
|
|
2623
|
+
weeks_before_enter = "weeks_before_enter",
|
|
2624
|
+
/** The exiting weeks when they disappear before the entering month. */
|
|
2625
|
+
weeks_before_exit = "weeks_before_exit",
|
|
2626
|
+
/** The entering weeks when they appear after the exiting month. */
|
|
2627
|
+
weeks_after_enter = "weeks_after_enter",
|
|
2628
|
+
/** The exiting weeks when they disappear after the entering month. */
|
|
2629
|
+
weeks_after_exit = "weeks_after_exit",
|
|
2630
|
+
/** The entering caption when it appears after the exiting month. */
|
|
2631
|
+
caption_after_enter = "caption_after_enter",
|
|
2632
|
+
/** The exiting caption when it disappears after the entering month. */
|
|
2633
|
+
caption_after_exit = "caption_after_exit",
|
|
2634
|
+
/** The entering caption when it appears before the exiting month. */
|
|
2635
|
+
caption_before_enter = "caption_before_enter",
|
|
2636
|
+
/** The exiting caption when it disappears before the entering month. */
|
|
2637
|
+
caption_before_exit = "caption_before_exit"
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
/**
|
|
2641
|
+
* Selection modes supported by DayPicker.
|
|
2642
|
+
*
|
|
2643
|
+
* - `single`: Select a single day.
|
|
2644
|
+
* - `multiple`: Select multiple days.
|
|
2645
|
+
* - `range`: Select a range of days.
|
|
2646
|
+
*
|
|
2647
|
+
* @see https://daypicker.dev/docs/selection-modes
|
|
2648
|
+
*/
|
|
2649
|
+
type Mode = "single" | "multiple" | "range";
|
|
2650
|
+
/**
|
|
2651
|
+
* The components that can be customized using the `components` prop.
|
|
2652
|
+
*
|
|
2653
|
+
* @see https://daypicker.dev/guides/custom-components
|
|
2654
|
+
*/
|
|
2655
|
+
type CustomComponents = {
|
|
2656
|
+
/** Render the chevron icon used in the navigation buttons and dropdowns. */
|
|
2657
|
+
Chevron: typeof Chevron;
|
|
2658
|
+
/** Render the caption label of the month grid. */
|
|
2659
|
+
CaptionLabel: typeof CaptionLabel;
|
|
2660
|
+
/** Render the day cell in the month grid. */
|
|
2661
|
+
Day: typeof Day;
|
|
2662
|
+
/** Render the button containing the day in the day cell. */
|
|
2663
|
+
DayButton: typeof DayButton;
|
|
2664
|
+
/** Render the dropdown element to select years and months. */
|
|
2665
|
+
Dropdown: typeof Dropdown;
|
|
2666
|
+
/** Render the container of the dropdowns. */
|
|
2667
|
+
DropdownNav: typeof DropdownNav;
|
|
2668
|
+
/** Render the footer element announced by screen readers. */
|
|
2669
|
+
Footer: typeof Footer;
|
|
2670
|
+
/** Render the container of the MonthGrid. */
|
|
2671
|
+
Month: typeof Month;
|
|
2672
|
+
/** Render the caption of the month grid. */
|
|
2673
|
+
MonthCaption: typeof MonthCaption;
|
|
2674
|
+
/** Render the grid of days in a month. */
|
|
2675
|
+
MonthGrid: typeof MonthGrid;
|
|
2676
|
+
/** Wrapper of the month grids. */
|
|
2677
|
+
Months: typeof Months;
|
|
2678
|
+
/** Render the navigation element with the next and previous buttons. */
|
|
2679
|
+
Nav: typeof Nav;
|
|
2680
|
+
/** Render the `<option>` HTML element in the dropdown. */
|
|
2681
|
+
Option: typeof Option;
|
|
2682
|
+
/** Render the previous month button element in the navigation. */
|
|
2683
|
+
PreviousMonthButton: typeof PreviousMonthButton;
|
|
2684
|
+
/** Render the next month button element in the navigation. */
|
|
2685
|
+
NextMonthButton: typeof NextMonthButton;
|
|
2686
|
+
/** Render the root element of the calendar. */
|
|
2687
|
+
Root: typeof Root;
|
|
2688
|
+
/** Render the select element in the dropdowns. */
|
|
2689
|
+
Select: typeof Select;
|
|
2690
|
+
/** Render the weeks section in the month grid. */
|
|
2691
|
+
Weeks: typeof Weeks;
|
|
2692
|
+
/** Render the week rows. */
|
|
2693
|
+
Week: typeof Week;
|
|
2694
|
+
/** Render the weekday name in the header. */
|
|
2695
|
+
Weekday: typeof Weekday;
|
|
2696
|
+
/** Render the row containing the week days. */
|
|
2697
|
+
Weekdays: typeof Weekdays;
|
|
2698
|
+
/** Render the cell with the number of the week. */
|
|
2699
|
+
WeekNumber: typeof WeekNumber;
|
|
2700
|
+
/** Render the header of the week number column. */
|
|
2701
|
+
WeekNumberHeader: typeof WeekNumberHeader;
|
|
2702
|
+
/** Render the dropdown for selecting months. */
|
|
2703
|
+
MonthsDropdown: typeof MonthsDropdown;
|
|
2704
|
+
/** Render the dropdown for selecting years. */
|
|
2705
|
+
YearsDropdown: typeof YearsDropdown;
|
|
2706
|
+
};
|
|
2707
|
+
/** Represents a map of formatters used to render localized content. */
|
|
2708
|
+
type Formatters = {
|
|
2709
|
+
/** Format the caption of a month grid. */
|
|
2710
|
+
formatCaption: typeof formatCaption;
|
|
2711
|
+
/** Format the day in the day cell. */
|
|
2712
|
+
formatDay: typeof formatDay;
|
|
2713
|
+
/** Format the label in the month dropdown. */
|
|
2714
|
+
formatMonthDropdown: typeof formatMonthDropdown;
|
|
2715
|
+
/** Format the week number. */
|
|
2716
|
+
formatWeekNumber: typeof formatWeekNumber;
|
|
2717
|
+
/** Format the header of the week number column. */
|
|
2718
|
+
formatWeekNumberHeader: typeof formatWeekNumberHeader;
|
|
2719
|
+
/** Format the week day name in the header. */
|
|
2720
|
+
formatWeekdayName: typeof formatWeekdayName;
|
|
2721
|
+
/** Format the label in the year dropdown. */
|
|
2722
|
+
formatYearDropdown: typeof formatYearDropdown;
|
|
2723
|
+
};
|
|
2724
|
+
/** A map of functions to translate ARIA labels for various elements. */
|
|
2725
|
+
type Labels = {
|
|
2726
|
+
/** The label for the navigation toolbar. */
|
|
2727
|
+
labelNav: typeof labelNav;
|
|
2728
|
+
/** The label for the month grid. */
|
|
2729
|
+
labelGrid: typeof labelGrid;
|
|
2730
|
+
/** The label for the gridcell, when the calendar is not interactive. */
|
|
2731
|
+
labelGridcell: typeof labelGridcell;
|
|
2732
|
+
/** The label for the month dropdown. */
|
|
2733
|
+
labelMonthDropdown: typeof labelMonthDropdown;
|
|
2734
|
+
/** The label for the year dropdown. */
|
|
2735
|
+
labelYearDropdown: typeof labelYearDropdown;
|
|
2736
|
+
/** The label for the "next month" button. */
|
|
2737
|
+
labelNext: typeof labelNext;
|
|
2738
|
+
/** The label for the "previous month" button. */
|
|
2739
|
+
labelPrevious: typeof labelPrevious;
|
|
2740
|
+
/** The label for the day button. */
|
|
2741
|
+
labelDayButton: typeof labelDayButton;
|
|
2742
|
+
/** The label for the weekday. */
|
|
2743
|
+
labelWeekday: typeof labelWeekday;
|
|
2744
|
+
/** The label for the week number. */
|
|
2745
|
+
labelWeekNumber: typeof labelWeekNumber;
|
|
2746
|
+
/** The label for the column of week numbers. */
|
|
2747
|
+
labelWeekNumberHeader: typeof labelWeekNumberHeader;
|
|
2748
|
+
};
|
|
2749
|
+
/**
|
|
2750
|
+
* A value or a function that matches specific days.
|
|
2751
|
+
*
|
|
2752
|
+
* @example
|
|
2753
|
+
* // Match weekends and specific holidays
|
|
2754
|
+
* const matcher: Matcher = [
|
|
2755
|
+
* { dayOfWeek: [0, 6] }, // Weekends
|
|
2756
|
+
* { from: new Date(2023, 11, 24), to: new Date(2023, 11, 26) }, // Christmas
|
|
2757
|
+
* ];
|
|
2758
|
+
*/
|
|
2759
|
+
type Matcher = boolean | ((date: Date) => boolean) | Date | Date[] | DateRange | DateBefore | DateAfter | DateInterval | DayOfWeek;
|
|
2760
|
+
/**
|
|
2761
|
+
* Match a day falling after the specified date (exclusive).
|
|
2762
|
+
*
|
|
2763
|
+
* @example
|
|
2764
|
+
* // Match days after February 2, 2019
|
|
2765
|
+
* const matcher: DateAfter = { after: new Date(2019, 1, 2) };
|
|
2766
|
+
*/
|
|
2767
|
+
type DateAfter = {
|
|
2768
|
+
after: Date;
|
|
2769
|
+
};
|
|
2770
|
+
/**
|
|
2771
|
+
* Match a day falling before the specified date (exclusive).
|
|
2772
|
+
*
|
|
2773
|
+
* @example
|
|
2774
|
+
* // Match days before February 2, 2019
|
|
2775
|
+
* const matcher: DateBefore = { before: new Date(2019, 1, 2) };
|
|
2776
|
+
*/
|
|
2777
|
+
type DateBefore = {
|
|
2778
|
+
before: Date;
|
|
2779
|
+
};
|
|
2780
|
+
/**
|
|
2781
|
+
* An interval of dates. Unlike {@link DateRange}, the range ends are not
|
|
2782
|
+
* included.
|
|
2783
|
+
*
|
|
2784
|
+
* @example
|
|
2785
|
+
* // Match days between February 2 and February 5, 2019
|
|
2786
|
+
* const matcher: DateInterval = {
|
|
2787
|
+
* after: new Date(2019, 1, 2),
|
|
2788
|
+
* before: new Date(2019, 1, 5),
|
|
2789
|
+
* };
|
|
2790
|
+
*/
|
|
2791
|
+
type DateInterval = {
|
|
2792
|
+
before: Date;
|
|
2793
|
+
after: Date;
|
|
2794
|
+
};
|
|
2795
|
+
/**
|
|
2796
|
+
* A range of dates. Unlike {@link DateInterval}, the range ends are included.
|
|
2797
|
+
*
|
|
2798
|
+
* @example
|
|
2799
|
+
* // Match days between February 2 and February 5, 2019
|
|
2800
|
+
* const matcher: DateRange = {
|
|
2801
|
+
* from: new Date(2019, 1, 2),
|
|
2802
|
+
* to: new Date(2019, 1, 5),
|
|
2803
|
+
* };
|
|
2804
|
+
*/
|
|
2805
|
+
type DateRange = {
|
|
2806
|
+
from: Date | undefined;
|
|
2807
|
+
to?: Date | undefined;
|
|
2808
|
+
};
|
|
2809
|
+
/**
|
|
2810
|
+
* Match days of the week (`0-6`, where `0` is Sunday).
|
|
2811
|
+
*
|
|
2812
|
+
* @example
|
|
2813
|
+
* // Match Sundays
|
|
2814
|
+
* const matcher: DayOfWeek = { dayOfWeek: 0 };
|
|
2815
|
+
* // Match weekends
|
|
2816
|
+
* const matcher: DayOfWeek = { dayOfWeek: [0, 6] };
|
|
2817
|
+
*/
|
|
2818
|
+
type DayOfWeek = {
|
|
2819
|
+
dayOfWeek: number | number[];
|
|
2820
|
+
};
|
|
2821
|
+
/**
|
|
2822
|
+
* The event handler triggered when clicking or interacting with a day.
|
|
2823
|
+
*
|
|
2824
|
+
* @template EventType - The event type that triggered the event (e.g.
|
|
2825
|
+
* `React.MouseEvent`, `React.KeyboardEvent`, etc.).
|
|
2826
|
+
* @param date - The date that has triggered the event.
|
|
2827
|
+
* @param modifiers - The modifiers belonging to the date.
|
|
2828
|
+
* @param e - The DOM event that triggered the event.
|
|
2829
|
+
*/
|
|
2830
|
+
type DayEventHandler<EventType> = (date: Date, modifiers: Modifiers, e: EventType) => void;
|
|
2831
|
+
/**
|
|
2832
|
+
* The event handler when a month is changed in the calendar.
|
|
2833
|
+
*
|
|
2834
|
+
* ```tsx
|
|
2835
|
+
* <DayPicker onMonthChange={(month) => console.log(month)} />
|
|
2836
|
+
* ```
|
|
2837
|
+
*
|
|
2838
|
+
* @see https://daypicker.dev/docs/navigation
|
|
2839
|
+
*/
|
|
2840
|
+
type MonthChangeEventHandler = (month: Date) => void;
|
|
2841
|
+
/**
|
|
2842
|
+
* The CSS classnames to use for the {@link UI} elements, the
|
|
2843
|
+
* {@link SelectionState} and the {@link DayFlag}.
|
|
2844
|
+
*
|
|
2845
|
+
* @example
|
|
2846
|
+
* const classNames: ClassNames = {
|
|
2847
|
+
* [UI.Root]: "root",
|
|
2848
|
+
* [UI.Outside]: "outside",
|
|
2849
|
+
* [UI.Nav]: "nav",
|
|
2850
|
+
* // etc.
|
|
2851
|
+
* };
|
|
2852
|
+
*/
|
|
2853
|
+
type ClassNames = {
|
|
2854
|
+
[key in UI | SelectionState | DayFlag | Animation]: string;
|
|
2855
|
+
};
|
|
2856
|
+
/**
|
|
2857
|
+
* The CSS styles to use for the {@link UI} elements, the {@link SelectionState}
|
|
2858
|
+
* and the {@link DayFlag}.
|
|
2859
|
+
*/
|
|
2860
|
+
type Styles = {
|
|
2861
|
+
[key in UI | SelectionState | DayFlag]: CSSProperties | undefined;
|
|
2862
|
+
};
|
|
2863
|
+
/**
|
|
2864
|
+
* Represents the modifiers that match a specific day in the calendar.
|
|
2865
|
+
*
|
|
2866
|
+
* @example
|
|
2867
|
+
* const modifiers: Modifiers = {
|
|
2868
|
+
* today: true, // The day is today
|
|
2869
|
+
* selected: false, // The day is not selected
|
|
2870
|
+
* weekend: true, // Custom modifier for weekends
|
|
2871
|
+
* };
|
|
2872
|
+
*
|
|
2873
|
+
* @see https://daypicker.dev/guides/custom-modifiers
|
|
2874
|
+
*/
|
|
2875
|
+
type Modifiers = Record<string, boolean>;
|
|
2876
|
+
/**
|
|
2877
|
+
* The style to apply to each day element matching a modifier.
|
|
2878
|
+
*
|
|
2879
|
+
* @example
|
|
2880
|
+
* const modifiersStyles: ModifiersStyles = {
|
|
2881
|
+
* today: { color: "red" },
|
|
2882
|
+
* selected: { backgroundColor: "blue" },
|
|
2883
|
+
* weekend: { color: "green" },
|
|
2884
|
+
* };
|
|
2885
|
+
*/
|
|
2886
|
+
type ModifiersStyles = Record<string, CSSProperties>;
|
|
2887
|
+
/**
|
|
2888
|
+
* The classnames to assign to each day element matching a modifier.
|
|
2889
|
+
*
|
|
2890
|
+
* @example
|
|
2891
|
+
* const modifiersClassNames: ModifiersClassNames = {
|
|
2892
|
+
* today: "today", // Use the "today" class for the today's day
|
|
2893
|
+
* selected: "highlight", // Use the "highlight" class for the selected day
|
|
2894
|
+
* weekend: "weekend", // Use the "weekend" class for the weekend days
|
|
2895
|
+
* };
|
|
2896
|
+
*/
|
|
2897
|
+
type ModifiersClassNames = Record<string, string>;
|
|
2898
|
+
/**
|
|
2899
|
+
* The numbering system supported by DayPicker.
|
|
2900
|
+
*
|
|
2901
|
+
* - `latn`: Latin (Western Arabic)
|
|
2902
|
+
* - `arab`: Arabic-Indic
|
|
2903
|
+
* - `arabext`: Eastern Arabic-Indic (Persian)
|
|
2904
|
+
* - `deva`: Devanagari
|
|
2905
|
+
* - `beng`: Bengali
|
|
2906
|
+
* - `guru`: Gurmukhi
|
|
2907
|
+
* - `gujr`: Gujarati
|
|
2908
|
+
* - `orya`: Oriya
|
|
2909
|
+
* - `tamldec`: Tamil
|
|
2910
|
+
* - `telu`: Telugu
|
|
2911
|
+
* - `knda`: Kannada
|
|
2912
|
+
* - `mlym`: Malayalam
|
|
2913
|
+
* - `thai`: Thai
|
|
2914
|
+
* - `mymr`: Myanmar
|
|
2915
|
+
* - `khmr`: Khmer
|
|
2916
|
+
* - `laoo`: Lao
|
|
2917
|
+
* - `tibt`: Tibetan
|
|
2918
|
+
*
|
|
2919
|
+
* @see https://daypicker.dev/docs/translation#numeral-systems
|
|
2920
|
+
*/
|
|
2921
|
+
type Numerals = "latn" | "arab" | "arabext" | "deva" | "geez" | "beng" | "guru" | "gujr" | "orya" | "tamldec" | "telu" | "knda" | "mlym" | "thai" | "mymr" | "khmr" | "laoo" | "tibt";
|
|
2922
|
+
|
|
2923
|
+
/**
|
|
2924
|
+
* Translations for DayPicker-specific labels.
|
|
2925
|
+
*
|
|
2926
|
+
* @since V9.12.0
|
|
2927
|
+
*/
|
|
2928
|
+
type DayPickerLocaleLabels = {
|
|
2929
|
+
[K in keyof Labels]?: string | Labels[K];
|
|
2930
|
+
};
|
|
2931
|
+
/**
|
|
2932
|
+
* Locale type used by DayPicker.
|
|
2933
|
+
*
|
|
2934
|
+
* @since V9.12.0
|
|
2935
|
+
*/
|
|
2936
|
+
interface DayPickerLocale extends Locale {
|
|
2937
|
+
/** Localized DayPicker-specific labels. */
|
|
2938
|
+
labels?: DayPickerLocaleLabels;
|
|
2939
|
+
}
|
|
2940
|
+
/** Indicates the preferred ordering of month and year for localized labels. */
|
|
2941
|
+
type MonthYearOrder = "month-first" | "year-first";
|
|
2942
|
+
/**
|
|
2943
|
+
* The options for the `DateLib` class.
|
|
2944
|
+
*
|
|
2945
|
+
* Extends `date-fns` [format](https://date-fns.org/docs/format),
|
|
2946
|
+
* [startOfWeek](https://date-fns.org/docs/startOfWeek) and
|
|
2947
|
+
* [endOfWeek](https://date-fns.org/docs/endOfWeek) options.
|
|
2948
|
+
*
|
|
2949
|
+
* @since 9.2.0
|
|
2950
|
+
*/
|
|
2951
|
+
interface DateLibOptions extends FormatOptions, StartOfWeekOptions, EndOfWeekOptions {
|
|
2952
|
+
/** A constructor for the `Date` object. */
|
|
2953
|
+
Date?: typeof Date;
|
|
2954
|
+
/** A locale to use for formatting dates. */
|
|
2955
|
+
locale?: DayPickerLocale;
|
|
2956
|
+
/**
|
|
2957
|
+
* A time zone to use for dates.
|
|
2958
|
+
*
|
|
2959
|
+
* @since 9.5.0
|
|
2960
|
+
*/
|
|
2961
|
+
timeZone?: string;
|
|
2962
|
+
/**
|
|
2963
|
+
* The numbering system to use for formatting numbers.
|
|
2964
|
+
*
|
|
2965
|
+
* @since 9.5.0
|
|
2966
|
+
*/
|
|
2967
|
+
numerals?: Numerals;
|
|
2968
|
+
}
|
|
2969
|
+
/**
|
|
2970
|
+
* A wrapper class around [date-fns](http://date-fns.org) that provides utility
|
|
2971
|
+
* methods for date manipulation and formatting.
|
|
2972
|
+
*
|
|
2973
|
+
* @since 9.2.0
|
|
2974
|
+
* @example
|
|
2975
|
+
* const dateLib = new DateLib({ locale: es });
|
|
2976
|
+
* const newDate = dateLib.addDays(new Date(), 5);
|
|
2977
|
+
*/
|
|
2978
|
+
declare class DateLib {
|
|
2979
|
+
/** The options for configuring the date library. */
|
|
2980
|
+
readonly options: DateLibOptions;
|
|
2981
|
+
/** Overrides for the default date library functions. */
|
|
2982
|
+
readonly overrides?: Partial<typeof DateLib.prototype>;
|
|
2983
|
+
/**
|
|
2984
|
+
* Creates an instance of `DateLib`.
|
|
2985
|
+
*
|
|
2986
|
+
* @param options Configuration options for the date library.
|
|
2987
|
+
* @param overrides Custom overrides for the date library functions.
|
|
2988
|
+
*/
|
|
2989
|
+
constructor(options?: DateLibOptions, overrides?: Partial<typeof DateLib.prototype>);
|
|
2990
|
+
/**
|
|
2991
|
+
* Generates a mapping of Arabic digits (0-9) to the target numbering system
|
|
2992
|
+
* digits.
|
|
2993
|
+
*
|
|
2994
|
+
* @since 9.5.0
|
|
2995
|
+
* @returns A record mapping Arabic digits to the target numerals.
|
|
2996
|
+
*/
|
|
2997
|
+
private getDigitMap;
|
|
2998
|
+
/**
|
|
2999
|
+
* Replaces Arabic digits in a string with the target numbering system digits.
|
|
3000
|
+
*
|
|
3001
|
+
* @since 9.5.0
|
|
3002
|
+
* @param input The string containing Arabic digits.
|
|
3003
|
+
* @returns The string with digits replaced.
|
|
3004
|
+
*/
|
|
3005
|
+
private replaceDigits;
|
|
3006
|
+
/**
|
|
3007
|
+
* Formats a number using the configured numbering system.
|
|
3008
|
+
*
|
|
3009
|
+
* @since 9.5.0
|
|
3010
|
+
* @param value The number to format.
|
|
3011
|
+
* @returns The formatted number as a string.
|
|
3012
|
+
*/
|
|
3013
|
+
formatNumber(value: number | string): string;
|
|
3014
|
+
/**
|
|
3015
|
+
* Returns the preferred ordering for month and year labels for the current
|
|
3016
|
+
* locale.
|
|
3017
|
+
*/
|
|
3018
|
+
getMonthYearOrder(): MonthYearOrder;
|
|
3019
|
+
/**
|
|
3020
|
+
* Formats the month/year pair respecting locale conventions.
|
|
3021
|
+
*
|
|
3022
|
+
* @since 9.11.0
|
|
3023
|
+
*/
|
|
3024
|
+
formatMonthYear(date: Date): string;
|
|
3025
|
+
private static readonly yearFirstLocales;
|
|
3026
|
+
/**
|
|
3027
|
+
* Creates a new `Date` object representing today's date.
|
|
3028
|
+
*
|
|
3029
|
+
* @since 9.5.0
|
|
3030
|
+
* @returns A `Date` object for today's date.
|
|
3031
|
+
*/
|
|
3032
|
+
today: () => Date;
|
|
3033
|
+
/**
|
|
3034
|
+
* Creates a new `Date` object with the specified year, month, and day.
|
|
3035
|
+
*
|
|
3036
|
+
* @since 9.5.0
|
|
3037
|
+
* @param year The year.
|
|
3038
|
+
* @param monthIndex The month (0-11).
|
|
3039
|
+
* @param date The day of the month.
|
|
3040
|
+
* @returns A new `Date` object.
|
|
3041
|
+
*/
|
|
3042
|
+
newDate: (year: number, monthIndex: number, date: number) => Date;
|
|
3043
|
+
/**
|
|
3044
|
+
* Adds the specified number of days to the given date.
|
|
3045
|
+
*
|
|
3046
|
+
* @param date The date to add days to.
|
|
3047
|
+
* @param amount The number of days to add.
|
|
3048
|
+
* @returns The new date with the days added.
|
|
3049
|
+
*/
|
|
3050
|
+
addDays: (date: Date, amount: number) => Date;
|
|
3051
|
+
/**
|
|
3052
|
+
* Adds the specified number of months to the given date.
|
|
3053
|
+
*
|
|
3054
|
+
* @param date The date to add months to.
|
|
3055
|
+
* @param amount The number of months to add.
|
|
3056
|
+
* @returns The new date with the months added.
|
|
3057
|
+
*/
|
|
3058
|
+
addMonths: (date: Date, amount: number) => Date;
|
|
3059
|
+
/**
|
|
3060
|
+
* Adds the specified number of weeks to the given date.
|
|
3061
|
+
*
|
|
3062
|
+
* @param date The date to add weeks to.
|
|
3063
|
+
* @param amount The number of weeks to add.
|
|
3064
|
+
* @returns The new date with the weeks added.
|
|
3065
|
+
*/
|
|
3066
|
+
addWeeks: (date: Date, amount: number) => Date;
|
|
3067
|
+
/**
|
|
3068
|
+
* Adds the specified number of years to the given date.
|
|
3069
|
+
*
|
|
3070
|
+
* @param date The date to add years to.
|
|
3071
|
+
* @param amount The number of years to add.
|
|
3072
|
+
* @returns The new date with the years added.
|
|
3073
|
+
*/
|
|
3074
|
+
addYears: (date: Date, amount: number) => Date;
|
|
3075
|
+
/**
|
|
3076
|
+
* Returns the number of calendar days between the given dates.
|
|
3077
|
+
*
|
|
3078
|
+
* @param dateLeft The later date.
|
|
3079
|
+
* @param dateRight The earlier date.
|
|
3080
|
+
* @returns The number of calendar days between the dates.
|
|
3081
|
+
*/
|
|
3082
|
+
differenceInCalendarDays: (dateLeft: Date, dateRight: Date) => number;
|
|
3083
|
+
/**
|
|
3084
|
+
* Returns the number of calendar months between the given dates.
|
|
3085
|
+
*
|
|
3086
|
+
* @param dateLeft The later date.
|
|
3087
|
+
* @param dateRight The earlier date.
|
|
3088
|
+
* @returns The number of calendar months between the dates.
|
|
3089
|
+
*/
|
|
3090
|
+
differenceInCalendarMonths: (dateLeft: Date, dateRight: Date) => number;
|
|
3091
|
+
/**
|
|
3092
|
+
* Returns the months between the given dates.
|
|
3093
|
+
*
|
|
3094
|
+
* @param interval The interval to get the months for.
|
|
3095
|
+
*/
|
|
3096
|
+
eachMonthOfInterval: (interval: Interval) => Date[];
|
|
3097
|
+
/**
|
|
3098
|
+
* Returns the years between the given dates.
|
|
3099
|
+
*
|
|
3100
|
+
* @since 9.11.1
|
|
3101
|
+
* @param interval The interval to get the years for.
|
|
3102
|
+
* @returns The array of years in the interval.
|
|
3103
|
+
*/
|
|
3104
|
+
eachYearOfInterval: (interval: Interval) => Date[];
|
|
3105
|
+
/**
|
|
3106
|
+
* Returns the end of the broadcast week for the given date.
|
|
3107
|
+
*
|
|
3108
|
+
* @param date The original date.
|
|
3109
|
+
* @returns The end of the broadcast week.
|
|
3110
|
+
*/
|
|
3111
|
+
endOfBroadcastWeek: (date: Date) => Date;
|
|
3112
|
+
/**
|
|
3113
|
+
* Returns the end of the ISO week for the given date.
|
|
3114
|
+
*
|
|
3115
|
+
* @param date The original date.
|
|
3116
|
+
* @returns The end of the ISO week.
|
|
3117
|
+
*/
|
|
3118
|
+
endOfISOWeek: (date: Date) => Date;
|
|
3119
|
+
/**
|
|
3120
|
+
* Returns the end of the month for the given date.
|
|
3121
|
+
*
|
|
3122
|
+
* @param date The original date.
|
|
3123
|
+
* @returns The end of the month.
|
|
3124
|
+
*/
|
|
3125
|
+
endOfMonth: (date: Date) => Date;
|
|
3126
|
+
/**
|
|
3127
|
+
* Returns the end of the week for the given date.
|
|
3128
|
+
*
|
|
3129
|
+
* @param date The original date.
|
|
3130
|
+
* @returns The end of the week.
|
|
3131
|
+
*/
|
|
3132
|
+
endOfWeek: (date: Date, options?: EndOfWeekOptions<Date>) => Date;
|
|
3133
|
+
/**
|
|
3134
|
+
* Returns the end of the year for the given date.
|
|
3135
|
+
*
|
|
3136
|
+
* @param date The original date.
|
|
3137
|
+
* @returns The end of the year.
|
|
3138
|
+
*/
|
|
3139
|
+
endOfYear: (date: Date) => Date;
|
|
3140
|
+
/**
|
|
3141
|
+
* Formats the given date using the specified format string.
|
|
3142
|
+
*
|
|
3143
|
+
* @param date The date to format.
|
|
3144
|
+
* @param formatStr The format string.
|
|
3145
|
+
* @returns The formatted date string.
|
|
3146
|
+
*/
|
|
3147
|
+
format: (date: Date, formatStr: string, _options?: FormatOptions) => string;
|
|
3148
|
+
/**
|
|
3149
|
+
* Returns the ISO week number for the given date.
|
|
3150
|
+
*
|
|
3151
|
+
* @param date The date to get the ISO week number for.
|
|
3152
|
+
* @returns The ISO week number.
|
|
3153
|
+
*/
|
|
3154
|
+
getISOWeek: (date: Date) => number;
|
|
3155
|
+
/**
|
|
3156
|
+
* Returns the month of the given date.
|
|
3157
|
+
*
|
|
3158
|
+
* @param date The date to get the month for.
|
|
3159
|
+
* @returns The month.
|
|
3160
|
+
*/
|
|
3161
|
+
getMonth: (date: Date, _options?: GetMonthOptions) => number;
|
|
3162
|
+
/**
|
|
3163
|
+
* Returns the year of the given date.
|
|
3164
|
+
*
|
|
3165
|
+
* @param date The date to get the year for.
|
|
3166
|
+
* @returns The year.
|
|
3167
|
+
*/
|
|
3168
|
+
getYear: (date: Date, _options?: GetYearOptions) => number;
|
|
3169
|
+
/**
|
|
3170
|
+
* Returns the local week number for the given date.
|
|
3171
|
+
*
|
|
3172
|
+
* @param date The date to get the week number for.
|
|
3173
|
+
* @returns The week number.
|
|
3174
|
+
*/
|
|
3175
|
+
getWeek: (date: Date, _options?: GetWeekOptions) => number;
|
|
3176
|
+
/**
|
|
3177
|
+
* Checks if the first date is after the second date.
|
|
3178
|
+
*
|
|
3179
|
+
* @param date The date to compare.
|
|
3180
|
+
* @param dateToCompare The date to compare with.
|
|
3181
|
+
* @returns True if the first date is after the second date.
|
|
3182
|
+
*/
|
|
3183
|
+
isAfter: (date: Date, dateToCompare: Date) => boolean;
|
|
3184
|
+
/**
|
|
3185
|
+
* Checks if the first date is before the second date.
|
|
3186
|
+
*
|
|
3187
|
+
* @param date The date to compare.
|
|
3188
|
+
* @param dateToCompare The date to compare with.
|
|
3189
|
+
* @returns True if the first date is before the second date.
|
|
3190
|
+
*/
|
|
3191
|
+
isBefore: (date: Date, dateToCompare: Date) => boolean;
|
|
3192
|
+
/**
|
|
3193
|
+
* Checks if the given value is a Date object.
|
|
3194
|
+
*
|
|
3195
|
+
* @param value The value to check.
|
|
3196
|
+
* @returns True if the value is a Date object.
|
|
3197
|
+
*/
|
|
3198
|
+
isDate: (value: unknown) => value is Date;
|
|
3199
|
+
/**
|
|
3200
|
+
* Checks if the given dates are on the same day.
|
|
3201
|
+
*
|
|
3202
|
+
* @param dateLeft The first date to compare.
|
|
3203
|
+
* @param dateRight The second date to compare.
|
|
3204
|
+
* @returns True if the dates are on the same day.
|
|
3205
|
+
*/
|
|
3206
|
+
isSameDay: (dateLeft: Date, dateRight: Date) => boolean;
|
|
3207
|
+
/**
|
|
3208
|
+
* Checks if the given dates are in the same month.
|
|
3209
|
+
*
|
|
3210
|
+
* @param dateLeft The first date to compare.
|
|
3211
|
+
* @param dateRight The second date to compare.
|
|
3212
|
+
* @returns True if the dates are in the same month.
|
|
3213
|
+
*/
|
|
3214
|
+
isSameMonth: (dateLeft: Date, dateRight: Date) => boolean;
|
|
3215
|
+
/**
|
|
3216
|
+
* Checks if the given dates are in the same year.
|
|
3217
|
+
*
|
|
3218
|
+
* @param dateLeft The first date to compare.
|
|
3219
|
+
* @param dateRight The second date to compare.
|
|
3220
|
+
* @returns True if the dates are in the same year.
|
|
3221
|
+
*/
|
|
3222
|
+
isSameYear: (dateLeft: Date, dateRight: Date) => boolean;
|
|
3223
|
+
/**
|
|
3224
|
+
* Returns the latest date in the given array of dates.
|
|
3225
|
+
*
|
|
3226
|
+
* @param dates The array of dates to compare.
|
|
3227
|
+
* @returns The latest date.
|
|
3228
|
+
*/
|
|
3229
|
+
max: (dates: Date[]) => Date;
|
|
3230
|
+
/**
|
|
3231
|
+
* Returns the earliest date in the given array of dates.
|
|
3232
|
+
*
|
|
3233
|
+
* @param dates The array of dates to compare.
|
|
3234
|
+
* @returns The earliest date.
|
|
3235
|
+
*/
|
|
3236
|
+
min: (dates: Date[]) => Date;
|
|
3237
|
+
/**
|
|
3238
|
+
* Sets the month of the given date.
|
|
3239
|
+
*
|
|
3240
|
+
* @param date The date to set the month on.
|
|
3241
|
+
* @param month The month to set (0-11).
|
|
3242
|
+
* @returns The new date with the month set.
|
|
3243
|
+
*/
|
|
3244
|
+
setMonth: (date: Date, month: number) => Date;
|
|
3245
|
+
/**
|
|
3246
|
+
* Sets the year of the given date.
|
|
3247
|
+
*
|
|
3248
|
+
* @param date The date to set the year on.
|
|
3249
|
+
* @param year The year to set.
|
|
3250
|
+
* @returns The new date with the year set.
|
|
3251
|
+
*/
|
|
3252
|
+
setYear: (date: Date, year: number) => Date;
|
|
3253
|
+
/**
|
|
3254
|
+
* Returns the start of the broadcast week for the given date.
|
|
3255
|
+
*
|
|
3256
|
+
* @param date The original date.
|
|
3257
|
+
* @returns The start of the broadcast week.
|
|
3258
|
+
*/
|
|
3259
|
+
startOfBroadcastWeek: (date: Date, _dateLib: DateLib) => Date;
|
|
3260
|
+
/**
|
|
3261
|
+
* Returns the start of the day for the given date.
|
|
3262
|
+
*
|
|
3263
|
+
* @param date The original date.
|
|
3264
|
+
* @returns The start of the day.
|
|
3265
|
+
*/
|
|
3266
|
+
startOfDay: (date: Date) => Date;
|
|
3267
|
+
/**
|
|
3268
|
+
* Returns the start of the ISO week for the given date.
|
|
3269
|
+
*
|
|
3270
|
+
* @param date The original date.
|
|
3271
|
+
* @returns The start of the ISO week.
|
|
3272
|
+
*/
|
|
3273
|
+
startOfISOWeek: (date: Date) => Date;
|
|
3274
|
+
/**
|
|
3275
|
+
* Returns the start of the month for the given date.
|
|
3276
|
+
*
|
|
3277
|
+
* @param date The original date.
|
|
3278
|
+
* @returns The start of the month.
|
|
3279
|
+
*/
|
|
3280
|
+
startOfMonth: (date: Date) => Date;
|
|
3281
|
+
/**
|
|
3282
|
+
* Returns the start of the week for the given date.
|
|
3283
|
+
*
|
|
3284
|
+
* @param date The original date.
|
|
3285
|
+
* @returns The start of the week.
|
|
3286
|
+
*/
|
|
3287
|
+
startOfWeek: (date: Date, _options?: StartOfWeekOptions) => Date;
|
|
3288
|
+
/**
|
|
3289
|
+
* Returns the start of the year for the given date.
|
|
3290
|
+
*
|
|
3291
|
+
* @param date The original date.
|
|
3292
|
+
* @returns The start of the year.
|
|
3293
|
+
*/
|
|
3294
|
+
startOfYear: (date: Date) => Date;
|
|
3295
|
+
}
|
|
3296
|
+
|
|
3297
|
+
/**
|
|
3298
|
+
* Represents a day displayed in the calendar.
|
|
3299
|
+
*
|
|
3300
|
+
* In DayPicker, a `CalendarDay` is a wrapper around a `Date` object that
|
|
3301
|
+
* provides additional information about the day, such as whether it belongs to
|
|
3302
|
+
* the displayed month.
|
|
3303
|
+
*/
|
|
3304
|
+
declare class CalendarDay {
|
|
3305
|
+
constructor(date: Date, displayMonth: Date, dateLib?: DateLib);
|
|
3306
|
+
/**
|
|
3307
|
+
* Utility functions for manipulating dates.
|
|
3308
|
+
*
|
|
3309
|
+
* @private
|
|
3310
|
+
*/
|
|
3311
|
+
readonly dateLib: DateLib;
|
|
3312
|
+
/**
|
|
3313
|
+
* Indicates whether the day does not belong to the displayed month.
|
|
3314
|
+
*
|
|
3315
|
+
* If `outside` is `true`, use `displayMonth` to determine the month to which
|
|
3316
|
+
* the day belongs.
|
|
3317
|
+
*/
|
|
3318
|
+
readonly outside: boolean;
|
|
3319
|
+
/**
|
|
3320
|
+
* The month that is currently displayed in the calendar.
|
|
3321
|
+
*
|
|
3322
|
+
* This property is useful for determining if the day belongs to the same
|
|
3323
|
+
* month as the displayed month, especially when `showOutsideDays` is
|
|
3324
|
+
* enabled.
|
|
3325
|
+
*/
|
|
3326
|
+
readonly displayMonth: Date;
|
|
3327
|
+
/** The date represented by this day. */
|
|
3328
|
+
readonly date: Date;
|
|
3329
|
+
/**
|
|
3330
|
+
* Stable `yyyy-MM-dd` representation for reuse in keys/data attrs.
|
|
3331
|
+
*
|
|
3332
|
+
* @since V9.11.2
|
|
3333
|
+
*/
|
|
3334
|
+
readonly isoDate: string;
|
|
3335
|
+
/**
|
|
3336
|
+
* Stable `yyyy-MM` representation of the displayed month.
|
|
3337
|
+
*
|
|
3338
|
+
* @since V9.11.2
|
|
3339
|
+
*/
|
|
3340
|
+
readonly displayMonthId: string;
|
|
3341
|
+
/**
|
|
3342
|
+
* Stable `yyyy-MM` representation of the date's actual month.
|
|
3343
|
+
*
|
|
3344
|
+
* @since V9.11.2
|
|
3345
|
+
*/
|
|
3346
|
+
readonly dateMonthId: string;
|
|
3347
|
+
/**
|
|
3348
|
+
* Checks if this day is equal to another `CalendarDay`, considering both the
|
|
3349
|
+
* date and the displayed month.
|
|
3350
|
+
*
|
|
3351
|
+
* @param day The `CalendarDay` to compare with.
|
|
3352
|
+
* @returns `true` if the days are equal, otherwise `false`.
|
|
3353
|
+
*/
|
|
3354
|
+
isEqualTo(day: CalendarDay): boolean;
|
|
3355
|
+
}
|
|
3356
|
+
|
|
910
3357
|
interface LabelLabels {
|
|
911
3358
|
/**
|
|
912
3359
|
* How the field name and its requirement fragment compose. `{label}` is the
|
|
@@ -963,6 +3410,8 @@ interface DateRangePickerLabels {
|
|
|
963
3410
|
fieldLabel: string;
|
|
964
3411
|
/** Select placeholder shown while the range matches no preset. */
|
|
965
3412
|
presetPlaceholder: string;
|
|
3413
|
+
/** react-day-picker's navigation and day announcements. */
|
|
3414
|
+
calendar?: DayPickerProps['labels'];
|
|
966
3415
|
}
|
|
967
3416
|
|
|
968
3417
|
interface AmountFilterLabels {
|