@transferwise/components 0.0.0-experimental-cbb427b → 0.0.0-experimental-53fa20a
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/build/index.esm.js +94 -133
- package/build/index.esm.js.map +1 -1
- package/build/index.js +94 -133
- package/build/index.js.map +1 -1
- package/build/types/common/dateUtils/getDayNames/getDayNames.d.ts +1 -1
- package/build/types/common/dateUtils/getDayNames/getDayNames.d.ts.map +1 -1
- package/build/types/common/dateUtils/getDayNames/index.d.ts +1 -1
- package/build/types/common/dateUtils/getDayNames/index.d.ts.map +1 -1
- package/build/types/common/dateUtils/getMonthNames/getMonthNames.d.ts +1 -1
- package/build/types/common/dateUtils/getMonthNames/getMonthNames.d.ts.map +1 -1
- package/build/types/common/dateUtils/getMonthNames/index.d.ts +1 -1
- package/build/types/common/dateUtils/getMonthNames/index.d.ts.map +1 -1
- package/build/types/common/dateUtils/index.d.ts +6 -6
- package/build/types/common/dateUtils/index.d.ts.map +1 -1
- package/build/types/common/dateUtils/isDateValid/index.d.ts +1 -1
- package/build/types/common/dateUtils/isDateValid/index.d.ts.map +1 -1
- package/build/types/common/dateUtils/isDateValid/isDateValid.d.ts +2 -2
- package/build/types/common/dateUtils/isDateValid/isDateValid.d.ts.map +1 -1
- package/build/types/common/dateUtils/isMonthAndYearFormat/index.d.ts +1 -1
- package/build/types/common/dateUtils/isMonthAndYearFormat/index.d.ts.map +1 -1
- package/build/types/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.d.ts +1 -1
- package/build/types/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.d.ts.map +1 -1
- package/build/types/common/dateUtils/isWithinRange/index.d.ts +1 -1
- package/build/types/common/dateUtils/isWithinRange/index.d.ts.map +1 -1
- package/build/types/common/dateUtils/isWithinRange/isWithinRange.d.ts +1 -1
- package/build/types/common/dateUtils/isWithinRange/isWithinRange.d.ts.map +1 -1
- package/build/types/common/dateUtils/moveToWithinRange/index.d.ts +1 -1
- package/build/types/common/dateUtils/moveToWithinRange/index.d.ts.map +1 -1
- package/build/types/common/dateUtils/moveToWithinRange/moveToWithinRange.d.ts +1 -1
- package/build/types/common/dateUtils/moveToWithinRange/moveToWithinRange.d.ts.map +1 -1
- package/build/types/dateInput/DateInput.d.ts +30 -41
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dateInput/DateInput.messages.d.ts +24 -33
- package/build/types/dateInput/DateInput.messages.d.ts.map +1 -1
- package/build/types/dateInput/index.d.ts +1 -1
- package/build/types/dateInput/index.d.ts.map +1 -1
- package/build/types/dateInput/utils/convertToLocalMidnight/convertToLocalMidnight.d.ts +1 -1
- package/build/types/dateInput/utils/convertToLocalMidnight/convertToLocalMidnight.d.ts.map +1 -1
- package/build/types/dateInput/utils/convertToLocalMidnight/index.d.ts +1 -1
- package/build/types/dateInput/utils/convertToLocalMidnight/index.d.ts.map +1 -1
- package/build/types/dateInput/utils/index.d.ts +1 -2
- package/build/types/dateInput/utils/index.d.ts.map +1 -1
- package/build/types/drawer/Drawer.d.ts.map +1 -1
- package/build/types/modal/Modal.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/dateUtils/getDayNames/getDayNames.spec.js +2 -2
- package/src/common/dateUtils/getDayNames/{getDayNames.js → getDayNames.ts} +5 -2
- package/src/common/dateUtils/getMonthNames/getMonthNames.spec.js +9 -8
- package/src/common/dateUtils/getMonthNames/{getMonthNames.js → getMonthNames.ts} +5 -3
- package/src/common/dateUtils/isDateValid/{isDateValid.spec.js → isDateValid.spec.ts} +1 -1
- package/src/common/dateUtils/isDateValid/isDateValid.ts +13 -0
- package/src/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.spec.js +3 -7
- package/src/common/dateUtils/isMonthAndYearFormat/{isMonthAndYearFormat.js → isMonthAndYearFormat.ts} +1 -1
- package/src/common/dateUtils/isWithinRange/{isWithinRange.spec.js → isWithinRange.spec.ts} +0 -10
- package/src/common/dateUtils/isWithinRange/{isWithinRange.js → isWithinRange.ts} +1 -1
- package/src/common/dateUtils/moveToWithinRange/{moveToWithinRange.js → moveToWithinRange.ts} +2 -2
- package/src/dateInput/DateInput.spec.js +7 -56
- package/src/dateInput/DateInput.story.tsx +11 -8
- package/src/dateInput/{DateInput.js → DateInput.tsx} +113 -121
- package/src/dateInput/utils/convertToLocalMidnight/{convertToLocalMidnight.js → convertToLocalMidnight.ts} +1 -1
- package/src/dateInput/utils/{index.js → index.ts} +0 -1
- package/src/dateLookup/dayCalendar/table/DayCalendarTable.js +1 -0
- package/src/drawer/Drawer.js +13 -2
- package/src/drawer/__snapshots__/Drawer.rtl.spec.js.snap +1 -0
- package/src/modal/Modal.tsx +6 -3
- package/src/popover/Popover.spec.js +16 -8
- package/src/popover/__snapshots__/Popover.spec.js.snap +0 -56
- package/build/types/dateInput/utils/explodeDate/explodeDate.d.ts +0 -6
- package/build/types/dateInput/utils/explodeDate/explodeDate.d.ts.map +0 -1
- package/build/types/dateInput/utils/explodeDate/index.d.ts +0 -2
- package/build/types/dateInput/utils/explodeDate/index.d.ts.map +0 -1
- package/src/common/dateUtils/isDateValid/isDateValid.js +0 -6
- package/src/dateInput/utils/explodeDate/explodeDate.js +0 -7
- package/src/dateInput/utils/explodeDate/explodeDate.spec.js +0 -11
- package/src/dateInput/utils/explodeDate/index.js +0 -1
- /package/src/common/dateUtils/getDayNames/{index.js → index.ts} +0 -0
- /package/src/common/dateUtils/getMonthNames/{index.js → index.ts} +0 -0
- /package/src/common/dateUtils/{index.js → index.ts} +0 -0
- /package/src/common/dateUtils/isDateValid/{index.js → index.ts} +0 -0
- /package/src/common/dateUtils/isMonthAndYearFormat/{index.js → index.ts} +0 -0
- /package/src/common/dateUtils/isWithinRange/{index.js → index.ts} +0 -0
- /package/src/common/dateUtils/moveToWithinRange/{index.js → index.ts} +0 -0
- /package/src/dateInput/{DateInput.messages.js → DateInput.messages.ts} +0 -0
- /package/src/dateInput/{index.js → index.ts} +0 -0
- /package/src/dateInput/utils/convertToLocalMidnight/{convertToLocalMidnight.spec.js → convertToLocalMidnight.spec.ts} +0 -0
- /package/src/dateInput/utils/convertToLocalMidnight/{index.js → index.ts} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function getDayNames(locale:
|
|
1
|
+
export declare function getDayNames(locale: string, format?: Intl.DateTimeFormatOptions['weekday']): string[];
|
|
2
2
|
//# sourceMappingURL=getDayNames.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDayNames.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/getDayNames/getDayNames.
|
|
1
|
+
{"version":3,"file":"getDayNames.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/getDayNames/getDayNames.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAW,YASxD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getDayNames } from
|
|
1
|
+
export { getDayNames } from './getDayNames';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/getDayNames/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/getDayNames/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const getMonthNames: (locale: string, format?: Intl.DateTimeFormatOptions['month']) => string[];
|
|
2
2
|
//# sourceMappingURL=getMonthNames.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMonthNames.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/getMonthNames/getMonthNames.
|
|
1
|
+
{"version":3,"file":"getMonthNames.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/getMonthNames/getMonthNames.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,WAChB,MAAM,WACN,KAAK,qBAAqB,CAAC,OAAO,CAAC,KAC1C,MAAM,EASR,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { getMonthNames } from
|
|
1
|
+
export { getMonthNames } from './getMonthNames';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/getMonthNames/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/getMonthNames/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { getDayNames } from
|
|
2
|
-
export { moveToWithinRange } from
|
|
3
|
-
export { isWithinRange } from
|
|
4
|
-
export { getMonthNames } from
|
|
5
|
-
export { isDateValid } from
|
|
6
|
-
export { isMonthAndYearFormat } from
|
|
1
|
+
export { getDayNames } from './getDayNames';
|
|
2
|
+
export { moveToWithinRange } from './moveToWithinRange';
|
|
3
|
+
export { isWithinRange } from './isWithinRange';
|
|
4
|
+
export { getMonthNames } from './getMonthNames';
|
|
5
|
+
export { isDateValid } from './isDateValid';
|
|
6
|
+
export { isMonthAndYearFormat } from './isMonthAndYearFormat';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/dateUtils/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/dateUtils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { isDateValid, validDateString } from
|
|
1
|
+
export { isDateValid, validDateString } from './isDateValid';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isDateValid/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isDateValid/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export declare const isDateValid: (date: Date | string | null) => boolean;
|
|
2
|
+
export declare const validDateString: (dateString: string) => boolean;
|
|
3
3
|
//# sourceMappingURL=isDateValid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDateValid.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isDateValid/isDateValid.
|
|
1
|
+
{"version":3,"file":"isDateValid.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isDateValid/isDateValid.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,SAAU,IAAI,GAAG,MAAM,GAAG,IAAI,YAQrD,CAAC;AAEF,eAAO,MAAM,eAAe,eAAgB,MAAM,YAA0C,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { isMonthAndYearFormat } from
|
|
1
|
+
export { isMonthAndYearFormat } from './isMonthAndYearFormat';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isMonthAndYearFormat/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isMonthAndYearFormat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const isMonthAndYearFormat: (dateString: string) => boolean;
|
|
2
2
|
//# sourceMappingURL=isMonthAndYearFormat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMonthAndYearFormat.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.
|
|
1
|
+
{"version":3,"file":"isMonthAndYearFormat.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isMonthAndYearFormat/isMonthAndYearFormat.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,eAAgB,MAAM,YACU,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { isWithinRange } from
|
|
1
|
+
export { isWithinRange } from './isWithinRange';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isWithinRange/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isWithinRange/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function isWithinRange(date:
|
|
1
|
+
export declare function isWithinRange(date: Date, min: Date, max: Date): boolean;
|
|
2
2
|
//# sourceMappingURL=isWithinRange.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isWithinRange.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isWithinRange/isWithinRange.
|
|
1
|
+
{"version":3,"file":"isWithinRange.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/isWithinRange/isWithinRange.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,WAE7D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { moveToWithinRange } from
|
|
1
|
+
export { moveToWithinRange } from './moveToWithinRange';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/moveToWithinRange/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/moveToWithinRange/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function moveToWithinRange(date:
|
|
1
|
+
export declare function moveToWithinRange(date: Date, min: Date, max: Date): Date;
|
|
2
2
|
//# sourceMappingURL=moveToWithinRange.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moveToWithinRange.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/moveToWithinRange/moveToWithinRange.
|
|
1
|
+
{"version":3,"file":"moveToWithinRange.d.ts","sourceRoot":"","sources":["../../../../../src/common/dateUtils/moveToWithinRange/moveToWithinRange.ts"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,QAEjE"}
|
|
@@ -1,41 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
monthFormat?: DateInputMonthFormat;
|
|
32
|
-
mode?: DateInputMode;
|
|
33
|
-
placeholders?: DateInputPlaceholders;
|
|
34
|
-
id?: string;
|
|
35
|
-
selectProps?: Object;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
declare const DateInput: React.FC<DateInputProps>;
|
|
39
|
-
|
|
40
|
-
export default DateInput;
|
|
41
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SelectInputProps } from '..';
|
|
3
|
+
import { Size, DateMode, MonthFormat } from '../common';
|
|
4
|
+
export interface DateInputProps {
|
|
5
|
+
'aria-label'?: string;
|
|
6
|
+
'aria-labelledby'?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
size?: Size.SMALL | Size.MEDIUM | Size.LARGE;
|
|
9
|
+
value?: Date | string;
|
|
10
|
+
onChange: (value: string | null) => void;
|
|
11
|
+
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
12
|
+
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
13
|
+
dayLabel?: string;
|
|
14
|
+
dayAutoComplete?: string;
|
|
15
|
+
monthLabel?: string;
|
|
16
|
+
yearLabel?: string;
|
|
17
|
+
yearAutoComplete?: string;
|
|
18
|
+
monthFormat?: `${MonthFormat}`;
|
|
19
|
+
mode?: `${DateMode}`;
|
|
20
|
+
placeholders?: {
|
|
21
|
+
day?: string;
|
|
22
|
+
month?: string;
|
|
23
|
+
year?: string;
|
|
24
|
+
};
|
|
25
|
+
id?: string;
|
|
26
|
+
selectProps?: Partial<SelectInputProps<number | null>>;
|
|
27
|
+
}
|
|
28
|
+
declare const DateInput: ({ "aria-labelledby": ariaLabelledBy, "aria-label": ariaLabel, disabled, size, value, dayLabel, dayAutoComplete, monthLabel, yearLabel, yearAutoComplete, monthFormat, mode, onChange, onFocus, onBlur, placeholders, id, selectProps, }: DateInputProps) => import("react").JSX.Element;
|
|
29
|
+
export default DateInput;
|
|
30
|
+
//# sourceMappingURL=DateInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../src/dateInput/DateInput.
|
|
1
|
+
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../src/dateInput/DateInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAsB,gBAAgB,EAA4B,MAAM,IAAI,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAQxD,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;IAC7C,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACpD,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC;IAC/B,IAAI,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC;IACrB,YAAY,CAAC,EAAE;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;CACxD;AAED,QAAA,MAAM,SAAS,4OAmBZ,cAAc,gCAuPhB,CAAC;AA8BF,eAAe,SAAS,CAAC"}
|
|
@@ -1,35 +1,26 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
namespace yearPlaceholder {
|
|
26
|
-
const id_4: string;
|
|
27
|
-
export { id_4 as id };
|
|
28
|
-
const defaultMessage_4: string;
|
|
29
|
-
export { defaultMessage_4 as defaultMessage };
|
|
30
|
-
const description_1: string;
|
|
31
|
-
export { description_1 as description };
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
declare const _default: {
|
|
2
|
+
monthLabel: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
};
|
|
6
|
+
dayLabel: {
|
|
7
|
+
id: string;
|
|
8
|
+
defaultMessage: string;
|
|
9
|
+
};
|
|
10
|
+
yearLabel: {
|
|
11
|
+
id: string;
|
|
12
|
+
defaultMessage: string;
|
|
13
|
+
};
|
|
14
|
+
dayPlaceholder: {
|
|
15
|
+
id: string;
|
|
16
|
+
defaultMessage: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
yearPlaceholder: {
|
|
20
|
+
id: string;
|
|
21
|
+
defaultMessage: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
34
25
|
export default _default;
|
|
35
26
|
//# sourceMappingURL=DateInput.messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.messages.d.ts","sourceRoot":"","sources":["../../../src/dateInput/DateInput.messages.
|
|
1
|
+
{"version":3,"file":"DateInput.messages.d.ts","sourceRoot":"","sources":["../../../src/dateInput/DateInput.messages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAuBG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dateInput/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dateInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,eAAe,SAAS,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const convertToLocalMidnight: (date: string) => Date;
|
|
2
2
|
//# sourceMappingURL=convertToLocalMidnight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertToLocalMidnight.d.ts","sourceRoot":"","sources":["../../../../../src/dateInput/utils/convertToLocalMidnight/convertToLocalMidnight.
|
|
1
|
+
{"version":3,"file":"convertToLocalMidnight.d.ts","sourceRoot":"","sources":["../../../../../src/dateInput/utils/convertToLocalMidnight/convertToLocalMidnight.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,SAAU,MAAM,SAIlD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { convertToLocalMidnight } from
|
|
1
|
+
export { convertToLocalMidnight } from './convertToLocalMidnight';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/dateInput/utils/convertToLocalMidnight/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/dateInput/utils/convertToLocalMidnight/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dateInput/utils/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dateInput/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/drawer/Drawer.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/drawer/Drawer.js"],"names":[],"mappings":";AAYA;;;;;;;;gCAoCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/modal/Modal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/modal/Modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAG1C,OAAO,EAGL,WAAW,EACX,cAAc,EAEd,WAAW,EACX,SAAS,EACT,UAAU,EACV,SAAS,EACT,cAAc,EACd,aAAa,EACb,cAAc,EAEf,MAAM,WAAW,CAAC;AASnB,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,cAAc,CAAC;IAC3D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,aAAa,GAAG,cAAc,CAAC;IACxC,QAAQ,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC;IACxC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,CAAC;AAEF,QAAA,MAAM,KAAK,wHAYR,UAAU,gCAmHZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -6,11 +6,11 @@ jest.mock('@transferwise/formatting', () => ({
|
|
|
6
6
|
|
|
7
7
|
describe('getDayNames', () => {
|
|
8
8
|
it('returns all weekdays', () => {
|
|
9
|
-
expect(getDayNames()).toHaveLength(7);
|
|
9
|
+
expect(getDayNames('en')).toHaveLength(7);
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
it('starts with Monday and ends with Sunday', () => {
|
|
13
|
-
const days = getDayNames();
|
|
13
|
+
const days = getDayNames('en');
|
|
14
14
|
expect(days[0]).toBe(1);
|
|
15
15
|
expect(days[days.length - 1]).toBe(0);
|
|
16
16
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { formatDate } from '@transferwise/formatting';
|
|
2
2
|
|
|
3
|
-
export function getDayNames(
|
|
4
|
-
|
|
3
|
+
export function getDayNames(
|
|
4
|
+
locale: string,
|
|
5
|
+
format: Intl.DateTimeFormatOptions['weekday'] = 'short',
|
|
6
|
+
) {
|
|
7
|
+
const days: string[] = [];
|
|
5
8
|
const date = new Date(2018, 0, 1); // 2018 started with Monday
|
|
6
9
|
while (days.length < 7) {
|
|
7
10
|
days.push(formatDate(date, locale, { weekday: format }));
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { getMonthNames } from '
|
|
2
|
-
|
|
3
|
-
jest.mock('@transferwise/formatting', () => ({
|
|
4
|
-
formatDate: (month) => month.getMonth(),
|
|
5
|
-
}));
|
|
1
|
+
import { getMonthNames } from './getMonthNames';
|
|
6
2
|
|
|
7
3
|
describe('getMonthNames', () => {
|
|
8
4
|
it('returns all months', () => {
|
|
@@ -10,8 +6,13 @@ describe('getMonthNames', () => {
|
|
|
10
6
|
});
|
|
11
7
|
|
|
12
8
|
it('starts with January and ends with December', () => {
|
|
13
|
-
const months = getMonthNames();
|
|
14
|
-
expect(months[0]).toBe(
|
|
15
|
-
expect(months
|
|
9
|
+
const months = getMonthNames('en', 'long');
|
|
10
|
+
expect(months[0]).toBe('January');
|
|
11
|
+
expect(months.at(-1)).toBe('December');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('gets localized month names', () => {
|
|
15
|
+
const months = getMonthNames('fr', 'long');
|
|
16
|
+
expect(months[0]).toBe('janvier');
|
|
16
17
|
});
|
|
17
18
|
});
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { formatDate } from '@transferwise/formatting';
|
|
2
2
|
|
|
3
|
-
export const getMonthNames = (
|
|
4
|
-
|
|
3
|
+
export const getMonthNames = (
|
|
4
|
+
locale: string,
|
|
5
|
+
format: Intl.DateTimeFormatOptions['month'] = 'long',
|
|
6
|
+
): string[] => {
|
|
7
|
+
const months: string[] = [];
|
|
5
8
|
const date = new Date(2018, 0, 1);
|
|
6
9
|
const monthFormat = { month: format };
|
|
7
10
|
while (months.length < 12) {
|
|
8
11
|
months.push(formatDate(date, locale, monthFormat));
|
|
9
12
|
date.setMonth(date.getMonth() + 1);
|
|
10
13
|
}
|
|
11
|
-
|
|
12
14
|
return months;
|
|
13
15
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const isDateValid = (date: Date | string | null) => {
|
|
2
|
+
if (date === null) {
|
|
3
|
+
return false;
|
|
4
|
+
} else if (date instanceof Date) {
|
|
5
|
+
return validDateObject(date);
|
|
6
|
+
} else {
|
|
7
|
+
return validDateString(date);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const validDateString = (dateString: string) => validDateObject(new Date(dateString));
|
|
12
|
+
|
|
13
|
+
const validDateObject = (dateObject: Date) => !isNaN(dateObject.getTime());
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { isMonthAndYearFormat } from '
|
|
1
|
+
import { isMonthAndYearFormat } from '..';
|
|
2
2
|
|
|
3
3
|
describe('isDateValid', () => {
|
|
4
|
-
it('should return false if day is provided', () => {
|
|
4
|
+
it('should return false if day is provided as string', () => {
|
|
5
5
|
expect(isMonthAndYearFormat('1998-02-04')).toBe(false);
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
it('should return true if day is not provided', () => {
|
|
8
|
+
it('should return true if day is not provided as string', () => {
|
|
9
9
|
expect(isMonthAndYearFormat('1998-02')).toBe(true);
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
it('should return false if argument provided is not a string', () => {
|
|
13
|
-
expect(isMonthAndYearFormat([])).toBe(false);
|
|
14
|
-
});
|
|
15
11
|
});
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { isWithinRange } from '..';
|
|
2
2
|
|
|
3
3
|
describe('isWithinRange', () => {
|
|
4
|
-
it('returns true when no dates are provided', () => {
|
|
5
|
-
expect(isWithinRange()).toBe(true);
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
it('returns true when no min and max', () => {
|
|
9
|
-
expect(isWithinRange(new Date())).toBe(true);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
4
|
it('returns true when date is between min and max', () => {
|
|
13
5
|
const date = new Date('1995-12-20');
|
|
14
6
|
const min = new Date('1995-12-19');
|
|
@@ -27,7 +19,6 @@ describe('isWithinRange', () => {
|
|
|
27
19
|
const date = new Date('1995-12-20');
|
|
28
20
|
const min = new Date('1995-12-21');
|
|
29
21
|
const max = new Date('1995-12-22');
|
|
30
|
-
expect(isWithinRange(date, min)).toBe(false);
|
|
31
22
|
expect(isWithinRange(date, min, max)).toBe(false);
|
|
32
23
|
});
|
|
33
24
|
|
|
@@ -35,7 +26,6 @@ describe('isWithinRange', () => {
|
|
|
35
26
|
const date = new Date('1995-12-23');
|
|
36
27
|
const min = new Date('1995-12-20');
|
|
37
28
|
const max = new Date('1995-12-22');
|
|
38
|
-
expect(isWithinRange(date, null, max)).toBe(false);
|
|
39
29
|
expect(isWithinRange(date, min, max)).toBe(false);
|
|
40
30
|
});
|
|
41
31
|
});
|
package/src/common/dateUtils/moveToWithinRange/{moveToWithinRange.js → moveToWithinRange.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isWithinRange } from '
|
|
1
|
+
import { isWithinRange } from '..';
|
|
2
2
|
|
|
3
3
|
// Makes sure that date is between min and max dates, returns a cloned min or max
|
|
4
|
-
export function moveToWithinRange(date, min, max) {
|
|
4
|
+
export function moveToWithinRange(date: Date, min: Date, max: Date) {
|
|
5
5
|
return isWithinRange(date, min, max) ? date : new Date(min && date < min ? +min : +max);
|
|
6
6
|
}
|