@transferwise/components 0.0.0-experimental-4d90243 → 0.0.0-experimental-a308934
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/field/Field.js +5 -4
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +5 -4
- package/build/field/Field.mjs.map +1 -1
- package/build/i18n/en.json +2 -0
- package/build/i18n/en.json.js +2 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +2 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -0
- package/build/index.mjs.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.js +5 -4
- package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.mjs +5 -4
- package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
- package/build/main.css +85 -29
- package/build/moneyInput/MoneyInput.js +12 -28
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +14 -30
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/moneyInput/currencyFormatting.js +2 -8
- package/build/moneyInput/currencyFormatting.js.map +1 -1
- package/build/moneyInput/currencyFormatting.mjs +4 -5
- package/build/moneyInput/currencyFormatting.mjs.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.js +8 -40
- package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.mjs +8 -40
- package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.js +145 -0
- package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -0
- package/build/prompt/CriticalBanner/CriticalBanner.mjs +143 -0
- package/build/prompt/CriticalBanner/CriticalBanner.mjs.map +1 -0
- package/build/prompt/CriticalBanner/helpers.js +29 -0
- package/build/prompt/CriticalBanner/helpers.js.map +1 -0
- package/build/prompt/CriticalBanner/helpers.mjs +26 -0
- package/build/prompt/CriticalBanner/helpers.mjs.map +1 -0
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.js +2 -0
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.js.map +1 -1
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs +2 -0
- package/build/prompt/PrimitivePrompt/PrimitivePrompt.mjs.map +1 -1
- package/build/prompt/common/Expander/Expander.js +47 -0
- package/build/prompt/common/Expander/Expander.js.map +1 -0
- package/build/prompt/common/Expander/Expander.messages.js +17 -0
- package/build/prompt/common/Expander/Expander.messages.js.map +1 -0
- package/build/prompt/common/Expander/Expander.messages.mjs +13 -0
- package/build/prompt/common/Expander/Expander.messages.mjs.map +1 -0
- package/build/prompt/common/Expander/Expander.mjs +44 -0
- package/build/prompt/common/Expander/Expander.mjs.map +1 -0
- package/build/prompt/helpers/promptMedia.js +52 -0
- package/build/prompt/helpers/promptMedia.js.map +1 -0
- package/build/prompt/helpers/promptMedia.mjs +50 -0
- package/build/prompt/helpers/promptMedia.mjs.map +1 -0
- package/build/styles/main.css +85 -29
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +39 -0
- package/build/styles/prompt/common/Expander/Expander.css +8 -0
- package/build/typeahead/Typeahead.js +5 -4
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +5 -4
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/types/index.d.ts +2 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts +0 -6
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/moneyInput/currencyFormatting.d.ts +3 -4
- package/build/types/moneyInput/currencyFormatting.d.ts.map +1 -1
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts +2 -11
- package/build/types/prompt/ActionPrompt/ActionPrompt.d.ts.map +1 -1
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts +43 -0
- package/build/types/prompt/CriticalBanner/CriticalBanner.d.ts.map +1 -0
- package/build/types/prompt/CriticalBanner/helpers.d.ts +18 -0
- package/build/types/prompt/CriticalBanner/helpers.d.ts.map +1 -0
- package/build/types/prompt/CriticalBanner/index.d.ts +3 -0
- package/build/types/prompt/CriticalBanner/index.d.ts.map +1 -0
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts +8 -3
- package/build/types/prompt/PrimitivePrompt/PrimitivePrompt.d.ts.map +1 -1
- package/build/types/prompt/common/Expander/Expander.d.ts +20 -0
- package/build/types/prompt/common/Expander/Expander.d.ts.map +1 -0
- package/build/types/prompt/common/Expander/Expander.messages.d.ts +14 -0
- package/build/types/prompt/common/Expander/Expander.messages.d.ts.map +1 -0
- package/build/types/prompt/helpers/promptMedia.d.ts +22 -0
- package/build/types/prompt/helpers/promptMedia.d.ts.map +1 -0
- package/build/types/prompt/index.d.ts +2 -0
- package/build/types/prompt/index.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +4 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/i18n/en.json +2 -0
- package/src/index.ts +2 -2
- package/src/main.css +85 -29
- package/src/main.less +3 -1
- package/src/moneyInput/MoneyInput.story.tsx +1 -10
- package/src/moneyInput/MoneyInput.test.story.tsx +1 -141
- package/src/moneyInput/MoneyInput.test.tsx +0 -45
- package/src/moneyInput/MoneyInput.tsx +3 -27
- package/src/moneyInput/currencyFormatting.ts +5 -11
- package/src/prompt/ActionPrompt/ActionPrompt.tsx +9 -62
- package/src/prompt/CriticalBanner/CriticalBanner.accessibility.docs.mdx +131 -0
- package/src/prompt/CriticalBanner/CriticalBanner.css +39 -0
- package/src/prompt/CriticalBanner/CriticalBanner.less +45 -0
- package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +476 -0
- package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +67 -0
- package/src/prompt/CriticalBanner/CriticalBanner.tsx +188 -0
- package/src/prompt/CriticalBanner/helpers.ts +39 -0
- package/src/prompt/CriticalBanner/index.ts +2 -0
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.tsx +9 -2
- package/src/prompt/common/Expander/Expander.css +8 -0
- package/src/prompt/common/Expander/Expander.less +9 -0
- package/src/prompt/common/Expander/Expander.messages.ts +14 -0
- package/src/prompt/common/Expander/Expander.test.tsx +167 -0
- package/src/prompt/common/Expander/Expander.tsx +83 -0
- package/src/prompt/helpers/promptMedia.tsx +79 -0
- package/src/prompt/index.ts +4 -0
- package/src/sentimentSurface/SentimentSurface.story.tsx +43 -17
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { Sentiment } from '../../sentimentSurface';
|
|
1
|
+
import { Emphasis, Sentiment } from '../../sentimentSurface';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
export type PrimitivePromptProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
4
|
/**
|
|
5
|
-
* The sentiment determines the colour scheme
|
|
5
|
+
* The sentiment determines the colour scheme.
|
|
6
6
|
* @default success
|
|
7
7
|
*/
|
|
8
8
|
sentiment?: Sentiment;
|
|
9
|
+
/**
|
|
10
|
+
* The emphasis level affecting background and text contrast.
|
|
11
|
+
* @default 'base
|
|
12
|
+
*/
|
|
13
|
+
emphasis?: Emphasis;
|
|
9
14
|
/**
|
|
10
15
|
* Media to be displayed on the prompt (icon/image/etc).
|
|
11
16
|
*/
|
|
@@ -26,5 +31,5 @@ export type PrimitivePromptProps = HTMLAttributes<HTMLDivElement> & {
|
|
|
26
31
|
/**
|
|
27
32
|
* PrimitivePrompt is a low-level component that provides the structure, sentiment support and styling for various prompts.
|
|
28
33
|
* Uses several css variables to handle styling from within the consuming component, e.g. --Prompt-padding. */
|
|
29
|
-
export declare const PrimitivePrompt: ({ sentiment, media, actions, onDismiss, className, children, ...restProps }: PrimitivePromptProps) => import("react").JSX.Element;
|
|
34
|
+
export declare const PrimitivePrompt: ({ sentiment, emphasis, media, actions, onDismiss, className, children, ...restProps }: PrimitivePromptProps) => import("react").JSX.Element;
|
|
30
35
|
//# sourceMappingURL=PrimitivePrompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimitivePrompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"names":[],"mappings":"AAEA,OAAyB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"PrimitivePrompt.d.ts","sourceRoot":"","sources":["../../../../src/prompt/PrimitivePrompt/PrimitivePrompt.tsx"],"names":[],"mappings":"AAEA,OAAyB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAI/E,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAClE;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;8GAE8G;AAC9G,eAAO,MAAM,eAAe,GAAI,uFAS7B,oBAAoB,gCA+BtB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ExpanderState = {
|
|
2
|
+
expanded: boolean;
|
|
3
|
+
toggle: () => void;
|
|
4
|
+
setExpanded: (expanded: boolean) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function useExpanderState(initialExpanded?: boolean): ExpanderState;
|
|
7
|
+
export declare function shouldShowWhenExpanded({ expanded, hasContent, alwaysShow, }: {
|
|
8
|
+
expanded: boolean;
|
|
9
|
+
hasContent: boolean;
|
|
10
|
+
alwaysShow?: boolean;
|
|
11
|
+
}): boolean;
|
|
12
|
+
export type ExpanderToggleProps = {
|
|
13
|
+
expanded: boolean;
|
|
14
|
+
onToggle: () => void;
|
|
15
|
+
size?: 16 | 24 | 32 | 40 | 48 | 56 | 72;
|
|
16
|
+
className?: string;
|
|
17
|
+
'data-testid'?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const ExpanderToggle: ({ expanded, onToggle, size, className, "data-testid": testId, }: ExpanderToggleProps) => import("react").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=Expander.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Expander.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/common/Expander/Expander.tsx"],"names":[],"mappings":"AAOA,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAGF,wBAAgB,gBAAgB,CAAC,eAAe,UAAO,GAAG,aAAa,CAYtE;AAGD,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,UAAU,EACV,UAAkB,GACnB,EAAE;IACD,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,OAAO,CAMV;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF,eAAO,MAAM,cAAc,GAAI,iEAM5B,mBAAmB,gCAsBrB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
expandAriaLabel: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
collapseAriaLabel: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=Expander.messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Expander.messages.d.ts","sourceRoot":"","sources":["../../../../../src/prompt/common/Expander/Expander.messages.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,wBAWG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AvatarViewProps } from '../../avatarView';
|
|
3
|
+
import { BadgeAssetsProps } from '../../badge';
|
|
4
|
+
import { PrimitivePromptProps } from '../PrimitivePrompt';
|
|
5
|
+
export type PromptMedia = {
|
|
6
|
+
imgSrc?: string;
|
|
7
|
+
avatar?: Pick<AvatarViewProps, 'imgSrc' | 'profileName' | 'profileType'> & {
|
|
8
|
+
asset?: AvatarViewProps['children'];
|
|
9
|
+
badge?: Pick<BadgeAssetsProps, 'flagCode'>;
|
|
10
|
+
};
|
|
11
|
+
'aria-label'?: string;
|
|
12
|
+
'aria-hidden'?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type RenderPromptMediaOptions = {
|
|
15
|
+
media: PromptMedia;
|
|
16
|
+
sentiment: PrimitivePromptProps['sentiment'];
|
|
17
|
+
mediaId: string;
|
|
18
|
+
imgClassName: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function renderPromptMedia({ media, sentiment, mediaId, imgClassName, }: RenderPromptMediaOptions): ReactNode;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=promptMedia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptMedia.d.ts","sourceRoot":"","sources":["../../../../src/prompt/helpers/promptMedia.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAG/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,aAAa,GAAG,aAAa,CAAC,GAAG;QACzE,KAAK,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;QACpC,KAAK,CAAC,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;KAC5C,CAAC;IACF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,SAAS,EACT,OAAO,EACP,YAAY,GACb,EAAE,wBAAwB,GAAG,SAAS,CA+CtC"}
|
|
@@ -4,4 +4,6 @@ export type { ActionPromptProps } from './ActionPrompt';
|
|
|
4
4
|
export { ActionPrompt } from './ActionPrompt';
|
|
5
5
|
export type { InfoPromptProps, InfoPromptAction, InfoPromptMedia } from './InfoPrompt';
|
|
6
6
|
export { InfoPrompt } from './InfoPrompt';
|
|
7
|
+
export type { CriticalBannerProps } from './CriticalBanner';
|
|
8
|
+
export { CriticalBanner } from './CriticalBanner';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompt/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prompt/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -26,6 +26,8 @@ declare function customRender(ui: ReactElement, { locale, messages, ...renderOpt
|
|
|
26
26
|
"neptune.DateLookup.selected": string;
|
|
27
27
|
"neptune.DateLookup.twentyYears": string;
|
|
28
28
|
"neptune.DateLookup.year": string;
|
|
29
|
+
"neptune.Expander.collapseAriaLabel": string;
|
|
30
|
+
"neptune.Expander.expandAriaLabel": string;
|
|
29
31
|
"neptune.ExpressiveMoneyInput.currency.search.placeholder": string;
|
|
30
32
|
"neptune.ExpressiveMoneyInput.currency.select.currency": string;
|
|
31
33
|
"neptune.FlowNavigation.back": string;
|
|
@@ -111,6 +113,8 @@ declare function customRenderHook(callback: () => unknown, { locale, messages }?
|
|
|
111
113
|
"neptune.DateLookup.selected": string;
|
|
112
114
|
"neptune.DateLookup.twentyYears": string;
|
|
113
115
|
"neptune.DateLookup.year": string;
|
|
116
|
+
"neptune.Expander.collapseAriaLabel": string;
|
|
117
|
+
"neptune.Expander.expandAriaLabel": string;
|
|
114
118
|
"neptune.ExpressiveMoneyInput.currency.search.placeholder": string;
|
|
115
119
|
"neptune.ExpressiveMoneyInput.currency.select.currency": string;
|
|
116
120
|
"neptune.FlowNavigation.back": string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test-utils/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAc,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAMxD;;;;GAIG;AACH,iBAAS,YAAY,CACnB,EAAE,EAAE,YAAY,EAChB,EAAE,MAAuB,EAAE,QAAa,EAAE,GAAG,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,GAChE,UAAU,CAAC,OAAO,MAAM,CAAC,CAK3B;AAED;;;GAGG;AACH,iBAAS,gBAAgB,CACvB,QAAQ,EAAE,MAAM,OAAO,EACvB,EAAE,MAAuB,EAAE,QAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAK,uEAKhD;AAED,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,gBAAgB,IAAI,UAAU,EAAE,SAAS,EAAE,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-a308934",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
"storybook-addon-test-codegen": "^3.0.1",
|
|
89
89
|
"@transferwise/less-config": "3.1.2",
|
|
90
90
|
"@transferwise/neptune-css": "14.27.1",
|
|
91
|
-
"@wise/
|
|
92
|
-
"@wise/
|
|
91
|
+
"@wise/wds-configs": "0.0.0",
|
|
92
|
+
"@wise/components-theming": "1.10.1"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
95
|
"@transferwise/icons": "^3 || ^4",
|
package/src/i18n/en.json
CHANGED
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"neptune.DateLookup.selected": "selected",
|
|
17
17
|
"neptune.DateLookup.twentyYears": "20 years",
|
|
18
18
|
"neptune.DateLookup.year": "year",
|
|
19
|
+
"neptune.Expander.collapseAriaLabel": "Collapse",
|
|
20
|
+
"neptune.Expander.expandAriaLabel": "Expand",
|
|
19
21
|
"neptune.ExpressiveMoneyInput.currency.search.placeholder": "Type a currency / country",
|
|
20
22
|
"neptune.ExpressiveMoneyInput.currency.select.currency": "Select currency",
|
|
21
23
|
"neptune.FlowNavigation.back": "back to previous step",
|
package/src/index.ts
CHANGED
|
@@ -35,7 +35,7 @@ export type { HeaderProps } from './header';
|
|
|
35
35
|
export type { EmphasisProps } from './emphasis';
|
|
36
36
|
export type { FieldProps } from './field/Field';
|
|
37
37
|
export type { InfoProps } from './info';
|
|
38
|
-
export type { InlinePromptProps, ActionPromptProps } from './prompt';
|
|
38
|
+
export type { InlinePromptProps, ActionPromptProps, CriticalBannerProps } from './prompt';
|
|
39
39
|
export type { InfoPromptProps, InfoPromptAction, InfoPromptMedia } from './prompt';
|
|
40
40
|
export type { InputWithDisplayFormatProps } from './inputWithDisplayFormat';
|
|
41
41
|
export type { InputProps } from './inputs/Input';
|
|
@@ -173,7 +173,7 @@ export { default as Header } from './header';
|
|
|
173
173
|
export { default as Image } from './image';
|
|
174
174
|
export { default as Info } from './info';
|
|
175
175
|
export { default as InlineAlert } from './inlineAlert';
|
|
176
|
-
export { InfoPrompt, InlinePrompt, ActionPrompt } from './prompt';
|
|
176
|
+
export { InfoPrompt, InlinePrompt, ActionPrompt, CriticalBanner } from './prompt';
|
|
177
177
|
export { default as InputWithDisplayFormat } from './inputWithDisplayFormat';
|
|
178
178
|
export { Input } from './inputs/Input';
|
|
179
179
|
export { InputGroup } from './inputs/InputGroup';
|
package/src/main.css
CHANGED
|
@@ -32176,6 +32176,91 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
32176
32176
|
padding: 0;
|
|
32177
32177
|
}
|
|
32178
32178
|
|
|
32179
|
+
.wds-action-prompt {
|
|
32180
|
+
--Prompt-padding: var(--size-16);
|
|
32181
|
+
--Prompt-actions-gap: var(--size-8);
|
|
32182
|
+
--Prompt-gap: var(--size-10) var(--size-16);
|
|
32183
|
+
--Prompt-border-radius: var(--radius-large);
|
|
32184
|
+
}
|
|
32185
|
+
|
|
32186
|
+
.wds-action-prompt--media-image {
|
|
32187
|
+
width: 48px;
|
|
32188
|
+
width: var(--size-48);
|
|
32189
|
+
height: 48px;
|
|
32190
|
+
height: var(--size-48);
|
|
32191
|
+
-o-object-fit: contain;
|
|
32192
|
+
object-fit: contain;
|
|
32193
|
+
}
|
|
32194
|
+
|
|
32195
|
+
@media (max-width: 767px) {
|
|
32196
|
+
.wds-action-prompt--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
|
|
32197
|
+
flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
|
|
32198
|
+
min-width: -moz-fit-content;
|
|
32199
|
+
min-width: fit-content;
|
|
32200
|
+
}
|
|
32201
|
+
}
|
|
32202
|
+
|
|
32203
|
+
.wds-action-prompt__content {
|
|
32204
|
+
max-width: calc(48px * 10);
|
|
32205
|
+
max-width: calc(var(--size-48) * 10);
|
|
32206
|
+
}
|
|
32207
|
+
|
|
32208
|
+
.wds-critical-banner {
|
|
32209
|
+
--Prompt-padding: var(--size-16);
|
|
32210
|
+
--Prompt-actions-gap: var(--size-8);
|
|
32211
|
+
--Prompt-gap: var(--size-10) var(--size-16);
|
|
32212
|
+
--Prompt-border-radius: 0;
|
|
32213
|
+
}
|
|
32214
|
+
|
|
32215
|
+
.wds-critical-banner--media-image {
|
|
32216
|
+
width: 48px;
|
|
32217
|
+
width: var(--size-48);
|
|
32218
|
+
height: 48px;
|
|
32219
|
+
height: var(--size-48);
|
|
32220
|
+
-o-object-fit: contain;
|
|
32221
|
+
object-fit: contain;
|
|
32222
|
+
}
|
|
32223
|
+
|
|
32224
|
+
@media (max-width: 767px) {
|
|
32225
|
+
.wds-critical-banner--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
|
|
32226
|
+
flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
|
|
32227
|
+
min-width: -moz-fit-content;
|
|
32228
|
+
min-width: fit-content;
|
|
32229
|
+
}
|
|
32230
|
+
}
|
|
32231
|
+
|
|
32232
|
+
.wds-critical-banner__description--collapsed {
|
|
32233
|
+
display: -webkit-box;
|
|
32234
|
+
-webkit-line-clamp: 2;
|
|
32235
|
+
-webkit-box-orient: vertical;
|
|
32236
|
+
overflow: hidden;
|
|
32237
|
+
}
|
|
32238
|
+
|
|
32239
|
+
.wds-critical-banner .wds-prompt__content-wrapper {
|
|
32240
|
+
grid-template-columns: auto 1fr auto;
|
|
32241
|
+
align-items: flex-start;
|
|
32242
|
+
}
|
|
32243
|
+
|
|
32244
|
+
.wds-critical-banner__text-wrapper {
|
|
32245
|
+
min-width: 0;
|
|
32246
|
+
}
|
|
32247
|
+
|
|
32248
|
+
@media (max-width: 767px) {
|
|
32249
|
+
.wds-critical-banner .wds-prompt__actions-wrapper {
|
|
32250
|
+
grid-column: span 3;
|
|
32251
|
+
}
|
|
32252
|
+
}
|
|
32253
|
+
|
|
32254
|
+
.wds-expander-toggle {
|
|
32255
|
+
align-self: flex-start;
|
|
32256
|
+
flex-shrink: 0;
|
|
32257
|
+
transition: transform 0.2s ease-in-out;
|
|
32258
|
+
}
|
|
32259
|
+
|
|
32260
|
+
.wds-expander-toggle--collapsed {
|
|
32261
|
+
transform: rotate(180deg);
|
|
32262
|
+
}
|
|
32263
|
+
|
|
32179
32264
|
.wds-radio-group .np-radio:last-child label {
|
|
32180
32265
|
margin-bottom: 0;
|
|
32181
32266
|
}
|
|
@@ -34600,32 +34685,3 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
34600
34685
|
.np-list-item__action {
|
|
34601
34686
|
flex-shrink: 0;
|
|
34602
34687
|
}
|
|
34603
|
-
|
|
34604
|
-
.wds-action-prompt {
|
|
34605
|
-
--Prompt-padding: var(--size-16);
|
|
34606
|
-
--Prompt-actions-gap: var(--size-8);
|
|
34607
|
-
--Prompt-gap: var(--size-10) var(--size-16);
|
|
34608
|
-
--Prompt-border-radius: var(--radius-large);
|
|
34609
|
-
}
|
|
34610
|
-
|
|
34611
|
-
.wds-action-prompt--media-image {
|
|
34612
|
-
width: 48px;
|
|
34613
|
-
width: var(--size-48);
|
|
34614
|
-
height: 48px;
|
|
34615
|
-
height: var(--size-48);
|
|
34616
|
-
-o-object-fit: contain;
|
|
34617
|
-
object-fit: contain;
|
|
34618
|
-
}
|
|
34619
|
-
|
|
34620
|
-
@media (max-width: 767px) {
|
|
34621
|
-
.wds-action-prompt--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
|
|
34622
|
-
flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
|
|
34623
|
-
min-width: -moz-fit-content;
|
|
34624
|
-
min-width: fit-content;
|
|
34625
|
-
}
|
|
34626
|
-
}
|
|
34627
|
-
|
|
34628
|
-
.wds-action-prompt__content {
|
|
34629
|
-
max-width: calc(48px * 10);
|
|
34630
|
-
max-width: calc(var(--size-48) * 10);
|
|
34631
|
-
}
|
package/src/main.less
CHANGED
|
@@ -66,6 +66,9 @@
|
|
|
66
66
|
@import "./prompt/PrimitivePrompt/PrimitivePrompt.less";
|
|
67
67
|
@import "./prompt/InlinePrompt/InlinePrompt.less";
|
|
68
68
|
@import "./prompt/InfoPrompt/InfoPrompt.less";
|
|
69
|
+
@import "./prompt/ActionPrompt/ActionPrompt.less";
|
|
70
|
+
@import "./prompt/CriticalBanner/CriticalBanner.less";
|
|
71
|
+
@import "./prompt/common/Expander/Expander.less";
|
|
69
72
|
@import "./radioGroup/RadioGroup.less";
|
|
70
73
|
@import "./section/Section.less";
|
|
71
74
|
@import "./slidingPanel/SlidingPanel.less";
|
|
@@ -90,7 +93,6 @@
|
|
|
90
93
|
@import "./progress/Progress.less";
|
|
91
94
|
@import "./progressBar/ProgressBar.less";
|
|
92
95
|
@import "./legacylistItem/LegacyListItem.less";
|
|
93
|
-
@import "./prompt/ActionPrompt/ActionPrompt.less";
|
|
94
96
|
|
|
95
97
|
// List all less files in src in alphabetical order: find -s src -type f -name '*.less' ! -name 'main.less'
|
|
96
98
|
// Make sure you are not referencing main.less itself in this file!
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { within, userEvent
|
|
2
|
+
import { within, userEvent } from 'storybook/test';
|
|
3
3
|
import { Lock } from '@transferwise/icons';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
@@ -155,15 +155,6 @@ export const BalanceCurrencies: Story = {
|
|
|
155
155
|
},
|
|
156
156
|
};
|
|
157
157
|
|
|
158
|
-
export const WithDecimals: Story = {
|
|
159
|
-
args: {
|
|
160
|
-
currencies: [],
|
|
161
|
-
selectedCurrency: exampleCurrency.eur,
|
|
162
|
-
decimals: 4,
|
|
163
|
-
amount: 1234.1412,
|
|
164
|
-
},
|
|
165
|
-
};
|
|
166
|
-
|
|
167
158
|
export const OpenedInput: Story = {
|
|
168
159
|
...MultipleCurrencies,
|
|
169
160
|
play: async ({ canvasElement }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { within,
|
|
2
|
+
import { within, fireEvent } from 'storybook/test';
|
|
3
3
|
import { allModes } from '../../.storybook/modes';
|
|
4
4
|
import { lorem500 } from '../test-utils';
|
|
5
5
|
import { Field } from '../field/Field';
|
|
@@ -102,143 +102,3 @@ export const SmoothScrollReset: Story = {
|
|
|
102
102
|
},
|
|
103
103
|
},
|
|
104
104
|
};
|
|
105
|
-
|
|
106
|
-
export const WithDecimals: Story = {
|
|
107
|
-
args: {
|
|
108
|
-
currencies: [],
|
|
109
|
-
decimals: 4,
|
|
110
|
-
amount: 1234.5678,
|
|
111
|
-
},
|
|
112
|
-
play: async ({ canvas }) => {
|
|
113
|
-
const input = canvas.getByRole('textbox');
|
|
114
|
-
await expect(input).toHaveValue('1,234.5678');
|
|
115
|
-
await userEvent.clear(input);
|
|
116
|
-
await userEvent.type(input, '99.123456789');
|
|
117
|
-
await userEvent.tab();
|
|
118
|
-
await expect(input).toHaveValue('99.1235');
|
|
119
|
-
},
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const eur = {
|
|
123
|
-
value: 'EUR',
|
|
124
|
-
label: 'EUR',
|
|
125
|
-
note: 'Euro',
|
|
126
|
-
currency: 'eur',
|
|
127
|
-
} as const;
|
|
128
|
-
|
|
129
|
-
const bhd = {
|
|
130
|
-
value: 'BHD',
|
|
131
|
-
label: 'BHD',
|
|
132
|
-
note: 'Bahraini dinar',
|
|
133
|
-
currency: 'bhd',
|
|
134
|
-
} as const;
|
|
135
|
-
|
|
136
|
-
const jpy = {
|
|
137
|
-
value: 'JPY',
|
|
138
|
-
label: 'JPY',
|
|
139
|
-
note: 'Japanese yen',
|
|
140
|
-
currency: 'jpy',
|
|
141
|
-
} as const;
|
|
142
|
-
|
|
143
|
-
const sharedProps = {
|
|
144
|
-
currencies: [],
|
|
145
|
-
onAmountChange: () => {},
|
|
146
|
-
onCurrencyChange: () => {},
|
|
147
|
-
} as const;
|
|
148
|
-
|
|
149
|
-
function Row({
|
|
150
|
-
label,
|
|
151
|
-
amount,
|
|
152
|
-
currency,
|
|
153
|
-
decimals,
|
|
154
|
-
}: {
|
|
155
|
-
label: string;
|
|
156
|
-
amount: number;
|
|
157
|
-
currency: { value: string; label: string; note: string; currency: string };
|
|
158
|
-
decimals: number;
|
|
159
|
-
}) {
|
|
160
|
-
return (
|
|
161
|
-
<div
|
|
162
|
-
style={{
|
|
163
|
-
display: 'grid',
|
|
164
|
-
gridTemplateColumns: '240px 1fr 1fr',
|
|
165
|
-
gap: 12,
|
|
166
|
-
alignItems: 'center',
|
|
167
|
-
}}
|
|
168
|
-
>
|
|
169
|
-
<Body as="span" style={{ fontSize: 13, color: '#6b7280' }}>
|
|
170
|
-
{label}
|
|
171
|
-
</Body>
|
|
172
|
-
<Field label={`No decimals prop (${currency.value})`}>
|
|
173
|
-
<MoneyInput {...sharedProps} selectedCurrency={currency} amount={amount} />
|
|
174
|
-
</Field>
|
|
175
|
-
<Field label={`decimals={${decimals}} (${currency.value})`}>
|
|
176
|
-
<MoneyInput
|
|
177
|
-
{...sharedProps}
|
|
178
|
-
selectedCurrency={currency}
|
|
179
|
-
amount={amount}
|
|
180
|
-
decimals={decimals}
|
|
181
|
-
/>
|
|
182
|
-
</Field>
|
|
183
|
-
</div>
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Side-by-side comparison of formatAmount (no decimals prop) vs formatNumber (with decimals prop)
|
|
189
|
-
* when decimals matches the currency default. Differences indicate a formatting parity issue.
|
|
190
|
-
*
|
|
191
|
-
* Problem 1: Trailing zero stripping — formatAmount strips ".00" for whole numbers,
|
|
192
|
-
* formatNumber always pads to the requested precision.
|
|
193
|
-
*
|
|
194
|
-
* Problem 2: BHD decimal count — formatAmount renders 2 fractional digits for BHD,
|
|
195
|
-
* but the currencyDecimals map says BHD has 3. formatNumber with decimals=3 shows 3.
|
|
196
|
-
*/
|
|
197
|
-
export const DecimalsFormatParity: Story = {
|
|
198
|
-
render: () => (
|
|
199
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
|
|
200
|
-
<Body as="p" style={{ fontWeight: 600, marginTop: 8 }}>
|
|
201
|
-
EUR — whole numbers (trailing zero stripping)
|
|
202
|
-
</Body>
|
|
203
|
-
<Row label="amount=0" amount={0} currency={eur} decimals={2} />
|
|
204
|
-
<Row label="amount=1" amount={1} currency={eur} decimals={2} />
|
|
205
|
-
<Row label="amount=42" amount={42} currency={eur} decimals={2} />
|
|
206
|
-
<Row label="amount=100" amount={100} currency={eur} decimals={2} />
|
|
207
|
-
<Row label="amount=1000" amount={1000} currency={eur} decimals={2} />
|
|
208
|
-
<Row label="amount=9999999" amount={9999999} currency={eur} decimals={2} />
|
|
209
|
-
|
|
210
|
-
<Body as="p" style={{ fontWeight: 600, marginTop: 8 }}>
|
|
211
|
-
EUR — fractional amounts (should match)
|
|
212
|
-
</Body>
|
|
213
|
-
<Row label="amount=0.01" amount={0.01} currency={eur} decimals={2} />
|
|
214
|
-
<Row label="amount=0.1" amount={0.1} currency={eur} decimals={2} />
|
|
215
|
-
<Row label="amount=99.9" amount={99.9} currency={eur} decimals={2} />
|
|
216
|
-
<Row label="amount=1234567.89" amount={1234567.89} currency={eur} decimals={2} />
|
|
217
|
-
|
|
218
|
-
<Body as="p" style={{ fontWeight: 600, marginTop: 8 }}>
|
|
219
|
-
BHD — all amounts (formatAmount uses 2 digits, formatNumber uses 3)
|
|
220
|
-
</Body>
|
|
221
|
-
<Row label="amount=0" amount={0} currency={bhd} decimals={3} />
|
|
222
|
-
<Row label="amount=0.001" amount={0.001} currency={bhd} decimals={3} />
|
|
223
|
-
<Row label="amount=0.01" amount={0.01} currency={bhd} decimals={3} />
|
|
224
|
-
<Row label="amount=0.1" amount={0.1} currency={bhd} decimals={3} />
|
|
225
|
-
<Row label="amount=42" amount={42} currency={bhd} decimals={3} />
|
|
226
|
-
<Row label="amount=99.9" amount={99.9} currency={bhd} decimals={3} />
|
|
227
|
-
<Row label="amount=999.99" amount={999.99} currency={bhd} decimals={3} />
|
|
228
|
-
<Row label="amount=1234567.89" amount={1234567.89} currency={bhd} decimals={3} />
|
|
229
|
-
|
|
230
|
-
<Body as="p" style={{ fontWeight: 600, marginTop: 8 }}>
|
|
231
|
-
JPY — zero-decimal currency (should always match)
|
|
232
|
-
</Body>
|
|
233
|
-
<Row label="amount=0" amount={0} currency={jpy} decimals={0} />
|
|
234
|
-
<Row label="amount=1" amount={1} currency={jpy} decimals={0} />
|
|
235
|
-
<Row label="amount=1000" amount={1000} currency={jpy} decimals={0} />
|
|
236
|
-
<Row label="amount=1234567" amount={1234567} currency={jpy} decimals={0} />
|
|
237
|
-
</div>
|
|
238
|
-
),
|
|
239
|
-
parameters: {
|
|
240
|
-
chromatic: {
|
|
241
|
-
disableSnapshot: true,
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
};
|
|
@@ -253,45 +253,6 @@ describe('Money Input', () => {
|
|
|
253
253
|
await userEvent.tab();
|
|
254
254
|
expect(input).toHaveValue('1,234,567.65');
|
|
255
255
|
});
|
|
256
|
-
|
|
257
|
-
it('uses custom decimals when specified', async () => {
|
|
258
|
-
customRender({ decimals: 4 });
|
|
259
|
-
const input = getInput();
|
|
260
|
-
await userEvent.clear(input);
|
|
261
|
-
await userEvent.type(input, '1234.56789');
|
|
262
|
-
await userEvent.tab();
|
|
263
|
-
expect(input).toHaveValue('1,234.5679');
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
it('uses custom decimals of 0', async () => {
|
|
267
|
-
customRender({ decimals: 0 });
|
|
268
|
-
const input = getInput();
|
|
269
|
-
await userEvent.clear(input);
|
|
270
|
-
await userEvent.type(input, '1234.56');
|
|
271
|
-
await userEvent.tab();
|
|
272
|
-
expect(input).toHaveValue('1,235');
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it('ignores custom decimals override for zero-decimal currencies like JPY', async () => {
|
|
276
|
-
const jpyCurrency: CurrencyOptionItem = {
|
|
277
|
-
value: 'JPY',
|
|
278
|
-
label: 'JPY',
|
|
279
|
-
note: 'Japanese yen',
|
|
280
|
-
currency: 'jpy',
|
|
281
|
-
};
|
|
282
|
-
customRender({
|
|
283
|
-
decimals: 4,
|
|
284
|
-
selectedCurrency: jpyCurrency,
|
|
285
|
-
currencies: [jpyCurrency],
|
|
286
|
-
amount: 1234,
|
|
287
|
-
});
|
|
288
|
-
const input = getInput();
|
|
289
|
-
expect(input).toHaveValue('1,234');
|
|
290
|
-
await userEvent.clear(input);
|
|
291
|
-
await userEvent.type(input, '5678.9999');
|
|
292
|
-
await userEvent.tab();
|
|
293
|
-
expect(input).toHaveValue('5,679');
|
|
294
|
-
});
|
|
295
256
|
});
|
|
296
257
|
|
|
297
258
|
it('calls onAmountChange with parsed and formatted value', async () => {
|
|
@@ -302,12 +263,6 @@ describe('Money Input', () => {
|
|
|
302
263
|
expect(initialProps.onAmountChange).toHaveBeenCalledWith(1000.65);
|
|
303
264
|
});
|
|
304
265
|
|
|
305
|
-
it('calls onAmountChange with value rounded to custom decimals', async () => {
|
|
306
|
-
customRender({ decimals: 4, amount: null });
|
|
307
|
-
await userEvent.type(getInput(), '12.34567');
|
|
308
|
-
expect(initialProps.onAmountChange).toHaveBeenCalledWith(12.3457);
|
|
309
|
-
});
|
|
310
|
-
|
|
311
266
|
it('calls onAmountChange when input value is empty', async () => {
|
|
312
267
|
customRender();
|
|
313
268
|
await userEvent.clear(getInput());
|