@transferwise/components 0.0.0-experimental-70cb6d1 → 0.0.0-experimental-8bfed24
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 +107 -51
- 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/css/neptune.css +22 -22
- package/build/styles/less/neptune-tokens.less +4 -4
- package/build/styles/main.css +107 -51
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +39 -0
- package/build/styles/prompt/common/Expander/Expander.css +8 -0
- package/build/styles/props/neptune-tokens.css +2 -2
- package/build/styles/styles/less/neptune.css +22 -22
- 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 +40 -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 +16 -16
- package/src/i18n/en.json +2 -0
- package/src/index.ts +2 -2
- package/src/main.css +107 -51
- 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 +645 -0
- package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +304 -0
- package/src/prompt/CriticalBanner/CriticalBanner.tsx +185 -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
- package/src/styles/less/neptune.css +22 -22
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-8bfed24",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -40,20 +40,20 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/core": "^7.29.0",
|
|
42
42
|
"@babel/plugin-transform-runtime": "^7.29.0",
|
|
43
|
-
"@babel/preset-env": "^7.29.
|
|
43
|
+
"@babel/preset-env": "^7.29.0",
|
|
44
44
|
"@babel/preset-react": "^7.28.5",
|
|
45
45
|
"@babel/preset-typescript": "^7.28.5",
|
|
46
|
-
"@formatjs/cli": "^6.
|
|
46
|
+
"@formatjs/cli": "^6.13.1",
|
|
47
47
|
"@rollup/plugin-babel": "^6.1.0",
|
|
48
48
|
"@rollup/plugin-json": "^6.1.0",
|
|
49
49
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
50
50
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
51
51
|
"@rollup/plugin-url": "^8.0.2",
|
|
52
|
-
"@storybook/addon-a11y": "^10.3.
|
|
53
|
-
"@storybook/addon-docs": "^10.3.
|
|
52
|
+
"@storybook/addon-a11y": "^10.3.3",
|
|
53
|
+
"@storybook/addon-docs": "^10.3.3",
|
|
54
54
|
"@storybook/addon-mcp": "^0.4.1",
|
|
55
|
-
"@storybook/addon-webpack5-compiler-babel": "^4.0.
|
|
56
|
-
"@storybook/react-webpack5": "^10.3.
|
|
55
|
+
"@storybook/addon-webpack5-compiler-babel": "^4.0.0",
|
|
56
|
+
"@storybook/react-webpack5": "^10.3.3",
|
|
57
57
|
"@testing-library/dom": "^10.4.1",
|
|
58
58
|
"@testing-library/jest-dom": "^6.9.1",
|
|
59
59
|
"@testing-library/react": "^16.3.2",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@wise/eslint-config": "^13.3.0",
|
|
74
74
|
"babel-plugin-formatjs": "^10.5.41",
|
|
75
75
|
"eslint": "^9.39.4",
|
|
76
|
-
"eslint-plugin-storybook": "^10.3.
|
|
76
|
+
"eslint-plugin-storybook": "^10.3.3",
|
|
77
77
|
"gulp": "^5.0.1",
|
|
78
78
|
"jest": "^30.3.0",
|
|
79
79
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -81,15 +81,15 @@
|
|
|
81
81
|
"jsdom-testing-mocks": "^1.16.0",
|
|
82
82
|
"lodash.times": "^4.3.2",
|
|
83
83
|
"react-intl": "^7.1.14",
|
|
84
|
-
"rollup": "^4.
|
|
84
|
+
"rollup": "^4.57.1",
|
|
85
85
|
"rollup-preserve-directives": "^1.1.3",
|
|
86
|
-
"storybook": "^10.3.
|
|
86
|
+
"storybook": "^10.3.3",
|
|
87
87
|
"storybook-addon-tag-badges": "^3.1.0",
|
|
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/components-theming": "1.10.1",
|
|
92
|
+
"@wise/wds-configs": "0.0.0"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
95
|
"@transferwise/icons": "^3 || ^4",
|
|
@@ -101,18 +101,18 @@
|
|
|
101
101
|
"react-intl": "^5.10.0 || ^6 || ^7"
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
|
-
"@babel/runtime": "^7.
|
|
104
|
+
"@babel/runtime": "^7.28.6",
|
|
105
105
|
"@floating-ui/react": "^0.27.19",
|
|
106
106
|
"@headlessui/react": "^2.2.9",
|
|
107
107
|
"@popperjs/core": "^2.11.8",
|
|
108
108
|
"@react-aria/focus": "^3.21.5",
|
|
109
109
|
"@react-aria/overlays": "^3.31.2",
|
|
110
|
-
"@transferwise/formatting": "^2.
|
|
110
|
+
"@transferwise/formatting": "^2.13.7",
|
|
111
111
|
"@transferwise/neptune-validation": "^3.3.3",
|
|
112
112
|
"clsx": "^2.1.1",
|
|
113
113
|
"commonmark": "^0.31.2",
|
|
114
|
-
"core-js": "^3.
|
|
115
|
-
"framer-motion": "^12.
|
|
114
|
+
"core-js": "^3.48.0",
|
|
115
|
+
"framer-motion": "^12.36.0",
|
|
116
116
|
"lodash.clamp": "^4.0.3",
|
|
117
117
|
"lodash.debounce": "^4.0.8",
|
|
118
118
|
"merge-props": "^6.0.0",
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Do not edit directly
|
|
3
|
-
* Generated on
|
|
2
|
+
* Do not edit directly
|
|
3
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root {
|
|
@@ -142,8 +142,8 @@
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
* Do not edit directly
|
|
146
|
-
* Generated on
|
|
145
|
+
* Do not edit directly
|
|
146
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
147
147
|
*/
|
|
148
148
|
|
|
149
149
|
.np-theme-personal {
|
|
@@ -391,8 +391,8 @@
|
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
/**
|
|
394
|
-
* Do not edit directly
|
|
395
|
-
* Generated on
|
|
394
|
+
* Do not edit directly
|
|
395
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
396
396
|
*/
|
|
397
397
|
|
|
398
398
|
.np-theme-personal--forest-green {
|
|
@@ -640,8 +640,8 @@
|
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
/**
|
|
643
|
-
* Do not edit directly
|
|
644
|
-
* Generated on
|
|
643
|
+
* Do not edit directly
|
|
644
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
645
645
|
*/
|
|
646
646
|
|
|
647
647
|
.np-theme-personal--bright-green {
|
|
@@ -889,8 +889,8 @@
|
|
|
889
889
|
}
|
|
890
890
|
|
|
891
891
|
/**
|
|
892
|
-
* Do not edit directly
|
|
893
|
-
* Generated on
|
|
892
|
+
* Do not edit directly
|
|
893
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
894
894
|
*/
|
|
895
895
|
|
|
896
896
|
.np-theme-personal--dark {
|
|
@@ -1138,8 +1138,8 @@
|
|
|
1138
1138
|
}
|
|
1139
1139
|
|
|
1140
1140
|
/**
|
|
1141
|
-
* Do not edit directly
|
|
1142
|
-
* Generated on
|
|
1141
|
+
* Do not edit directly
|
|
1142
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
1143
1143
|
*/
|
|
1144
1144
|
|
|
1145
1145
|
.np-theme-platform {
|
|
@@ -1321,8 +1321,8 @@
|
|
|
1321
1321
|
}
|
|
1322
1322
|
|
|
1323
1323
|
/**
|
|
1324
|
-
* Do not edit directly
|
|
1325
|
-
* Generated on
|
|
1324
|
+
* Do not edit directly
|
|
1325
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
1326
1326
|
*/
|
|
1327
1327
|
|
|
1328
1328
|
.np-theme-platform--forest-green {
|
|
@@ -1504,8 +1504,8 @@
|
|
|
1504
1504
|
}
|
|
1505
1505
|
|
|
1506
1506
|
/**
|
|
1507
|
-
* Do not edit directly
|
|
1508
|
-
* Generated on
|
|
1507
|
+
* Do not edit directly
|
|
1508
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
1509
1509
|
*/
|
|
1510
1510
|
|
|
1511
1511
|
.np-theme-business {
|
|
@@ -1688,8 +1688,8 @@
|
|
|
1688
1688
|
}
|
|
1689
1689
|
|
|
1690
1690
|
/**
|
|
1691
|
-
* Do not edit directly
|
|
1692
|
-
* Generated on
|
|
1691
|
+
* Do not edit directly
|
|
1692
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
1693
1693
|
*/
|
|
1694
1694
|
|
|
1695
1695
|
.np-theme-business--dark {
|
|
@@ -1872,8 +1872,8 @@
|
|
|
1872
1872
|
}
|
|
1873
1873
|
|
|
1874
1874
|
/**
|
|
1875
|
-
* Do not edit directly
|
|
1876
|
-
* Generated on
|
|
1875
|
+
* Do not edit directly
|
|
1876
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
1877
1877
|
*/
|
|
1878
1878
|
|
|
1879
1879
|
.np-theme-business--forest-green {
|
|
@@ -2056,8 +2056,8 @@
|
|
|
2056
2056
|
}
|
|
2057
2057
|
|
|
2058
2058
|
/**
|
|
2059
|
-
* Do not edit directly
|
|
2060
|
-
* Generated on
|
|
2059
|
+
* Do not edit directly
|
|
2060
|
+
* Generated on Wed, 07 Jan 2026 11:56:15 GMT
|
|
2061
2061
|
*/
|
|
2062
2062
|
|
|
2063
2063
|
.np-theme-business--bright-green {
|
|
@@ -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());
|