@transferwise/components 0.0.0-experimental-da6dbbf → 0.0.0-experimental-4c1cb43
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 +635 -933
- package/build/index.js.map +1 -1
- package/build/index.mjs +625 -922
- package/build/index.mjs.map +1 -1
- package/build/main.css +0 -135
- package/build/styles/main.css +0 -135
- package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/build/types/common/card/Card.d.ts +2 -2
- package/build/types/common/card/Card.d.ts.map +1 -1
- package/build/types/common/hooks/useMedia.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts +6 -5
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dimmer/Dimmer.d.ts +1 -11
- package/build/types/dimmer/Dimmer.d.ts.map +1 -1
- package/build/types/drawer/Drawer.d.ts +4 -4
- package/build/types/index.d.ts +3 -4
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts +2 -1
- package/build/types/inputWithDisplayFormat/InputWithDisplayFormat.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.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/build/types/modal/Modal.d.ts.map +1 -1
- package/build/types/processIndicator/ProcessIndicator.d.ts +36 -19
- package/build/types/processIndicator/ProcessIndicator.d.ts.map +1 -1
- package/build/types/processIndicator/index.d.ts +2 -2
- package/build/types/processIndicator/index.d.ts.map +1 -1
- package/build/types/promoCard/PromoCard.d.ts +5 -16
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/build/types/select/searchBox/SearchBox.d.ts +1 -1
- package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts +2 -1
- package/build/types/textareaWithDisplayFormat/TextareaWithDisplayFormat.d.ts.map +1 -1
- package/build/types/tooltip/Tooltip.d.ts +1 -1
- package/build/types/tooltip/Tooltip.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts +14 -14
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
- package/package.json +9 -13
- package/src/accordion/AccordionItem/AccordionItem.tsx +2 -4
- package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -3
- package/src/button/Button.tsx +1 -1
- package/src/common/card/Card.tsx +43 -51
- package/src/common/hooks/useConditionalListener/useConditionalListener.spec.js +1 -1
- package/src/common/hooks/useHasIntersected/useHasIntersected.spec.js +3 -3
- package/src/common/hooks/useMedia.spec.ts +1 -1
- package/src/common/hooks/useMedia.ts +1 -2
- package/src/common/panel/Panel.tsx +90 -92
- package/src/common/responsivePanel/ResponsivePanel.tsx +34 -38
- package/src/dateLookup/DateLookup.rtl.spec.tsx +181 -5
- package/src/dateLookup/DateLookup.testingLibrary.spec.js +171 -124
- package/src/dateLookup/DateLookup.tsx +14 -9
- package/src/drawer/Drawer.js +3 -3
- package/src/field/Field.tsx +3 -3
- package/src/index.ts +3 -4
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.tsx +2 -1
- package/src/inputs/SelectInput.story.tsx +2 -1
- package/src/inputs/SelectInput.tsx +10 -2
- package/src/inputs/contexts.tsx +4 -4
- package/src/main.css +0 -135
- package/src/main.less +0 -1
- package/src/modal/Modal.tsx +1 -2
- package/src/processIndicator/ProcessIndicator.rtl.spec.tsx +45 -0
- package/src/processIndicator/ProcessIndicator.tsx +110 -0
- package/src/promoCard/PromoCard.story.tsx +2 -2
- package/src/promoCard/PromoCard.tsx +9 -31
- package/src/radio/__snapshots__/Radio.rtl.spec.tsx.snap +0 -1
- package/src/snackbar/Snackbar.spec.js +4 -1
- package/src/snackbar/Snackbar.story.tsx +4 -2
- package/src/tabs/Tabs.spec.js +46 -27
- package/src/test-utils/index.js +5 -7
- package/src/test-utils/jest.setup.js +9 -3
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.tsx +2 -1
- package/src/tooltip/Tooltip.tsx +44 -46
- package/src/tooltip/__snapshots__/Tooltip.spec.tsx.snap +2 -2
- package/src/upload/Upload.spec.js +34 -13
- package/src/uploadInput/UploadInput.spec.tsx +21 -23
- package/src/uploadInput/uploadItem/UploadItem.tsx +1 -3
- package/src/withDisplayFormat/WithDisplayFormat.spec.js +63 -32
- package/src/withDisplayFormat/WithDisplayFormat.tsx +28 -28
- package/build/styles/carousel/Carousel.css +0 -135
- package/build/types/carousel/Carousel.d.ts +0 -26
- package/build/types/carousel/Carousel.d.ts.map +0 -1
- package/build/types/carousel/index.d.ts +0 -3
- package/build/types/carousel/index.d.ts.map +0 -1
- package/src/carousel/Carousel.css +0 -135
- package/src/carousel/Carousel.less +0 -133
- package/src/carousel/Carousel.spec.tsx +0 -221
- package/src/carousel/Carousel.story.tsx +0 -63
- package/src/carousel/Carousel.tsx +0 -345
- package/src/carousel/index.ts +0 -3
- package/src/dateLookup/DateLookup.keyboardEvents.spec.js +0 -180
- package/src/processIndicator/ProcessIndicator.js +0 -117
- package/src/processIndicator/ProcessIndicator.spec.js +0 -101
- /package/src/processIndicator/{index.js → index.ts} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default } from
|
|
2
|
-
export * from
|
|
1
|
+
export { default } from './ProcessIndicator';
|
|
2
|
+
export * from './ProcessIndicator';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/processIndicator/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/processIndicator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export type ReferenceType = React.Ref<HTMLInputElement
|
|
2
|
+
import { CardProps } from '../common/card';
|
|
3
|
+
import { PromoCardIndicatorProps } from './PromoCardIndicator';
|
|
4
|
+
export type ReferenceType = React.Ref<HTMLInputElement>;
|
|
5
5
|
export type RelatedTypes = '' | 'alternate' | 'author' | 'bookmark' | 'external' | 'help' | 'license' | 'next' | 'nofollow' | 'noreferrer' | 'noopener' | 'prev' | 'search' | 'tag';
|
|
6
6
|
export interface PromoCardCommonProps {
|
|
7
7
|
/** Optional prop to specify classNames onto the PromoCard */
|
|
@@ -30,15 +30,12 @@ export interface PromoCardCommonProps {
|
|
|
30
30
|
isDisabled?: boolean;
|
|
31
31
|
/** Specify an onClick event handler */
|
|
32
32
|
onClick?: () => void;
|
|
33
|
-
/** Specify an onKeyDown event handler */
|
|
34
|
-
onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
35
33
|
/** Optional prop to specify the ID used for testing */
|
|
36
34
|
testId?: string;
|
|
37
35
|
/** Required prop to specify the title text of the PromoCard */
|
|
38
36
|
title: string;
|
|
39
37
|
/** Set to false to use body font style for the title */
|
|
40
38
|
useDisplayFont?: boolean;
|
|
41
|
-
ref?: ReferenceType;
|
|
42
39
|
}
|
|
43
40
|
export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps, 'children'> {
|
|
44
41
|
/**
|
|
@@ -50,12 +47,6 @@ export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps
|
|
|
50
47
|
href?: string;
|
|
51
48
|
/** Optionally specify the language of the linked URL */
|
|
52
49
|
hrefLang?: string;
|
|
53
|
-
/** Optional property that can be pass a ref for the anchor. */
|
|
54
|
-
anchorRef?: React.Ref<HTMLAnchorElement>;
|
|
55
|
-
/**
|
|
56
|
-
* Optional prop to specify the ID of the anchor element which can be useful when using a ref.
|
|
57
|
-
*/
|
|
58
|
-
anchorId?: string;
|
|
59
50
|
/**
|
|
60
51
|
* Relationship between the PromoCard href URL and the current page. See
|
|
61
52
|
* [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).
|
|
@@ -68,7 +59,7 @@ export interface PromoCardLinkProps extends PromoCardCommonProps, Omit<CardProps
|
|
|
68
59
|
isChecked?: never;
|
|
69
60
|
tabIndex?: never;
|
|
70
61
|
type?: never;
|
|
71
|
-
|
|
62
|
+
reference?: never;
|
|
72
63
|
value?: never;
|
|
73
64
|
}
|
|
74
65
|
export interface PromoCardCheckedProps extends PromoCardCommonProps, Omit<CardProps, 'children'> {
|
|
@@ -79,7 +70,7 @@ export interface PromoCardCheckedProps extends PromoCardCommonProps, Omit<CardPr
|
|
|
79
70
|
/** Optional prop to specify the tabIndex of the PromoCard */
|
|
80
71
|
tabIndex?: number;
|
|
81
72
|
/** Optional property to provide component Ref */
|
|
82
|
-
|
|
73
|
+
reference?: ReferenceType;
|
|
83
74
|
/** Optional prop to specify the input type of the PromoCard */
|
|
84
75
|
type?: 'checkbox' | 'radio';
|
|
85
76
|
/** Specify the value attribute of the PromoCard if Checkbox or Radio */
|
|
@@ -87,8 +78,6 @@ export interface PromoCardCheckedProps extends PromoCardCommonProps, Omit<CardPr
|
|
|
87
78
|
/** Only applies to <a />s */
|
|
88
79
|
download?: never;
|
|
89
80
|
href?: never;
|
|
90
|
-
anchorRef?: never;
|
|
91
|
-
anchorId?: never;
|
|
92
81
|
hrefLang?: never;
|
|
93
82
|
rel?: never;
|
|
94
83
|
target?: never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromoCard.d.ts","sourceRoot":"","sources":["../../../src/promoCard/PromoCard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PromoCard.d.ts","sourceRoot":"","sources":["../../../src/promoCard/PromoCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoE,MAAM,OAAO,CAA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GAAG,CACjC,KAAK,EAAE,kBAAkB,GAAG,qBAAqB,KAC9C,GAAG,CAAC,OAAO,CAAC;;AAuOjB,wBAAqC"}
|
|
@@ -3,6 +3,6 @@ declare const SearchBox: import("react").ForwardRefExoticComponent<{
|
|
|
3
3
|
id?: string | undefined;
|
|
4
4
|
classNames?: Record<string, string> | undefined;
|
|
5
5
|
focusedOptionId?: string | undefined;
|
|
6
|
-
} & Pick<InputHTMLAttributes<HTMLInputElement>, "
|
|
6
|
+
} & Pick<InputHTMLAttributes<HTMLInputElement>, "onChange" | "onClick" | "value" | "placeholder"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
7
7
|
export default SearchBox;
|
|
8
8
|
//# sourceMappingURL=SearchBox.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { type TextAreaProps } from '../inputs/TextArea';
|
|
2
3
|
import { type WithDisplayFormatProps } from '../withDisplayFormat';
|
|
3
|
-
export interface TextareaWithDisplayFormatProps extends Omit<WithDisplayFormatProps
|
|
4
|
+
export interface TextareaWithDisplayFormatProps extends Omit<WithDisplayFormatProps<TextAreaProps>, 'render'> {
|
|
4
5
|
}
|
|
5
6
|
declare const TextareaWithDisplayFormat: (props: TextareaWithDisplayFormatProps) => import("react").JSX.Element;
|
|
6
7
|
export default TextareaWithDisplayFormat;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextareaWithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/TextareaWithDisplayFormat.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"TextareaWithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/textareaWithDisplayFormat/TextareaWithDisplayFormat.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAA0B,EAAE,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,MAAM,WAAW,8BACf,SAAQ,IAAI,CAAC,sBAAsB,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC;CAAG;AAElE,QAAA,MAAM,yBAAyB,UAAW,8BAA8B,gCAKvE,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
2
|
import { CommonProps } from '../common';
|
|
3
3
|
import { PositionBottom, PositionLeft, PositionRight, PositionTop } from '../common/propsValues/position';
|
|
4
4
|
export type TooltipProps = PropsWithChildren<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/tooltip/Tooltip.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EAEjB,SAAS,EAMV,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,WAAW,EAAY,MAAM,WAAW,CAAC;AAClD,OAAO,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,WAAW,EACZ,MAAM,gCAAgC,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC;IAC3C,QAAQ,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,cAAc,GAAG,YAAY,CAAC;IACvE,KAAK,EAAE,SAAS,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC,GACA,WAAW,CAAC;AAEd,QAAA,MAAM,OAAO,kDAMV,YAAY,gCAoFd,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxC,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,mBAAmB,GAAG;IACtD,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,QAAA,MAAM,UAAU,iEAMb,eAAe,
|
|
1
|
+
{"version":3,"file":"UploadItem.d.ts","sourceRoot":"","sources":["../../../../src/uploadInput/uploadItem/UploadItem.tsx"],"names":[],"mappings":";AAUA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxC,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,mBAAmB,GAAG;IACtD,IAAI,EAAE,YAAY,CAAC;IACnB;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB;AAED,QAAA,MAAM,UAAU,iEAMb,eAAe,gCAmHjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -5,17 +5,17 @@ import { TextAreaProps } from '../inputs/TextArea';
|
|
|
5
5
|
type HTMLTextElement = HTMLInputElement | HTMLTextAreaElement;
|
|
6
6
|
type TextElementProps = InputProps | TextAreaProps;
|
|
7
7
|
export type EventType = 'KeyDown' | 'Paste' | 'Cut' | 'Undo' | 'Redo' | 'Backspace' | 'Delete' | 'Initial';
|
|
8
|
-
interface WithDisplayFormatState {
|
|
8
|
+
interface WithDisplayFormatState<T extends HTMLTextElement> {
|
|
9
9
|
value: string;
|
|
10
10
|
historyNavigator: HistoryNavigator;
|
|
11
11
|
prevDisplayPattern: string;
|
|
12
12
|
triggerType: EventType;
|
|
13
|
-
triggerEvent: React.KeyboardEvent<
|
|
13
|
+
triggerEvent: React.KeyboardEvent<T> | null;
|
|
14
14
|
pastedLength: number;
|
|
15
15
|
selectionStart: number;
|
|
16
16
|
selectionEnd: number;
|
|
17
17
|
}
|
|
18
|
-
export interface WithDisplayFormatProps<T extends TextElementProps = TextElementProps> extends Pick<
|
|
18
|
+
export interface WithDisplayFormatProps<T extends TextElementProps = TextElementProps> extends Pick<T, 'className' | 'disabled' | 'id' | 'maxLength' | 'minLength' | 'name' | 'placeholder' | 'readOnly' | 'required' | 'inputMode'> {
|
|
19
19
|
value?: string;
|
|
20
20
|
displayPattern: string;
|
|
21
21
|
/**
|
|
@@ -29,15 +29,15 @@ export interface WithDisplayFormatProps<T extends TextElementProps = TextElement
|
|
|
29
29
|
onFocus?: (value: string) => void;
|
|
30
30
|
render: (renderProps: T) => JSX.Element;
|
|
31
31
|
}
|
|
32
|
-
declare class WithDisplayFormat<T extends TextElementProps> extends Component<WithDisplayFormatProps<T>, WithDisplayFormatState
|
|
33
|
-
props: WithDisplayFormatProps<T> & Required<Pick<WithDisplayFormatProps<T>, keyof typeof WithDisplayFormat
|
|
32
|
+
declare class WithDisplayFormat<T extends TextElementProps = TextElementProps, U extends HTMLTextElement = HTMLTextElement> extends Component<WithDisplayFormatProps<T>, WithDisplayFormatState<U>> {
|
|
33
|
+
props: WithDisplayFormatProps<T> & Required<Pick<WithDisplayFormatProps<T>, keyof (typeof WithDisplayFormat<T, U>)['defaultProps']>>;
|
|
34
34
|
static defaultProps: {
|
|
35
35
|
autoComplete: string;
|
|
36
36
|
displayPattern: string;
|
|
37
37
|
value: string;
|
|
38
38
|
};
|
|
39
|
-
constructor(props:
|
|
40
|
-
static getDerivedStateFromProps({ displayPattern }:
|
|
39
|
+
constructor(props: WithDisplayFormat<T, U>['props']);
|
|
40
|
+
static getDerivedStateFromProps({ displayPattern }: WithDisplayFormat['props'], { prevDisplayPattern, value, historyNavigator }: WithDisplayFormat['state']): {
|
|
41
41
|
prevDisplayPattern: string;
|
|
42
42
|
value: string;
|
|
43
43
|
triggerType: null;
|
|
@@ -46,14 +46,14 @@ declare class WithDisplayFormat<T extends TextElementProps> extends Component<Wi
|
|
|
46
46
|
} | null;
|
|
47
47
|
getUserAction: (unformattedValue: string) => EventType | string;
|
|
48
48
|
resetEvent: () => void;
|
|
49
|
-
detectUndoRedo: (event: React.KeyboardEvent<
|
|
50
|
-
handleOnKeyDown: React.KeyboardEventHandler<
|
|
51
|
-
handleOnPaste: React.ClipboardEventHandler<
|
|
52
|
-
handleOnCut: React.ClipboardEventHandler<
|
|
49
|
+
detectUndoRedo: (event: React.KeyboardEvent<U>) => "Undo" | "Redo" | null;
|
|
50
|
+
handleOnKeyDown: React.KeyboardEventHandler<U>;
|
|
51
|
+
handleOnPaste: React.ClipboardEventHandler<U>;
|
|
52
|
+
handleOnCut: React.ClipboardEventHandler<U>;
|
|
53
53
|
isKeyAllowed: (action: EventType | string) => boolean;
|
|
54
|
-
handleOnChange: React.ChangeEventHandler<
|
|
55
|
-
handleOnBlur: React.FocusEventHandler<
|
|
56
|
-
handleOnFocus: React.FocusEventHandler<
|
|
54
|
+
handleOnChange: React.ChangeEventHandler<U>;
|
|
55
|
+
handleOnBlur: React.FocusEventHandler<U>;
|
|
56
|
+
handleOnFocus: React.FocusEventHandler<U>;
|
|
57
57
|
handleDelete: (unformattedValue: string, action: EventType) => string;
|
|
58
58
|
handleCursorPositioning: (action: string) => void;
|
|
59
59
|
render(): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithDisplayFormat.d.ts","sourceRoot":"","sources":["../../../src/withDisplayFormat/WithDisplayFormat.tsx"],"names":[],"mappings":"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CAAC;IAenD,MAAM,CAAC,wBAAwB,CAC7B,EAAE,cAAc,EAAE,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAC9C,EAAE,kBAAmC,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,iBAAiB,CAAC,OAAO,CAAC;;;;;;;IAiB9F,aAAa,qBAAsB,MAAM,KAAG,SAAS,GAAG,MAAM,CA8B5D;IAEF,UAAU,aAMR;IAEF,cAAc,UAAW,mBAAmB,CAAC,CAAC,CAAC,4BAM7C;IAEF,eAAe,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAuB5C;IAEF,aAAa,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAQ3C;IAEF,WAAW,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAEzC;IAEF,YAAY,WAAY,SAAS,GAAG,MAAM,aAKxC;IAEF,cAAc,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,CA0BzC;IAEF,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAEtC;IAEF,aAAa,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAMvC;IAEF,YAAY,qBAAsB,MAAM,UAAU,SAAS,YAuBzD;IAEF,uBAAuB,WAAY,MAAM,UAiBvC;IAEF,MAAM;CAqCP;AAED,eAAe,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-4c1cb43",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"@babel/preset-env": "^7.24.5",
|
|
44
44
|
"@babel/preset-react": "^7.24.1",
|
|
45
45
|
"@babel/preset-typescript": "^7.24.1",
|
|
46
|
+
"@cfaester/enzyme-adapter-react-18": "0.8.0",
|
|
46
47
|
"@formatjs/cli": "^6.2.10",
|
|
47
48
|
"@rollup/plugin-babel": "^6.0.4",
|
|
48
49
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -65,10 +66,9 @@
|
|
|
65
66
|
"@storybook/test": "^7.6.19",
|
|
66
67
|
"@storybook/theming": "^7.6.19",
|
|
67
68
|
"@storybook/types": "^7.6.19",
|
|
68
|
-
"@testing-library/dom": "^
|
|
69
|
+
"@testing-library/dom": "^8.20.1",
|
|
69
70
|
"@testing-library/jest-dom": "^5.17.0",
|
|
70
|
-
"@testing-library/react": "^
|
|
71
|
-
"@testing-library/react-hooks": "^8.0.1",
|
|
71
|
+
"@testing-library/react": "^13.4.0",
|
|
72
72
|
"@testing-library/user-event": "^13.5.0",
|
|
73
73
|
"@transferwise/icons": "^3.7.0",
|
|
74
74
|
"@transferwise/neptune-tokens": "^8.9.2",
|
|
@@ -79,13 +79,11 @@
|
|
|
79
79
|
"@types/lodash": "4.17.1",
|
|
80
80
|
"@types/lodash.clamp": "^4.0.9",
|
|
81
81
|
"@types/lodash.debounce": "^4.0.9",
|
|
82
|
-
"@types/react": "^
|
|
83
|
-
"@types/react-dom": "^
|
|
82
|
+
"@types/react": "^18.3.3",
|
|
83
|
+
"@types/react-dom": "^18.3.0",
|
|
84
84
|
"@types/react-transition-group": "4.4.10",
|
|
85
85
|
"@types/testing-library__jest-dom": "^5.14.9",
|
|
86
|
-
"@types/use-sync-external-store": "^0.0.6",
|
|
87
86
|
"@wise/art": "^2.7.0",
|
|
88
|
-
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
|
|
89
87
|
"babel-plugin-formatjs": "^10.5.14",
|
|
90
88
|
"babel-plugin-inline-react-svg": "^2.0.2",
|
|
91
89
|
"enzyme": "^3.11.0",
|
|
@@ -97,8 +95,8 @@
|
|
|
97
95
|
"rollup": "^4.17.2",
|
|
98
96
|
"storybook": "^7.6.19",
|
|
99
97
|
"@transferwise/less-config": "3.1.0",
|
|
100
|
-
"@
|
|
101
|
-
"@
|
|
98
|
+
"@wise/components-theming": "1.2.2",
|
|
99
|
+
"@transferwise/neptune-css": "14.10.0"
|
|
102
100
|
},
|
|
103
101
|
"peerDependencies": {
|
|
104
102
|
"@transferwise/icons": "^3.7.0",
|
|
@@ -115,7 +113,6 @@
|
|
|
115
113
|
"@formatjs/intl-locale": "^3.4.5",
|
|
116
114
|
"@headlessui/react": "^1.7.19",
|
|
117
115
|
"@popperjs/core": "^2.11.8",
|
|
118
|
-
"@radix-ui/react-id": "^1.0.1",
|
|
119
116
|
"@react-aria/focus": "^3.17.0",
|
|
120
117
|
"@react-aria/overlays": "^3.22.0",
|
|
121
118
|
"@react-spring/web": "~9.7.3",
|
|
@@ -131,8 +128,7 @@
|
|
|
131
128
|
"prop-types": "^15.8.1",
|
|
132
129
|
"react-popper": "^2.3.0",
|
|
133
130
|
"react-required-if": "^1.0.3",
|
|
134
|
-
"react-transition-group": "^4.4.5"
|
|
135
|
-
"use-sync-external-store": "^1.2.2"
|
|
131
|
+
"react-transition-group": "^4.4.5"
|
|
136
132
|
},
|
|
137
133
|
"publishConfig": {
|
|
138
134
|
"access": "public"
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { useId } from '@radix-ui/react-id';
|
|
2
|
-
import { useTheme } from '@wise/components-theming';
|
|
3
1
|
import classNames from 'classnames';
|
|
4
|
-
import { cloneElement, FC, ReactNode } from 'react';
|
|
2
|
+
import { cloneElement, FC, useId, ReactNode } from 'react';
|
|
5
3
|
|
|
6
4
|
import Body from '../../body';
|
|
7
5
|
import Chevron from '../../chevron';
|
|
@@ -75,7 +73,7 @@ const AccordionItem: FC<AccordionItemProps> = ({
|
|
|
75
73
|
icon,
|
|
76
74
|
theme = 'light',
|
|
77
75
|
}) => {
|
|
78
|
-
const iconElement = icon ? cloneElement(icon as React.ReactElement
|
|
76
|
+
const iconElement = icon ? cloneElement(icon as React.ReactElement, { size: 24 }) : null;
|
|
79
77
|
const fallbackId = useId();
|
|
80
78
|
const accordionId = id ?? fallbackId;
|
|
81
79
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { ComponentProps } from 'react';
|
|
3
2
|
|
|
4
|
-
import Avatar from '../avatar/Avatar';
|
|
5
3
|
import { ProfileType, Sentiment } from '../common';
|
|
6
4
|
|
|
7
5
|
import AvatarWrapper from './AvatarWrapper';
|
|
@@ -18,7 +16,7 @@ export const All: Story = {
|
|
|
18
16
|
avatarProps: { outlined: true },
|
|
19
17
|
},
|
|
20
18
|
render: (args) => {
|
|
21
|
-
const avatarProps = args
|
|
19
|
+
const { avatarProps } = args;
|
|
22
20
|
const badgeUrl = 'https://wise.com/public-resources/assets/brand/fast_flag_badge_personal.svg';
|
|
23
21
|
|
|
24
22
|
return (
|
package/src/button/Button.tsx
CHANGED
package/src/common/card/Card.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { MouseEvent,
|
|
2
|
+
import { MouseEvent, ReactNode, useRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { CloseButton } from '../closeButton';
|
|
5
5
|
import { stopPropagation } from '../domHelpers';
|
|
@@ -48,56 +48,48 @@ export interface CardProps {
|
|
|
48
48
|
* <p>Hello World!</p>
|
|
49
49
|
* </Card>
|
|
50
50
|
*/
|
|
51
|
-
const Card
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
ref,
|
|
64
|
-
) => {
|
|
65
|
-
const closeButtonReference = useRef(null);
|
|
51
|
+
const Card: React.FC<CardProps> = ({
|
|
52
|
+
className,
|
|
53
|
+
children = null,
|
|
54
|
+
id,
|
|
55
|
+
isDisabled = false,
|
|
56
|
+
isSmall = false,
|
|
57
|
+
onDismiss,
|
|
58
|
+
testId,
|
|
59
|
+
...props
|
|
60
|
+
}) => {
|
|
61
|
+
const closeButtonReference = useRef(null);
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
Card.displayName = 'Card';
|
|
63
|
+
return (
|
|
64
|
+
<div
|
|
65
|
+
className={classNames(
|
|
66
|
+
'np-Card',
|
|
67
|
+
{
|
|
68
|
+
'np-Card--small': !!isSmall,
|
|
69
|
+
'is-disabled': !!isDisabled,
|
|
70
|
+
},
|
|
71
|
+
className,
|
|
72
|
+
)}
|
|
73
|
+
id={id}
|
|
74
|
+
data-testid={testId}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
{onDismiss && (
|
|
78
|
+
<CloseButton
|
|
79
|
+
ref={closeButtonReference}
|
|
80
|
+
className="np-Card-closeButton"
|
|
81
|
+
size={isSmall ? 'sm' : 'md'}
|
|
82
|
+
isDisabled={isDisabled}
|
|
83
|
+
testId="close-button"
|
|
84
|
+
onClick={(e) => {
|
|
85
|
+
stopPropagation(e);
|
|
86
|
+
onDismiss();
|
|
87
|
+
}}
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
{children}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
};
|
|
102
94
|
|
|
103
95
|
export default Card;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { renderHook } from '@testing-library/react
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
2
|
|
|
3
3
|
import useHasIntersected from '.';
|
|
4
4
|
|
|
@@ -90,8 +90,8 @@ describe('useHasIntersected', () => {
|
|
|
90
90
|
|
|
91
91
|
describe('calls unobserve with correct ref', () => {
|
|
92
92
|
it('when component unmounts before unobserve is called', () => {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
const current = 'a valid ref';
|
|
94
|
+
const reference = { current };
|
|
95
95
|
|
|
96
96
|
setupIntersectionObserver(true);
|
|
97
97
|
observe = jest.fn(() => {
|