@transferwise/components 0.0.0-experimental-cd2c30a → 0.0.0-experimental-6030e58
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.js.map +1 -1
- package/build/index.mjs.map +1 -1
- package/build/types/dateInput/DateInput.d.ts +2 -2
- package/build/types/dateInput/DateInput.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts +5 -6
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/inputs/contexts.d.ts +2 -2
- package/build/types/inputs/contexts.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/dateInput/DateInput.tsx +4 -4
- package/src/dateLookup/DateLookup.tsx +9 -14
- package/src/inputs/contexts.tsx +4 -4
|
@@ -9,8 +9,8 @@ export interface DateInputProps {
|
|
|
9
9
|
size?: SizeSmall | SizeMedium | SizeLarge;
|
|
10
10
|
value?: Date | string;
|
|
11
11
|
onChange: (value: string | null) => void;
|
|
12
|
-
onFocus?: React.FocusEventHandler<
|
|
13
|
-
onBlur?: React.FocusEventHandler<
|
|
12
|
+
onFocus?: React.FocusEventHandler<HTMLDivElement>;
|
|
13
|
+
onBlur?: React.FocusEventHandler<HTMLDivElement>;
|
|
14
14
|
dayLabel?: string;
|
|
15
15
|
dayAutoComplete?: string;
|
|
16
16
|
monthLabel?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../src/dateInput/DateInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAgD,gBAAgB,EAAE,MAAM,IAAI,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAQ,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAM1F,MAAM,WAAW,cAAc;IAC7B,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ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,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,wPAmBZ,cAAc,gCA6ShB,CAAC;AA8BF,eAAe,SAAS,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PureComponent, KeyboardEvent } from 'react';
|
|
2
2
|
import { Size, MonthFormat, SizeSmall, SizeMedium, SizeLarge } from '../common';
|
|
3
3
|
import { WithInputAttributesProps } from '../inputs/contexts';
|
|
4
|
-
export interface DateLookupProps {
|
|
4
|
+
export interface DateLookupProps extends Partial<WithInputAttributesProps> {
|
|
5
5
|
id?: string;
|
|
6
6
|
value: Date | null;
|
|
7
7
|
min?: Date | null;
|
|
@@ -17,7 +17,6 @@ export interface DateLookupProps {
|
|
|
17
17
|
onFocus?: () => void;
|
|
18
18
|
onBlur?: () => void;
|
|
19
19
|
}
|
|
20
|
-
type DateLookupPropsWithInputAttributes = DateLookupProps & Partial<WithInputAttributesProps>;
|
|
21
20
|
interface DateLookupState {
|
|
22
21
|
selectedDate: Date | null;
|
|
23
22
|
originalDate: Date | null;
|
|
@@ -29,8 +28,8 @@ interface DateLookupState {
|
|
|
29
28
|
mode: 'day' | 'month' | 'year';
|
|
30
29
|
isMobile: boolean;
|
|
31
30
|
}
|
|
32
|
-
declare class DateLookup extends PureComponent<
|
|
33
|
-
props:
|
|
31
|
+
declare class DateLookup extends PureComponent<DateLookupProps, DateLookupState> {
|
|
32
|
+
props: DateLookupProps & Required<Pick<DateLookupProps, keyof typeof DateLookup.defaultProps>>;
|
|
34
33
|
static defaultProps: {
|
|
35
34
|
value: null;
|
|
36
35
|
min: null;
|
|
@@ -52,7 +51,7 @@ declare class DateLookup extends PureComponent<DateLookupPropsWithInputAttribute
|
|
|
52
51
|
viewMonth: number;
|
|
53
52
|
viewYear: number;
|
|
54
53
|
} | null;
|
|
55
|
-
componentDidUpdate(previousProps:
|
|
54
|
+
componentDidUpdate(previousProps: DateLookupProps): void;
|
|
56
55
|
componentWillUnmount(): void;
|
|
57
56
|
open: () => void;
|
|
58
57
|
discard: () => void;
|
|
@@ -75,7 +74,7 @@ declare class DateLookup extends PureComponent<DateLookupPropsWithInputAttribute
|
|
|
75
74
|
}
|
|
76
75
|
export declare const DateLookupWithoutInputAttributes: typeof DateLookup;
|
|
77
76
|
declare const _default: {
|
|
78
|
-
(props:
|
|
77
|
+
(props: DateLookupProps): import("react").JSX.Element;
|
|
79
78
|
displayName: string;
|
|
80
79
|
};
|
|
81
80
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateLookup.d.ts","sourceRoot":"","sources":["../../../src/dateLookup/DateLookup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,aAAa,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EACL,IAAI,EACJ,WAAW,EAGX,SAAS,EACT,UAAU,EACV,SAAS,EACV,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,wBAAwB,EAAuB,MAAM,oBAAoB,CAAC;AAOnF,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"DateLookup.d.ts","sourceRoot":"","sources":["../../../src/dateLookup/DateLookup.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,aAAa,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EACL,IAAI,EACJ,WAAW,EAGX,SAAS,EACT,UAAU,EACV,SAAS,EACV,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,wBAAwB,EAAuB,MAAM,oBAAoB,CAAC;AAOnF,MAAM,WAAW,eAAgB,SA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AAY;;;;;;;;;;MAUkB;IAErC,OAAO,4CAA+B;IACtC,QAAQ,4CAA+B;gBAE3B,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC;IAetC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,eAAe;;;;;;;IAwBlF,kBAAkB,CAAC,aAAa,EAAE,eAAe;IAQjD,oBAAoB;IAKpB,IAAI,aAOF;IAEF,OAAO,aAML;IAEF,KAAK,aAMH;IAEF,aAAa,UAAW,cAAc,cAAc,CAAC,UA6CnD;IAEF,UAAU,cAAe,MAAM,eAAe,MAAM,cAAc,MAAM,UAqBtE;IAEF,OAAO,qBAAsB,MAAM,oBAAoB,MAAM,UAO3D;IAEF,UAAU,SAAU,KAAK,GAAG,OAAO,GAAG,MAAM,UAI1C;IAEF,YAAY,aAAgC;IAE5C,cAAc,aAAkC;IAEhD,aAAa,aAAiC;IAE9C,wBAAwB,iBAAkB,IAAI,UAM5C;IAEF,oBAAoB;;;eAElB;IAEF,WAAW,oCA2CT;IAEF,WAAW,aAGT;IAEF,MAAM;CAiDP;AAED,eAAO,MAAM,gCAAgC,mBAAa,CAAC;;;;;AAE3D,wBAEG"}
|
|
@@ -16,8 +16,8 @@ export declare function useInputAttributes({ nonLabelable }?: UseInputAttributes
|
|
|
16
16
|
export interface WithInputAttributesProps {
|
|
17
17
|
inputAttributes: ReturnType<typeof useInputAttributes>;
|
|
18
18
|
}
|
|
19
|
-
export declare function withInputAttributes<T
|
|
20
|
-
(props:
|
|
19
|
+
export declare function withInputAttributes<T>(Component: React.ComponentType<T & Partial<WithInputAttributesProps>>, args?: UseInputAttributesArgs): {
|
|
20
|
+
(props: T): import("react").JSX.Element;
|
|
21
21
|
displayName: string;
|
|
22
22
|
};
|
|
23
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../src/inputs/contexts.tsx"],"names":[],"mappings":";AAGA,eAAO,MAAM,2BAA2B,8CAA+B,CAAC;AAGxE,eAAO,MAAM,sBAAsB,8CAA0B,CAAC;AAG9D,eAAO,MAAM,wBAAwB,8CAAmC,CAAC;AAGzE,eAAO,MAAM,oBAAoB,+CAA+B,CAAC;AAEjE,UAAU,sBAAsB;IAC9B,gLAAgL;IAChL,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,YAAY,EAAE,GAAE,sBAA2B;;;;;EAQ/E;AAED,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;CACxD;AAED,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../src/inputs/contexts.tsx"],"names":[],"mappings":";AAGA,eAAO,MAAM,2BAA2B,8CAA+B,CAAC;AAGxE,eAAO,MAAM,sBAAsB,8CAA0B,CAAC;AAG9D,eAAO,MAAM,wBAAwB,8CAAmC,CAAC;AAGzE,eAAO,MAAM,oBAAoB,+CAA+B,CAAC;AAEjE,UAAU,sBAAsB;IAC9B,gLAAgL;IAChL,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,YAAY,EAAE,GAAE,sBAA2B;;;;;EAQ/E;AAED,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;CACxD;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC,EACrE,IAAI,CAAC,EAAE,sBAAsB;YAEgB,CAAC;;EAO/C"}
|
package/package.json
CHANGED
|
@@ -17,8 +17,8 @@ export interface DateInputProps {
|
|
|
17
17
|
size?: SizeSmall | SizeMedium | SizeLarge;
|
|
18
18
|
value?: Date | string;
|
|
19
19
|
onChange: (value: string | null) => void;
|
|
20
|
-
onFocus?: React.FocusEventHandler<
|
|
21
|
-
onBlur?: React.FocusEventHandler<
|
|
20
|
+
onFocus?: React.FocusEventHandler<HTMLDivElement>;
|
|
21
|
+
onBlur?: React.FocusEventHandler<HTMLDivElement>;
|
|
22
22
|
dayLabel?: string;
|
|
23
23
|
dayAutoComplete?: string;
|
|
24
24
|
monthLabel?: string;
|
|
@@ -308,10 +308,10 @@ const DateInput = ({
|
|
|
308
308
|
aria-labelledby={ariaLabelledBy}
|
|
309
309
|
aria-label={ariaLabel}
|
|
310
310
|
role="group" // Add role attribute to indicate container for interactive elements
|
|
311
|
-
onFocus={(event
|
|
311
|
+
onFocus={(event) =>
|
|
312
312
|
shouldPropagateOnFocus(event) ? onFocus && onFocus(event) : event.stopPropagation()
|
|
313
313
|
}
|
|
314
|
-
onBlur={(event
|
|
314
|
+
onBlur={(event) =>
|
|
315
315
|
shouldPropagateOnBlur(event) ? onBlur && onBlur(event) : event.stopPropagation()
|
|
316
316
|
}
|
|
317
317
|
>
|
|
@@ -19,7 +19,7 @@ import { getStartOfDay } from './getStartOfDay';
|
|
|
19
19
|
import MonthCalendar from './monthCalendar';
|
|
20
20
|
import YearCalendar from './yearCalendar';
|
|
21
21
|
|
|
22
|
-
export interface DateLookupProps {
|
|
22
|
+
export interface DateLookupProps extends Partial<WithInputAttributesProps> {
|
|
23
23
|
id?: string;
|
|
24
24
|
value: Date | null;
|
|
25
25
|
min?: Date | null;
|
|
@@ -36,8 +36,6 @@ export interface DateLookupProps {
|
|
|
36
36
|
onBlur?: () => void;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
type DateLookupPropsWithInputAttributes = DateLookupProps & Partial<WithInputAttributesProps>;
|
|
40
|
-
|
|
41
39
|
interface DateLookupState {
|
|
42
40
|
selectedDate: Date | null;
|
|
43
41
|
originalDate: Date | null;
|
|
@@ -50,9 +48,9 @@ interface DateLookupState {
|
|
|
50
48
|
isMobile: boolean;
|
|
51
49
|
}
|
|
52
50
|
|
|
53
|
-
class DateLookup extends PureComponent<
|
|
54
|
-
declare props:
|
|
55
|
-
Required<Pick<
|
|
51
|
+
class DateLookup extends PureComponent<DateLookupProps, DateLookupState> {
|
|
52
|
+
declare props: DateLookupProps &
|
|
53
|
+
Required<Pick<DateLookupProps, keyof typeof DateLookup.defaultProps>>;
|
|
56
54
|
|
|
57
55
|
static defaultProps = {
|
|
58
56
|
value: null,
|
|
@@ -64,7 +62,7 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
|
|
|
64
62
|
monthFormat: MonthFormat.LONG,
|
|
65
63
|
disabled: false,
|
|
66
64
|
clearable: false,
|
|
67
|
-
} satisfies Partial<
|
|
65
|
+
} satisfies Partial<DateLookupProps>;
|
|
68
66
|
|
|
69
67
|
element = createRef<HTMLDivElement>();
|
|
70
68
|
dropdown = createRef<HTMLDivElement>();
|
|
@@ -108,7 +106,7 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
|
|
|
108
106
|
return null;
|
|
109
107
|
}
|
|
110
108
|
|
|
111
|
-
componentDidUpdate(previousProps:
|
|
109
|
+
componentDidUpdate(previousProps: DateLookupProps) {
|
|
112
110
|
if (this.props.value?.getTime() !== previousProps.value?.getTime() && this.state.open) {
|
|
113
111
|
this.focusOn('.active');
|
|
114
112
|
}
|
|
@@ -352,9 +350,6 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
|
|
|
352
350
|
|
|
353
351
|
export const DateLookupWithoutInputAttributes = DateLookup;
|
|
354
352
|
|
|
355
|
-
export default withInputAttributes(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
nonLabelable: true,
|
|
359
|
-
},
|
|
360
|
-
);
|
|
353
|
+
export default withInputAttributes(DateLookup as React.ComponentType<DateLookupProps>, {
|
|
354
|
+
nonLabelable: true,
|
|
355
|
+
});
|
package/src/inputs/contexts.tsx
CHANGED
|
@@ -31,12 +31,12 @@ export interface WithInputAttributesProps {
|
|
|
31
31
|
inputAttributes: ReturnType<typeof useInputAttributes>;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export function withInputAttributes<T
|
|
35
|
-
Component: React.ComponentType<T
|
|
34
|
+
export function withInputAttributes<T>(
|
|
35
|
+
Component: React.ComponentType<T & Partial<WithInputAttributesProps>>,
|
|
36
36
|
args?: UseInputAttributesArgs,
|
|
37
37
|
) {
|
|
38
|
-
function ComponentWithInputAttributes(props:
|
|
39
|
-
return <Component inputAttributes={useInputAttributes(args)} {...
|
|
38
|
+
function ComponentWithInputAttributes(props: T) {
|
|
39
|
+
return <Component inputAttributes={useInputAttributes(args)} {...props} />;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
ComponentWithInputAttributes.displayName = `withInputAttributes(${Component.displayName || Component.name || 'Component'})`;
|