@transferwise/components 0.0.0-experimental-8cc553f → 0.0.0-experimental-769973c
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/checkbox/Checkbox.js +1 -1
- package/build/checkbox/Checkbox.js.map +1 -1
- package/build/checkbox/Checkbox.mjs +1 -1
- package/build/checkbox/Checkbox.mjs.map +1 -1
- package/build/common/Option/Option.js +2 -2
- package/build/common/Option/Option.js.map +1 -1
- package/build/common/Option/Option.mjs +2 -2
- package/build/common/Option/Option.mjs.map +1 -1
- package/build/main.css +5397 -5944
- package/build/moneyInput/MoneyInput.js +28 -12
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +30 -14
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/moneyInput/currencyFormatting.js +8 -2
- package/build/moneyInput/currencyFormatting.js.map +1 -1
- package/build/moneyInput/currencyFormatting.mjs +5 -4
- package/build/moneyInput/currencyFormatting.mjs.map +1 -1
- package/build/styles/accordion/Accordion.css +23 -21
- package/build/styles/actionButton/ActionButton.css +8 -6
- package/build/styles/alert/Alert.css +2 -2
- package/build/styles/avatar/Avatar.css +65 -65
- package/build/styles/avatarLayout/AvatarLayout.css +11 -11
- package/build/styles/avatarView/AvatarView.css +3 -3
- package/build/styles/avatarView/Dot.css +3 -3
- package/build/styles/badge/Badge.css +8 -12
- package/build/styles/button/Button.css +6 -6
- package/build/styles/button/LegacyButton.css +3 -9
- package/build/styles/card/Card.css +27 -18
- package/build/styles/carousel/Carousel.css +28 -27
- package/build/styles/checkboxButton/CheckboxButton.css +10 -15
- package/build/styles/chips/Chip.css +26 -29
- package/build/styles/common/Option/Option.css +42 -44
- package/build/styles/common/baseCard/BaseCard.css +3 -7
- package/build/styles/common/bottomSheet/BottomSheet.css +30 -18
- package/build/styles/common/circle/Circle.css +10 -10
- package/build/styles/common/closeButton/CloseButton.css +36 -36
- package/build/styles/common/liveRegion/LiveRegion.css +1 -1
- package/build/styles/common/panel/Panel.css +7 -7
- package/build/styles/criticalBanner/CriticalCommsBanner.css +7 -7
- package/build/styles/css/accordion.css +35 -37
- package/build/styles/css/alerts.css +84 -96
- package/build/styles/css/badge.css +25 -23
- package/build/styles/css/breadcrumbs.css +6 -4
- package/build/styles/css/button-groups.css +157 -168
- package/build/styles/css/buttons.css +69 -74
- package/build/styles/css/circles.css +54 -60
- package/build/styles/css/close.css +2 -2
- package/build/styles/css/column-layout.css +45 -48
- package/build/styles/css/currency-flags.css +10 -12
- package/build/styles/css/decision.css +14 -12
- package/build/styles/css/dropdowns.css +116 -142
- package/build/styles/css/droppable.css +45 -36
- package/build/styles/css/flex.css +88 -104
- package/build/styles/css/footer.css +15 -14
- package/build/styles/css/grid.css +780 -975
- package/build/styles/css/input-groups.css +333 -361
- package/build/styles/css/link-callout.css +5 -6
- package/build/styles/css/list-group.css +72 -66
- package/build/styles/css/loaders.css +11 -11
- package/build/styles/css/media.css +21 -25
- package/build/styles/css/modals.css +57 -51
- package/build/styles/css/navbar.css +537 -581
- package/build/styles/css/navs.css +84 -88
- package/build/styles/css/neptune-social-media.css +17 -21
- package/build/styles/css/neptune.css +4217 -4545
- package/build/styles/css/panels.css +100 -102
- package/build/styles/css/popovers.css +189 -217
- package/build/styles/css/process.css +69 -71
- package/build/styles/css/progress-bars.css +13 -17
- package/build/styles/css/select.css +35 -39
- package/build/styles/css/sequences.css +147 -169
- package/build/styles/css/table.css +50 -39
- package/build/styles/css/tick.css +15 -10
- package/build/styles/css/tooltip.css +66 -64
- package/build/styles/css/utilities.css +24 -24
- package/build/styles/css/wells.css +20 -20
- package/build/styles/dateInput/DateInput.css +4 -4
- package/build/styles/dateLookup/DateLookup.css +10 -9
- package/build/styles/dateLookup/dateTrigger/DateTrigger.css +9 -15
- package/build/styles/definitionList/DefinitionList.css +8 -14
- package/build/styles/dimmer/Dimmer.css +9 -19
- package/build/styles/divider/Divider.css +8 -7
- package/build/styles/drawer/Drawer.css +16 -15
- package/build/styles/dropFade/DropFade.css +2 -2
- package/build/styles/expressiveMoneyInput/ExpressiveMoneyInput.css +11 -11
- package/build/styles/expressiveMoneyInput/amountInput/AmountInput.css +4 -4
- package/build/styles/expressiveMoneyInput/chevron/Chevron.css +5 -5
- package/build/styles/field/Field.css +5 -5
- package/build/styles/flowNavigation/FlowNavigation.css +29 -28
- package/build/styles/flowNavigation/animatedLabel/AnimatedLabel.css +5 -5
- package/build/styles/header/Header.css +11 -9
- package/build/styles/image/Image.css +7 -7
- package/build/styles/info/Info.css +1 -1
- package/build/styles/inputs/Input.css +24 -25
- package/build/styles/inputs/InputGroup.css +13 -13
- package/build/styles/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +10 -10
- package/build/styles/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +5 -5
- package/build/styles/inputs/SelectInput/ClearButton/SelectInputClearButton.css +6 -6
- package/build/styles/inputs/SelectInput/ItemView/SelectInputItemView.css +4 -4
- package/build/styles/inputs/SelectInput/Option/SelectInputOption.css +4 -2
- package/build/styles/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +4 -4
- package/build/styles/inputs/SelectInput/Options/SelectInputOptions.css +17 -12
- package/build/styles/inputs/SelectInput/Popover/SelectInputPopover.css +4 -4
- package/build/styles/inputs/SelectInput/SelectInput.css +54 -47
- package/build/styles/inputs/TextArea.css +26 -27
- package/build/styles/instructionsList/InstructionsList.css +5 -5
- package/build/styles/legacylistItem/LegacyListItem.css +1 -1
- package/build/styles/link/Link.css +2 -8
- package/build/styles/listItem/ListItem.css +38 -35
- package/build/styles/listItem/ListItem.grid.css +7 -7
- package/build/styles/loader/Loader.css +30 -30
- package/build/styles/main.css +5397 -5944
- package/build/styles/modal/Modal.css +17 -16
- package/build/styles/moneyInput/MoneyInput.css +10 -20
- package/build/styles/navigationOption/NavigationOption.css +6 -19
- package/build/styles/navigationOptionsList/NavigationOptionsList.css +3 -8
- package/build/styles/nudge/Nudge.css +46 -72
- package/build/styles/overlayHeader/OverlayHeader.css +7 -6
- package/build/styles/phoneNumberInput/PhoneNumberInput.css +3 -9
- package/build/styles/popover/Popover.css +13 -10
- package/build/styles/progress/Progress.css +3 -3
- package/build/styles/progressBar/ProgressBar.css +4 -4
- package/build/styles/promoCard/PromoCard.css +27 -41
- package/build/styles/prompt/ActionPrompt/ActionPrompt.css +8 -8
- package/build/styles/prompt/InfoPrompt/InfoPrompt.css +7 -7
- package/build/styles/prompt/InlinePrompt/InlinePrompt.css +5 -6
- package/build/styles/prompt/PrimitivePrompt/PrimitivePrompt.css +6 -6
- package/build/styles/radioGroup/RadioGroup.css +1 -1
- package/build/styles/section/Section.css +6 -6
- package/build/styles/segmentedControl/SegmentedControl.css +18 -15
- package/build/styles/select/Select.css +55 -99
- package/build/styles/slidingPanel/SlidingPanel.css +9 -31
- package/build/styles/snackbar/Snackbar.css +21 -35
- package/build/styles/stepper/Stepper.css +9 -12
- package/build/styles/styles/less/accordion.css +35 -37
- package/build/styles/styles/less/alerts.css +84 -96
- package/build/styles/styles/less/badge.css +25 -23
- package/build/styles/styles/less/breadcrumbs.css +6 -4
- package/build/styles/styles/less/button-groups.css +157 -168
- package/build/styles/styles/less/buttons.css +69 -74
- package/build/styles/styles/less/circles.css +54 -60
- package/build/styles/styles/less/close.css +2 -2
- package/build/styles/styles/less/column-layout.css +45 -48
- package/build/styles/styles/less/currency-flags.css +10 -12
- package/build/styles/styles/less/decision.css +14 -12
- package/build/styles/styles/less/dropdowns.css +116 -142
- package/build/styles/styles/less/droppable.css +45 -36
- package/build/styles/styles/less/flex.css +88 -104
- package/build/styles/styles/less/footer.css +15 -14
- package/build/styles/styles/less/forms/bootstrap-forms.css +244 -264
- package/build/styles/styles/less/forms/checkbox-radio.css +41 -41
- package/build/styles/styles/less/grid.css +780 -975
- package/build/styles/styles/less/input-groups.css +333 -361
- package/build/styles/styles/less/link-callout.css +5 -6
- package/build/styles/styles/less/list-group.css +72 -66
- package/build/styles/styles/less/loaders.css +11 -11
- package/build/styles/styles/less/media.css +21 -25
- package/build/styles/styles/less/modals.css +57 -51
- package/build/styles/styles/less/navbar.css +537 -581
- package/build/styles/styles/less/navs.css +84 -88
- package/build/styles/styles/less/neptune-social-media.css +17 -21
- package/build/styles/styles/less/neptune.css +4217 -4545
- package/build/styles/styles/less/panels.css +100 -102
- package/build/styles/styles/less/popovers.css +189 -217
- package/build/styles/styles/less/process.css +69 -71
- package/build/styles/styles/less/progress-bars.css +13 -17
- package/build/styles/styles/less/select.css +35 -39
- package/build/styles/styles/less/sequences.css +147 -169
- package/build/styles/styles/less/table.css +50 -39
- package/build/styles/styles/less/tick.css +15 -10
- package/build/styles/styles/less/tooltip.css +66 -64
- package/build/styles/styles/less/utilities.css +24 -24
- package/build/styles/styles/less/wells.css +20 -20
- package/build/styles/summary/Summary.css +19 -30
- package/build/styles/switch/Switch.css +5 -4
- package/build/styles/table/Table.css +60 -57
- package/build/styles/tabs/Tabs.css +18 -14
- package/build/styles/tile/Tile.css +12 -12
- package/build/styles/tooltip/Tooltip.css +2 -2
- package/build/styles/typeahead/Typeahead.css +40 -52
- package/build/styles/upload/Upload.css +11 -10
- package/build/styles/uploadInput/UploadInput.css +4 -4
- package/build/styles/uploadInput/uploadButton/UploadButton.css +20 -19
- package/build/styles/uploadInput/uploadItem/UploadItem.css +45 -44
- package/build/types/moneyInput/MoneyInput.d.ts +6 -0
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/moneyInput/currencyFormatting.d.ts +4 -3
- package/build/types/moneyInput/currencyFormatting.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accordion/Accordion.css +23 -21
- package/src/accordion/Accordion.less +3 -3
- package/src/actionButton/ActionButton.css +8 -6
- package/src/alert/Alert.css +2 -2
- package/src/avatar/Avatar.css +65 -65
- package/src/avatarLayout/AvatarLayout.css +11 -11
- package/src/avatarView/AvatarView.css +3 -3
- package/src/avatarView/Dot.css +3 -3
- package/src/badge/Badge.css +8 -12
- package/src/badge/Badge.less +1 -1
- package/src/button/Button.css +6 -6
- package/src/button/LegacyButton.css +3 -9
- package/src/button/LegacyButton.less +1 -1
- package/src/card/Card.css +27 -18
- package/src/card/Card.less +1 -1
- package/src/carousel/Carousel.css +28 -27
- package/src/checkbox/Checkbox.tsx +1 -1
- package/src/checkboxButton/CheckboxButton.css +10 -15
- package/src/checkboxButton/CheckboxButton.less +2 -2
- package/src/chips/Chip.css +26 -29
- package/src/chips/Chip.less +1 -1
- package/src/common/Option/Option.css +42 -44
- package/src/common/Option/Option.less +2 -2
- package/src/common/Option/Option.tsx +2 -2
- package/src/common/baseCard/BaseCard.css +3 -7
- package/src/common/baseCard/BaseCard.less +0 -5
- package/src/common/bottomSheet/BottomSheet.css +30 -18
- package/src/common/circle/Circle.css +10 -10
- package/src/common/closeButton/CloseButton.css +36 -36
- package/src/common/liveRegion/LiveRegion.css +1 -1
- package/src/common/panel/Panel.css +7 -7
- package/src/criticalBanner/CriticalCommsBanner.css +7 -7
- package/src/dateInput/DateInput.css +4 -4
- package/src/dateLookup/DateLookup.css +10 -9
- package/src/dateLookup/dateTrigger/DateTrigger.css +9 -15
- package/src/dateLookup/dateTrigger/DateTrigger.less +1 -1
- package/src/definitionList/DefinitionList.css +8 -14
- package/src/definitionList/DefinitionList.less +1 -1
- package/src/dimmer/Dimmer.css +9 -19
- package/src/dimmer/Dimmer.less +2 -3
- package/src/divider/Divider.css +8 -7
- package/src/drawer/Drawer.css +16 -15
- package/src/dropFade/DropFade.css +2 -2
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.css +11 -11
- package/src/expressiveMoneyInput/amountInput/AmountInput.css +4 -4
- package/src/expressiveMoneyInput/chevron/Chevron.css +5 -5
- package/src/field/Field.css +5 -5
- package/src/flowNavigation/FlowNavigation.css +29 -28
- package/src/flowNavigation/animatedLabel/AnimatedLabel.css +5 -5
- package/src/header/Header.css +11 -9
- package/src/image/Image.css +7 -7
- package/src/info/Info.css +1 -1
- package/src/inputs/Input.css +24 -25
- package/src/inputs/InputGroup.css +13 -13
- package/src/inputs/SelectInput/BottomSheet/SelectInputBottomSheet.css +10 -10
- package/src/inputs/SelectInput/ButtonInput/SelectInputButtonInput.css +5 -5
- package/src/inputs/SelectInput/ClearButton/SelectInputClearButton.css +6 -6
- package/src/inputs/SelectInput/ItemView/SelectInputItemView.css +4 -4
- package/src/inputs/SelectInput/Option/SelectInputOption.css +4 -2
- package/src/inputs/SelectInput/OptionContent/SelectInputOptionContent.css +4 -4
- package/src/inputs/SelectInput/Options/SelectInputOptions.css +17 -12
- package/src/inputs/SelectInput/Popover/SelectInputPopover.css +4 -4
- package/src/inputs/SelectInput/SelectInput.css +54 -47
- package/src/inputs/TextArea.css +26 -27
- package/src/instructionsList/InstructionsList.css +5 -5
- package/src/legacylistItem/LegacyListItem.css +1 -1
- package/src/link/Link.css +2 -8
- package/src/link/Link.less +1 -1
- package/src/listItem/ListItem.css +38 -35
- package/src/listItem/ListItem.grid.css +7 -7
- package/src/loader/Loader.css +30 -30
- package/src/main.css +5397 -5944
- package/src/modal/Modal.css +17 -16
- package/src/moneyInput/MoneyInput.css +10 -20
- package/src/moneyInput/MoneyInput.less +4 -4
- package/src/moneyInput/MoneyInput.story.tsx +10 -1
- package/src/moneyInput/MoneyInput.test.story.tsx +141 -1
- package/src/moneyInput/MoneyInput.test.tsx +45 -0
- package/src/moneyInput/MoneyInput.tsx +27 -3
- package/src/moneyInput/currencyFormatting.ts +11 -5
- package/src/navigationOption/NavigationOption.css +6 -19
- package/src/navigationOption/NavigationOption.less +3 -4
- package/src/navigationOptionsList/NavigationOptionsList.css +3 -8
- package/src/navigationOptionsList/NavigationOptionsList.less +1 -1
- package/src/nudge/Nudge.css +46 -72
- package/src/nudge/Nudge.less +0 -8
- package/src/overlayHeader/OverlayHeader.css +7 -6
- package/src/phoneNumberInput/PhoneNumberInput.css +3 -9
- package/src/phoneNumberInput/PhoneNumberInput.less +1 -1
- package/src/popover/Popover.css +13 -10
- package/src/progress/Progress.css +3 -3
- package/src/progressBar/ProgressBar.css +4 -4
- package/src/promoCard/PromoCard.css +27 -41
- package/src/promoCard/PromoCard.less +12 -27
- package/src/prompt/ActionPrompt/ActionPrompt.css +8 -8
- package/src/prompt/InfoPrompt/InfoPrompt.css +7 -7
- package/src/prompt/InlinePrompt/InlinePrompt.css +5 -6
- package/src/prompt/PrimitivePrompt/PrimitivePrompt.css +6 -6
- package/src/radioGroup/RadioGroup.css +1 -1
- package/src/section/Section.css +6 -6
- package/src/section/Section.story.tsx +2 -8
- package/src/segmentedControl/SegmentedControl.css +18 -15
- package/src/select/Select.css +55 -99
- package/src/select/Select.less +9 -10
- package/src/slidingPanel/SlidingPanel.css +9 -31
- package/src/slidingPanel/SlidingPanel.less +4 -4
- package/src/snackbar/Snackbar.css +21 -35
- package/src/snackbar/Snackbar.less +3 -9
- package/src/stepper/Stepper.css +9 -12
- package/src/stepper/Stepper.less +1 -1
- package/src/styles/less/accordion.css +35 -37
- package/src/styles/less/alerts.css +84 -96
- package/src/styles/less/badge.css +25 -23
- package/src/styles/less/breadcrumbs.css +6 -4
- package/src/styles/less/button-groups.css +157 -168
- package/src/styles/less/buttons.css +69 -74
- package/src/styles/less/circles.css +54 -60
- package/src/styles/less/close.css +2 -2
- package/src/styles/less/column-layout.css +45 -48
- package/src/styles/less/currency-flags.css +10 -12
- package/src/styles/less/decision.css +14 -12
- package/src/styles/less/dropdowns.css +116 -142
- package/src/styles/less/droppable.css +45 -36
- package/src/styles/less/flex.css +88 -104
- package/src/styles/less/footer.css +15 -14
- package/src/styles/less/forms/bootstrap-forms.css +244 -264
- package/src/styles/less/forms/checkbox-radio.css +41 -41
- package/src/styles/less/grid.css +780 -975
- package/src/styles/less/input-groups.css +333 -361
- package/src/styles/less/link-callout.css +5 -6
- package/src/styles/less/list-group.css +72 -66
- package/src/styles/less/loaders.css +11 -11
- package/src/styles/less/media.css +21 -25
- package/src/styles/less/modals.css +57 -51
- package/src/styles/less/navbar.css +537 -581
- package/src/styles/less/navs.css +84 -88
- package/src/styles/less/neptune-social-media.css +17 -21
- package/src/styles/less/neptune.css +4217 -4545
- package/src/styles/less/panels.css +100 -102
- package/src/styles/less/popovers.css +189 -217
- package/src/styles/less/process.css +69 -71
- package/src/styles/less/progress-bars.css +13 -17
- package/src/styles/less/progress-bars.less +0 -5
- package/src/styles/less/select.css +35 -39
- package/src/styles/less/sequences.css +147 -169
- package/src/styles/less/table.css +50 -39
- package/src/styles/less/tick.css +15 -10
- package/src/styles/less/tick.less +6 -1
- package/src/styles/less/tooltip.css +66 -64
- package/src/styles/less/utilities.css +24 -24
- package/src/styles/less/wells.css +20 -20
- package/src/summary/Summary.css +19 -30
- package/src/summary/Summary.less +1 -6
- package/src/switch/Switch.css +5 -4
- package/src/table/Table.css +60 -57
- package/src/tabs/Tabs.css +18 -14
- package/src/tile/Tile.css +12 -12
- package/src/tooltip/Tooltip.css +2 -2
- package/src/typeahead/Typeahead.css +40 -52
- package/src/typeahead/Typeahead.less +2 -2
- package/src/upload/Upload.css +11 -10
- package/src/uploadInput/UploadInput.css +4 -4
- package/src/uploadInput/uploadButton/UploadButton.css +20 -19
- package/src/uploadInput/uploadItem/UploadItem.css +45 -44
package/src/modal/Modal.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.tw-modal--scrollable {
|
|
2
|
-
max-
|
|
2
|
+
max-block-size: 100%;
|
|
3
3
|
/* mobile viewport bug fix */
|
|
4
|
-
max-
|
|
4
|
+
max-block-size: -webkit-fill-available;
|
|
5
5
|
}
|
|
6
6
|
.tw-modal .tw-modal-dialog {
|
|
7
7
|
transition: transform 0.3s ease-out;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
transform: translate(0);
|
|
17
17
|
}
|
|
18
18
|
.tw-modal .tw-modal-content {
|
|
19
|
-
|
|
19
|
+
inline-size: 100%;
|
|
20
20
|
background-color: transparent;
|
|
21
21
|
}
|
|
22
22
|
.tw-modal .tw-modal-content .tw-modal-body {
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
padding: var(--size-16);
|
|
34
34
|
}
|
|
35
35
|
.tw-modal .tw-modal-content .tw-modal-title {
|
|
36
|
-
max-
|
|
36
|
+
max-inline-size: 85%;
|
|
37
37
|
}
|
|
38
38
|
.tw-modal .tw-modal-content .tw-modal-footer {
|
|
39
|
-
padding-
|
|
40
|
-
padding-
|
|
41
|
-
padding-
|
|
42
|
-
padding-
|
|
39
|
+
padding-block-start: 12px;
|
|
40
|
+
padding-block-start: var(--size-12);
|
|
41
|
+
padding-block-end: 12px;
|
|
42
|
+
padding-block-end: var(--size-12);
|
|
43
43
|
}
|
|
44
44
|
@media (min-width: 576px) {
|
|
45
45
|
.tw-modal .tw-modal-content .tw-modal-header,
|
|
@@ -48,13 +48,14 @@
|
|
|
48
48
|
padding: var(--size-24);
|
|
49
49
|
}
|
|
50
50
|
.tw-modal .tw-modal-content .tw-modal-body {
|
|
51
|
-
padding: 0
|
|
52
|
-
padding:
|
|
51
|
+
padding-block: 0;
|
|
52
|
+
padding-inline: 24px;
|
|
53
|
+
padding-inline: var(--size-24);
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
@media (min-width: 480px) {
|
|
56
57
|
.tw-modal-dialog.tw-modal-sm {
|
|
57
|
-
|
|
58
|
+
inline-size: 300px;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
@media (min-width: 576px) {
|
|
@@ -67,17 +68,17 @@
|
|
|
67
68
|
border-radius: var(--radius-small);
|
|
68
69
|
}
|
|
69
70
|
.tw-modal .tw-modal-dialog.tw-modal-md {
|
|
70
|
-
|
|
71
|
+
inline-size: 540px;
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
@media (min-width: 768px) {
|
|
74
75
|
.tw-modal-dialog.tw-modal-lg {
|
|
75
|
-
|
|
76
|
+
inline-size: 720px;
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
@media (min-width: 992px) {
|
|
79
80
|
.tw-modal-dialog.tw-modal-xl {
|
|
80
|
-
|
|
81
|
+
inline-size: 1000px;
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
/* Internet explorer hack */
|
|
@@ -86,10 +87,10 @@
|
|
|
86
87
|
/* stylelint-disable selector-no-vendor-prefix, selector-type-no-unknown */
|
|
87
88
|
_:-ms-fullscreen,
|
|
88
89
|
:root .tw-modal {
|
|
89
|
-
|
|
90
|
+
block-size: 100%;
|
|
90
91
|
}
|
|
91
92
|
_:-ms-fullscreen .tw-modal-dialog,
|
|
92
93
|
:root .tw-modal .tw-modal-dialog {
|
|
93
|
-
|
|
94
|
+
block-size: 100%;
|
|
94
95
|
}
|
|
95
96
|
}
|
|
@@ -2,12 +2,7 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
}
|
|
4
4
|
.tw-money-input .tw-money-input__fixed-currency {
|
|
5
|
-
padding-
|
|
6
|
-
}
|
|
7
|
-
[dir="rtl"] .tw-money-input .tw-money-input__fixed-currency {
|
|
8
|
-
padding-right: 0 !important;
|
|
9
|
-
padding-left: 0 !important;
|
|
10
|
-
padding-left: initial !important;
|
|
5
|
+
padding-inline-start: 0 !important;
|
|
11
6
|
}
|
|
12
7
|
.tw-money-input .tw-money-input__fixed-currency .np-text-title-subsection {
|
|
13
8
|
color: #768e9c;
|
|
@@ -16,14 +11,14 @@
|
|
|
16
11
|
font-weight: var(--font-weight-semi-bold);
|
|
17
12
|
}
|
|
18
13
|
.tw-money-input.input-group-sm .form-control {
|
|
19
|
-
min-
|
|
14
|
+
min-block-size: 34px;
|
|
20
15
|
}
|
|
21
16
|
.tw-money-input.input-group-sm .np-text-title-subsection {
|
|
22
17
|
font-size: 0.875rem;
|
|
23
18
|
font-size: var(--font-size-14);
|
|
24
19
|
}
|
|
25
20
|
.tw-money-input.input-group-md .form-control {
|
|
26
|
-
min-
|
|
21
|
+
min-block-size: 53px;
|
|
27
22
|
}
|
|
28
23
|
.tw-money-input.input-group-md .np-text-title-subsection {
|
|
29
24
|
font-size: 1rem;
|
|
@@ -36,26 +31,21 @@
|
|
|
36
31
|
display: flex;
|
|
37
32
|
align-items: center;
|
|
38
33
|
flex-shrink: 0;
|
|
39
|
-
|
|
34
|
+
inline-size: auto;
|
|
40
35
|
}
|
|
41
36
|
.tw-money-input .input-group-addon:not(.amount-currency-select-btn):not(.tw-money-input__fixed-currency):not(:has(~ .tw-money-input__fixed-currency)) {
|
|
42
|
-
padding-
|
|
43
|
-
}
|
|
44
|
-
[dir="rtl"] .tw-money-input .input-group-addon:not(.amount-currency-select-btn):not(.tw-money-input__fixed-currency):not(:has(~ .tw-money-input__fixed-currency)) {
|
|
45
|
-
padding-left: 0 !important;
|
|
46
|
-
padding-right: 0 !important;
|
|
47
|
-
padding-right: initial !important;
|
|
37
|
+
padding-inline-end: 0 !important;
|
|
48
38
|
}
|
|
49
39
|
.tw-money-input .amount-currency-select-btn {
|
|
50
40
|
flex-shrink: 0;
|
|
51
|
-
|
|
41
|
+
inline-size: auto;
|
|
52
42
|
line-height: normal;
|
|
53
43
|
}
|
|
54
44
|
.tw-money-input .np-button-input {
|
|
55
|
-
border-
|
|
56
|
-
border-
|
|
57
|
-
border-
|
|
58
|
-
border-
|
|
45
|
+
border-start-end-radius: 10px !important;
|
|
46
|
+
border-start-end-radius: var(--radius-small) !important;
|
|
47
|
+
border-end-end-radius: 10px !important;
|
|
48
|
+
border-end-end-radius: var(--radius-small) !important;
|
|
59
49
|
}
|
|
60
50
|
.tw-money-input .np-button-input:not(.disabled):not(:disabled):focus-visible {
|
|
61
51
|
border-radius: 10px !important;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
.tw-money-input {
|
|
5
5
|
display: flex;
|
|
6
6
|
.tw-money-input__fixed-currency {
|
|
7
|
-
|
|
7
|
+
padding-left: 0 !important;
|
|
8
8
|
|
|
9
9
|
.np-text-title-subsection {
|
|
10
10
|
color: var(--color-content-tertiary);
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
.input-group-addon {
|
|
34
34
|
flex-shrink: 0;
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
&:not(.amount-currency-select-btn) {
|
|
37
37
|
display: flex;
|
|
38
38
|
align-items: center;
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
width: auto;
|
|
41
41
|
|
|
42
42
|
&:not(.tw-money-input__fixed-currency):not(:has(~ .tw-money-input__fixed-currency)) {
|
|
43
|
-
|
|
43
|
+
padding-right: 0 !important;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
.amount-currency-select-btn {
|
|
49
49
|
flex-shrink: 0;
|
|
50
50
|
width: auto;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { within, userEvent } from 'storybook/test';
|
|
2
|
+
import { within, userEvent, expect } from 'storybook/test';
|
|
3
3
|
import { Lock } from '@transferwise/icons';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
@@ -155,6 +155,15 @@ 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
|
+
|
|
158
167
|
export const OpenedInput: Story = {
|
|
159
168
|
...MultipleCurrencies,
|
|
160
169
|
play: async ({ canvasElement }) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { within, fireEvent } from 'storybook/test';
|
|
2
|
+
import { within, userEvent, fireEvent, expect } 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,3 +102,143 @@ 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,6 +253,45 @@ 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
|
+
});
|
|
256
295
|
});
|
|
257
296
|
|
|
258
297
|
it('calls onAmountChange with parsed and formatted value', async () => {
|
|
@@ -263,6 +302,12 @@ describe('Money Input', () => {
|
|
|
263
302
|
expect(initialProps.onAmountChange).toHaveBeenCalledWith(1000.65);
|
|
264
303
|
});
|
|
265
304
|
|
|
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
|
+
|
|
266
311
|
it('calls onAmountChange when input value is empty', async () => {
|
|
267
312
|
customRender();
|
|
268
313
|
await userEvent.clear(getInput());
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import Title from '../title';
|
|
25
25
|
|
|
26
26
|
import messages from './MoneyInput.messages';
|
|
27
|
-
import { formatAmount, parseAmount } from './currencyFormatting';
|
|
27
|
+
import { formatAmount, formatNumber, getCurrencyDecimals, parseAmount } from './currencyFormatting';
|
|
28
28
|
import withId from '../withId';
|
|
29
29
|
|
|
30
30
|
export interface CurrencyOptionItem {
|
|
@@ -48,24 +48,34 @@ const formatAmountIfSet = ({
|
|
|
48
48
|
amount,
|
|
49
49
|
currency,
|
|
50
50
|
locale,
|
|
51
|
+
decimals,
|
|
51
52
|
}: {
|
|
52
53
|
amount: number | null | undefined;
|
|
53
54
|
currency: string;
|
|
54
55
|
locale: string;
|
|
56
|
+
decimals?: number;
|
|
55
57
|
}) => {
|
|
56
|
-
|
|
58
|
+
if (typeof amount !== 'number') {
|
|
59
|
+
return '';
|
|
60
|
+
}
|
|
61
|
+
if (decimals != null && getCurrencyDecimals(currency) !== 0) {
|
|
62
|
+
return formatNumber(amount, locale, decimals);
|
|
63
|
+
}
|
|
64
|
+
return formatAmount(amount, currency, locale);
|
|
57
65
|
};
|
|
58
66
|
|
|
59
67
|
const parseNumber = ({
|
|
60
68
|
amount,
|
|
61
69
|
currency,
|
|
62
70
|
locale,
|
|
71
|
+
decimals,
|
|
63
72
|
}: {
|
|
64
73
|
amount: string;
|
|
65
74
|
currency: string;
|
|
66
75
|
locale: string;
|
|
76
|
+
decimals?: number;
|
|
67
77
|
}) => {
|
|
68
|
-
return parseAmount(amount, currency, locale);
|
|
78
|
+
return parseAmount(amount, currency, locale, decimals);
|
|
69
79
|
};
|
|
70
80
|
|
|
71
81
|
const allowedInputKeys = new Set([
|
|
@@ -102,6 +112,12 @@ export interface MoneyInputProps extends WrappedComponentProps {
|
|
|
102
112
|
onCustomAction?: () => void;
|
|
103
113
|
classNames?: Record<string, string>;
|
|
104
114
|
selectProps?: Partial<SelectInputProps<CurrencyOptionItem>>;
|
|
115
|
+
/**
|
|
116
|
+
* Specify the number of decimal places to format the amount. When not specified, the number of
|
|
117
|
+
* decimals is determined by the selected currency (e.g. 2 for EUR, 0 for JPY, 3 for BHD).
|
|
118
|
+
* This override is ignored for zero-decimal currencies (e.g. JPY, KRW, HUF), which always use 0.
|
|
119
|
+
*/
|
|
120
|
+
decimals?: number;
|
|
105
121
|
}
|
|
106
122
|
|
|
107
123
|
export type MoneyInputPropsWithInputAttributes = MoneyInputProps &
|
|
@@ -133,6 +149,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
133
149
|
amount: props.amount,
|
|
134
150
|
currency: props.selectedCurrency.currency,
|
|
135
151
|
locale: props.intl.locale,
|
|
152
|
+
decimals: props.decimals,
|
|
136
153
|
}),
|
|
137
154
|
locale: props.intl.locale,
|
|
138
155
|
};
|
|
@@ -147,6 +164,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
147
164
|
amount: nextProps.amount,
|
|
148
165
|
currency: nextProps.selectedCurrency.currency,
|
|
149
166
|
locale: nextProps.intl.locale,
|
|
167
|
+
decimals: nextProps.decimals,
|
|
150
168
|
}),
|
|
151
169
|
});
|
|
152
170
|
}
|
|
@@ -174,6 +192,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
174
192
|
amount: paste,
|
|
175
193
|
currency: this.props.selectedCurrency.currency,
|
|
176
194
|
locale,
|
|
195
|
+
decimals: this.props.decimals,
|
|
177
196
|
});
|
|
178
197
|
|
|
179
198
|
if (isNumberOrNull(parsed)) {
|
|
@@ -182,6 +201,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
182
201
|
amount: parsed,
|
|
183
202
|
currency: this.props.selectedCurrency.currency,
|
|
184
203
|
locale,
|
|
204
|
+
decimals: this.props.decimals,
|
|
185
205
|
}),
|
|
186
206
|
});
|
|
187
207
|
this.props.onAmountChange?.(parsed);
|
|
@@ -201,6 +221,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
201
221
|
amount: value,
|
|
202
222
|
currency: this.props.selectedCurrency.currency,
|
|
203
223
|
locale: this.state.locale,
|
|
224
|
+
decimals: this.props.decimals,
|
|
204
225
|
});
|
|
205
226
|
if (isNumberOrNull(parsed)) {
|
|
206
227
|
this.props.onAmountChange?.(parsed);
|
|
@@ -248,6 +269,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
248
269
|
amount: previousState.formattedAmount,
|
|
249
270
|
currency: this.props.selectedCurrency.currency,
|
|
250
271
|
locale: previousState.locale,
|
|
272
|
+
decimals: this.props.decimals,
|
|
251
273
|
});
|
|
252
274
|
if (!isNumberOrNull(parsed)) {
|
|
253
275
|
return {
|
|
@@ -259,6 +281,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
259
281
|
amount: parsed,
|
|
260
282
|
currency: this.props.selectedCurrency.currency,
|
|
261
283
|
locale: previousState.locale,
|
|
284
|
+
decimals: this.props.decimals,
|
|
262
285
|
}),
|
|
263
286
|
};
|
|
264
287
|
});
|
|
@@ -340,6 +363,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
340
363
|
amount: this.props.placeholder,
|
|
341
364
|
currency: this.props.selectedCurrency.currency,
|
|
342
365
|
locale: this.state.locale,
|
|
366
|
+
decimals: this.props.decimals,
|
|
343
367
|
})}
|
|
344
368
|
autoComplete="off"
|
|
345
369
|
aria-describedby={selectedCurrencyElementId}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { formatAmount } from '@transferwise/formatting';
|
|
1
|
+
import { formatAmount, formatNumber } from '@transferwise/formatting';
|
|
2
2
|
|
|
3
3
|
import { DEFAULT_LOCALE } from '../common/locale';
|
|
4
4
|
|
|
5
|
-
export { formatAmount };
|
|
5
|
+
export { formatAmount, formatNumber };
|
|
6
6
|
|
|
7
7
|
// TODO: do not duplicate this between formatting and components
|
|
8
8
|
const currencyDecimals: Record<string, number> = {
|
|
@@ -52,7 +52,7 @@ function getValidLocale(locale: string) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
function getCurrencyDecimals(currency: string) {
|
|
55
|
+
export function getCurrencyDecimals(currency: string) {
|
|
56
56
|
const upperCaseCurrency = currency.toUpperCase();
|
|
57
57
|
return currencyDecimals[upperCaseCurrency] ?? DEFAULT_CURRENCY_DECIMALS;
|
|
58
58
|
}
|
|
@@ -61,10 +61,16 @@ function getDecimalSeparator(locale: string) {
|
|
|
61
61
|
return isNumberLocaleSupported() ? (1.1).toLocaleString(locale)[1] : '.';
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export function parseAmount(
|
|
64
|
+
export function parseAmount(
|
|
65
|
+
number: string,
|
|
66
|
+
currency: string,
|
|
67
|
+
locale = DEFAULT_LOCALE,
|
|
68
|
+
decimals?: number,
|
|
69
|
+
) {
|
|
65
70
|
const validLocale = getValidLocale(locale);
|
|
66
71
|
|
|
67
|
-
const
|
|
72
|
+
const currencyDefault = getCurrencyDecimals(currency);
|
|
73
|
+
const precision = currencyDefault === 0 ? 0 : (decimals ?? currencyDefault);
|
|
68
74
|
const groupSeparator = isNumberLocaleSupported() ? (10000).toLocaleString(validLocale)[2] : ',';
|
|
69
75
|
const decimalSeparator = getDecimalSeparator(validLocale);
|
|
70
76
|
const numberWithStandardDecimalSeparator = (number || '')
|
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
.np-navigation-option {
|
|
2
2
|
-webkit-text-decoration: none;
|
|
3
3
|
text-decoration: none;
|
|
4
|
+
border-inline-start-width: 0;
|
|
5
|
+
border-inline-end-width: 0;
|
|
4
6
|
background-color: transparent;
|
|
5
|
-
text-align:
|
|
6
|
-
|
|
7
|
+
text-align: start;
|
|
8
|
+
inline-size: 100%;
|
|
7
9
|
--ring-outline-offset: 0;
|
|
8
10
|
}
|
|
9
|
-
[dir="rtl"] .np-navigation-option {
|
|
10
|
-
border-right: 0 ;
|
|
11
|
-
}
|
|
12
|
-
html:not([dir="rtl"]) .np-navigation-option {
|
|
13
|
-
border-left: 0 ;
|
|
14
|
-
}
|
|
15
|
-
[dir="rtl"] .np-navigation-option {
|
|
16
|
-
border-left: 0 ;
|
|
17
|
-
}
|
|
18
|
-
html:not([dir="rtl"]) .np-navigation-option {
|
|
19
|
-
border-right: 0 ;
|
|
20
|
-
}
|
|
21
|
-
[dir="rtl"] .np-navigation-option {
|
|
22
|
-
text-align: right;
|
|
23
|
-
}
|
|
24
11
|
.np-navigation-option:hover,
|
|
25
12
|
.np-navigation-option:focus {
|
|
26
13
|
-webkit-text-decoration: none;
|
|
@@ -64,6 +51,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
64
51
|
color: var(--color-content-accent-active);
|
|
65
52
|
}
|
|
66
53
|
.np-theme-personal .np-option__container-aligned {
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
inline-size: calc(100% + 2 * 16px);
|
|
55
|
+
inline-size: calc(100% + 2 * var(--space-content-horizontal));
|
|
69
56
|
}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
.np-navigation-options-list {
|
|
2
2
|
list-style-type: none;
|
|
3
|
-
padding-
|
|
4
|
-
margin-
|
|
5
|
-
}
|
|
6
|
-
[dir="rtl"] .np-navigation-options-list {
|
|
7
|
-
padding-right: 0;
|
|
8
|
-
padding-left: 0;
|
|
9
|
-
padding-left: initial;
|
|
3
|
+
padding-inline-start: 0;
|
|
4
|
+
margin-block-end: 0;
|
|
10
5
|
}
|
|
11
6
|
.np-navigation-options-list__item + .np-navigation-options-list__item {
|
|
12
|
-
margin-
|
|
7
|
+
margin-block-start: -1px;
|
|
13
8
|
}
|