@transferwise/components 46.133.1 → 46.135.0
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 +1 -0
- package/build/accordion/AccordionItem/AccordionItem.js.map +1 -1
- package/build/accordion/AccordionItem/AccordionItem.mjs +1 -0
- package/build/accordion/AccordionItem/AccordionItem.mjs.map +1 -1
- package/build/actionButton/ActionButton.js +1 -0
- package/build/actionButton/ActionButton.js.map +1 -1
- package/build/actionButton/ActionButton.mjs +1 -0
- package/build/actionButton/ActionButton.mjs.map +1 -1
- package/build/actionOption/ActionOption.js +1 -0
- package/build/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs +1 -0
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/alert/Alert.js +1 -0
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +1 -0
- package/build/alert/Alert.mjs.map +1 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.js +1 -0
- package/build/alert/inlineMarkdown/InlineMarkdown.js.map +1 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.mjs +1 -0
- package/build/alert/inlineMarkdown/InlineMarkdown.mjs.map +1 -1
- package/build/avatar/Avatar.js +1 -0
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +1 -0
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatarView/AvatarView.js +1 -0
- package/build/avatarView/AvatarView.js.map +1 -1
- package/build/avatarView/AvatarView.mjs +1 -0
- package/build/avatarView/AvatarView.mjs.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.js +1 -0
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +1 -0
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +1 -0
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +1 -0
- package/build/badge/Badge.mjs.map +1 -1
- package/build/button/Button.js +1 -0
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +1 -0
- package/build/button/Button.mjs.map +1 -1
- package/build/button/LegacyButton.js +1 -0
- package/build/button/LegacyButton.js.map +1 -1
- package/build/button/LegacyButton.mjs +1 -0
- package/build/button/LegacyButton.mjs.map +1 -1
- package/build/button/classMap.js +1 -0
- package/build/button/classMap.js.map +1 -1
- package/build/button/classMap.mjs +1 -0
- package/build/button/classMap.mjs.map +1 -1
- package/build/button/legacyUtils/legacyUtils.js +1 -0
- package/build/button/legacyUtils/legacyUtils.js.map +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs +1 -0
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
- package/build/card/Card.js +1 -0
- package/build/card/Card.js.map +1 -1
- package/build/card/Card.mjs +1 -0
- package/build/card/Card.mjs.map +1 -1
- package/build/checkbox/Checkbox.js +1 -0
- package/build/checkbox/Checkbox.js.map +1 -1
- package/build/checkbox/Checkbox.mjs +1 -0
- package/build/checkbox/Checkbox.mjs.map +1 -1
- package/build/chevron/Chevron.js +1 -0
- package/build/chevron/Chevron.js.map +1 -1
- package/build/chevron/Chevron.mjs +1 -0
- package/build/chevron/Chevron.mjs.map +1 -1
- package/build/chips/Chip.js +1 -0
- package/build/chips/Chip.js.map +1 -1
- package/build/chips/Chip.mjs +1 -0
- package/build/chips/Chip.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +1 -0
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +1 -0
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/locale/index.js +9 -4
- package/build/common/locale/index.js.map +1 -1
- package/build/common/locale/index.mjs +9 -4
- package/build/common/locale/index.mjs.map +1 -1
- package/build/common/panel/Panel.js +1 -0
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +1 -0
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.js +1 -0
- package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs +1 -0
- package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +1 -0
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +1 -0
- 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 +1 -0
- package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.mjs +1 -0
- package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
- package/build/decision/Decision.js +1 -0
- package/build/decision/Decision.js.map +1 -1
- package/build/decision/Decision.mjs +1 -0
- package/build/decision/Decision.mjs.map +1 -1
- package/build/definitionList/DefinitionList.js +1 -0
- package/build/definitionList/DefinitionList.js.map +1 -1
- package/build/definitionList/DefinitionList.mjs +1 -0
- package/build/definitionList/DefinitionList.mjs.map +1 -1
- package/build/dimmer/Dimmer.js +1 -0
- package/build/dimmer/Dimmer.js.map +1 -1
- package/build/dimmer/Dimmer.mjs +1 -0
- package/build/dimmer/Dimmer.mjs.map +1 -1
- package/build/display/Display.js +1 -0
- package/build/display/Display.js.map +1 -1
- package/build/display/Display.mjs +1 -0
- package/build/display/Display.mjs.map +1 -1
- package/build/drawer/Drawer.js +1 -0
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +1 -0
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js +4 -3
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.js.map +1 -1
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs +4 -3
- package/build/expressiveMoneyInput/currencySelector/CurrencySelector.mjs.map +1 -1
- package/build/field/Field.js +1 -0
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +1 -0
- package/build/field/Field.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +1 -0
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +1 -0
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/header/Header.js +1 -0
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +1 -0
- package/build/header/Header.mjs.map +1 -1
- package/build/info/Info.js +1 -0
- package/build/info/Info.js.map +1 -1
- package/build/info/Info.mjs +1 -0
- package/build/info/Info.mjs.map +1 -1
- package/build/inlineAlert/InlineAlert.js +1 -0
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs +1 -0
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/inputs/SearchInput.js +1 -0
- package/build/inputs/SearchInput.js.map +1 -1
- package/build/inputs/SearchInput.mjs +1 -0
- package/build/inputs/SearchInput.mjs.map +1 -1
- package/build/instructionsList/InstructionsList.js +1 -0
- package/build/instructionsList/InstructionsList.js.map +1 -1
- package/build/instructionsList/InstructionsList.mjs +1 -0
- package/build/instructionsList/InstructionsList.mjs.map +1 -1
- package/build/link/Link.js +1 -0
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +1 -0
- package/build/link/Link.mjs.map +1 -1
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +1 -0
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js.map +1 -1
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +1 -0
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +1 -1
- package/build/listItem/ListItem.js +1 -0
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +1 -0
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.js +1 -0
- package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.mjs +1 -0
- package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
- package/build/loader/Loader.js +1 -0
- package/build/loader/Loader.js.map +1 -1
- package/build/loader/Loader.mjs +1 -0
- package/build/loader/Loader.mjs.map +1 -1
- package/build/main.css +65 -27
- package/build/markdown/Markdown.js +1 -0
- package/build/markdown/Markdown.js.map +1 -1
- package/build/markdown/Markdown.mjs +1 -0
- package/build/markdown/Markdown.mjs.map +1 -1
- package/build/modal/Modal.js +1 -0
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs +1 -0
- package/build/modal/Modal.mjs.map +1 -1
- 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/navigationOption/NavigationOption.js +1 -0
- package/build/navigationOption/NavigationOption.js.map +1 -1
- package/build/navigationOption/NavigationOption.mjs +1 -0
- package/build/navigationOption/NavigationOption.mjs.map +1 -1
- package/build/nudge/Nudge.js +1 -0
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +1 -0
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/overlayHeader/OverlayHeader.js +1 -0
- package/build/overlayHeader/OverlayHeader.js.map +1 -1
- package/build/overlayHeader/OverlayHeader.mjs +1 -0
- package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +1 -0
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +1 -0
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/popover/Popover.js +1 -0
- package/build/popover/Popover.js.map +1 -1
- package/build/popover/Popover.mjs +1 -0
- package/build/popover/Popover.mjs.map +1 -1
- package/build/processIndicator/ProcessIndicator.js +1 -0
- package/build/processIndicator/ProcessIndicator.js.map +1 -1
- package/build/processIndicator/ProcessIndicator.mjs +1 -0
- package/build/processIndicator/ProcessIndicator.mjs.map +1 -1
- package/build/progressBar/ProgressBar.js +1 -0
- package/build/progressBar/ProgressBar.js.map +1 -1
- package/build/progressBar/ProgressBar.mjs +1 -0
- package/build/progressBar/ProgressBar.mjs.map +1 -1
- package/build/promoCard/PromoCard.js +1 -0
- package/build/promoCard/PromoCard.js.map +1 -1
- package/build/promoCard/PromoCard.mjs +1 -0
- package/build/promoCard/PromoCard.mjs.map +1 -1
- package/build/promoCard/PromoCardIndicator.js +1 -0
- package/build/promoCard/PromoCardIndicator.js.map +1 -1
- package/build/promoCard/PromoCardIndicator.mjs +1 -0
- package/build/promoCard/PromoCardIndicator.mjs.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.js +1 -0
- package/build/prompt/ActionPrompt/ActionPrompt.js.map +1 -1
- package/build/prompt/ActionPrompt/ActionPrompt.mjs +1 -0
- package/build/prompt/ActionPrompt/ActionPrompt.mjs.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.js +1 -0
- package/build/prompt/InfoPrompt/InfoPrompt.js.map +1 -1
- package/build/prompt/InfoPrompt/InfoPrompt.mjs +1 -0
- package/build/prompt/InfoPrompt/InfoPrompt.mjs.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.js +1 -0
- package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/prompt/InlinePrompt/InlinePrompt.mjs +1 -0
- package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/radio/Radio.js +1 -0
- package/build/radio/Radio.js.map +1 -1
- package/build/radio/Radio.mjs +1 -0
- package/build/radio/Radio.mjs.map +1 -1
- package/build/segmentedControl/SegmentedControl.js +1 -0
- package/build/segmentedControl/SegmentedControl.js.map +1 -1
- package/build/segmentedControl/SegmentedControl.mjs +1 -0
- package/build/segmentedControl/SegmentedControl.mjs.map +1 -1
- package/build/select/Select.js +1 -0
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +1 -0
- package/build/select/Select.mjs.map +1 -1
- package/build/select/option/Option.js +1 -0
- package/build/select/option/Option.js.map +1 -1
- package/build/select/option/Option.mjs +1 -0
- package/build/select/option/Option.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.js +2 -12
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +2 -12
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/stepper/Stepper.js +1 -0
- package/build/stepper/Stepper.js.map +1 -1
- package/build/stepper/Stepper.mjs +1 -0
- package/build/stepper/Stepper.mjs.map +1 -1
- package/build/sticky/Sticky.js +1 -0
- package/build/sticky/Sticky.js.map +1 -1
- package/build/sticky/Sticky.mjs +1 -0
- 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 +65 -27
- package/build/styles/props/neptune-tokens.css +2 -2
- package/build/styles/sentimentSurface/SentimentSurface.css +1 -1
- package/build/styles/statusIcon/StatusIcon.css +35 -4
- package/build/styles/styles/less/neptune.css +22 -22
- package/build/summary/Summary.js +1 -0
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +1 -0
- package/build/summary/Summary.mjs.map +1 -1
- package/build/table/Table.js +1 -0
- package/build/table/Table.js.map +1 -1
- package/build/table/Table.mjs +1 -0
- package/build/table/Table.mjs.map +1 -1
- package/build/table/TableRow.js +1 -0
- package/build/table/TableRow.js.map +1 -1
- package/build/table/TableRow.mjs +1 -0
- package/build/table/TableRow.mjs.map +1 -1
- package/build/table/TableStatusText.js +1 -0
- package/build/table/TableStatusText.js.map +1 -1
- package/build/table/TableStatusText.mjs +1 -0
- package/build/table/TableStatusText.mjs.map +1 -1
- package/build/tabs/Tabs.js +1 -0
- package/build/tabs/Tabs.js.map +1 -1
- package/build/tabs/Tabs.mjs +1 -0
- package/build/tabs/Tabs.mjs.map +1 -1
- package/build/tile/Tile.js +1 -0
- package/build/tile/Tile.js.map +1 -1
- package/build/tile/Tile.mjs +1 -0
- package/build/tile/Tile.mjs.map +1 -1
- package/build/title/Title.js +1 -0
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs +1 -0
- package/build/title/Title.mjs.map +1 -1
- package/build/tooltip/Tooltip.js +1 -0
- package/build/tooltip/Tooltip.js.map +1 -1
- package/build/tooltip/Tooltip.mjs +1 -0
- package/build/tooltip/Tooltip.mjs.map +1 -1
- package/build/typeahead/Typeahead.js +1 -0
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +1 -0
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/types/common/locale/index.d.ts +1 -1
- package/build/types/common/locale/index.d.ts.map +1 -1
- package/build/types/expressiveMoneyInput/currencySelector/CurrencySelector.d.ts.map +1 -1
- 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/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/upload/Upload.js +1 -0
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.mjs +1 -0
- package/build/upload/Upload.mjs.map +1 -1
- package/build/upload/steps/completeStep/completeStep.js +1 -0
- package/build/upload/steps/completeStep/completeStep.js.map +1 -1
- package/build/upload/steps/completeStep/completeStep.mjs +1 -0
- package/build/upload/steps/completeStep/completeStep.mjs.map +1 -1
- package/build/upload/steps/processingStep/processingStep.js +1 -0
- package/build/upload/steps/processingStep/processingStep.js.map +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +1 -0
- package/build/upload/steps/processingStep/processingStep.mjs.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js +1 -0
- package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +1 -0
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js +1 -0
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +1 -0
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +1 -0
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +1 -0
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/build/uploadInput/uploadButton/defaults.js +1 -0
- package/build/uploadInput/uploadButton/defaults.js.map +1 -1
- package/build/uploadInput/uploadButton/defaults.mjs +1 -0
- package/build/uploadInput/uploadButton/defaults.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +1 -0
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +1 -0
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.js +1 -0
- package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.mjs +1 -0
- package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
- package/package.json +14 -14
- package/src/common/locale/index.test.ts +13 -4
- package/src/common/locale/index.ts +9 -3
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +18 -0
- package/src/expressiveMoneyInput/currencySelector/CurrencySelector.test.tsx +119 -1
- package/src/expressiveMoneyInput/currencySelector/CurrencySelector.tsx +4 -3
- package/src/main.css +65 -27
- 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/sentimentSurface/SentimentSurface.css +1 -1
- package/src/sentimentSurface/SentimentSurface.less +1 -1
- package/src/statusIcon/StatusIcon.css +35 -4
- package/src/statusIcon/StatusIcon.less +35 -4
- package/src/statusIcon/StatusIcon.story.tsx +119 -79
- package/src/statusIcon/StatusIcon.test.story.tsx +125 -0
- package/src/statusIcon/StatusIcon.test.tsx +16 -23
- package/src/statusIcon/StatusIcon.tsx +2 -16
- package/src/styles/less/neptune.css +22 -22
|
@@ -25,6 +25,7 @@ require('../../common/propsValues/variant.js');
|
|
|
25
25
|
require('../../common/propsValues/scroll.js');
|
|
26
26
|
require('../../common/propsValues/markdownNodeType.js');
|
|
27
27
|
require('../../common/fileType.js');
|
|
28
|
+
require('@transferwise/formatting');
|
|
28
29
|
require('@transferwise/icons');
|
|
29
30
|
require('react-intl');
|
|
30
31
|
require('../../common/closeButton/CloseButton.messages.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionItem.js","sources":["../../../src/accordion/AccordionItem/AccordionItem.tsx"],"sourcesContent":["import { IdIconProps } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { FC, ReactNode, cloneElement, useId } from 'react';\n\nimport Body from '../../body';\nimport Chevron from '../../chevron';\nimport { Position, Size, Typography } from '../../common';\nimport Option from '../../common/Option';\n\nexport interface AccordionItemProps {\n /** A label for the accordion item, used for accessibility purposes. */\n 'aria-label'?: string;\n /** An ID for the accordion item, used for accessibility purposes. */\n id?: string;\n /** The title of the accordion item. */\n title: ReactNode;\n /** The subtitle of the accordion item. */\n subtitle?: ReactNode;\n /** The content of the accordion item. */\n content: ReactNode;\n /** A callback function that is called when the accordion item is clicked. */\n onClick: () => void;\n /** Whether the accordion item is currently open or closed. */\n open: boolean;\n /** An optional icon to display next to the accordion item title. */\n icon?: ReactNode;\n /** An optional media element to display next to the accordion item title. */\n media?: ReactNode;\n /** An optional showMediaAtAllSizes with media available at all sizes of the screen. */\n showMediaAtAllSizes?: boolean;\n /** An optional showMediaCircle to display media within the circle. */\n showMediaCircle?: boolean;\n /** An optional isContainerAligned to display media aligned with the container. */\n isContainerAligned?: boolean;\n /** @deprecated ... */\n theme?: 'light' | 'dark';\n}\n\n/**\n * AccordionItem\n *\n * A single item in an accordion component.\n *\n * @component\n * @param {string} [aria-label] - A label for the accordion item, used for accessibility purposes.\n * @param {string} [id] - An ID for the accordion item, used for accessibility purposes.\n * @param {ReactNode} title - The title of the accordion item.\n * @param {ReactNode} subtitle - The subtitle of the accordion item.\n * @param {ReactNode} content - The content of the accordion item.\n * @param {Function} onClick - A callback function that is called when the accordion item is clicked.\n * @param {boolean} open - Whether the accordion item is currently open or closed.\n * @param {ReactNode} [icon] - An optional icon to display next to the accordion item title.\n * @param {ReactNode} [media] - An optional media to display next to the accordion item.\n * @param {boolean} [showMediaAtAllSizes] - An optional showMediaAtAllSizes with media available at all sizes of the screen.\n * @param {boolean} [showMediaCircle] - An optional showMediaCircle to display media within the circle.\n * @param {boolean} [isContainerAligned] - An optional isContainerAligned to display media aligned with the container.\n * @example\n * // Example usage:\n *\n * import AccordionItem from './AccordionItem';\n *\n * function App() {\n * const handleItemClick = () => {\n * console.log('Accordion item was clicked.');\n * };\n *\n * return (\n * <AccordionItem\n * title={<h2>Item Title</h2>}\n * content={<p>Item content goes here.</p>}\n * onClick={handleItemClick}\n * open={true}\n * icon={<Chevron />}\n * />\n * );\n * }\n */\nconst AccordionItem: FC<AccordionItemProps> = ({\n 'aria-label': ariaLabel,\n id,\n title,\n subtitle,\n content,\n onClick,\n open,\n icon,\n media,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n theme = 'light',\n}) => {\n const mediaElement = icon\n ? cloneElement(icon as React.ReactElement<IdIconProps>, { size: 24 })\n : media;\n const fallbackId = useId();\n const accordionId = id ?? fallbackId;\n\n return (\n <div\n id={accordionId}\n className={clsx('np-accordion-item', {\n 'np-accordion-item--open': open,\n 'np-accordion-item--with-icon': Boolean(icon),\n 'np-accordion-item--with-media': Boolean(media),\n })}\n >\n <Option\n aria-label={ariaLabel}\n as=\"button\"\n media={mediaElement}\n title={title}\n content={subtitle}\n button={<Chevron orientation={open ? Position.TOP : Position.BOTTOM} size={Size.MEDIUM} />}\n inverseMediaCircle={false}\n aria-expanded={open}\n aria-controls={`${accordionId}-section`}\n id={`${accordionId}-control`}\n showMediaCircle={showMediaCircle}\n showMediaAtAllSizes={showMediaAtAllSizes}\n isContainerAligned={isContainerAligned}\n onClick={onClick}\n />\n {open && (\n <div id={`${accordionId}-section`} role=\"region\" aria-labelledby={`${accordionId}-control`}>\n <Body\n as=\"span\"\n type={Typography.BODY_LARGE}\n className={clsx('np-accordion-item__content', 'd-block', {\n 'has-icon': icon,\n })}\n >\n {content}\n </Body>\n </div>\n )}\n </div>\n );\n};\n\nexport default AccordionItem;\n"],"names":["AccordionItem","ariaLabel","id","title","subtitle","content","onClick","open","icon","media","showMediaAtAllSizes","showMediaCircle","isContainerAligned","theme","mediaElement","cloneElement","size","fallbackId","useId","accordionId","_jsxs","className","clsx","Boolean","children","_jsx","Option","as","button","Chevron","orientation","Position","TOP","BOTTOM","Size","MEDIUM","inverseMediaCircle","role","Body","type","Typography","BODY_LARGE"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AccordionItem.js","sources":["../../../src/accordion/AccordionItem/AccordionItem.tsx"],"sourcesContent":["import { IdIconProps } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { FC, ReactNode, cloneElement, useId } from 'react';\n\nimport Body from '../../body';\nimport Chevron from '../../chevron';\nimport { Position, Size, Typography } from '../../common';\nimport Option from '../../common/Option';\n\nexport interface AccordionItemProps {\n /** A label for the accordion item, used for accessibility purposes. */\n 'aria-label'?: string;\n /** An ID for the accordion item, used for accessibility purposes. */\n id?: string;\n /** The title of the accordion item. */\n title: ReactNode;\n /** The subtitle of the accordion item. */\n subtitle?: ReactNode;\n /** The content of the accordion item. */\n content: ReactNode;\n /** A callback function that is called when the accordion item is clicked. */\n onClick: () => void;\n /** Whether the accordion item is currently open or closed. */\n open: boolean;\n /** An optional icon to display next to the accordion item title. */\n icon?: ReactNode;\n /** An optional media element to display next to the accordion item title. */\n media?: ReactNode;\n /** An optional showMediaAtAllSizes with media available at all sizes of the screen. */\n showMediaAtAllSizes?: boolean;\n /** An optional showMediaCircle to display media within the circle. */\n showMediaCircle?: boolean;\n /** An optional isContainerAligned to display media aligned with the container. */\n isContainerAligned?: boolean;\n /** @deprecated ... */\n theme?: 'light' | 'dark';\n}\n\n/**\n * AccordionItem\n *\n * A single item in an accordion component.\n *\n * @component\n * @param {string} [aria-label] - A label for the accordion item, used for accessibility purposes.\n * @param {string} [id] - An ID for the accordion item, used for accessibility purposes.\n * @param {ReactNode} title - The title of the accordion item.\n * @param {ReactNode} subtitle - The subtitle of the accordion item.\n * @param {ReactNode} content - The content of the accordion item.\n * @param {Function} onClick - A callback function that is called when the accordion item is clicked.\n * @param {boolean} open - Whether the accordion item is currently open or closed.\n * @param {ReactNode} [icon] - An optional icon to display next to the accordion item title.\n * @param {ReactNode} [media] - An optional media to display next to the accordion item.\n * @param {boolean} [showMediaAtAllSizes] - An optional showMediaAtAllSizes with media available at all sizes of the screen.\n * @param {boolean} [showMediaCircle] - An optional showMediaCircle to display media within the circle.\n * @param {boolean} [isContainerAligned] - An optional isContainerAligned to display media aligned with the container.\n * @example\n * // Example usage:\n *\n * import AccordionItem from './AccordionItem';\n *\n * function App() {\n * const handleItemClick = () => {\n * console.log('Accordion item was clicked.');\n * };\n *\n * return (\n * <AccordionItem\n * title={<h2>Item Title</h2>}\n * content={<p>Item content goes here.</p>}\n * onClick={handleItemClick}\n * open={true}\n * icon={<Chevron />}\n * />\n * );\n * }\n */\nconst AccordionItem: FC<AccordionItemProps> = ({\n 'aria-label': ariaLabel,\n id,\n title,\n subtitle,\n content,\n onClick,\n open,\n icon,\n media,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n theme = 'light',\n}) => {\n const mediaElement = icon\n ? cloneElement(icon as React.ReactElement<IdIconProps>, { size: 24 })\n : media;\n const fallbackId = useId();\n const accordionId = id ?? fallbackId;\n\n return (\n <div\n id={accordionId}\n className={clsx('np-accordion-item', {\n 'np-accordion-item--open': open,\n 'np-accordion-item--with-icon': Boolean(icon),\n 'np-accordion-item--with-media': Boolean(media),\n })}\n >\n <Option\n aria-label={ariaLabel}\n as=\"button\"\n media={mediaElement}\n title={title}\n content={subtitle}\n button={<Chevron orientation={open ? Position.TOP : Position.BOTTOM} size={Size.MEDIUM} />}\n inverseMediaCircle={false}\n aria-expanded={open}\n aria-controls={`${accordionId}-section`}\n id={`${accordionId}-control`}\n showMediaCircle={showMediaCircle}\n showMediaAtAllSizes={showMediaAtAllSizes}\n isContainerAligned={isContainerAligned}\n onClick={onClick}\n />\n {open && (\n <div id={`${accordionId}-section`} role=\"region\" aria-labelledby={`${accordionId}-control`}>\n <Body\n as=\"span\"\n type={Typography.BODY_LARGE}\n className={clsx('np-accordion-item__content', 'd-block', {\n 'has-icon': icon,\n })}\n >\n {content}\n </Body>\n </div>\n )}\n </div>\n );\n};\n\nexport default AccordionItem;\n"],"names":["AccordionItem","ariaLabel","id","title","subtitle","content","onClick","open","icon","media","showMediaAtAllSizes","showMediaCircle","isContainerAligned","theme","mediaElement","cloneElement","size","fallbackId","useId","accordionId","_jsxs","className","clsx","Boolean","children","_jsx","Option","as","button","Chevron","orientation","Position","TOP","BOTTOM","Size","MEDIUM","inverseMediaCircle","role","Body","type","Typography","BODY_LARGE"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,MAAMA,aAAa,GAA2BA,CAAC;AAC7C,EAAA,YAAY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,EAAE,EAAE,CAAA,EAAGiB,WAAW,CAAA,QAAA,CAAW;AAC7BR,MAAAA,eAAe,EAAEA,eAAgB;AACjCD,MAAAA,mBAAmB,EAAEA,mBAAoB;AACzCE,MAAAA,kBAAkB,EAAEA,kBAAmB;AACvCN,MAAAA,OAAO,EAAEA;AAAQ,KAAA,CAEnB,EAACC,IAAI,iBACHkB,cAAA,CAAA,KAAA,EAAA;MAAKvB,EAAE,EAAE,CAAA,EAAGiB,WAAW,CAAA,QAAA,CAAW;AAACkB,MAAAA,IAAI,EAAC,QAAQ;MAAC,iBAAA,EAAiB,CAAA,EAAGlB,WAAW,CAAA,QAAA,CAAW;MAAAK,QAAA,eACzFC,cAAA,CAACa,YAAI,EAAA;AACHX,QAAAA,EAAE,EAAC,MAAM;QACTY,IAAI,EAAEC,qBAAU,CAACC,UAAW;AAC5BpB,QAAAA,SAAS,EAAEC,SAAI,CAAC,4BAA4B,EAAE,SAAS,EAAE;AACvD,UAAA,UAAU,EAAEd;AACb,SAAA,CAAE;AAAAgB,QAAAA,QAAA,EAEFnB;OACG;AACR,KAAK,CACN;AAAA,GACE,CAAC;AAEV;;;;"}
|
|
@@ -21,6 +21,7 @@ import '../../common/propsValues/variant.mjs';
|
|
|
21
21
|
import '../../common/propsValues/scroll.mjs';
|
|
22
22
|
import '../../common/propsValues/markdownNodeType.mjs';
|
|
23
23
|
import '../../common/fileType.mjs';
|
|
24
|
+
import '@transferwise/formatting';
|
|
24
25
|
import '@transferwise/icons';
|
|
25
26
|
import 'react-intl';
|
|
26
27
|
import '../../common/closeButton/CloseButton.messages.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionItem.mjs","sources":["../../../src/accordion/AccordionItem/AccordionItem.tsx"],"sourcesContent":["import { IdIconProps } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { FC, ReactNode, cloneElement, useId } from 'react';\n\nimport Body from '../../body';\nimport Chevron from '../../chevron';\nimport { Position, Size, Typography } from '../../common';\nimport Option from '../../common/Option';\n\nexport interface AccordionItemProps {\n /** A label for the accordion item, used for accessibility purposes. */\n 'aria-label'?: string;\n /** An ID for the accordion item, used for accessibility purposes. */\n id?: string;\n /** The title of the accordion item. */\n title: ReactNode;\n /** The subtitle of the accordion item. */\n subtitle?: ReactNode;\n /** The content of the accordion item. */\n content: ReactNode;\n /** A callback function that is called when the accordion item is clicked. */\n onClick: () => void;\n /** Whether the accordion item is currently open or closed. */\n open: boolean;\n /** An optional icon to display next to the accordion item title. */\n icon?: ReactNode;\n /** An optional media element to display next to the accordion item title. */\n media?: ReactNode;\n /** An optional showMediaAtAllSizes with media available at all sizes of the screen. */\n showMediaAtAllSizes?: boolean;\n /** An optional showMediaCircle to display media within the circle. */\n showMediaCircle?: boolean;\n /** An optional isContainerAligned to display media aligned with the container. */\n isContainerAligned?: boolean;\n /** @deprecated ... */\n theme?: 'light' | 'dark';\n}\n\n/**\n * AccordionItem\n *\n * A single item in an accordion component.\n *\n * @component\n * @param {string} [aria-label] - A label for the accordion item, used for accessibility purposes.\n * @param {string} [id] - An ID for the accordion item, used for accessibility purposes.\n * @param {ReactNode} title - The title of the accordion item.\n * @param {ReactNode} subtitle - The subtitle of the accordion item.\n * @param {ReactNode} content - The content of the accordion item.\n * @param {Function} onClick - A callback function that is called when the accordion item is clicked.\n * @param {boolean} open - Whether the accordion item is currently open or closed.\n * @param {ReactNode} [icon] - An optional icon to display next to the accordion item title.\n * @param {ReactNode} [media] - An optional media to display next to the accordion item.\n * @param {boolean} [showMediaAtAllSizes] - An optional showMediaAtAllSizes with media available at all sizes of the screen.\n * @param {boolean} [showMediaCircle] - An optional showMediaCircle to display media within the circle.\n * @param {boolean} [isContainerAligned] - An optional isContainerAligned to display media aligned with the container.\n * @example\n * // Example usage:\n *\n * import AccordionItem from './AccordionItem';\n *\n * function App() {\n * const handleItemClick = () => {\n * console.log('Accordion item was clicked.');\n * };\n *\n * return (\n * <AccordionItem\n * title={<h2>Item Title</h2>}\n * content={<p>Item content goes here.</p>}\n * onClick={handleItemClick}\n * open={true}\n * icon={<Chevron />}\n * />\n * );\n * }\n */\nconst AccordionItem: FC<AccordionItemProps> = ({\n 'aria-label': ariaLabel,\n id,\n title,\n subtitle,\n content,\n onClick,\n open,\n icon,\n media,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n theme = 'light',\n}) => {\n const mediaElement = icon\n ? cloneElement(icon as React.ReactElement<IdIconProps>, { size: 24 })\n : media;\n const fallbackId = useId();\n const accordionId = id ?? fallbackId;\n\n return (\n <div\n id={accordionId}\n className={clsx('np-accordion-item', {\n 'np-accordion-item--open': open,\n 'np-accordion-item--with-icon': Boolean(icon),\n 'np-accordion-item--with-media': Boolean(media),\n })}\n >\n <Option\n aria-label={ariaLabel}\n as=\"button\"\n media={mediaElement}\n title={title}\n content={subtitle}\n button={<Chevron orientation={open ? Position.TOP : Position.BOTTOM} size={Size.MEDIUM} />}\n inverseMediaCircle={false}\n aria-expanded={open}\n aria-controls={`${accordionId}-section`}\n id={`${accordionId}-control`}\n showMediaCircle={showMediaCircle}\n showMediaAtAllSizes={showMediaAtAllSizes}\n isContainerAligned={isContainerAligned}\n onClick={onClick}\n />\n {open && (\n <div id={`${accordionId}-section`} role=\"region\" aria-labelledby={`${accordionId}-control`}>\n <Body\n as=\"span\"\n type={Typography.BODY_LARGE}\n className={clsx('np-accordion-item__content', 'd-block', {\n 'has-icon': icon,\n })}\n >\n {content}\n </Body>\n </div>\n )}\n </div>\n );\n};\n\nexport default AccordionItem;\n"],"names":["AccordionItem","ariaLabel","id","title","subtitle","content","onClick","open","icon","media","showMediaAtAllSizes","showMediaCircle","isContainerAligned","theme","mediaElement","cloneElement","size","fallbackId","useId","accordionId","_jsxs","className","clsx","Boolean","children","_jsx","Option","as","button","Chevron","orientation","Position","TOP","BOTTOM","Size","MEDIUM","inverseMediaCircle","role","Body","type","Typography","BODY_LARGE"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AccordionItem.mjs","sources":["../../../src/accordion/AccordionItem/AccordionItem.tsx"],"sourcesContent":["import { IdIconProps } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { FC, ReactNode, cloneElement, useId } from 'react';\n\nimport Body from '../../body';\nimport Chevron from '../../chevron';\nimport { Position, Size, Typography } from '../../common';\nimport Option from '../../common/Option';\n\nexport interface AccordionItemProps {\n /** A label for the accordion item, used for accessibility purposes. */\n 'aria-label'?: string;\n /** An ID for the accordion item, used for accessibility purposes. */\n id?: string;\n /** The title of the accordion item. */\n title: ReactNode;\n /** The subtitle of the accordion item. */\n subtitle?: ReactNode;\n /** The content of the accordion item. */\n content: ReactNode;\n /** A callback function that is called when the accordion item is clicked. */\n onClick: () => void;\n /** Whether the accordion item is currently open or closed. */\n open: boolean;\n /** An optional icon to display next to the accordion item title. */\n icon?: ReactNode;\n /** An optional media element to display next to the accordion item title. */\n media?: ReactNode;\n /** An optional showMediaAtAllSizes with media available at all sizes of the screen. */\n showMediaAtAllSizes?: boolean;\n /** An optional showMediaCircle to display media within the circle. */\n showMediaCircle?: boolean;\n /** An optional isContainerAligned to display media aligned with the container. */\n isContainerAligned?: boolean;\n /** @deprecated ... */\n theme?: 'light' | 'dark';\n}\n\n/**\n * AccordionItem\n *\n * A single item in an accordion component.\n *\n * @component\n * @param {string} [aria-label] - A label for the accordion item, used for accessibility purposes.\n * @param {string} [id] - An ID for the accordion item, used for accessibility purposes.\n * @param {ReactNode} title - The title of the accordion item.\n * @param {ReactNode} subtitle - The subtitle of the accordion item.\n * @param {ReactNode} content - The content of the accordion item.\n * @param {Function} onClick - A callback function that is called when the accordion item is clicked.\n * @param {boolean} open - Whether the accordion item is currently open or closed.\n * @param {ReactNode} [icon] - An optional icon to display next to the accordion item title.\n * @param {ReactNode} [media] - An optional media to display next to the accordion item.\n * @param {boolean} [showMediaAtAllSizes] - An optional showMediaAtAllSizes with media available at all sizes of the screen.\n * @param {boolean} [showMediaCircle] - An optional showMediaCircle to display media within the circle.\n * @param {boolean} [isContainerAligned] - An optional isContainerAligned to display media aligned with the container.\n * @example\n * // Example usage:\n *\n * import AccordionItem from './AccordionItem';\n *\n * function App() {\n * const handleItemClick = () => {\n * console.log('Accordion item was clicked.');\n * };\n *\n * return (\n * <AccordionItem\n * title={<h2>Item Title</h2>}\n * content={<p>Item content goes here.</p>}\n * onClick={handleItemClick}\n * open={true}\n * icon={<Chevron />}\n * />\n * );\n * }\n */\nconst AccordionItem: FC<AccordionItemProps> = ({\n 'aria-label': ariaLabel,\n id,\n title,\n subtitle,\n content,\n onClick,\n open,\n icon,\n media,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n theme = 'light',\n}) => {\n const mediaElement = icon\n ? cloneElement(icon as React.ReactElement<IdIconProps>, { size: 24 })\n : media;\n const fallbackId = useId();\n const accordionId = id ?? fallbackId;\n\n return (\n <div\n id={accordionId}\n className={clsx('np-accordion-item', {\n 'np-accordion-item--open': open,\n 'np-accordion-item--with-icon': Boolean(icon),\n 'np-accordion-item--with-media': Boolean(media),\n })}\n >\n <Option\n aria-label={ariaLabel}\n as=\"button\"\n media={mediaElement}\n title={title}\n content={subtitle}\n button={<Chevron orientation={open ? Position.TOP : Position.BOTTOM} size={Size.MEDIUM} />}\n inverseMediaCircle={false}\n aria-expanded={open}\n aria-controls={`${accordionId}-section`}\n id={`${accordionId}-control`}\n showMediaCircle={showMediaCircle}\n showMediaAtAllSizes={showMediaAtAllSizes}\n isContainerAligned={isContainerAligned}\n onClick={onClick}\n />\n {open && (\n <div id={`${accordionId}-section`} role=\"region\" aria-labelledby={`${accordionId}-control`}>\n <Body\n as=\"span\"\n type={Typography.BODY_LARGE}\n className={clsx('np-accordion-item__content', 'd-block', {\n 'has-icon': icon,\n })}\n >\n {content}\n </Body>\n </div>\n )}\n </div>\n );\n};\n\nexport default AccordionItem;\n"],"names":["AccordionItem","ariaLabel","id","title","subtitle","content","onClick","open","icon","media","showMediaAtAllSizes","showMediaCircle","isContainerAligned","theme","mediaElement","cloneElement","size","fallbackId","useId","accordionId","_jsxs","className","clsx","Boolean","children","_jsx","Option","as","button","Chevron","orientation","Position","TOP","BOTTOM","Size","MEDIUM","inverseMediaCircle","role","Body","type","Typography","BODY_LARGE"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,MAAMA,aAAa,GAA2BA,CAAC;AAC7C,EAAA,YAAY,EAAEC,SAAS;EACvBC,EAAE;EACFC,KAAK;EACLC,QAAQ;EACRC,OAAO;EACPC,OAAO;EACPC,IAAI;EACJC,IAAI;EACJC,KAAK;EACLC,mBAAmB;EACnBC,eAAe;EACfC,kBAAkB;AAClBC,EAAAA,KAAK,GAAG;AAAO,CAChB,KAAI;AACH,EAAA,MAAMC,YAAY,GAAGN,IAAI,gBACrBO,YAAY,CAACP,IAAuC,EAAE;AAAEQ,IAAAA,IAAI,EAAE;GAAI,CAAC,GACnEP,KAAK;AACT,EAAA,MAAMQ,UAAU,GAAGC,KAAK,EAAE;AAC1B,EAAA,MAAMC,WAAW,GAAGjB,EAAE,IAAIe,UAAU;AAEpC,EAAA,oBACEG,IAAA,CAAA,KAAA,EAAA;AACElB,IAAAA,EAAE,EAAEiB,WAAY;AAChBE,IAAAA,SAAS,EAAEC,IAAI,CAAC,mBAAmB,EAAE;AACnC,MAAA,yBAAyB,EAAEf,IAAI;AAC/B,MAAA,8BAA8B,EAAEgB,OAAO,CAACf,IAAI,CAAC;MAC7C,+BAA+B,EAAEe,OAAO,CAACd,KAAK;AAC/C,KAAA,CAAE;IAAAe,QAAA,EAAA,cAEHC,GAAA,CAACC,MAAM,EAAA;AACL,MAAA,YAAA,EAAYzB,SAAU;AACtB0B,MAAAA,EAAE,EAAC,QAAQ;AACXlB,MAAAA,KAAK,EAAEK,YAAa;AACpBX,MAAAA,KAAK,EAAEA,KAAM;AACbE,MAAAA,OAAO,EAAED,QAAS;MAClBwB,MAAM,eAAEH,GAAA,CAACI,OAAO,EAAA;QAACC,WAAW,EAAEvB,IAAI,GAAGwB,QAAQ,CAACC,GAAG,GAAGD,QAAQ,CAACE,MAAO;QAACjB,IAAI,EAAEkB,IAAI,CAACC;AAAO,OAAA,CAAI;AAC3FC,MAAAA,kBAAkB,EAAE,KAAM;AAC1B,MAAA,eAAA,EAAe7B,IAAK;MACpB,eAAA,EAAe,CAAA,EAAGY,WAAW,CAAA,QAAA,CAAW;MACxCjB,EAAE,EAAE,CAAA,EAAGiB,WAAW,CAAA,QAAA,CAAW;AAC7BR,MAAAA,eAAe,EAAEA,eAAgB;AACjCD,MAAAA,mBAAmB,EAAEA,mBAAoB;AACzCE,MAAAA,kBAAkB,EAAEA,kBAAmB;AACvCN,MAAAA,OAAO,EAAEA;AAAQ,KAAA,CAEnB,EAACC,IAAI,iBACHkB,GAAA,CAAA,KAAA,EAAA;MAAKvB,EAAE,EAAE,CAAA,EAAGiB,WAAW,CAAA,QAAA,CAAW;AAACkB,MAAAA,IAAI,EAAC,QAAQ;MAAC,iBAAA,EAAiB,CAAA,EAAGlB,WAAW,CAAA,QAAA,CAAW;MAAAK,QAAA,eACzFC,GAAA,CAACa,IAAI,EAAA;AACHX,QAAAA,EAAE,EAAC,MAAM;QACTY,IAAI,EAAEC,UAAU,CAACC,UAAW;AAC5BpB,QAAAA,SAAS,EAAEC,IAAI,CAAC,4BAA4B,EAAE,SAAS,EAAE;AACvD,UAAA,UAAU,EAAEd;AACb,SAAA,CAAE;AAAAgB,QAAAA,QAAA,EAEFnB;OACG;AACR,KAAK,CACN;AAAA,GACE,CAAC;AAEV;;;;"}
|
|
@@ -23,6 +23,7 @@ require('../common/propsValues/variant.js');
|
|
|
23
23
|
require('../common/propsValues/scroll.js');
|
|
24
24
|
require('../common/propsValues/markdownNodeType.js');
|
|
25
25
|
require('../common/fileType.js');
|
|
26
|
+
require('@transferwise/formatting');
|
|
26
27
|
require('@transferwise/icons');
|
|
27
28
|
require('react-intl');
|
|
28
29
|
require('../common/closeButton/CloseButton.messages.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton.js","sources":["../../src/actionButton/ActionButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ButtonHTMLAttributes, forwardRef } from 'react';\n\nimport { Priority, PriorityPrimary, PrioritySecondary, PriorityTertiary } from '../common';\n\n/**\n * @deprecated Use `<Button />` component instead with `ButtonProps`.\n */\nexport type ActionButtonProps = {\n /** @default Priority.PRIMARY */\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary;\n /**\n * @deprecated Use `children` instead.\n */\n text?: string;\n} & ButtonHTMLAttributes<HTMLButtonElement>;\n\n/**\n * @deprecated Use `<Button v2 size=\"sm\" priority={'primary' / 'secondary-neutral' / 'tertiary'} .. />` component instead.\n */\nconst ActionButton = forwardRef<HTMLButtonElement, ActionButtonProps>(\n (\n {\n disabled = false,\n className = undefined,\n onClick,\n priority = Priority.PRIMARY,\n text,\n children,\n ...rest\n }: ActionButtonProps,\n reference,\n ) => (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-action-btn',\n 'np-text-body-default-bold',\n priority === Priority.TERTIARY\n ? 'btn-priority-3'\n : priority === Priority.SECONDARY\n ? 'btn-priority-2'\n : 'btn-priority-1',\n className,\n )}\n disabled={disabled}\n onClick={onClick}\n {...rest}\n >\n {children || text}\n </button>\n ),\n);\n\nexport default ActionButton;\n"],"names":["ActionButton","forwardRef","disabled","className","undefined","onClick","priority","Priority","PRIMARY","text","children","rest","reference","_jsx","ref","type","clsx","TERTIARY","SECONDARY"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionButton.js","sources":["../../src/actionButton/ActionButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ButtonHTMLAttributes, forwardRef } from 'react';\n\nimport { Priority, PriorityPrimary, PrioritySecondary, PriorityTertiary } from '../common';\n\n/**\n * @deprecated Use `<Button />` component instead with `ButtonProps`.\n */\nexport type ActionButtonProps = {\n /** @default Priority.PRIMARY */\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary;\n /**\n * @deprecated Use `children` instead.\n */\n text?: string;\n} & ButtonHTMLAttributes<HTMLButtonElement>;\n\n/**\n * @deprecated Use `<Button v2 size=\"sm\" priority={'primary' / 'secondary-neutral' / 'tertiary'} .. />` component instead.\n */\nconst ActionButton = forwardRef<HTMLButtonElement, ActionButtonProps>(\n (\n {\n disabled = false,\n className = undefined,\n onClick,\n priority = Priority.PRIMARY,\n text,\n children,\n ...rest\n }: ActionButtonProps,\n reference,\n ) => (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-action-btn',\n 'np-text-body-default-bold',\n priority === Priority.TERTIARY\n ? 'btn-priority-3'\n : priority === Priority.SECONDARY\n ? 'btn-priority-2'\n : 'btn-priority-1',\n className,\n )}\n disabled={disabled}\n onClick={onClick}\n {...rest}\n >\n {children || text}\n </button>\n ),\n);\n\nexport default ActionButton;\n"],"names":["ActionButton","forwardRef","disabled","className","undefined","onClick","priority","Priority","PRIMARY","text","children","rest","reference","_jsx","ref","type","clsx","TERTIARY","SECONDARY"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAMA,YAAY,gBAAGC,gBAAU,CAC7B,CACE;AACEC,EAAAA,QAAQ,GAAG,KAAK;AAChBC,EAAAA,SAAS,GAAGC,SAAS;EACrBC,OAAO;EACPC,QAAQ,GAAGC,gBAAQ,CAACC,OAAO;EAC3BC,IAAI;EACJC,QAAQ;EACR,GAAGC;AAAI,CACW,EACpBC,SAAS,kBAETC,cAAA,CAAA,QAAA,EAAA;AACEC,EAAAA,GAAG,EAAEF,SAAU;AACfG,EAAAA,IAAI,EAAC,QAAQ;EACbZ,SAAS,EAAEa,SAAI,CACb,eAAe,EACf,2BAA2B,EAC3BV,QAAQ,KAAKC,gBAAQ,CAACU,QAAQ,GAC1B,gBAAgB,GAChBX,QAAQ,KAAKC,gBAAQ,CAACW,SAAS,GAC7B,gBAAgB,GAChB,gBAAgB,EACtBf,SAAS,CACT;AACFD,EAAAA,QAAQ,EAAEA,QAAS;AACnBG,EAAAA,OAAO,EAAEA,OAAQ;AAAA,EAAA,GACbM,IAAI;EAAAD,QAAA,EAEPA,QAAQ,IAAID;AAAI,CACX,CACT;;;;"}
|
|
@@ -19,6 +19,7 @@ import '../common/propsValues/variant.mjs';
|
|
|
19
19
|
import '../common/propsValues/scroll.mjs';
|
|
20
20
|
import '../common/propsValues/markdownNodeType.mjs';
|
|
21
21
|
import '../common/fileType.mjs';
|
|
22
|
+
import '@transferwise/formatting';
|
|
22
23
|
import '@transferwise/icons';
|
|
23
24
|
import 'react-intl';
|
|
24
25
|
import '../common/closeButton/CloseButton.messages.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton.mjs","sources":["../../src/actionButton/ActionButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ButtonHTMLAttributes, forwardRef } from 'react';\n\nimport { Priority, PriorityPrimary, PrioritySecondary, PriorityTertiary } from '../common';\n\n/**\n * @deprecated Use `<Button />` component instead with `ButtonProps`.\n */\nexport type ActionButtonProps = {\n /** @default Priority.PRIMARY */\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary;\n /**\n * @deprecated Use `children` instead.\n */\n text?: string;\n} & ButtonHTMLAttributes<HTMLButtonElement>;\n\n/**\n * @deprecated Use `<Button v2 size=\"sm\" priority={'primary' / 'secondary-neutral' / 'tertiary'} .. />` component instead.\n */\nconst ActionButton = forwardRef<HTMLButtonElement, ActionButtonProps>(\n (\n {\n disabled = false,\n className = undefined,\n onClick,\n priority = Priority.PRIMARY,\n text,\n children,\n ...rest\n }: ActionButtonProps,\n reference,\n ) => (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-action-btn',\n 'np-text-body-default-bold',\n priority === Priority.TERTIARY\n ? 'btn-priority-3'\n : priority === Priority.SECONDARY\n ? 'btn-priority-2'\n : 'btn-priority-1',\n className,\n )}\n disabled={disabled}\n onClick={onClick}\n {...rest}\n >\n {children || text}\n </button>\n ),\n);\n\nexport default ActionButton;\n"],"names":["ActionButton","forwardRef","disabled","className","undefined","onClick","priority","Priority","PRIMARY","text","children","rest","reference","_jsx","ref","type","clsx","TERTIARY","SECONDARY"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionButton.mjs","sources":["../../src/actionButton/ActionButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ButtonHTMLAttributes, forwardRef } from 'react';\n\nimport { Priority, PriorityPrimary, PrioritySecondary, PriorityTertiary } from '../common';\n\n/**\n * @deprecated Use `<Button />` component instead with `ButtonProps`.\n */\nexport type ActionButtonProps = {\n /** @default Priority.PRIMARY */\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary;\n /**\n * @deprecated Use `children` instead.\n */\n text?: string;\n} & ButtonHTMLAttributes<HTMLButtonElement>;\n\n/**\n * @deprecated Use `<Button v2 size=\"sm\" priority={'primary' / 'secondary-neutral' / 'tertiary'} .. />` component instead.\n */\nconst ActionButton = forwardRef<HTMLButtonElement, ActionButtonProps>(\n (\n {\n disabled = false,\n className = undefined,\n onClick,\n priority = Priority.PRIMARY,\n text,\n children,\n ...rest\n }: ActionButtonProps,\n reference,\n ) => (\n <button\n ref={reference}\n type=\"button\"\n className={clsx(\n 'np-action-btn',\n 'np-text-body-default-bold',\n priority === Priority.TERTIARY\n ? 'btn-priority-3'\n : priority === Priority.SECONDARY\n ? 'btn-priority-2'\n : 'btn-priority-1',\n className,\n )}\n disabled={disabled}\n onClick={onClick}\n {...rest}\n >\n {children || text}\n </button>\n ),\n);\n\nexport default ActionButton;\n"],"names":["ActionButton","forwardRef","disabled","className","undefined","onClick","priority","Priority","PRIMARY","text","children","rest","reference","_jsx","ref","type","clsx","TERTIARY","SECONDARY"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAMA,YAAY,gBAAGC,UAAU,CAC7B,CACE;AACEC,EAAAA,QAAQ,GAAG,KAAK;AAChBC,EAAAA,SAAS,GAAGC,SAAS;EACrBC,OAAO;EACPC,QAAQ,GAAGC,QAAQ,CAACC,OAAO;EAC3BC,IAAI;EACJC,QAAQ;EACR,GAAGC;AAAI,CACW,EACpBC,SAAS,kBAETC,GAAA,CAAA,QAAA,EAAA;AACEC,EAAAA,GAAG,EAAEF,SAAU;AACfG,EAAAA,IAAI,EAAC,QAAQ;EACbZ,SAAS,EAAEa,IAAI,CACb,eAAe,EACf,2BAA2B,EAC3BV,QAAQ,KAAKC,QAAQ,CAACU,QAAQ,GAC1B,gBAAgB,GAChBX,QAAQ,KAAKC,QAAQ,CAACW,SAAS,GAC7B,gBAAgB,GAChB,gBAAgB,EACtBf,SAAS,CACT;AACFD,EAAAA,QAAQ,EAAEA,QAAS;AACnBG,EAAAA,OAAO,EAAEA,OAAQ;AAAA,EAAA,GACbM,IAAI;EAAAD,QAAA,EAEPA,QAAQ,IAAID;AAAI,CACX,CACT;;;;"}
|
|
@@ -23,6 +23,7 @@ require('../common/propsValues/variant.js');
|
|
|
23
23
|
require('../common/propsValues/scroll.js');
|
|
24
24
|
require('../common/propsValues/markdownNodeType.js');
|
|
25
25
|
require('../common/fileType.js');
|
|
26
|
+
require('@transferwise/formatting');
|
|
26
27
|
require('@transferwise/icons');
|
|
27
28
|
require('react');
|
|
28
29
|
require('react-intl');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionOption.js","sources":["../../src/actionOption/ActionOption.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport Button from '../button';\nimport {\n AriaLabelProperty,\n CommonProps,\n Priority,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n} from '../common';\nimport Option from '../common/Option';\nimport { ButtonPriority } from '../button/Button.types';\n\ntype ActionOptionPriority =\n | PriorityPrimary\n | PrioritySecondary\n | PriorityTertiary\n | 'secondary-send';\n\nexport type ActionOptionProps = {\n complex?: boolean;\n content?: React.ReactNode;\n disabled?: boolean;\n media?: React.ReactNode;\n showMediaAtAllSizes?: boolean;\n onClick: () => void;\n title: React.ReactNode;\n additionalContent?: React.ReactNode;\n action: React.ReactNode;\n priority?: ActionOptionPriority;\n showMediaCircle?: boolean;\n isContainerAligned?: boolean;\n as?: React.ElementType;\n} & CommonProps &\n AriaLabelProperty;\n\n/**\n * @deprecated Use `<ListItem />` instead (run codemod to migrate: **`npx @wise/wds-codemods@latest list-item`**).\n * @deprecatedSince 46.104.0\n * @see [Source](../listItem/ListItem.tsx)\n * @see [Storybook](https://storybook.wise.design/?path=/docs/content-listitem--docs)\n * @see [Design docs](https://wise.design/components/list-item)\n * @see [Release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes)\n */\nconst ActionOption = ({\n action,\n priority = Priority.PRIMARY,\n disabled,\n onClick,\n media,\n title,\n content,\n additionalContent,\n complex,\n className,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n as,\n 'aria-label': ariaLabel,\n}: ActionOptionProps) => {\n const sharedProps = {\n media,\n title,\n content,\n complex,\n disabled,\n showMediaAtAllSizes,\n showMediaCircle,\n className: clsx('tw-action-option', className),\n isContainerAligned,\n additionalContent,\n as,\n };\n\n const getAriaLabel = (): string | undefined => {\n if (ariaLabel) {\n return ariaLabel;\n }\n\n const generatedLabels: string[] = [];\n\n if (typeof title === 'string') {\n generatedLabels.push(title);\n }\n\n if (typeof action === 'string') {\n generatedLabels.push(action);\n }\n\n return generatedLabels.join(', ') || undefined;\n };\n\n const mapPriority = (priority: ActionOptionPriority): ButtonPriority => {\n switch (priority) {\n case 'primary':\n return 'primary';\n case 'secondary':\n return 'secondary-neutral';\n case 'tertiary':\n return 'tertiary';\n case 'secondary-send':\n return 'secondary';\n default:\n return 'primary';\n }\n };\n\n return (\n <Option\n {...sharedProps}\n button={\n <Button\n v2\n size=\"sm\"\n priority={mapPriority(priority)}\n disabled={disabled}\n aria-label={getAriaLabel()}\n onClick={onClick}\n >\n {action}\n </Button>\n }\n />\n );\n};\n\nexport default ActionOption;\n"],"names":["ActionOption","action","priority","Priority","PRIMARY","disabled","onClick","media","title","content","additionalContent","complex","className","showMediaAtAllSizes","showMediaCircle","isContainerAligned","as","ariaLabel","sharedProps","clsx","getAriaLabel","generatedLabels","push","join","undefined","mapPriority","_jsx","Option","button","Button","v2","size","children"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionOption.js","sources":["../../src/actionOption/ActionOption.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport Button from '../button';\nimport {\n AriaLabelProperty,\n CommonProps,\n Priority,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n} from '../common';\nimport Option from '../common/Option';\nimport { ButtonPriority } from '../button/Button.types';\n\ntype ActionOptionPriority =\n | PriorityPrimary\n | PrioritySecondary\n | PriorityTertiary\n | 'secondary-send';\n\nexport type ActionOptionProps = {\n complex?: boolean;\n content?: React.ReactNode;\n disabled?: boolean;\n media?: React.ReactNode;\n showMediaAtAllSizes?: boolean;\n onClick: () => void;\n title: React.ReactNode;\n additionalContent?: React.ReactNode;\n action: React.ReactNode;\n priority?: ActionOptionPriority;\n showMediaCircle?: boolean;\n isContainerAligned?: boolean;\n as?: React.ElementType;\n} & CommonProps &\n AriaLabelProperty;\n\n/**\n * @deprecated Use `<ListItem />` instead (run codemod to migrate: **`npx @wise/wds-codemods@latest list-item`**).\n * @deprecatedSince 46.104.0\n * @see [Source](../listItem/ListItem.tsx)\n * @see [Storybook](https://storybook.wise.design/?path=/docs/content-listitem--docs)\n * @see [Design docs](https://wise.design/components/list-item)\n * @see [Release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes)\n */\nconst ActionOption = ({\n action,\n priority = Priority.PRIMARY,\n disabled,\n onClick,\n media,\n title,\n content,\n additionalContent,\n complex,\n className,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n as,\n 'aria-label': ariaLabel,\n}: ActionOptionProps) => {\n const sharedProps = {\n media,\n title,\n content,\n complex,\n disabled,\n showMediaAtAllSizes,\n showMediaCircle,\n className: clsx('tw-action-option', className),\n isContainerAligned,\n additionalContent,\n as,\n };\n\n const getAriaLabel = (): string | undefined => {\n if (ariaLabel) {\n return ariaLabel;\n }\n\n const generatedLabels: string[] = [];\n\n if (typeof title === 'string') {\n generatedLabels.push(title);\n }\n\n if (typeof action === 'string') {\n generatedLabels.push(action);\n }\n\n return generatedLabels.join(', ') || undefined;\n };\n\n const mapPriority = (priority: ActionOptionPriority): ButtonPriority => {\n switch (priority) {\n case 'primary':\n return 'primary';\n case 'secondary':\n return 'secondary-neutral';\n case 'tertiary':\n return 'tertiary';\n case 'secondary-send':\n return 'secondary';\n default:\n return 'primary';\n }\n };\n\n return (\n <Option\n {...sharedProps}\n button={\n <Button\n v2\n size=\"sm\"\n priority={mapPriority(priority)}\n disabled={disabled}\n aria-label={getAriaLabel()}\n onClick={onClick}\n >\n {action}\n </Button>\n }\n />\n );\n};\n\nexport default ActionOption;\n"],"names":["ActionOption","action","priority","Priority","PRIMARY","disabled","onClick","media","title","content","additionalContent","complex","className","showMediaAtAllSizes","showMediaCircle","isContainerAligned","as","ariaLabel","sharedProps","clsx","getAriaLabel","generatedLabels","push","join","undefined","mapPriority","_jsx","Option","button","Button","v2","size","children"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAMA,YAAY,GAAGA,CAAC;EACpBC,MAAM;EACNC,QAAQ,GAAGC,gBAAQ,CAACC,OAAO;EAC3BC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC,KAAK;EACLC,OAAO;EACPC,iBAAiB;EACjBC,OAAO;EACPC,SAAS;EACTC,mBAAmB;EACnBC,eAAe;EACfC,kBAAkB;EAClBC,EAAE;AACF,EAAA,YAAY,EAAEC;AAAS,CACL,KAAI;AACtB,EAAA,MAAMC,WAAW,GAAG;IAClBX,KAAK;IACLC,KAAK;IACLC,OAAO;IACPE,OAAO;IACPN,QAAQ;IACRQ,mBAAmB;IACnBC,eAAe;AACfF,IAAAA,SAAS,EAAEO,SAAI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"}
|
|
@@ -19,6 +19,7 @@ import '../common/propsValues/variant.mjs';
|
|
|
19
19
|
import '../common/propsValues/scroll.mjs';
|
|
20
20
|
import '../common/propsValues/markdownNodeType.mjs';
|
|
21
21
|
import '../common/fileType.mjs';
|
|
22
|
+
import '@transferwise/formatting';
|
|
22
23
|
import '@transferwise/icons';
|
|
23
24
|
import 'react';
|
|
24
25
|
import 'react-intl';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionOption.mjs","sources":["../../src/actionOption/ActionOption.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport Button from '../button';\nimport {\n AriaLabelProperty,\n CommonProps,\n Priority,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n} from '../common';\nimport Option from '../common/Option';\nimport { ButtonPriority } from '../button/Button.types';\n\ntype ActionOptionPriority =\n | PriorityPrimary\n | PrioritySecondary\n | PriorityTertiary\n | 'secondary-send';\n\nexport type ActionOptionProps = {\n complex?: boolean;\n content?: React.ReactNode;\n disabled?: boolean;\n media?: React.ReactNode;\n showMediaAtAllSizes?: boolean;\n onClick: () => void;\n title: React.ReactNode;\n additionalContent?: React.ReactNode;\n action: React.ReactNode;\n priority?: ActionOptionPriority;\n showMediaCircle?: boolean;\n isContainerAligned?: boolean;\n as?: React.ElementType;\n} & CommonProps &\n AriaLabelProperty;\n\n/**\n * @deprecated Use `<ListItem />` instead (run codemod to migrate: **`npx @wise/wds-codemods@latest list-item`**).\n * @deprecatedSince 46.104.0\n * @see [Source](../listItem/ListItem.tsx)\n * @see [Storybook](https://storybook.wise.design/?path=/docs/content-listitem--docs)\n * @see [Design docs](https://wise.design/components/list-item)\n * @see [Release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes)\n */\nconst ActionOption = ({\n action,\n priority = Priority.PRIMARY,\n disabled,\n onClick,\n media,\n title,\n content,\n additionalContent,\n complex,\n className,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n as,\n 'aria-label': ariaLabel,\n}: ActionOptionProps) => {\n const sharedProps = {\n media,\n title,\n content,\n complex,\n disabled,\n showMediaAtAllSizes,\n showMediaCircle,\n className: clsx('tw-action-option', className),\n isContainerAligned,\n additionalContent,\n as,\n };\n\n const getAriaLabel = (): string | undefined => {\n if (ariaLabel) {\n return ariaLabel;\n }\n\n const generatedLabels: string[] = [];\n\n if (typeof title === 'string') {\n generatedLabels.push(title);\n }\n\n if (typeof action === 'string') {\n generatedLabels.push(action);\n }\n\n return generatedLabels.join(', ') || undefined;\n };\n\n const mapPriority = (priority: ActionOptionPriority): ButtonPriority => {\n switch (priority) {\n case 'primary':\n return 'primary';\n case 'secondary':\n return 'secondary-neutral';\n case 'tertiary':\n return 'tertiary';\n case 'secondary-send':\n return 'secondary';\n default:\n return 'primary';\n }\n };\n\n return (\n <Option\n {...sharedProps}\n button={\n <Button\n v2\n size=\"sm\"\n priority={mapPriority(priority)}\n disabled={disabled}\n aria-label={getAriaLabel()}\n onClick={onClick}\n >\n {action}\n </Button>\n }\n />\n );\n};\n\nexport default ActionOption;\n"],"names":["ActionOption","action","priority","Priority","PRIMARY","disabled","onClick","media","title","content","additionalContent","complex","className","showMediaAtAllSizes","showMediaCircle","isContainerAligned","as","ariaLabel","sharedProps","clsx","getAriaLabel","generatedLabels","push","join","undefined","mapPriority","_jsx","Option","button","Button","v2","size","children"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionOption.mjs","sources":["../../src/actionOption/ActionOption.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport Button from '../button';\nimport {\n AriaLabelProperty,\n CommonProps,\n Priority,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n} from '../common';\nimport Option from '../common/Option';\nimport { ButtonPriority } from '../button/Button.types';\n\ntype ActionOptionPriority =\n | PriorityPrimary\n | PrioritySecondary\n | PriorityTertiary\n | 'secondary-send';\n\nexport type ActionOptionProps = {\n complex?: boolean;\n content?: React.ReactNode;\n disabled?: boolean;\n media?: React.ReactNode;\n showMediaAtAllSizes?: boolean;\n onClick: () => void;\n title: React.ReactNode;\n additionalContent?: React.ReactNode;\n action: React.ReactNode;\n priority?: ActionOptionPriority;\n showMediaCircle?: boolean;\n isContainerAligned?: boolean;\n as?: React.ElementType;\n} & CommonProps &\n AriaLabelProperty;\n\n/**\n * @deprecated Use `<ListItem />` instead (run codemod to migrate: **`npx @wise/wds-codemods@latest list-item`**).\n * @deprecatedSince 46.104.0\n * @see [Source](../listItem/ListItem.tsx)\n * @see [Storybook](https://storybook.wise.design/?path=/docs/content-listitem--docs)\n * @see [Design docs](https://wise.design/components/list-item)\n * @see [Release notes](https://transferwise.atlassian.net/wiki/spaces/DS/pages/3647251055/List+Item+release+notes)\n */\nconst ActionOption = ({\n action,\n priority = Priority.PRIMARY,\n disabled,\n onClick,\n media,\n title,\n content,\n additionalContent,\n complex,\n className,\n showMediaAtAllSizes,\n showMediaCircle,\n isContainerAligned,\n as,\n 'aria-label': ariaLabel,\n}: ActionOptionProps) => {\n const sharedProps = {\n media,\n title,\n content,\n complex,\n disabled,\n showMediaAtAllSizes,\n showMediaCircle,\n className: clsx('tw-action-option', className),\n isContainerAligned,\n additionalContent,\n as,\n };\n\n const getAriaLabel = (): string | undefined => {\n if (ariaLabel) {\n return ariaLabel;\n }\n\n const generatedLabels: string[] = [];\n\n if (typeof title === 'string') {\n generatedLabels.push(title);\n }\n\n if (typeof action === 'string') {\n generatedLabels.push(action);\n }\n\n return generatedLabels.join(', ') || undefined;\n };\n\n const mapPriority = (priority: ActionOptionPriority): ButtonPriority => {\n switch (priority) {\n case 'primary':\n return 'primary';\n case 'secondary':\n return 'secondary-neutral';\n case 'tertiary':\n return 'tertiary';\n case 'secondary-send':\n return 'secondary';\n default:\n return 'primary';\n }\n };\n\n return (\n <Option\n {...sharedProps}\n button={\n <Button\n v2\n size=\"sm\"\n priority={mapPriority(priority)}\n disabled={disabled}\n aria-label={getAriaLabel()}\n onClick={onClick}\n >\n {action}\n </Button>\n }\n />\n );\n};\n\nexport default ActionOption;\n"],"names":["ActionOption","action","priority","Priority","PRIMARY","disabled","onClick","media","title","content","additionalContent","complex","className","showMediaAtAllSizes","showMediaCircle","isContainerAligned","as","ariaLabel","sharedProps","clsx","getAriaLabel","generatedLabels","push","join","undefined","mapPriority","_jsx","Option","button","Button","v2","size","children"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAMA,YAAY,GAAGA,CAAC;EACpBC,MAAM;EACNC,QAAQ,GAAGC,QAAQ,CAACC,OAAO;EAC3BC,QAAQ;EACRC,OAAO;EACPC,KAAK;EACLC,KAAK;EACLC,OAAO;EACPC,iBAAiB;EACjBC,OAAO;EACPC,SAAS;EACTC,mBAAmB;EACnBC,eAAe;EACfC,kBAAkB;EAClBC,EAAE;AACF,EAAA,YAAY,EAAEC;AAAS,CACL,KAAI;AACtB,EAAA,MAAMC,WAAW,GAAG;IAClBX,KAAK;IACLC,KAAK;IACLC,OAAO;IACPE,OAAO;IACPN,QAAQ;IACRQ,mBAAmB;IACnBC,eAAe;AACfF,IAAAA,SAAS,EAAEO,IAAI,CAAC,kBAAkB,EAAEP,SAAS,CAAC;IAC9CG,kBAAkB;IAClBL,iBAAiB;AACjBM,IAAAA;GACD;EAED,MAAMI,YAAY,GAAGA,MAAyB;AAC5C,IAAA,IAAIH,SAAS,EAAE;AACb,MAAA,OAAOA,SAAS;AAClB,IAAA;IAEA,MAAMI,eAAe,GAAa,EAAE;AAEpC,IAAA,IAAI,OAAOb,KAAK,KAAK,QAAQ,EAAE;AAC7Ba,MAAAA,eAAe,CAACC,IAAI,CAACd,KAAK,CAAC;AAC7B,IAAA;AAEA,IAAA,IAAI,OAAOP,MAAM,KAAK,QAAQ,EAAE;AAC9BoB,MAAAA,eAAe,CAACC,IAAI,CAACrB,MAAM,CAAC;AAC9B,IAAA;AAEA,IAAA,OAAOoB,eAAe,CAACE,IAAI,CAAC,IAAI,CAAC,IAAIC,SAAS;EAChD,CAAC;EAED,MAAMC,WAAW,GAAIvB,QAA8B,IAAoB;AACrE,IAAA,QAAQA,QAAQ;AACd,MAAA,KAAK,SAAS;AACZ,QAAA,OAAO,SAAS;AAClB,MAAA,KAAK,WAAW;AACd,QAAA,OAAO,mBAAmB;AAC5B,MAAA,KAAK,UAAU;AACb,QAAA,OAAO,UAAU;AACnB,MAAA,KAAK,gBAAgB;AACnB,QAAA,OAAO,WAAW;AACpB,MAAA;AACE,QAAA,OAAO,SAAS;AACpB;EACF,CAAC;EAED,oBACEwB,GAAA,CAACC,MAAM,EAAA;AAAA,IAAA,GACDT,WAAW;IACfU,MAAM,eACJF,GAAA,CAACG,MAAM,EAAA;MACLC,EAAE,EAAA,IAAA;AACFC,MAAAA,IAAI,EAAC,IAAI;AACT7B,MAAAA,QAAQ,EAAEuB,WAAW,CAACvB,QAAQ,CAAE;AAChCG,MAAAA,QAAQ,EAAEA,QAAS;MACnB,YAAA,EAAYe,YAAY,EAAG;AAC3Bd,MAAAA,OAAO,EAAEA,OAAQ;AAAA0B,MAAAA,QAAA,EAEhB/B;KACK;AACT,GAAA,CACD;AAEN;;;;"}
|
package/build/alert/Alert.js
CHANGED
|
@@ -24,6 +24,7 @@ require('../common/propsValues/variant.js');
|
|
|
24
24
|
require('../common/propsValues/scroll.js');
|
|
25
25
|
require('../common/propsValues/markdownNodeType.js');
|
|
26
26
|
require('../common/fileType.js');
|
|
27
|
+
require('@transferwise/formatting');
|
|
27
28
|
var constants = require('../common/constants.js');
|
|
28
29
|
var CloseButton = require('../common/closeButton/CloseButton.js');
|
|
29
30
|
var jsxRuntime = require('react/jsx-runtime');
|
package/build/alert/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport {\n CloseButton,\n Sentiment,\n Size,\n Status,\n Typography,\n WDS_LIVE_REGION_DELAY_MS,\n} from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n /** Controls the rendered element: `'link'` (default) renders a Link, `'button'` renders a Button. When `'button'` is used with `href`, renders an anchor styled as a button. */\n as?: 'button' | 'link';\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE\n // remove when all instances of Sentiment.PENDING have been updated to Status.PENDING\n | Sentiment.PENDING\n | Status.PENDING}`;\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /**\n * The type dictates which icon and colour will be used\n * @default 'neutral'\n */\n type?: AlertType;\n /** @deprecated Use `InlinePrompt` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\n/**\n * @deprecated Use [`InfoPrompt`](https://storybook.wise.design/?path=/docs/prompts-infoprompt--docs) component instead. Run codemod to migrate: **`npx @wise/wds-codemods@latest info-prompt`**\n */\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlinePrompt' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n const timeoutId = setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n\n return () => clearTimeout(timeoutId);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n /**\n * All focusable elements must be disabled until we announce the alert.\n * @see https://dequeuniversity.com/rules/axe/4.10/aria-hidden-focus?application=axeAPI\n */\n const accessibleTabIndex = shouldAnnounce ? undefined : -1;\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action && action.as !== 'button' ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n as={action.href ? 'a' : 'button'}\n href={action.href}\n target={action.target}\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton\n ref={closeButtonReference}\n size=\"xs\"\n tabIndex={accessibleTabIndex}\n onClick={onDismiss}\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","timeoutId","setTimeout","WDS_LIVE_REGION_DELAY_MS","clearTimeout","closeButtonReference","useRef","accessibleTabIndex","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","tabIndex","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDYA;AAAZ,CAAA,UAAYA,kBAAkB,EAAA;AAC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AACE,MAAA,OAAO,OAAO;AAClB;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"Alert.js","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport {\n CloseButton,\n Sentiment,\n Size,\n Status,\n Typography,\n WDS_LIVE_REGION_DELAY_MS,\n} from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n /** Controls the rendered element: `'link'` (default) renders a Link, `'button'` renders a Button. When `'button'` is used with `href`, renders an anchor styled as a button. */\n as?: 'button' | 'link';\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE\n // remove when all instances of Sentiment.PENDING have been updated to Status.PENDING\n | Sentiment.PENDING\n | Status.PENDING}`;\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /**\n * The type dictates which icon and colour will be used\n * @default 'neutral'\n */\n type?: AlertType;\n /** @deprecated Use `InlinePrompt` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\n/**\n * @deprecated Use [`InfoPrompt`](https://storybook.wise.design/?path=/docs/prompts-infoprompt--docs) component instead. Run codemod to migrate: **`npx @wise/wds-codemods@latest info-prompt`**\n */\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlinePrompt' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n const timeoutId = setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n\n return () => clearTimeout(timeoutId);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n /**\n * All focusable elements must be disabled until we announce the alert.\n * @see https://dequeuniversity.com/rules/axe/4.10/aria-hidden-focus?application=axeAPI\n */\n const accessibleTabIndex = shouldAnnounce ? undefined : -1;\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action && action.as !== 'button' ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n as={action.href ? 'a' : 'button'}\n href={action.href}\n target={action.target}\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton\n ref={closeButtonReference}\n size=\"xs\"\n tabIndex={accessibleTabIndex}\n onClick={onDismiss}\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","timeoutId","setTimeout","WDS_LIVE_REGION_DELAY_MS","clearTimeout","closeButtonReference","useRef","accessibleTabIndex","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","tabIndex","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDYA;AAAZ,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB;AACtBA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,WAAyB;AACzBA,EAAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,aAAsB;AACtBA,EAAAA,kBAAA,CAAA,cAAA,CAAA,GAAA,YAA2B;AAC7B,CAAC,EAPWA,0BAAkB,KAAlBA,0BAAkB,GAAA,EAAA,CAAA,CAAA;AA4C9B,SAASC,WAAWA,CAACC,IAAe,EAAA;AAClC,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,SAAS;AACZ,MAAA,OAAO,UAAU;AACnB,IAAA,KAAK,MAAM;AACT,MAAA,OAAO,SAAS;AAClB,IAAA,KAAK,OAAO;AACV,MAAA,OAAO,UAAU;AACnB,IAAA;AACE,MAAA,OAAOA,IAAI;AACf;AACF;AAEA;;AAEG;AACW,SAAUC,KAAKA,CAAC;EAC5BC,MAAM;EACNC,SAAS;EACTC,IAAI;EACJC,eAAe;EACfC,SAAS;EACTC,OAAO;EACPC,KAAK;AACLR,EAAAA,IAAI,GAAG,SAAS;EAChBS,KAAK;EACLC,QAAQ;EACRC,IAAI;AACJC,EAAAA;AAAW,CACA,EAAA;AACXC,EAAAA,eAAS,CAAC,MAAK;IACb,IAAIJ,KAAK,KAAKK,SAAS,EAAE;MACvBC,mCAAiB,CACf,8EAA8E,CAC/E;AACH,IAAA;AACF,EAAA,CAAC,EAAE,CAACN,KAAK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AK,WAAW;AACd,MAAA,OAAO,+BAA+B;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB;AAC5B,IAAA,KAAK,SAAS;AACd,IAAA;AACE,MAAA,OAAO,OAAO;AAClB;AACF;;;;"}
|
package/build/alert/Alert.mjs
CHANGED
|
@@ -20,6 +20,7 @@ import '../common/propsValues/variant.mjs';
|
|
|
20
20
|
import '../common/propsValues/scroll.mjs';
|
|
21
21
|
import '../common/propsValues/markdownNodeType.mjs';
|
|
22
22
|
import '../common/fileType.mjs';
|
|
23
|
+
import '@transferwise/formatting';
|
|
23
24
|
import { WDS_LIVE_REGION_DELAY_MS } from '../common/constants.mjs';
|
|
24
25
|
import { CloseButton } from '../common/closeButton/CloseButton.mjs';
|
|
25
26
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.mjs","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport {\n CloseButton,\n Sentiment,\n Size,\n Status,\n Typography,\n WDS_LIVE_REGION_DELAY_MS,\n} from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n /** Controls the rendered element: `'link'` (default) renders a Link, `'button'` renders a Button. When `'button'` is used with `href`, renders an anchor styled as a button. */\n as?: 'button' | 'link';\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE\n // remove when all instances of Sentiment.PENDING have been updated to Status.PENDING\n | Sentiment.PENDING\n | Status.PENDING}`;\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /**\n * The type dictates which icon and colour will be used\n * @default 'neutral'\n */\n type?: AlertType;\n /** @deprecated Use `InlinePrompt` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\n/**\n * @deprecated Use [`InfoPrompt`](https://storybook.wise.design/?path=/docs/prompts-infoprompt--docs) component instead. Run codemod to migrate: **`npx @wise/wds-codemods@latest info-prompt`**\n */\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlinePrompt' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n const timeoutId = setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n\n return () => clearTimeout(timeoutId);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n /**\n * All focusable elements must be disabled until we announce the alert.\n * @see https://dequeuniversity.com/rules/axe/4.10/aria-hidden-focus?application=axeAPI\n */\n const accessibleTabIndex = shouldAnnounce ? undefined : -1;\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action && action.as !== 'button' ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n as={action.href ? 'a' : 'button'}\n href={action.href}\n target={action.target}\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton\n ref={closeButtonReference}\n size=\"xs\"\n tabIndex={accessibleTabIndex}\n onClick={onDismiss}\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","timeoutId","setTimeout","WDS_LIVE_REGION_DELAY_MS","clearTimeout","closeButtonReference","useRef","accessibleTabIndex","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","tabIndex","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqDYA;AAAZ,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB;AACtBA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,WAAyB;AACzBA,EAAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,aAAsB;AACtBA,EAAAA,kBAAA,CAAA,cAAA,CAAA,GAAA,YAA2B;AAC7B,CAAC,EAPWA,kBAAkB,KAAlBA,kBAAkB,GAAA,EAAA,CAAA,CAAA;AA4C9B,SAASC,WAAWA,CAACC,IAAe,EAAA;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7BmC,OAAO,EAAE7D,MAAM,CAAC6D,OAAQ;YAAArD,QAAA,EAEvBR,MAAM,CAAC8D;AAAI,WACN,CACT,CAAC;SACD;AACP,OAAK,CACL,EAAC1D,SAAS,iBACRuB,GAAA,CAAA,KAAA,EAAA;AAAK1B,QAAAA,SAAS,EAAC,cAAc;QAAAO,QAAA,eAC3BmB,GAAA,CAACuC,WAAW,EAAA;AACVC,UAAAA,GAAG,EAAE3C,oBAAqB;AAC1Bf,UAAAA,IAAI,EAAC,IAAI;AACTmD,UAAAA,QAAQ,EAAElC,kBAAmB;AAC7BmC,UAAAA,OAAO,EAAEzD;SAAU;AAEvB,OAAK,CACN;KACE;AACP,GAAK,CAAC;AAEV;AAEA,SAAS6B,oBAAoBA,CAAC1B,KAA8B,EAAA;AAC1D,EAAA,QAAQA,KAAK;AACX,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,iCAAiC;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB;AAC5B,IAAA,KAAK,SAAS;AACd,IAAA;AACE,MAAA,OAAO,OAAO;AAClB;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"Alert.mjs","sources":["../../src/alert/Alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useState, useRef, useEffect } from 'react';\n\nimport Body from '../body/Body';\nimport {\n CloseButton,\n Sentiment,\n Size,\n Status,\n Typography,\n WDS_LIVE_REGION_DELAY_MS,\n} from '../common';\n\nimport StatusIcon from '../statusIcon';\nimport Title from '../title/Title';\nimport { logActionRequired } from '../utilities';\n\nimport InlineMarkdown from './inlineMarkdown';\nimport Button from '../button';\nimport Link from '../link';\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport type AlertAction = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n /** Controls the rendered element: `'link'` (default) renders a Link, `'button'` renders a Button. When `'button'` is used with `href`, renders an anchor styled as a button. */\n as?: 'button' | 'link';\n};\n\n/** @deprecated Use `\"top\" | \"bottom\"` instead. */\ntype AlertTypeDeprecated = `${Sentiment.SUCCESS | Sentiment.INFO | Sentiment.ERROR}`;\ntype AlertTypeResolved = `${\n | Sentiment.POSITIVE\n | Sentiment.NEUTRAL\n | Sentiment.WARNING\n | Sentiment.NEGATIVE\n // remove when all instances of Sentiment.PENDING have been updated to Status.PENDING\n | Sentiment.PENDING\n | Status.PENDING}`;\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport type AlertType = AlertTypeResolved | AlertTypeDeprecated;\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport enum AlertArrowPosition {\n TOP_LEFT = 'up-left',\n TOP = 'up-center',\n TOP_RIGHT = 'up-right',\n BOTTOM_LEFT = 'down-left',\n BOTTOM = 'down-center',\n BOTTOM_RIGHT = 'down-right',\n}\n\n/**\n * @deprecated `Alert` component is being replaced by the `InfoPrompt` component\n */\nexport interface AlertProps {\n /** An optional call to action to sit under the main body of the alert. If your label is short, use aria-label to provide more context */\n action?: AlertAction;\n className?: string;\n /** An optional icon. If not provided, we will default the icon to something appropriate for the type */\n icon?: React.ReactNode;\n /**\n * Override for [StatusIcon's default, accessible name](/?path=/docs/other-statusicon-accessibility--docs)\n * announced by the screen readers\n * */\n statusIconLabel?: string;\n /** Title for the alert component */\n title?: string;\n /** The main body of the alert. Accepts plain text and bold words specified with **double stars */\n message?: string;\n /** The presence of the onDismiss handler will trigger the visibility of the close button */\n onDismiss?: React.MouseEventHandler<HTMLButtonElement>;\n /**\n * The type dictates which icon and colour will be used\n * @default 'neutral'\n */\n type?: AlertType;\n /** @deprecated Use `InlinePrompt` instead. */\n arrow?: `${AlertArrowPosition}`;\n /** @deprecated Use `message` instead. Be aware `message` only accepts plain text or text with **bold** markdown. */\n children?: React.ReactNode;\n /** @deprecated Use `onDismiss` instead. */\n dismissible?: boolean;\n /** @deprecated Alert component doesn't support `size` anymore, please remove this prop. */\n size?: `${Size}`;\n}\n\nfunction resolveType(type: AlertType): AlertTypeResolved {\n switch (type) {\n case 'success':\n return 'positive';\n case 'info':\n return 'neutral';\n case 'error':\n return 'negative';\n default:\n return type;\n }\n}\n\n/**\n * @deprecated Use [`InfoPrompt`](https://storybook.wise.design/?path=/docs/prompts-infoprompt--docs) component instead. Run codemod to migrate: **`npx @wise/wds-codemods@latest info-prompt`**\n */\nexport default function Alert({\n action,\n className,\n icon,\n statusIconLabel,\n onDismiss,\n message,\n title,\n type = 'neutral',\n arrow,\n children,\n size,\n dismissible,\n}: AlertProps) {\n useEffect(() => {\n if (arrow !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'arrow' anymore, use 'InlinePrompt' instead.\",\n );\n }\n }, [arrow]);\n\n useEffect(() => {\n if (children !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'children' anymore, use 'message' instead.\",\n );\n }\n }, [children]);\n\n useEffect(() => {\n if (dismissible !== undefined) {\n logActionRequired(\n \"Alert component doesn't support 'dismissible' anymore, use 'onDismiss' instead.\",\n );\n }\n }, [dismissible]);\n\n useEffect(() => {\n if (size !== undefined) {\n logActionRequired(\"Alert component doesn't support 'size' anymore, please remove that prop.\");\n }\n }, [size]);\n\n const resolvedType = resolveType(type);\n useEffect(() => {\n if (resolvedType !== type) {\n logActionRequired(\n `Alert component has deprecated '${type}' value for the 'type' prop. Please use '${resolvedType}' instead.`,\n );\n }\n }, [resolvedType, type]);\n\n const [shouldFire, setShouldFire] = useState<boolean>();\n\n const [shouldAnnounce, setShouldAnnounce] = useState<boolean>(false);\n useEffect(() => {\n const timeoutId = setTimeout(() => {\n setShouldAnnounce(true);\n }, WDS_LIVE_REGION_DELAY_MS);\n\n return () => clearTimeout(timeoutId);\n }, []);\n\n const closeButtonReference = useRef<HTMLButtonElement>(null);\n\n /**\n * All focusable elements must be disabled until we announce the alert.\n * @see https://dequeuniversity.com/rules/axe/4.10/aria-hidden-focus?application=axeAPI\n */\n const accessibleTabIndex = shouldAnnounce ? undefined : -1;\n\n return (\n <div\n role={resolvedType === Sentiment.NEGATIVE ? 'alert' : 'status'}\n className=\"wds-alert__liveRegion\"\n >\n <div\n aria-hidden={shouldAnnounce ? undefined : 'true'}\n className={clsx(\n 'alert d-flex',\n `alert-${resolvedType}`,\n arrow != null && alertArrowClassNames(arrow),\n className,\n )}\n data-testid=\"alert\"\n onTouchStart={() => setShouldFire(true)}\n onTouchEnd={(event) => {\n if (\n shouldFire &&\n action?.href &&\n // Check if current event is triggered from closeButton\n event.target instanceof Node &&\n closeButtonReference.current &&\n !closeButtonReference.current.contains(event.target)\n ) {\n if (action.target === '_blank') {\n window.top?.open(action.href);\n } else {\n window.top?.location.assign(action.href);\n }\n }\n setShouldFire(false);\n }}\n onTouchMove={() => setShouldFire(false)}\n >\n <div className=\"alert__icon\">\n {icon || <StatusIcon size={32} sentiment={resolvedType} iconLabel={statusIconLabel} />}\n </div>\n <div className={clsx('alert__content', 'd-flex', 'flex-grow-1')}>\n <div className=\"alert__message\">\n <div>\n {title && (\n <Title className=\"m-b-1\" type={Typography.TITLE_BODY}>\n {title}\n </Title>\n )}\n <Body as=\"span\" className=\"d-block\" type={Typography.BODY_LARGE}>\n {children || <InlineMarkdown>{message}</InlineMarkdown>}\n </Body>\n </div>\n {action &&\n ('href' in action && action.as !== 'button' ? (\n <Link\n href={action.href}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n ) : (\n <Button\n v2\n as={action.href ? 'a' : 'button'}\n href={action.href}\n target={action.target}\n size=\"sm\"\n sentiment=\"default\"\n aria-label={action['aria-label']}\n priority=\"secondary-neutral\"\n className=\"alert__action\"\n tabIndex={accessibleTabIndex}\n onClick={action.onClick}\n >\n {action.text}\n </Button>\n ))}\n </div>\n </div>\n {onDismiss && (\n <div className=\"alert__close\">\n <CloseButton\n ref={closeButtonReference}\n size=\"xs\"\n tabIndex={accessibleTabIndex}\n onClick={onDismiss}\n />\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction alertArrowClassNames(arrow: `${AlertArrowPosition}`) {\n switch (arrow) {\n case 'down-center':\n return 'arrow arrow-bottom arrow-center';\n case 'down-left':\n return 'arrow arrow-bottom arrow-left';\n case 'down-right':\n return 'arrow arrow-bottom arrow-right';\n case 'up-center':\n return 'arrow arrow-center';\n case 'up-right':\n return 'arrow arrow-right';\n case 'up-left':\n default:\n return 'arrow';\n }\n}\n"],"names":["AlertArrowPosition","resolveType","type","Alert","action","className","icon","statusIconLabel","onDismiss","message","title","arrow","children","size","dismissible","useEffect","undefined","logActionRequired","resolvedType","shouldFire","setShouldFire","useState","shouldAnnounce","setShouldAnnounce","timeoutId","setTimeout","WDS_LIVE_REGION_DELAY_MS","clearTimeout","closeButtonReference","useRef","accessibleTabIndex","_jsx","role","Sentiment","NEGATIVE","_jsxs","clsx","alertArrowClassNames","onTouchStart","onTouchEnd","event","href","target","Node","current","contains","window","top","open","location","assign","onTouchMove","StatusIcon","sentiment","iconLabel","Title","Typography","TITLE_BODY","Body","as","BODY_LARGE","InlineMarkdown","Link","LINK_LARGE","tabIndex","onClick","text","Button","v2","priority","CloseButton","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqDYA;AAAZ,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,SAAoB;AACpBA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,WAAiB;AACjBA,EAAAA,kBAAA,CAAA,WAAA,CAAA,GAAA,UAAsB;AACtBA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,WAAyB;AACzBA,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AAI,EAAC,IAAI;AACTwC,YAAAA,SAAS,EAAC,SAAS;YACnB,YAAA,EAAYjD,MAAM,CAAC,YAAY,CAAE;AACjCiE,YAAAA,QAAQ,EAAC,mBAAmB;AAC5BhE,YAAAA,SAAS,EAAC,eAAe;AACzB2D,YAAAA,QAAQ,EAAElC,kBAAmB;YAC7BmC,OAAO,EAAE7D,MAAM,CAAC6D,OAAQ;YAAArD,QAAA,EAEvBR,MAAM,CAAC8D;AAAI,WACN,CACT,CAAC;SACD;AACP,OAAK,CACL,EAAC1D,SAAS,iBACRuB,GAAA,CAAA,KAAA,EAAA;AAAK1B,QAAAA,SAAS,EAAC,cAAc;QAAAO,QAAA,eAC3BmB,GAAA,CAACuC,WAAW,EAAA;AACVC,UAAAA,GAAG,EAAE3C,oBAAqB;AAC1Bf,UAAAA,IAAI,EAAC,IAAI;AACTmD,UAAAA,QAAQ,EAAElC,kBAAmB;AAC7BmC,UAAAA,OAAO,EAAEzD;SAAU;AAEvB,OAAK,CACN;KACE;AACP,GAAK,CAAC;AAEV;AAEA,SAAS6B,oBAAoBA,CAAC1B,KAA8B,EAAA;AAC1D,EAAA,QAAQA,KAAK;AACX,IAAA,KAAK,aAAa;AAChB,MAAA,OAAO,iCAAiC;AAC1C,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,+BAA+B;AACxC,IAAA,KAAK,YAAY;AACf,MAAA,OAAO,gCAAgC;AACzC,IAAA,KAAK,WAAW;AACd,MAAA,OAAO,oBAAoB;AAC7B,IAAA,KAAK,UAAU;AACb,MAAA,OAAO,mBAAmB;AAC5B,IAAA,KAAK,SAAS;AACd,IAAA;AACE,MAAA,OAAO,OAAO;AAClB;AACF;;;;"}
|
|
@@ -21,6 +21,7 @@ require('../../common/propsValues/variant.js');
|
|
|
21
21
|
require('../../common/propsValues/scroll.js');
|
|
22
22
|
var markdownNodeType = require('../../common/propsValues/markdownNodeType.js');
|
|
23
23
|
require('../../common/fileType.js');
|
|
24
|
+
require('@transferwise/formatting');
|
|
24
25
|
require('@transferwise/icons');
|
|
25
26
|
require('clsx');
|
|
26
27
|
require('react');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineMarkdown.js","sources":["../../../src/alert/inlineMarkdown/InlineMarkdown.tsx"],"sourcesContent":["import { MarkdownNodeType } from '../../common';\nimport Markdown from '../../markdown';\n\nconst allowList = [MarkdownNodeType.STRONG];\n\nexport interface InlineMarkdownProps {\n children?: string;\n className?: string;\n}\n\nexport default function InlineMarkdown(props: InlineMarkdownProps) {\n return <Markdown {...props} as=\"span\" allowList={allowList} blockList={undefined} />;\n}\n"],"names":["allowList","MarkdownNodeType","STRONG","InlineMarkdown","props","_jsx","Markdown","as","blockList","undefined"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InlineMarkdown.js","sources":["../../../src/alert/inlineMarkdown/InlineMarkdown.tsx"],"sourcesContent":["import { MarkdownNodeType } from '../../common';\nimport Markdown from '../../markdown';\n\nconst allowList = [MarkdownNodeType.STRONG];\n\nexport interface InlineMarkdownProps {\n children?: string;\n className?: string;\n}\n\nexport default function InlineMarkdown(props: InlineMarkdownProps) {\n return <Markdown {...props} as=\"span\" allowList={allowList} blockList={undefined} />;\n}\n"],"names":["allowList","MarkdownNodeType","STRONG","InlineMarkdown","props","_jsx","Markdown","as","blockList","undefined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,SAAS,GAAG,CAACC,iCAAgB,CAACC,MAAM,CAAC;AAO7B,SAAUC,cAAcA,CAACC,KAA0B,EAAA;EAC/D,oBAAOC,cAAA,CAACC,gBAAQ,EAAA;AAAA,IAAA,GAAKF,KAAK;AAAEG,IAAAA,EAAE,EAAC,MAAM;AAACP,IAAAA,SAAS,EAAEA,SAAU;AAACQ,IAAAA,SAAS,EAAEC;AAAU,GAAA,CAAG;AACtF;;;;"}
|
|
@@ -17,6 +17,7 @@ import '../../common/propsValues/variant.mjs';
|
|
|
17
17
|
import '../../common/propsValues/scroll.mjs';
|
|
18
18
|
import { MarkdownNodeType } from '../../common/propsValues/markdownNodeType.mjs';
|
|
19
19
|
import '../../common/fileType.mjs';
|
|
20
|
+
import '@transferwise/formatting';
|
|
20
21
|
import '@transferwise/icons';
|
|
21
22
|
import 'clsx';
|
|
22
23
|
import 'react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineMarkdown.mjs","sources":["../../../src/alert/inlineMarkdown/InlineMarkdown.tsx"],"sourcesContent":["import { MarkdownNodeType } from '../../common';\nimport Markdown from '../../markdown';\n\nconst allowList = [MarkdownNodeType.STRONG];\n\nexport interface InlineMarkdownProps {\n children?: string;\n className?: string;\n}\n\nexport default function InlineMarkdown(props: InlineMarkdownProps) {\n return <Markdown {...props} as=\"span\" allowList={allowList} blockList={undefined} />;\n}\n"],"names":["allowList","MarkdownNodeType","STRONG","InlineMarkdown","props","_jsx","Markdown","as","blockList","undefined"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InlineMarkdown.mjs","sources":["../../../src/alert/inlineMarkdown/InlineMarkdown.tsx"],"sourcesContent":["import { MarkdownNodeType } from '../../common';\nimport Markdown from '../../markdown';\n\nconst allowList = [MarkdownNodeType.STRONG];\n\nexport interface InlineMarkdownProps {\n children?: string;\n className?: string;\n}\n\nexport default function InlineMarkdown(props: InlineMarkdownProps) {\n return <Markdown {...props} as=\"span\" allowList={allowList} blockList={undefined} />;\n}\n"],"names":["allowList","MarkdownNodeType","STRONG","InlineMarkdown","props","_jsx","Markdown","as","blockList","undefined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAMA,SAAS,GAAG,CAACC,gBAAgB,CAACC,MAAM,CAAC;AAO7B,SAAUC,cAAcA,CAACC,KAA0B,EAAA;EAC/D,oBAAOC,GAAA,CAACC,QAAQ,EAAA;AAAA,IAAA,GAAKF,KAAK;AAAEG,IAAAA,EAAE,EAAC,MAAM;AAACP,IAAAA,SAAS,EAAEA,SAAU;AAACQ,IAAAA,SAAS,EAAEC;AAAU,GAAA,CAAG;AACtF;;;;"}
|
package/build/avatar/Avatar.js
CHANGED
|
@@ -23,6 +23,7 @@ require('../common/propsValues/variant.js');
|
|
|
23
23
|
require('../common/propsValues/scroll.js');
|
|
24
24
|
require('../common/propsValues/markdownNodeType.js');
|
|
25
25
|
require('../common/fileType.js');
|
|
26
|
+
require('@transferwise/formatting');
|
|
26
27
|
var colors = require('../common/colors.js');
|
|
27
28
|
require('@transferwise/icons');
|
|
28
29
|
require('react-intl');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { getBrandColorFromSeed, Theme } from '../common';\n\nimport Circle from '../common/circle';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\n/**\n * @deprecated `Avatar` is deprecated please use `AvatarView` instead\n */\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n /** @default false */\n outlined?: boolean;\n /** @default 48 */\n size?: AvatarSize;\n /** @default 'light' */\n theme?: AvatarTheme;\n /** @default 'thumbnail' */\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\n/**\n * @deprecated Use `AvatarView` component instead\n */\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? getBrandColorFromSeed(backgroundColorSeed)\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\n return (\n <div\n className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {\n 'tw-avatar--outlined': outlined,\n 'tw-avatar--branded': Boolean(backgroundColorFromSeed),\n 'np-text-title-body': type === 'initials',\n })}\n aria-label={ariaLabel}\n >\n <div\n className=\"tw-avatar__content\"\n style={{\n backgroundColor: backgroundColor || backgroundColorFromSeed,\n }}\n >\n {children}\n </div>\n </div>\n );\n};\n\nexport default Avatar;\n"],"names":["backwardsCompatibleSize","size","Avatar","backgroundColor","backgroundColorSeed","children","className","outlined","sizeFromProps","theme","Theme","LIGHT","type","ariaLabel","backgroundColorFromSeed","useMemo","getBrandColorFromSeed","undefined","_jsx","clsx","Boolean","style"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { getBrandColorFromSeed, Theme } from '../common';\n\nimport Circle from '../common/circle';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\n/**\n * @deprecated `Avatar` is deprecated please use `AvatarView` instead\n */\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n /** @default false */\n outlined?: boolean;\n /** @default 48 */\n size?: AvatarSize;\n /** @default 'light' */\n theme?: AvatarTheme;\n /** @default 'thumbnail' */\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\n/**\n * @deprecated Use `AvatarView` component instead\n */\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? getBrandColorFromSeed(backgroundColorSeed)\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\n return (\n <div\n className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {\n 'tw-avatar--outlined': outlined,\n 'tw-avatar--branded': Boolean(backgroundColorFromSeed),\n 'np-text-title-body': type === 'initials',\n })}\n aria-label={ariaLabel}\n >\n <div\n className=\"tw-avatar__content\"\n style={{\n backgroundColor: backgroundColor || backgroundColorFromSeed,\n }}\n >\n {children}\n </div>\n </div>\n );\n};\n\nexport default Avatar;\n"],"names":["backwardsCompatibleSize","size","Avatar","backgroundColor","backgroundColorSeed","children","className","outlined","sizeFromProps","theme","Theme","LIGHT","type","ariaLabel","backgroundColorFromSeed","useMemo","getBrandColorFromSeed","undefined","_jsx","clsx","Boolean","style"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAMA,uBAAuB,GAAIC,IAAgB,IAAuB;AACtE,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE;AAEX,IAAA;AACE,MAA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 @@ import '../common/propsValues/variant.mjs';
|
|
|
19
19
|
import '../common/propsValues/scroll.mjs';
|
|
20
20
|
import '../common/propsValues/markdownNodeType.mjs';
|
|
21
21
|
import '../common/fileType.mjs';
|
|
22
|
+
import '@transferwise/formatting';
|
|
22
23
|
import { getBrandColorFromSeed } from '../common/colors.mjs';
|
|
23
24
|
import '@transferwise/icons';
|
|
24
25
|
import 'react-intl';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.mjs","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { getBrandColorFromSeed, Theme } from '../common';\n\nimport Circle from '../common/circle';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\n/**\n * @deprecated `Avatar` is deprecated please use `AvatarView` instead\n */\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n /** @default false */\n outlined?: boolean;\n /** @default 48 */\n size?: AvatarSize;\n /** @default 'light' */\n theme?: AvatarTheme;\n /** @default 'thumbnail' */\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\n/**\n * @deprecated Use `AvatarView` component instead\n */\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? getBrandColorFromSeed(backgroundColorSeed)\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\n return (\n <div\n className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {\n 'tw-avatar--outlined': outlined,\n 'tw-avatar--branded': Boolean(backgroundColorFromSeed),\n 'np-text-title-body': type === 'initials',\n })}\n aria-label={ariaLabel}\n >\n <div\n className=\"tw-avatar__content\"\n style={{\n backgroundColor: backgroundColor || backgroundColorFromSeed,\n }}\n >\n {children}\n </div>\n </div>\n );\n};\n\nexport default Avatar;\n"],"names":["backwardsCompatibleSize","size","Avatar","backgroundColor","backgroundColorSeed","children","className","outlined","sizeFromProps","theme","Theme","LIGHT","type","ariaLabel","backgroundColorFromSeed","useMemo","getBrandColorFromSeed","undefined","_jsx","clsx","Boolean","style"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Avatar.mjs","sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useMemo } from 'react';\n\nimport { getBrandColorFromSeed, Theme } from '../common';\n\nimport Circle from '../common/circle';\n\ntype NumericAvatarSize = 24 | 40 | 48 | 56 | 72;\n\ntype LegacyAvatarSize = 'sm' | 'md' | 'lg';\n\nexport type AvatarSize = NumericAvatarSize | LegacyAvatarSize;\n\nexport type AvatarTheme = 'light' | 'dark';\n\nexport type AvatarType = 'thumbnail' | 'icon' | 'emoji' | 'initials';\n\n/**\n * @deprecated `Avatar` is deprecated please use `AvatarView` instead\n */\nexport interface AvatarProps {\n backgroundColor?: string;\n backgroundColorSeed?: string;\n children?: React.ReactNode;\n className?: string;\n /** @default false */\n outlined?: boolean;\n /** @default 48 */\n size?: AvatarSize;\n /** @default 'light' */\n theme?: AvatarTheme;\n /** @default 'thumbnail' */\n type?: AvatarType;\n 'aria-label'?: string;\n}\n\nconst backwardsCompatibleSize = (size: AvatarSize): NumericAvatarSize => {\n switch (size) {\n case 'sm':\n return 24;\n\n case 'md':\n return 48;\n\n case 'lg':\n return 72;\n\n default:\n return size;\n }\n};\n\n/**\n * @deprecated Use `AvatarView` component instead\n */\nconst Avatar: React.FC<AvatarProps> = ({\n backgroundColor = null,\n backgroundColorSeed = null,\n children = null,\n className,\n outlined = false,\n size: sizeFromProps = 48,\n theme = Theme.LIGHT,\n type = 'thumbnail',\n 'aria-label': ariaLabel,\n}) => {\n const backgroundColorFromSeed = useMemo<string | undefined>(\n () =>\n !backgroundColor && backgroundColorSeed\n ? getBrandColorFromSeed(backgroundColorSeed)\n : undefined,\n [backgroundColor, backgroundColorSeed],\n );\n\n const size = backwardsCompatibleSize(sizeFromProps);\n\n return (\n <div\n className={clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {\n 'tw-avatar--outlined': outlined,\n 'tw-avatar--branded': Boolean(backgroundColorFromSeed),\n 'np-text-title-body': type === 'initials',\n })}\n aria-label={ariaLabel}\n >\n <div\n className=\"tw-avatar__content\"\n style={{\n backgroundColor: backgroundColor || backgroundColorFromSeed,\n }}\n >\n {children}\n </div>\n </div>\n );\n};\n\nexport default Avatar;\n"],"names":["backwardsCompatibleSize","size","Avatar","backgroundColor","backgroundColorSeed","children","className","outlined","sizeFromProps","theme","Theme","LIGHT","type","ariaLabel","backgroundColorFromSeed","useMemo","getBrandColorFromSeed","undefined","_jsx","clsx","Boolean","style"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAMA,uBAAuB,GAAIC,IAAgB,IAAuB;AACtE,EAAA,QAAQA,IAAI;AACV,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE;AAEX,IAAA,KAAK,IAAI;AACP,MAAA,OAAO,EAAE;AAEX,IAAA;AACE,MAAA,OAAOA,IAAI;AACf;AACF,CAAC;AAED;;AAEG;AACH,MAAMC,MAAM,GAA0BA,CAAC;AACrCC,EAAAA,eAAe,GAAG,IAAI;AACtBC,EAAAA,mBAAmB,GAAG,IAAI;AAC1BC,EAAAA,QAAQ,GAAG,IAAI;EACfC,SAAS;AACTC,EAAAA,QAAQ,GAAG,KAAK;EAChBN,IAAI,EAAEO,aAAa,GAAG,EAAE;EACxBC,KAAK,GAAGC,KAAK,CAACC,KAAK;AACnBC,EAAAA,IAAI,GAAG,WAAW;AAClB,EAAA,YAAY,EAAEC;AAAS,CACxB,KAAI;EACH,MAAMC,uBAAuB,GAAGC,OAAO,CACrC,MACE,CAACZ,eAAe,IAAIC,mBAAmB,GACnCY,qBAAqB,CAACZ,mBAAmB,CAAC,GAC1Ca,SAAS,EACf,CAACd,eAAe,EAAEC,mBAAmB,CAAC,CACvC;AAED,EAAA,MAAMH,IAAI,GAAGD,uBAAuB,CAACQ,aAAa,CAAC;AAEnD,EAAA,oBACEU,GAAA,CAAA,KAAA,EAAA;AACEZ,IAAAA,SAAS,EAAEa,IAAI,CAAC,WAAW,EAAEb,SAAS,EAAE,CAAA,WAAA,EAAcL,IAAI,CAAA,CAAE,EAAE,CAAA,WAAA,EAAcW,IAAI,EAAE,EAAE;AAClF,MAAA,qBAAqB,EAAEL,QAAQ;AAC/B,MAAA,oBAAoB,EAAEa,OAAO,CAACN,uBAAuB,CAAC;MACtD,oBAAoB,EAAEF,IAAI,KAAK;AAChC,KAAA,CAAE;AACH,IAAA,YAAA,EAAYC,SAAU;AAAAR,IAAAA,QAAA,eAEtBa,GAAA,CAAA,KAAA,EAAA;AACEZ,MAAAA,SAAS,EAAC,oBAAoB;AAC9Be,MAAAA,KAAK,EAAE;QACLlB,eAAe,EAAEA,eAAe,IAAIW;OACpC;AAAAT,MAAAA,QAAA,EAEDA;KACE;AACP,GAAK,CAAC;AAEV;;;;"}
|
|
@@ -28,6 +28,7 @@ require('../common/propsValues/variant.js');
|
|
|
28
28
|
require('../common/propsValues/scroll.js');
|
|
29
29
|
require('../common/propsValues/markdownNodeType.js');
|
|
30
30
|
require('../common/fileType.js');
|
|
31
|
+
require('@transferwise/formatting');
|
|
31
32
|
var initials = require('../common/initials.js');
|
|
32
33
|
var icons = require('@transferwise/icons');
|
|
33
34
|
require('react-intl');
|