@transferwise/components 0.0.0-experimental-c7da7db → 0.0.0-experimental-24a0a12
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/accordion/AccordionItem/AccordionItem.js +0 -1
- package/build/accordion/AccordionItem/AccordionItem.js.map +1 -1
- package/build/accordion/AccordionItem/AccordionItem.mjs +0 -1
- package/build/accordion/AccordionItem/AccordionItem.mjs.map +1 -1
- package/build/actionButton/ActionButton.js +0 -1
- package/build/actionButton/ActionButton.js.map +1 -1
- package/build/actionButton/ActionButton.mjs +0 -1
- package/build/actionButton/ActionButton.mjs.map +1 -1
- package/build/actionOption/ActionOption.js +0 -1
- package/build/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs +0 -1
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/alert/Alert.js +0 -1
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +0 -1
- package/build/alert/Alert.mjs.map +1 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.js +0 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.js.map +1 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.mjs +0 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.mjs.map +1 -1
- package/build/avatar/Avatar.js +0 -1
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +0 -1
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatarView/AvatarView.js +0 -1
- package/build/avatarView/AvatarView.js.map +1 -1
- package/build/avatarView/AvatarView.mjs +0 -1
- package/build/avatarView/AvatarView.mjs.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.js +0 -1
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +0 -1
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +0 -1
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +0 -1
- package/build/badge/Badge.mjs.map +1 -1
- package/build/button/Button.js +0 -1
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +0 -1
- package/build/button/Button.mjs.map +1 -1
- package/build/button/LegacyButton.js +0 -1
- package/build/button/LegacyButton.js.map +1 -1
- package/build/button/LegacyButton.mjs +0 -1
- package/build/button/LegacyButton.mjs.map +1 -1
- package/build/button/classMap.js +0 -1
- package/build/button/classMap.js.map +1 -1
- package/build/button/classMap.mjs +0 -1
- package/build/button/classMap.mjs.map +1 -1
- package/build/button/legacyUtils/legacyUtils.js +0 -1
- package/build/button/legacyUtils/legacyUtils.js.map +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs +0 -1
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
- package/build/card/Card.js +0 -1
- package/build/card/Card.js.map +1 -1
- package/build/card/Card.mjs +0 -1
- package/build/card/Card.mjs.map +1 -1
- package/build/checkbox/Checkbox.js +0 -1
- package/build/checkbox/Checkbox.js.map +1 -1
- package/build/checkbox/Checkbox.mjs +0 -1
- package/build/checkbox/Checkbox.mjs.map +1 -1
- package/build/chevron/Chevron.js +0 -1
- package/build/chevron/Chevron.js.map +1 -1
- package/build/chevron/Chevron.mjs +0 -1
- package/build/chevron/Chevron.mjs.map +1 -1
- package/build/chips/Chip.js +0 -1
- package/build/chips/Chip.js.map +1 -1
- package/build/chips/Chip.mjs +0 -1
- package/build/chips/Chip.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +0 -1
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +0 -1
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/locale/index.js +4 -9
- package/build/common/locale/index.js.map +1 -1
- package/build/common/locale/index.mjs +4 -9
- package/build/common/locale/index.mjs.map +1 -1
- package/build/common/panel/Panel.js +56 -41
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +61 -46
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.js +0 -1
- package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs +0 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +0 -1
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +0 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/dateInput/DateInput.js +1 -1
- package/build/dateInput/DateInput.mjs +1 -1
- package/build/dateLookup/DateLookup.js +1 -1
- package/build/dateLookup/DateLookup.mjs +1 -1
- package/build/dateLookup/dateHeader/DateHeader.js +0 -1
- package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.mjs +0 -1
- package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
- package/build/decision/Decision.js +0 -1
- package/build/decision/Decision.js.map +1 -1
- package/build/decision/Decision.mjs +0 -1
- package/build/decision/Decision.mjs.map +1 -1
- package/build/definitionList/DefinitionList.js +0 -1
- package/build/definitionList/DefinitionList.js.map +1 -1
- package/build/definitionList/DefinitionList.mjs +0 -1
- package/build/definitionList/DefinitionList.mjs.map +1 -1
- package/build/dimmer/Dimmer.js +0 -1
- package/build/dimmer/Dimmer.js.map +1 -1
- package/build/dimmer/Dimmer.mjs +0 -1
- package/build/dimmer/Dimmer.mjs.map +1 -1
- package/build/display/Display.js +0 -1
- package/build/display/Display.js.map +1 -1
- package/build/display/Display.mjs +0 -1
- package/build/display/Display.mjs.map +1 -1
- package/build/drawer/Drawer.js +0 -1
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +0 -1
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +3 -4
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +3 -4
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
- package/build/field/Field.js +5 -5
- package/build/field/Field.mjs +5 -5
- package/build/flowNavigation/FlowNavigation.js +0 -1
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +0 -1
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/header/Header.js +0 -1
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +0 -1
- package/build/header/Header.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/info/Info.js +0 -1
- package/build/info/Info.js.map +1 -1
- package/build/info/Info.mjs +0 -1
- package/build/info/Info.mjs.map +1 -1
- package/build/inlineAlert/InlineAlert.js +0 -1
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs +0 -1
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/inputs/SearchInput.js +0 -1
- package/build/inputs/SearchInput.js.map +1 -1
- package/build/inputs/SearchInput.mjs +0 -1
- package/build/inputs/SearchInput.mjs.map +1 -1
- package/build/instructionsList/InstructionsList.js +0 -1
- package/build/instructionsList/InstructionsList.js.map +1 -1
- package/build/instructionsList/InstructionsList.mjs +0 -1
- package/build/instructionsList/InstructionsList.mjs.map +1 -1
- package/build/link/Link.js +0 -1
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +0 -1
- package/build/link/Link.mjs.map +1 -1
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +0 -1
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js.map +1 -1
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +0 -1
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +1 -1
- package/build/listItem/ListItem.js +0 -1
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +0 -1
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.js +5 -5
- package/build/listItem/Prompt/ListItemPrompt.mjs +5 -5
- package/build/loader/Loader.js +0 -1
- package/build/loader/Loader.js.map +1 -1
- package/build/loader/Loader.mjs +0 -1
- package/build/loader/Loader.mjs.map +1 -1
- package/build/main.css +130 -51
- package/build/markdown/Markdown.js +0 -1
- package/build/markdown/Markdown.js.map +1 -1
- package/build/markdown/Markdown.mjs +0 -1
- package/build/markdown/Markdown.mjs.map +1 -1
- package/build/modal/Modal.js +0 -1
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs +0 -1
- package/build/modal/Modal.mjs.map +1 -1
- 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/navigationOption/NavigationOption.js +0 -1
- package/build/navigationOption/NavigationOption.js.map +1 -1
- package/build/navigationOption/NavigationOption.mjs +0 -1
- package/build/navigationOption/NavigationOption.mjs.map +1 -1
- package/build/nudge/Nudge.js +0 -1
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +0 -1
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/overlayHeader/OverlayHeader.js +0 -1
- package/build/overlayHeader/OverlayHeader.js.map +1 -1
- package/build/overlayHeader/OverlayHeader.mjs +0 -1
- package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +0 -1
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +0 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/popover/Popover.js +0 -1
- package/build/popover/Popover.js.map +1 -1
- package/build/popover/Popover.mjs +0 -1
- package/build/popover/Popover.mjs.map +1 -1
- package/build/processIndicator/ProcessIndicator.js +0 -1
- package/build/processIndicator/ProcessIndicator.js.map +1 -1
- package/build/processIndicator/ProcessIndicator.mjs +0 -1
- package/build/processIndicator/ProcessIndicator.mjs.map +1 -1
- package/build/progressBar/ProgressBar.js +0 -1
- package/build/progressBar/ProgressBar.js.map +1 -1
- package/build/progressBar/ProgressBar.mjs +0 -1
- package/build/progressBar/ProgressBar.mjs.map +1 -1
- package/build/promoCard/PromoCard.js +0 -1
- package/build/promoCard/PromoCard.js.map +1 -1
- package/build/promoCard/PromoCard.mjs +0 -1
- package/build/promoCard/PromoCard.mjs.map +1 -1
- package/build/promoCard/PromoCardIndicator.js +0 -1
- package/build/promoCard/PromoCardIndicator.js.map +1 -1
- package/build/promoCard/PromoCardIndicator.mjs +0 -1
- package/build/promoCard/PromoCardIndicator.mjs.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.js +8 -41
- package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.mjs +8 -41
- package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
- package/build/prompt/CriticalBanner/CriticalBanner.js +148 -0
- package/build/prompt/CriticalBanner/CriticalBanner.js.map +1 -0
- package/build/prompt/CriticalBanner/CriticalBanner.mjs +146 -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/InfoPrompt/InfoPrompt.js +0 -1
- package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.mjs +0 -1
- package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.js +0 -1
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs +0 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- 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/radio/Radio.js +0 -1
- package/build/radio/Radio.js.map +1 -1
- package/build/radio/Radio.mjs +0 -1
- package/build/radio/Radio.mjs.map +1 -1
- package/build/segmentedControl/SegmentedControl.js +0 -1
- package/build/segmentedControl/SegmentedControl.js.map +1 -1
- package/build/segmentedControl/SegmentedControl.mjs +0 -1
- package/build/segmentedControl/SegmentedControl.mjs.map +1 -1
- package/build/select/Select.js +0 -1
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +0 -1
- package/build/select/Select.mjs.map +1 -1
- package/build/select/option/Option.js +0 -1
- package/build/select/option/Option.js.map +1 -1
- package/build/select/option/Option.mjs +0 -1
- package/build/select/option/Option.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.js +0 -1
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +0 -1
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/stepper/Stepper.js +0 -1
- package/build/stepper/Stepper.js.map +1 -1
- package/build/stepper/Stepper.mjs +0 -1
- package/build/stepper/Stepper.mjs.map +1 -1
- package/build/sticky/Sticky.js +0 -1
- package/build/sticky/Sticky.js.map +1 -1
- package/build/sticky/Sticky.mjs +0 -1
- package/build/sticky/Sticky.mjs.map +1 -1
- package/build/styles/css/neptune.css +22 -22
- package/build/styles/less/neptune-tokens.less +4 -4
- package/build/styles/main.css +130 -51
- package/build/styles/prompt/CriticalBanner/CriticalBanner.css +59 -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/summary/Summary.js +0 -1
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +0 -1
- package/build/summary/Summary.mjs.map +1 -1
- package/build/table/Table.js +0 -1
- package/build/table/Table.js.map +1 -1
- package/build/table/Table.mjs +0 -1
- package/build/table/Table.mjs.map +1 -1
- package/build/table/TableRow.js +0 -1
- package/build/table/TableRow.js.map +1 -1
- package/build/table/TableRow.mjs +0 -1
- package/build/table/TableRow.mjs.map +1 -1
- package/build/table/TableStatusText.js +0 -1
- package/build/table/TableStatusText.js.map +1 -1
- package/build/table/TableStatusText.mjs +0 -1
- package/build/table/TableStatusText.mjs.map +1 -1
- package/build/tabs/Tabs.js +0 -1
- package/build/tabs/Tabs.js.map +1 -1
- package/build/tabs/Tabs.mjs +0 -1
- package/build/tabs/Tabs.mjs.map +1 -1
- package/build/tile/Tile.js +0 -1
- package/build/tile/Tile.js.map +1 -1
- package/build/tile/Tile.mjs +0 -1
- package/build/tile/Tile.mjs.map +1 -1
- package/build/title/Title.js +0 -1
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs +0 -1
- package/build/title/Title.mjs.map +1 -1
- package/build/tooltip/Tooltip.js +50 -30
- package/build/tooltip/Tooltip.js.map +1 -1
- package/build/tooltip/Tooltip.mjs +51 -31
- package/build/tooltip/Tooltip.mjs.map +1 -1
- package/build/typeahead/Typeahead.js +5 -5
- package/build/typeahead/Typeahead.mjs +5 -5
- package/build/types/common/locale/index.d.ts +1 -1
- package/build/types/common/locale/index.d.ts.map +1 -1
- package/build/types/common/panel/Panel.d.ts.map +1 -1
- package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts.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/build/types/tooltip/Tooltip.d.ts.map +1 -1
- package/build/upload/Upload.js +0 -1
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.mjs +0 -1
- package/build/upload/Upload.mjs.map +1 -1
- package/build/upload/steps/completeStep/completeStep.js +0 -1
- package/build/upload/steps/completeStep/completeStep.js.map +1 -1
- package/build/upload/steps/completeStep/completeStep.mjs +0 -1
- package/build/upload/steps/completeStep/completeStep.mjs.map +1 -1
- package/build/upload/steps/processingStep/processingStep.js +0 -1
- package/build/upload/steps/processingStep/processingStep.js.map +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +0 -1
- package/build/upload/steps/processingStep/processingStep.mjs.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js +0 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +0 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js +0 -1
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +0 -1
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +0 -1
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +0 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/build/uploadInput/uploadButton/defaults.js +0 -1
- package/build/uploadInput/uploadButton/defaults.js.map +1 -1
- package/build/uploadInput/uploadButton/defaults.mjs +0 -1
- package/build/uploadInput/uploadButton/defaults.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +0 -1
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +0 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.js +0 -1
- package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.mjs +0 -1
- package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
- package/package.json +16 -14
- package/src/common/locale/index.test.ts +4 -13
- package/src/common/locale/index.ts +3 -9
- package/src/common/panel/Panel.tsx +50 -42
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +0 -18
- package/src/expressiveMoneyInput/currencySelector/CurrencySelector.test.tsx +1 -119
- package/src/expressiveMoneyInput/currencySelector/CurrencySelector.tsx +3 -4
- package/src/i18n/en.json +2 -0
- package/src/index.ts +2 -2
- package/src/main.css +130 -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 +59 -0
- package/src/prompt/CriticalBanner/CriticalBanner.less +64 -0
- package/src/prompt/CriticalBanner/CriticalBanner.story.tsx +645 -0
- package/src/prompt/CriticalBanner/CriticalBanner.test.story.tsx +285 -0
- package/src/prompt/CriticalBanner/CriticalBanner.tsx +194 -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/src/tooltip/Tooltip.tsx +45 -26
|
@@ -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());
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import Title from '../title';
|
|
25
25
|
|
|
26
26
|
import messages from './MoneyInput.messages';
|
|
27
|
-
import { formatAmount,
|
|
27
|
+
import { formatAmount, parseAmount } from './currencyFormatting';
|
|
28
28
|
import withId from '../withId';
|
|
29
29
|
|
|
30
30
|
export interface CurrencyOptionItem {
|
|
@@ -48,34 +48,24 @@ const formatAmountIfSet = ({
|
|
|
48
48
|
amount,
|
|
49
49
|
currency,
|
|
50
50
|
locale,
|
|
51
|
-
decimals,
|
|
52
51
|
}: {
|
|
53
52
|
amount: number | null | undefined;
|
|
54
53
|
currency: string;
|
|
55
54
|
locale: string;
|
|
56
|
-
decimals?: number;
|
|
57
55
|
}) => {
|
|
58
|
-
|
|
59
|
-
return '';
|
|
60
|
-
}
|
|
61
|
-
if (decimals != null && getCurrencyDecimals(currency) !== 0) {
|
|
62
|
-
return formatNumber(amount, locale, decimals);
|
|
63
|
-
}
|
|
64
|
-
return formatAmount(amount, currency, locale);
|
|
56
|
+
return typeof amount === 'number' ? formatAmount(amount, currency, locale) : '';
|
|
65
57
|
};
|
|
66
58
|
|
|
67
59
|
const parseNumber = ({
|
|
68
60
|
amount,
|
|
69
61
|
currency,
|
|
70
62
|
locale,
|
|
71
|
-
decimals,
|
|
72
63
|
}: {
|
|
73
64
|
amount: string;
|
|
74
65
|
currency: string;
|
|
75
66
|
locale: string;
|
|
76
|
-
decimals?: number;
|
|
77
67
|
}) => {
|
|
78
|
-
return parseAmount(amount, currency, locale
|
|
68
|
+
return parseAmount(amount, currency, locale);
|
|
79
69
|
};
|
|
80
70
|
|
|
81
71
|
const allowedInputKeys = new Set([
|
|
@@ -112,12 +102,6 @@ export interface MoneyInputProps extends WrappedComponentProps {
|
|
|
112
102
|
onCustomAction?: () => void;
|
|
113
103
|
classNames?: Record<string, string>;
|
|
114
104
|
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;
|
|
121
105
|
}
|
|
122
106
|
|
|
123
107
|
export type MoneyInputPropsWithInputAttributes = MoneyInputProps &
|
|
@@ -149,7 +133,6 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
149
133
|
amount: props.amount,
|
|
150
134
|
currency: props.selectedCurrency.currency,
|
|
151
135
|
locale: props.intl.locale,
|
|
152
|
-
decimals: props.decimals,
|
|
153
136
|
}),
|
|
154
137
|
locale: props.intl.locale,
|
|
155
138
|
};
|
|
@@ -164,7 +147,6 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
164
147
|
amount: nextProps.amount,
|
|
165
148
|
currency: nextProps.selectedCurrency.currency,
|
|
166
149
|
locale: nextProps.intl.locale,
|
|
167
|
-
decimals: nextProps.decimals,
|
|
168
150
|
}),
|
|
169
151
|
});
|
|
170
152
|
}
|
|
@@ -192,7 +174,6 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
192
174
|
amount: paste,
|
|
193
175
|
currency: this.props.selectedCurrency.currency,
|
|
194
176
|
locale,
|
|
195
|
-
decimals: this.props.decimals,
|
|
196
177
|
});
|
|
197
178
|
|
|
198
179
|
if (isNumberOrNull(parsed)) {
|
|
@@ -201,7 +182,6 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
201
182
|
amount: parsed,
|
|
202
183
|
currency: this.props.selectedCurrency.currency,
|
|
203
184
|
locale,
|
|
204
|
-
decimals: this.props.decimals,
|
|
205
185
|
}),
|
|
206
186
|
});
|
|
207
187
|
this.props.onAmountChange?.(parsed);
|
|
@@ -221,7 +201,6 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
221
201
|
amount: value,
|
|
222
202
|
currency: this.props.selectedCurrency.currency,
|
|
223
203
|
locale: this.state.locale,
|
|
224
|
-
decimals: this.props.decimals,
|
|
225
204
|
});
|
|
226
205
|
if (isNumberOrNull(parsed)) {
|
|
227
206
|
this.props.onAmountChange?.(parsed);
|
|
@@ -269,7 +248,6 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
269
248
|
amount: previousState.formattedAmount,
|
|
270
249
|
currency: this.props.selectedCurrency.currency,
|
|
271
250
|
locale: previousState.locale,
|
|
272
|
-
decimals: this.props.decimals,
|
|
273
251
|
});
|
|
274
252
|
if (!isNumberOrNull(parsed)) {
|
|
275
253
|
return {
|
|
@@ -281,7 +259,6 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
281
259
|
amount: parsed,
|
|
282
260
|
currency: this.props.selectedCurrency.currency,
|
|
283
261
|
locale: previousState.locale,
|
|
284
|
-
decimals: this.props.decimals,
|
|
285
262
|
}),
|
|
286
263
|
};
|
|
287
264
|
});
|
|
@@ -363,7 +340,6 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
|
|
|
363
340
|
amount: this.props.placeholder,
|
|
364
341
|
currency: this.props.selectedCurrency.currency,
|
|
365
342
|
locale: this.state.locale,
|
|
366
|
-
decimals: this.props.decimals,
|
|
367
343
|
})}
|
|
368
344
|
autoComplete="off"
|
|
369
345
|
aria-describedby={selectedCurrencyElementId}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { formatAmount
|
|
1
|
+
import { formatAmount } from '@transferwise/formatting';
|
|
2
2
|
|
|
3
3
|
import { DEFAULT_LOCALE } from '../common/locale';
|
|
4
4
|
|
|
5
|
-
export { formatAmount
|
|
5
|
+
export { formatAmount };
|
|
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
|
-
|
|
55
|
+
function getCurrencyDecimals(currency: string) {
|
|
56
56
|
const upperCaseCurrency = currency.toUpperCase();
|
|
57
57
|
return currencyDecimals[upperCaseCurrency] ?? DEFAULT_CURRENCY_DECIMALS;
|
|
58
58
|
}
|
|
@@ -61,16 +61,10 @@ function getDecimalSeparator(locale: string) {
|
|
|
61
61
|
return isNumberLocaleSupported() ? (1.1).toLocaleString(locale)[1] : '.';
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export function parseAmount(
|
|
65
|
-
number: string,
|
|
66
|
-
currency: string,
|
|
67
|
-
locale = DEFAULT_LOCALE,
|
|
68
|
-
decimals?: number,
|
|
69
|
-
) {
|
|
64
|
+
export function parseAmount(number: string, currency: string, locale = DEFAULT_LOCALE) {
|
|
70
65
|
const validLocale = getValidLocale(locale);
|
|
71
66
|
|
|
72
|
-
const
|
|
73
|
-
const precision = currencyDefault === 0 ? 0 : (decimals ?? currencyDefault);
|
|
67
|
+
const precision = getCurrencyDecimals(currency);
|
|
74
68
|
const groupSeparator = isNumberLocaleSupported() ? (10000).toLocaleString(validLocale)[2] : ',';
|
|
75
69
|
const decimalSeparator = getDecimalSeparator(validLocale);
|
|
76
70
|
const numberWithStandardDecimalSeparator = (number || '')
|
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
import { AriaAttributes, ReactNode, useId } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
|
|
4
|
-
import StatusIcon from '../../statusIcon';
|
|
5
4
|
import Body from '../../body';
|
|
6
5
|
import Button from '../../button';
|
|
7
6
|
import { Breakpoint, Typography } from '../../common';
|
|
8
|
-
import AvatarView, { AvatarViewProps } from '../../avatarView';
|
|
9
|
-
import Image from '../../image';
|
|
10
7
|
import { ButtonProps } from '../../button/Button.types';
|
|
11
8
|
import { PrimitivePrompt, PrimitivePromptProps } from '../PrimitivePrompt';
|
|
12
|
-
import { BadgeAssetsProps } from '../../badge';
|
|
13
|
-
import { GiftBox } from '@transferwise/icons';
|
|
14
9
|
import { useScreenSize } from '../../common/hooks/useScreenSize';
|
|
10
|
+
import { renderPromptMedia, PromptMedia } from '../helpers/promptMedia';
|
|
15
11
|
|
|
16
12
|
export type ActionPromptProps = {
|
|
17
13
|
title: ReactNode;
|
|
18
14
|
description?: ReactNode;
|
|
19
15
|
/** @default {} */
|
|
20
|
-
media?:
|
|
21
|
-
imgSrc?: string;
|
|
22
|
-
avatar?: Pick<AvatarViewProps, 'imgSrc' | 'profileName' | 'profileType'> & {
|
|
23
|
-
asset?: AvatarViewProps['children'];
|
|
24
|
-
badge?: Pick<BadgeAssetsProps, 'flagCode'>;
|
|
25
|
-
};
|
|
26
|
-
'aria-label'?: string;
|
|
27
|
-
'aria-hidden'?: boolean;
|
|
28
|
-
};
|
|
16
|
+
media?: PromptMedia;
|
|
29
17
|
action: Pick<ButtonProps, 'onClick' | 'href' | 'target'> & {
|
|
30
18
|
label: ButtonProps['children'];
|
|
31
19
|
};
|
|
@@ -74,54 +62,13 @@ export const ActionPrompt = ({
|
|
|
74
62
|
.filter(Boolean)
|
|
75
63
|
.join(' ');
|
|
76
64
|
|
|
77
|
-
const renderMedia = () =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
alt={media['aria-label'] ?? ''}
|
|
85
|
-
/>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
if (media?.avatar) {
|
|
89
|
-
const badge = media.avatar.badge
|
|
90
|
-
? media.avatar.badge
|
|
91
|
-
: sentiment === 'proposition'
|
|
92
|
-
? {}
|
|
93
|
-
: { status: sentiment };
|
|
94
|
-
return (
|
|
95
|
-
<AvatarView
|
|
96
|
-
{...media.avatar}
|
|
97
|
-
badge={badge}
|
|
98
|
-
aria-label={media['aria-label']}
|
|
99
|
-
aria-hidden={media['aria-hidden']}
|
|
100
|
-
id={mediaId}
|
|
101
|
-
size={48}
|
|
102
|
-
>
|
|
103
|
-
{media.avatar.asset}
|
|
104
|
-
</AvatarView>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
return sentiment === 'proposition' ? (
|
|
108
|
-
<AvatarView
|
|
109
|
-
id={mediaId}
|
|
110
|
-
size={48}
|
|
111
|
-
aria-label={media['aria-label']}
|
|
112
|
-
aria-hidden={media['aria-hidden']}
|
|
113
|
-
>
|
|
114
|
-
<GiftBox />
|
|
115
|
-
</AvatarView>
|
|
116
|
-
) : (
|
|
117
|
-
<StatusIcon
|
|
118
|
-
id={mediaId}
|
|
119
|
-
size={48}
|
|
120
|
-
sentiment={sentiment}
|
|
121
|
-
iconLabel={media['aria-hidden'] ? null : media['aria-label']}
|
|
122
|
-
/>
|
|
123
|
-
);
|
|
124
|
-
};
|
|
65
|
+
const renderMedia = () =>
|
|
66
|
+
renderPromptMedia({
|
|
67
|
+
media,
|
|
68
|
+
sentiment,
|
|
69
|
+
mediaId,
|
|
70
|
+
imgClassName: 'wds-action-prompt--media-image',
|
|
71
|
+
});
|
|
125
72
|
|
|
126
73
|
return (
|
|
127
74
|
<PrimitivePrompt
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Meta, Source, Canvas } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as CriticalBannerStories from './CriticalBanner.story';
|
|
3
|
+
|
|
4
|
+
<Meta title="Prompts/CriticalBanner/Accessibility" tags={['new']} />
|
|
5
|
+
|
|
6
|
+
# Accessibility
|
|
7
|
+
|
|
8
|
+
Under the hood, `CriticalBanner` is marked as `role="region"` for a section of content that users might want to navigate to directly.
|
|
9
|
+
|
|
10
|
+
By default, it's labelled by the `title` and described by the `description`.
|
|
11
|
+
|
|
12
|
+
## Announcement Behavior
|
|
13
|
+
|
|
14
|
+
`CriticalBanner` is designed for critical messages that require immediate attention. It always uses **`aria-live="assertive"`** to immediately interrupt and announce changes to screen readers.
|
|
15
|
+
|
|
16
|
+
Unlike `InfoPrompt` which offers configurable politeness levels, `CriticalBanner` is always assertive because it communicates critical, time-sensitive information that users must be aware of immediately.
|
|
17
|
+
|
|
18
|
+
### What Gets Announced
|
|
19
|
+
|
|
20
|
+
The component intelligently announces only **visible content**, respecting the collapsed/expanded state:
|
|
21
|
+
|
|
22
|
+
- **Collapsed with title**: Announces title only (description is hidden)
|
|
23
|
+
- **Collapsed without title**: Announces description only (visible up to 2 lines)
|
|
24
|
+
- **Expanded**: Announces title, description, and action button labels (all visible)
|
|
25
|
+
|
|
26
|
+
<Source
|
|
27
|
+
dark
|
|
28
|
+
code={`
|
|
29
|
+
// Collapsed with title - announces: "Your account requires verification"
|
|
30
|
+
<CriticalBanner
|
|
31
|
+
title="Your account requires verification"
|
|
32
|
+
description="Please verify your identity to continue"
|
|
33
|
+
action={{ label: "Verify now", onClick: handleVerify }}
|
|
34
|
+
expanded={false}
|
|
35
|
+
onToggle={handleToggle}
|
|
36
|
+
/>
|
|
37
|
+
|
|
38
|
+
// Expanded - announces: "Your account requires verification | Please verify your identity to continue | Verify now | Learn more"
|
|
39
|
+
|
|
40
|
+
<CriticalBanner
|
|
41
|
+
title="Your account requires verification"
|
|
42
|
+
description="Please verify your identity to continue"
|
|
43
|
+
action={{ label: 'Verify now', onClick: handleVerify }}
|
|
44
|
+
actionSecondary={{ label: 'Learn more', onClick: handleLearnMore }}
|
|
45
|
+
expanded={true}
|
|
46
|
+
onToggle={handleToggle}
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
// Collapsed without title - announces: "Your verification is pending..."
|
|
50
|
+
|
|
51
|
+
<CriticalBanner
|
|
52
|
+
description="Your verification is pending. We'll notify you once complete."
|
|
53
|
+
expanded={false}
|
|
54
|
+
onToggle={handleToggle}
|
|
55
|
+
/>
|
|
56
|
+
`}
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
### When Announcements Trigger
|
|
60
|
+
|
|
61
|
+
Screen readers announce the banner content whenever:
|
|
62
|
+
|
|
63
|
+
- The banner first appears in the DOM
|
|
64
|
+
- The user toggles between collapsed and expanded states
|
|
65
|
+
- The content (title, description, or action labels) changes
|
|
66
|
+
|
|
67
|
+
## Custom Labels
|
|
68
|
+
|
|
69
|
+
If you want to provide a custom label for screen readers, you can use the `aria-label` prop. Make sure to include all necessary information in it, because when provided, the default labelling will be removed.
|
|
70
|
+
|
|
71
|
+
<Source
|
|
72
|
+
dark
|
|
73
|
+
code={`
|
|
74
|
+
<CriticalBanner
|
|
75
|
+
title="Account suspended"
|
|
76
|
+
description="Unusual activity detected"
|
|
77
|
+
action={{ label: "Verify identity", onClick: handleVerify }}
|
|
78
|
+
aria-label="Critical: Your account has been suspended due to unusual activity. Please verify your identity immediately to restore access."
|
|
79
|
+
expanded={false}
|
|
80
|
+
onToggle={handleToggle}
|
|
81
|
+
/>
|
|
82
|
+
`}
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
## Media
|
|
86
|
+
|
|
87
|
+
Custom media icons should include their own accessibility attributes. Use the `title` prop on icons to provide accessible names for screen readers:
|
|
88
|
+
|
|
89
|
+
<Source
|
|
90
|
+
dark
|
|
91
|
+
code={`
|
|
92
|
+
import { Bank, AlertCircle } from '@transferwise/icons';
|
|
93
|
+
|
|
94
|
+
<CriticalBanner
|
|
95
|
+
title="Bank connection required"
|
|
96
|
+
description="Connect your bank account to continue"
|
|
97
|
+
media={{ avatar: { asset: <Bank title="Bank account" /> } }}
|
|
98
|
+
action={{ label: 'Connect now', onClick: handleConnect }}
|
|
99
|
+
expanded={false}
|
|
100
|
+
onToggle={handleToggle}
|
|
101
|
+
/>
|
|
102
|
+
|
|
103
|
+
<CriticalBanner
|
|
104
|
+
title="Verification required"
|
|
105
|
+
description="We need to verify your identity"
|
|
106
|
+
media={{ avatar: { asset: <AlertCircle title="Alert" /> } }}
|
|
107
|
+
action={{ label: "Start verification", onClick: handleVerify }}
|
|
108
|
+
expanded={false}
|
|
109
|
+
onToggle={handleToggle}
|
|
110
|
+
/>
|
|
111
|
+
`}
|
|
112
|
+
/>
|
|
113
|
+
|
|
114
|
+
Alternatively, you can use `media['aria-label']` to provide a label for custom images:
|
|
115
|
+
|
|
116
|
+
<Source
|
|
117
|
+
dark
|
|
118
|
+
code={`
|
|
119
|
+
<CriticalBanner
|
|
120
|
+
title="Card blocked"
|
|
121
|
+
description="Your card has been blocked for security reasons"
|
|
122
|
+
media={{
|
|
123
|
+
imgSrc: '/wise-card.svg',
|
|
124
|
+
'aria-label': 'Wise debit card'
|
|
125
|
+
}}
|
|
126
|
+
action={{ label: "Unblock card", onClick: handleUnblock }}
|
|
127
|
+
expanded={false}
|
|
128
|
+
onToggle={handleToggle}
|
|
129
|
+
/>
|
|
130
|
+
`}
|
|
131
|
+
/>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
.wds-critical-banner {
|
|
2
|
+
--Prompt-padding: var(--size-16);
|
|
3
|
+
--Prompt-actions-gap: var(--size-8);
|
|
4
|
+
--Prompt-gap: var(--size-10) var(--size-16);
|
|
5
|
+
--Prompt-border-radius: 0;
|
|
6
|
+
/* Override PrimitivePrompt's --screen-sm-max actions behaviour:
|
|
7
|
+
actions only go full-width below 480px (--screen-xs) */
|
|
8
|
+
}
|
|
9
|
+
.wds-critical-banner__mobile--collapsed {
|
|
10
|
+
max-height: 30vh;
|
|
11
|
+
}
|
|
12
|
+
.wds-critical-banner--media-image {
|
|
13
|
+
width: 48px;
|
|
14
|
+
width: var(--size-48);
|
|
15
|
+
height: 48px;
|
|
16
|
+
height: var(--size-48);
|
|
17
|
+
-o-object-fit: contain;
|
|
18
|
+
object-fit: contain;
|
|
19
|
+
}
|
|
20
|
+
.wds-critical-banner__title--collapsed {
|
|
21
|
+
display: -webkit-box;
|
|
22
|
+
-webkit-line-clamp: 2;
|
|
23
|
+
line-clamp: 2;
|
|
24
|
+
-webkit-box-orient: vertical;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
.wds-critical-banner__description--collapsed {
|
|
28
|
+
display: -webkit-box;
|
|
29
|
+
-webkit-line-clamp: 2;
|
|
30
|
+
line-clamp: 2;
|
|
31
|
+
-webkit-box-orient: vertical;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
}
|
|
34
|
+
.wds-critical-banner .wds-prompt__content-wrapper {
|
|
35
|
+
grid-template-columns: auto 1fr auto;
|
|
36
|
+
align-items: flex-start;
|
|
37
|
+
}
|
|
38
|
+
.wds-critical-banner__text-wrapper {
|
|
39
|
+
min-width: 0;
|
|
40
|
+
max-width: 480px;
|
|
41
|
+
height: 100%;
|
|
42
|
+
}
|
|
43
|
+
.wds-critical-banner .wds-prompt__actions-wrapper {
|
|
44
|
+
grid-column-start: 2;
|
|
45
|
+
grid-column-end: 3;
|
|
46
|
+
}
|
|
47
|
+
@media not (min-width: 480px) {
|
|
48
|
+
.wds-critical-banner .wds-prompt__actions-wrapper {
|
|
49
|
+
grid-column: span 3;
|
|
50
|
+
width: 100%;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
@media not (min-width: 480px) {
|
|
54
|
+
.wds-critical-banner--with-two-actions .wds-prompt__actions-wrapper .wds-Button {
|
|
55
|
+
flex: 1 1 calc(50% - (var(--Prompt-actions-gap) / 2));
|
|
56
|
+
min-width: -moz-fit-content;
|
|
57
|
+
min-width: fit-content;
|
|
58
|
+
}
|
|
59
|
+
}
|