@transferwise/components 0.0.0-experimental-e068634 → 0.0.0-experimental-0e166d9
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/button/Button.js +0 -1
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +0 -1
- package/build/button/Button.mjs.map +1 -1
- package/build/common/RadioButton/RadioButton.js +2 -5
- package/build/common/RadioButton/RadioButton.js.map +1 -1
- package/build/common/RadioButton/RadioButton.mjs +2 -5
- package/build/common/RadioButton/RadioButton.mjs.map +1 -1
- package/build/common/initials.js +4 -1
- package/build/common/initials.js.map +1 -1
- package/build/common/initials.mjs +4 -1
- package/build/common/initials.mjs.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js +3 -2
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +2 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
- package/build/i18n/de.json +2 -0
- package/build/i18n/de.json.js +2 -0
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +2 -0
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/fr.json +2 -0
- package/build/i18n/fr.json.js +2 -0
- package/build/i18n/fr.json.js.map +1 -1
- package/build/i18n/fr.json.mjs +2 -0
- package/build/i18n/fr.json.mjs.map +1 -1
- package/build/i18n/hu.json +2 -0
- package/build/i18n/hu.json.js +2 -0
- package/build/i18n/hu.json.js.map +1 -1
- package/build/i18n/hu.json.mjs +2 -0
- package/build/i18n/hu.json.mjs.map +1 -1
- package/build/i18n/it.json +2 -0
- package/build/i18n/it.json.js +2 -0
- package/build/i18n/it.json.js.map +1 -1
- package/build/i18n/it.json.mjs +2 -0
- package/build/i18n/it.json.mjs.map +1 -1
- package/build/i18n/ja.json +2 -0
- package/build/i18n/ja.json.js +2 -0
- package/build/i18n/ja.json.js.map +1 -1
- package/build/i18n/ja.json.mjs +2 -0
- package/build/i18n/ja.json.mjs.map +1 -1
- package/build/i18n/pl.json +2 -0
- package/build/i18n/pl.json.js +2 -0
- package/build/i18n/pl.json.js.map +1 -1
- package/build/i18n/pl.json.mjs +2 -0
- package/build/i18n/pl.json.mjs.map +1 -1
- package/build/i18n/pt.json +2 -0
- package/build/i18n/pt.json.js +2 -0
- package/build/i18n/pt.json.js.map +1 -1
- package/build/i18n/pt.json.mjs +2 -0
- package/build/i18n/pt.json.mjs.map +1 -1
- package/build/i18n/ro.json +2 -0
- package/build/i18n/ro.json.js +2 -0
- package/build/i18n/ro.json.js.map +1 -1
- package/build/i18n/ro.json.mjs +2 -0
- package/build/i18n/ro.json.mjs.map +1 -1
- package/build/i18n/ru.json +2 -0
- package/build/i18n/ru.json.js +2 -0
- package/build/i18n/ru.json.js.map +1 -1
- package/build/i18n/ru.json.mjs +2 -0
- package/build/i18n/ru.json.mjs.map +1 -1
- package/build/i18n/tr.json +2 -0
- package/build/i18n/tr.json.js +2 -0
- package/build/i18n/tr.json.js.map +1 -1
- package/build/i18n/tr.json.mjs +2 -0
- package/build/i18n/tr.json.mjs.map +1 -1
- package/build/i18n/zh-CN.json +2 -0
- package/build/i18n/zh-CN.json.js +2 -0
- package/build/i18n/zh-CN.json.js.map +1 -1
- package/build/i18n/zh-CN.json.mjs +2 -0
- package/build/i18n/zh-CN.json.mjs.map +1 -1
- package/build/i18n/zh-HK.json +2 -0
- package/build/i18n/zh-HK.json.js +2 -0
- package/build/i18n/zh-HK.json.js.map +1 -1
- package/build/i18n/zh-HK.json.mjs +2 -0
- package/build/i18n/zh-HK.json.mjs.map +1 -1
- package/build/iconButton/IconButton.js.map +1 -1
- package/build/iconButton/IconButton.mjs.map +1 -1
- package/build/image/Image.js.map +1 -1
- package/build/image/Image.mjs.map +1 -1
- package/build/index.js +2 -4
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -2
- package/build/index.mjs.map +1 -1
- package/build/legacylistItem/List.js +17 -0
- package/build/legacylistItem/List.js.map +1 -0
- package/build/legacylistItem/List.mjs +15 -0
- package/build/legacylistItem/List.mjs.map +1 -0
- package/build/main.css +2 -774
- package/build/styles/avatarView/AvatarView.css +1 -3
- package/build/styles/button/Button.css +1 -1
- package/build/styles/main.css +2 -774
- package/build/switch/Switch.js +1 -3
- package/build/switch/Switch.js.map +1 -1
- package/build/switch/Switch.mjs +1 -3
- package/build/switch/Switch.mjs.map +1 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/Button.types.d.ts +1 -1
- package/build/types/button/Button.types.d.ts.map +1 -1
- package/build/types/button/index.d.ts +1 -1
- package/build/types/button/index.d.ts.map +1 -1
- package/build/types/common/RadioButton/RadioButton.d.ts +1 -3
- package/build/types/common/RadioButton/RadioButton.d.ts.map +1 -1
- package/build/types/common/initials.d.ts.map +1 -1
- package/build/types/iconButton/IconButton.d.ts +2 -2
- package/build/types/iconButton/IconButton.d.ts.map +1 -1
- package/build/types/image/Image.d.ts +0 -3
- package/build/types/image/Image.d.ts.map +1 -1
- package/build/types/image/index.d.ts +0 -1
- package/build/types/image/index.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -6
- package/build/types/index.d.ts.map +1 -1
- package/build/types/legacylistItem/List.d.ts +6 -0
- package/build/types/legacylistItem/List.d.ts.map +1 -0
- package/build/types/legacylistItem/index.d.ts +2 -0
- package/build/types/legacylistItem/index.d.ts.map +1 -1
- package/build/types/switch/Switch.d.ts +1 -3
- package/build/types/switch/Switch.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/avatarView/AvatarView.css +1 -3
- package/src/avatarView/AvatarView.less +1 -2
- package/src/button/Button.css +1 -1
- package/src/button/Button.less +1 -1
- package/src/button/Button.spec.tsx +0 -18
- package/src/button/Button.story.tsx +9 -4
- package/src/button/Button.tsx +1 -5
- package/src/button/Button.types.ts +1 -1
- package/src/button/index.ts +1 -1
- package/src/checkboxButton/CheckboxButton.story.tsx +4 -4
- package/src/common/RadioButton/RadioButton.tsx +1 -6
- package/src/common/initials.spec.tsx +13 -0
- package/src/common/initials.ts +5 -0
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +1 -1
- package/src/i18n/de.json +2 -0
- package/src/i18n/fr.json +2 -0
- package/src/i18n/hu.json +2 -0
- package/src/i18n/it.json +2 -0
- package/src/i18n/ja.json +2 -0
- package/src/i18n/pl.json +2 -0
- package/src/i18n/pt.json +2 -0
- package/src/i18n/ro.json +2 -0
- package/src/i18n/ru.json +2 -0
- package/src/i18n/tr.json +2 -0
- package/src/i18n/zh-CN.json +2 -0
- package/src/i18n/zh-HK.json +2 -0
- package/src/iconButton/IconButton.story.tsx +1 -1
- package/src/iconButton/IconButton.tsx +1 -1
- package/src/image/Image.tsx +0 -3
- package/src/image/index.ts +0 -1
- package/src/index.ts +2 -6
- package/src/legacylistItem/LegacyListItem.story.tsx +2 -2
- package/src/legacylistItem/LegacyListItem.tests.story.tsx +1 -2
- package/src/legacylistItem/List.tsx +10 -0
- package/src/legacylistItem/index.ts +2 -0
- package/src/main.css +2 -774
- package/src/main.less +0 -1
- package/src/switch/Switch.tsx +2 -6
- package/src/test-utils/Parameters.d.ts +77 -0
- package/build/list/List.js +0 -21
- package/build/list/List.js.map +0 -1
- package/build/list/List.mjs +0 -17
- package/build/list/List.mjs.map +0 -1
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +0 -56
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js.map +0 -1
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +0 -54
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +0 -1
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.js +0 -23
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.js.map +0 -1
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs +0 -21
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs.map +0 -1
- package/build/listItem/AvatarView/ListItemAvatarView.js +0 -23
- package/build/listItem/AvatarView/ListItemAvatarView.js.map +0 -1
- package/build/listItem/AvatarView/ListItemAvatarView.mjs +0 -21
- package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +0 -1
- package/build/listItem/Button/ListItemButton.js +0 -43
- package/build/listItem/Button/ListItemButton.js.map +0 -1
- package/build/listItem/Button/ListItemButton.mjs +0 -41
- package/build/listItem/Button/ListItemButton.mjs.map +0 -1
- package/build/listItem/Checkbox/ListItemCheckbox.js +0 -30
- package/build/listItem/Checkbox/ListItemCheckbox.js.map +0 -1
- package/build/listItem/Checkbox/ListItemCheckbox.mjs +0 -28
- package/build/listItem/Checkbox/ListItemCheckbox.mjs.map +0 -1
- package/build/listItem/IconButton/ListItemIconButton.js +0 -56
- package/build/listItem/IconButton/ListItemIconButton.js.map +0 -1
- package/build/listItem/IconButton/ListItemIconButton.mjs +0 -54
- package/build/listItem/IconButton/ListItemIconButton.mjs.map +0 -1
- package/build/listItem/Image/ListItemImage.js +0 -31
- package/build/listItem/Image/ListItemImage.js.map +0 -1
- package/build/listItem/Image/ListItemImage.mjs +0 -29
- package/build/listItem/Image/ListItemImage.mjs.map +0 -1
- package/build/listItem/ListItem.js +0 -312
- package/build/listItem/ListItem.js.map +0 -1
- package/build/listItem/ListItem.mjs +0 -307
- package/build/listItem/ListItem.mjs.map +0 -1
- package/build/listItem/ListItemContext.js +0 -8
- package/build/listItem/ListItemContext.js.map +0 -1
- package/build/listItem/ListItemContext.mjs +0 -6
- package/build/listItem/ListItemContext.mjs.map +0 -1
- package/build/listItem/Navigation/ListItemNavigation.js +0 -45
- package/build/listItem/Navigation/ListItemNavigation.js.map +0 -1
- package/build/listItem/Navigation/ListItemNavigation.mjs +0 -43
- package/build/listItem/Navigation/ListItemNavigation.mjs.map +0 -1
- package/build/listItem/Prompt/ListItemPrompt.js +0 -59
- package/build/listItem/Prompt/ListItemPrompt.js.map +0 -1
- package/build/listItem/Prompt/ListItemPrompt.mjs +0 -54
- package/build/listItem/Prompt/ListItemPrompt.mjs.map +0 -1
- package/build/listItem/Radio/ListItemRadio.js +0 -30
- package/build/listItem/Radio/ListItemRadio.js.map +0 -1
- package/build/listItem/Radio/ListItemRadio.mjs +0 -28
- package/build/listItem/Radio/ListItemRadio.mjs.map +0 -1
- package/build/listItem/Switch/ListItemSwitch.js +0 -30
- package/build/listItem/Switch/ListItemSwitch.js.map +0 -1
- package/build/listItem/Switch/ListItemSwitch.mjs +0 -28
- package/build/listItem/Switch/ListItemSwitch.mjs.map +0 -1
- package/build/listItem/useListItemControl.js +0 -22
- package/build/listItem/useListItemControl.js.map +0 -1
- package/build/listItem/useListItemControl.mjs +0 -20
- package/build/listItem/useListItemControl.mjs.map +0 -1
- package/build/listItem/useListItemMedia.js +0 -21
- package/build/listItem/useListItemMedia.js.map +0 -1
- package/build/listItem/useListItemMedia.mjs +0 -19
- package/build/listItem/useListItemMedia.mjs.map +0 -1
- package/build/styles/listItem/ListItem.css +0 -770
- package/build/styles/listItem/ListItem.grid.css +0 -370
- package/build/test-utils/assets/placeholder-landscape.svg +0 -1
- package/build/test-utils/assets/placeholder-portrait.svg +0 -1
- package/build/types/list/List.d.ts +0 -10
- package/build/types/list/List.d.ts.map +0 -1
- package/build/types/list/index.d.ts +0 -3
- package/build/types/list/index.d.ts.map +0 -1
- package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts +0 -15
- package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts.map +0 -1
- package/build/types/listItem/AdditionalInfo/index.d.ts +0 -3
- package/build/types/listItem/AdditionalInfo/index.d.ts.map +0 -1
- package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts +0 -18
- package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts.map +0 -1
- package/build/types/listItem/AvatarLayout/index.d.ts +0 -3
- package/build/types/listItem/AvatarLayout/index.d.ts.map +0 -1
- package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts +0 -16
- package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts.map +0 -1
- package/build/types/listItem/AvatarView/index.d.ts +0 -3
- package/build/types/listItem/AvatarView/index.d.ts.map +0 -1
- package/build/types/listItem/Button/ListItemButton.d.ts +0 -20
- package/build/types/listItem/Button/ListItemButton.d.ts.map +0 -1
- package/build/types/listItem/Button/index.d.ts +0 -3
- package/build/types/listItem/Button/index.d.ts.map +0 -1
- package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts +0 -14
- package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts.map +0 -1
- package/build/types/listItem/Checkbox/index.d.ts +0 -3
- package/build/types/listItem/Checkbox/index.d.ts.map +0 -1
- package/build/types/listItem/IconButton/ListItemIconButton.d.ts +0 -18
- package/build/types/listItem/IconButton/ListItemIconButton.d.ts.map +0 -1
- package/build/types/listItem/IconButton/index.d.ts +0 -3
- package/build/types/listItem/IconButton/index.d.ts.map +0 -1
- package/build/types/listItem/Image/ListItemImage.d.ts +0 -25
- package/build/types/listItem/Image/ListItemImage.d.ts.map +0 -1
- package/build/types/listItem/Image/index.d.ts +0 -3
- package/build/types/listItem/Image/index.d.ts.map +0 -1
- package/build/types/listItem/ListItem.d.ts +0 -113
- package/build/types/listItem/ListItem.d.ts.map +0 -1
- package/build/types/listItem/ListItemContext.d.ts +0 -22
- package/build/types/listItem/ListItemContext.d.ts.map +0 -1
- package/build/types/listItem/Navigation/ListItemNavigation.d.ts +0 -15
- package/build/types/listItem/Navigation/ListItemNavigation.d.ts.map +0 -1
- package/build/types/listItem/Navigation/index.d.ts +0 -3
- package/build/types/listItem/Navigation/index.d.ts.map +0 -1
- package/build/types/listItem/Prompt/ListItemPrompt.d.ts +0 -16
- package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +0 -1
- package/build/types/listItem/Prompt/index.d.ts +0 -3
- package/build/types/listItem/Prompt/index.d.ts.map +0 -1
- package/build/types/listItem/Radio/ListItemRadio.d.ts +0 -14
- package/build/types/listItem/Radio/ListItemRadio.d.ts.map +0 -1
- package/build/types/listItem/Radio/index.d.ts +0 -3
- package/build/types/listItem/Radio/index.d.ts.map +0 -1
- package/build/types/listItem/Switch/ListItemSwitch.d.ts +0 -14
- package/build/types/listItem/Switch/ListItemSwitch.d.ts.map +0 -1
- package/build/types/listItem/Switch/index.d.ts +0 -3
- package/build/types/listItem/Switch/index.d.ts.map +0 -1
- package/build/types/listItem/_stories/helpers.d.ts +0 -27
- package/build/types/listItem/_stories/helpers.d.ts.map +0 -1
- package/build/types/listItem/_stories/subcomponents.d.ts +0 -18
- package/build/types/listItem/_stories/subcomponents.d.ts.map +0 -1
- package/build/types/listItem/index.d.ts +0 -14
- package/build/types/listItem/index.d.ts.map +0 -1
- package/build/types/listItem/test-utils.d.ts +0 -7
- package/build/types/listItem/test-utils.d.ts.map +0 -1
- package/build/types/listItem/useListItemControl.d.ts +0 -5
- package/build/types/listItem/useListItemControl.d.ts.map +0 -1
- package/build/types/listItem/useListItemMedia.d.ts +0 -6
- package/build/types/listItem/useListItemMedia.d.ts.map +0 -1
- package/src/list/List.spec.tsx +0 -52
- package/src/list/List.story.tsx +0 -30
- package/src/list/List.tsx +0 -14
- package/src/list/index.ts +0 -2
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.spec.tsx +0 -56
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +0 -198
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.tsx +0 -36
- package/src/listItem/AdditionalInfo/index.ts +0 -2
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.spec.tsx +0 -59
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +0 -124
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.tsx +0 -27
- package/src/listItem/AvatarLayout/index.ts +0 -2
- package/src/listItem/AvatarView/ListItemAvatarView.spec.tsx +0 -75
- package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +0 -339
- package/src/listItem/AvatarView/ListItemAvatarView.tsx +0 -27
- package/src/listItem/AvatarView/index.ts +0 -2
- package/src/listItem/Button/ListItemButton.spec.tsx +0 -68
- package/src/listItem/Button/ListItemButton.story.tsx +0 -473
- package/src/listItem/Button/ListItemButton.tsx +0 -56
- package/src/listItem/Button/index.ts +0 -2
- package/src/listItem/Checkbox/ListItemCheckbox.spec.tsx +0 -82
- package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +0 -128
- package/src/listItem/Checkbox/ListItemCheckbox.tsx +0 -33
- package/src/listItem/Checkbox/index.ts +0 -2
- package/src/listItem/IconButton/ListItemIconButton.spec.tsx +0 -119
- package/src/listItem/IconButton/ListItemIconButton.story.tsx +0 -284
- package/src/listItem/IconButton/ListItemIconButton.tsx +0 -73
- package/src/listItem/IconButton/index.ts +0 -2
- package/src/listItem/Image/ListItemImage.spec.tsx +0 -30
- package/src/listItem/Image/ListItemImage.story.tsx +0 -80
- package/src/listItem/Image/ListItemImage.tsx +0 -46
- package/src/listItem/Image/index.ts +0 -2
- package/src/listItem/ListItem.css +0 -770
- package/src/listItem/ListItem.grid.css +0 -370
- package/src/listItem/ListItem.grid.less +0 -622
- package/src/listItem/ListItem.less +0 -421
- package/src/listItem/ListItem.spec.tsx +0 -1521
- package/src/listItem/ListItem.tsx +0 -447
- package/src/listItem/ListItemContext.tsx +0 -27
- package/src/listItem/Navigation/ListItemNavigation.spec.tsx +0 -59
- package/src/listItem/Navigation/ListItemNavigation.story.tsx +0 -112
- package/src/listItem/Navigation/ListItemNavigation.tsx +0 -40
- package/src/listItem/Navigation/index.ts +0 -2
- package/src/listItem/Prompt/ListItemPrompt.spec.tsx +0 -36
- package/src/listItem/Prompt/ListItemPrompt.story.tsx +0 -204
- package/src/listItem/Prompt/ListItemPrompt.tsx +0 -32
- package/src/listItem/Prompt/index.ts +0 -2
- package/src/listItem/Radio/ListItemRadio.spec.tsx +0 -66
- package/src/listItem/Radio/ListItemRadio.story.tsx +0 -111
- package/src/listItem/Radio/ListItemRadio.tsx +0 -33
- package/src/listItem/Radio/index.ts +0 -2
- package/src/listItem/Switch/ListItemSwitch.spec.tsx +0 -47
- package/src/listItem/Switch/ListItemSwitch.story.tsx +0 -79
- package/src/listItem/Switch/ListItemSwitch.tsx +0 -33
- package/src/listItem/Switch/index.ts +0 -2
- package/src/listItem/_stories/ListItem.focus.test.story.tsx +0 -265
- package/src/listItem/_stories/ListItem.layout.test.story.tsx +0 -354
- package/src/listItem/_stories/ListItem.scenarios.story.tsx +0 -228
- package/src/listItem/_stories/ListItem.story.tsx +0 -775
- package/src/listItem/_stories/ListItem.variants.test.story.tsx +0 -271
- package/src/listItem/_stories/helpers.tsx +0 -53
- package/src/listItem/_stories/subcomponents.tsx +0 -139
- package/src/listItem/index.ts +0 -14
- package/src/listItem/test-utils.tsx +0 -33
- package/src/listItem/useListItemControl.tsx +0 -18
- package/src/listItem/useListItemMedia.tsx +0 -13
- package/src/test-utils/assets/placeholder-landscape.svg +0 -1
- package/src/test-utils/assets/placeholder-portrait.svg +0 -1
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { fn } from 'storybook/test';
|
|
3
|
-
import { action } from 'storybook/actions';
|
|
4
|
-
import { lorem20 } from '../../test-utils';
|
|
5
|
-
import List from '../../list';
|
|
6
|
-
import { ListItem } from '../ListItem';
|
|
7
|
-
import {
|
|
8
|
-
SB_LIST_ITEM_CONTROLS as CONTROLS,
|
|
9
|
-
SB_LIST_ITEM_MEDIA as MEDIA,
|
|
10
|
-
} from '../_stories/subcomponents';
|
|
11
|
-
import { disableControls } from '../_stories/helpers';
|
|
12
|
-
import type { ListItemAdditionalInfoProps } from './ListItemAdditionalInfo';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Use additional information to add extra details that help make the information clearer for users. Use additional information only after you've used the subtitle.
|
|
16
|
-
*
|
|
17
|
-
* Refer to the [design documentation](https://wise.design/components/list-item#content:~:text=StatusIcon.iconLabel.error-,Additional%20information,-Use%20additional%20information) for more details.
|
|
18
|
-
*/
|
|
19
|
-
export default {
|
|
20
|
-
component: ListItem.AdditionalInfo,
|
|
21
|
-
title: 'Content/ListItem/ListItem.AdditionalInfo',
|
|
22
|
-
parameters: {
|
|
23
|
-
docs: {
|
|
24
|
-
toc: true,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
args: {
|
|
28
|
-
children: lorem20,
|
|
29
|
-
},
|
|
30
|
-
argTypes: {
|
|
31
|
-
children: {
|
|
32
|
-
table: {
|
|
33
|
-
type: { summary: 'ReactNode' },
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
action: {
|
|
37
|
-
table: {
|
|
38
|
-
type: { summary: `{ label: string } & Pick<LinkProps, 'href' | 'onClick' | 'target'>` },
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
} satisfies Meta<ListItemAdditionalInfoProps>;
|
|
43
|
-
|
|
44
|
-
type Story = StoryObj<ListItemAdditionalInfoProps>;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Convenience controls for previewing rich markup,
|
|
48
|
-
* not otherwise possible via Storybook
|
|
49
|
-
*/
|
|
50
|
-
type PreviewStoryArgs = ListItemAdditionalInfoProps & {
|
|
51
|
-
previewAction?: string | ListItemAdditionalInfoProps['action'];
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const previewArgGroup = {
|
|
55
|
-
category: 'Preview options',
|
|
56
|
-
type: {
|
|
57
|
-
summary: undefined,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const previewArgTypes = {
|
|
62
|
-
previewAction: {
|
|
63
|
-
name: 'Preview `action`',
|
|
64
|
-
control: 'radio',
|
|
65
|
-
options: ['unset (undefined)', 'link', 'button'],
|
|
66
|
-
mapping: {
|
|
67
|
-
'unset (undefined)': undefined,
|
|
68
|
-
link: {
|
|
69
|
-
label: 'Details about the subject.',
|
|
70
|
-
href: 'https://wise.com',
|
|
71
|
-
target: '_blank',
|
|
72
|
-
},
|
|
73
|
-
button: {
|
|
74
|
-
label: 'Details about the subject.',
|
|
75
|
-
onClick: fn(),
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
table: previewArgGroup,
|
|
79
|
-
},
|
|
80
|
-
} as const;
|
|
81
|
-
|
|
82
|
-
export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
83
|
-
tags: ['!autodocs'],
|
|
84
|
-
argTypes: previewArgTypes,
|
|
85
|
-
args: {
|
|
86
|
-
children: lorem20,
|
|
87
|
-
previewAction: 'link',
|
|
88
|
-
},
|
|
89
|
-
render: (args: PreviewStoryArgs) => {
|
|
90
|
-
const { previewAction, ...props } = args as {
|
|
91
|
-
previewAction: ListItemAdditionalInfoProps['action'];
|
|
92
|
-
props: ListItemAdditionalInfoProps;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<List>
|
|
97
|
-
<ListItem
|
|
98
|
-
title="List item title"
|
|
99
|
-
subtitle="Subtitle goes here"
|
|
100
|
-
media={MEDIA.avatarSingle}
|
|
101
|
-
control={CONTROLS.partialButton}
|
|
102
|
-
additionalInfo={<ListItem.AdditionalInfo {...props} action={previewAction} />}
|
|
103
|
-
/>
|
|
104
|
-
</List>
|
|
105
|
-
);
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Fully interactive ListItems do not allow for any nested links or inline buttons as that would fail accessibility compliance.
|
|
111
|
-
*
|
|
112
|
-
* Non-interactive or partially-interactive ListItems allow appending a single link or inline button via `action` prop. The restriction has been introduced to ensure that the ListItem remains accessible and adheres to the vendors' best practices for mobile platforms.
|
|
113
|
-
*/
|
|
114
|
-
export const Interactivity: Story = {
|
|
115
|
-
args: {
|
|
116
|
-
action: {
|
|
117
|
-
label: 'Details about the subject.',
|
|
118
|
-
href: 'https://wise.com',
|
|
119
|
-
target: '_blank',
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
argTypes: disableControls()(['action']),
|
|
123
|
-
render: (args: ListItemAdditionalInfoProps) => {
|
|
124
|
-
return (
|
|
125
|
-
<List>
|
|
126
|
-
<ListItem
|
|
127
|
-
title="Fully interactive ListItem"
|
|
128
|
-
subtitle="Subtitle goes here"
|
|
129
|
-
media={MEDIA.avatarSingle}
|
|
130
|
-
control={CONTROLS.button}
|
|
131
|
-
additionalInfo={<ListItem.AdditionalInfo {...args} action={undefined} />}
|
|
132
|
-
/>
|
|
133
|
-
|
|
134
|
-
<ListItem
|
|
135
|
-
title="Partially interactive ListItem"
|
|
136
|
-
subtitle="Subtitle goes here"
|
|
137
|
-
media={MEDIA.avatarSingle}
|
|
138
|
-
control={CONTROLS.partialButton}
|
|
139
|
-
additionalInfo={<ListItem.AdditionalInfo {...args} />}
|
|
140
|
-
/>
|
|
141
|
-
|
|
142
|
-
<ListItem
|
|
143
|
-
title="Non-interactive ListItem"
|
|
144
|
-
subtitle="Subtitle goes here"
|
|
145
|
-
media={MEDIA.avatarSingle}
|
|
146
|
-
additionalInfo={<ListItem.AdditionalInfo {...args} />}
|
|
147
|
-
/>
|
|
148
|
-
</List>
|
|
149
|
-
);
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Interactive `ListItem.AdditionalInfo` allows for 2 types of actions: a link or a button.
|
|
155
|
-
*/
|
|
156
|
-
export const Actions: Story = {
|
|
157
|
-
argTypes: disableControls()(['action']),
|
|
158
|
-
render: (args: ListItemAdditionalInfoProps) => {
|
|
159
|
-
return (
|
|
160
|
-
<List>
|
|
161
|
-
<ListItem
|
|
162
|
-
title="Partially interactive ListItem"
|
|
163
|
-
subtitle="Subtitle goes here"
|
|
164
|
-
media={MEDIA.avatarSingle}
|
|
165
|
-
control={CONTROLS.partialButton}
|
|
166
|
-
additionalInfo={
|
|
167
|
-
<ListItem.AdditionalInfo
|
|
168
|
-
{...args}
|
|
169
|
-
action={{
|
|
170
|
-
label: 'I am a link.',
|
|
171
|
-
href: 'https://wise.com',
|
|
172
|
-
target: '_blank',
|
|
173
|
-
}}
|
|
174
|
-
/>
|
|
175
|
-
}
|
|
176
|
-
/>
|
|
177
|
-
|
|
178
|
-
<ListItem
|
|
179
|
-
title="Partially interactive ListItem"
|
|
180
|
-
subtitle="Subtitle goes here"
|
|
181
|
-
media={MEDIA.avatarSingle}
|
|
182
|
-
control={CONTROLS.partialButton}
|
|
183
|
-
additionalInfo={
|
|
184
|
-
<ListItem.AdditionalInfo
|
|
185
|
-
{...args}
|
|
186
|
-
action={{
|
|
187
|
-
label: 'I am a button.',
|
|
188
|
-
onClick: () => {
|
|
189
|
-
action('Button clicked')();
|
|
190
|
-
},
|
|
191
|
-
}}
|
|
192
|
-
/>
|
|
193
|
-
}
|
|
194
|
-
/>
|
|
195
|
-
</List>
|
|
196
|
-
);
|
|
197
|
-
},
|
|
198
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren, useContext } from 'react';
|
|
2
|
-
import { ListItemContext, type ListItemContextData } from '../ListItemContext';
|
|
3
|
-
import Body from '../../body';
|
|
4
|
-
import Link, { LinkProps } from '../../link';
|
|
5
|
-
import { Typography } from '../../common';
|
|
6
|
-
|
|
7
|
-
export type ListItemAdditionalInfoProps = PropsWithChildren<{
|
|
8
|
-
/**
|
|
9
|
-
* Props object to be passed to the [Link](https://storybook.wise.design/?path=/docs/typography-link--docs) component.
|
|
10
|
-
*/
|
|
11
|
-
action?: { label: string } & Pick<LinkProps, 'href' | 'onClick' | 'target'>;
|
|
12
|
-
}>;
|
|
13
|
-
|
|
14
|
-
export const AdditionalInfo = function ({ children, action }: ListItemAdditionalInfoProps) {
|
|
15
|
-
const { ids } = useContext<ListItemContextData>(ListItemContext);
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Body
|
|
19
|
-
type={Typography.BODY_DEFAULT}
|
|
20
|
-
id={ids.additionalInfo}
|
|
21
|
-
className="wds-list-item-additional-info"
|
|
22
|
-
>
|
|
23
|
-
{children}
|
|
24
|
-
{action ? (
|
|
25
|
-
<>
|
|
26
|
-
{' '}
|
|
27
|
-
<Link href={action.href} target={action.target} onClick={action.onClick}>
|
|
28
|
-
{action.label}
|
|
29
|
-
</Link>
|
|
30
|
-
</>
|
|
31
|
-
) : null}
|
|
32
|
-
</Body>
|
|
33
|
-
);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
AdditionalInfo.displayName = 'ListItem.AdditionalInfo';
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { mockMatchMedia, render, screen } from '../../test-utils';
|
|
2
|
-
import { ListItem, type Props as ListItemProps } from '../ListItem';
|
|
3
|
-
|
|
4
|
-
mockMatchMedia();
|
|
5
|
-
|
|
6
|
-
const avatars = [
|
|
7
|
-
{ imgSrc: 'avatar1.jpg', profileName: 'User 1' },
|
|
8
|
-
{ imgSrc: 'avatar2.jpg', profileName: 'User 2' },
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
const renderWithMedia = (media: ListItemProps['media']) =>
|
|
12
|
-
render(<ListItem title="Test Title" media={media} />);
|
|
13
|
-
|
|
14
|
-
describe('ListItem.AvatarLayout', () => {
|
|
15
|
-
it('applies custom className alongside default class', () => {
|
|
16
|
-
renderWithMedia(
|
|
17
|
-
<ListItem.AvatarLayout
|
|
18
|
-
className="custom-class"
|
|
19
|
-
role="group"
|
|
20
|
-
aria-label="Custom avatar group"
|
|
21
|
-
avatars={avatars}
|
|
22
|
-
/>,
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
expect(screen.getByRole('group', { name: 'Custom avatar group' })).toHaveClass('custom-class');
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('renders both avatars', () => {
|
|
29
|
-
renderWithMedia(<ListItem.AvatarLayout avatars={avatars} />);
|
|
30
|
-
|
|
31
|
-
const images = screen.getAllByRole('presentation');
|
|
32
|
-
expect(images).toHaveLength(avatars.length);
|
|
33
|
-
expect(images[0]).toHaveAttribute('src', avatars[0].imgSrc);
|
|
34
|
-
expect(images[1]).toHaveAttribute('src', avatars[1].imgSrc);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('renders with single avatar', () => {
|
|
38
|
-
renderWithMedia(<ListItem.AvatarLayout avatars={[avatars[0]]} />);
|
|
39
|
-
expect(screen.getByRole('presentation')).toHaveAttribute('src', avatars[0].imgSrc);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('handles empty avatars array', () => {
|
|
43
|
-
renderWithMedia(<ListItem.AvatarLayout avatars={[]} />);
|
|
44
|
-
expect(screen.queryByRole('img')).not.toBeInTheDocument();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('supports accessibility props', () => {
|
|
48
|
-
renderWithMedia(<ListItem.AvatarLayout aria-label="User avatars" avatars={avatars} />);
|
|
49
|
-
expect(screen.getByLabelText('User avatars')).toBeInTheDocument();
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('passes through role', () => {
|
|
53
|
-
renderWithMedia(
|
|
54
|
-
<ListItem.AvatarLayout role="group" aria-label="Avatar group" avatars={avatars} />,
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
expect(screen.getByRole('group', { name: 'Avatar group' })).toBeInTheDocument();
|
|
58
|
-
});
|
|
59
|
-
});
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import { Flag } from '@wise/art';
|
|
3
|
-
import { lorem10 } from '../../test-utils';
|
|
4
|
-
import { ListItem } from '../ListItem';
|
|
5
|
-
import List from '../../list';
|
|
6
|
-
import {
|
|
7
|
-
SB_LIST_ITEM_ADDITIONAL_INFO as INFO,
|
|
8
|
-
SB_LIST_ITEM_CONTROLS as CONTROLS,
|
|
9
|
-
} from '../_stories/subcomponents';
|
|
10
|
-
import { disableControls } from '../_stories/helpers';
|
|
11
|
-
import { ListItemAvatarLayoutProps } from './ListItemAvatarLayout';
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
component: ListItem.AvatarLayout,
|
|
15
|
-
title: 'Content/ListItem/ListItem.AvatarLayout',
|
|
16
|
-
parameters: {
|
|
17
|
-
docs: {
|
|
18
|
-
toc: true,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
args: {
|
|
22
|
-
avatars: [{ asset: <Flag code="gb" /> }, { asset: <Flag code="eur" /> }],
|
|
23
|
-
orientation: 'horizontal',
|
|
24
|
-
size: 48,
|
|
25
|
-
},
|
|
26
|
-
argTypes: {
|
|
27
|
-
avatars: {
|
|
28
|
-
description: 'Array of avatar objects with asset and optional styling properties',
|
|
29
|
-
table: {
|
|
30
|
-
type: { summary: 'SingleAvatarType[]' },
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
orientation: {
|
|
34
|
-
control: 'inline-radio',
|
|
35
|
-
options: ['horizontal', 'diagonal'],
|
|
36
|
-
description: 'Layout orientation for multiple avatars',
|
|
37
|
-
},
|
|
38
|
-
size: {
|
|
39
|
-
control: 'select',
|
|
40
|
-
options: [32, 40, 48, 56, 72],
|
|
41
|
-
description: 'Size of the avatar layout',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
} satisfies Meta<ListItemAvatarLayoutProps>;
|
|
45
|
-
|
|
46
|
-
type Story = StoryObj<ListItemAvatarLayoutProps>;
|
|
47
|
-
|
|
48
|
-
export const Playground: Story = {
|
|
49
|
-
tags: ['!autodocs'],
|
|
50
|
-
render: (args: ListItemAvatarLayoutProps) => {
|
|
51
|
-
return (
|
|
52
|
-
<List>
|
|
53
|
-
<ListItem
|
|
54
|
-
title="Transfer from GBP to EUR"
|
|
55
|
-
subtitle="Currency exchange"
|
|
56
|
-
media={<ListItem.AvatarLayout {...args} />}
|
|
57
|
-
control={CONTROLS.iconButton}
|
|
58
|
-
additionalInfo={INFO.nonInteractive}
|
|
59
|
-
/>
|
|
60
|
-
</List>
|
|
61
|
-
);
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* AvatarLayout supports two orientations: horizontal (default) and diagonal. <br />
|
|
67
|
-
* Please refer to the [design documentation](https://wise.design/components/avatar#double) for more details.
|
|
68
|
-
*/
|
|
69
|
-
export const Orientations: Story = {
|
|
70
|
-
argTypes: disableControls()(['orientation']),
|
|
71
|
-
render: (args) => {
|
|
72
|
-
return (
|
|
73
|
-
<List>
|
|
74
|
-
<ListItem
|
|
75
|
-
title="Horizontal orientation"
|
|
76
|
-
subtitle={lorem10}
|
|
77
|
-
media={<ListItem.AvatarLayout {...args} orientation="horizontal" />}
|
|
78
|
-
control={CONTROLS.iconButton}
|
|
79
|
-
/>
|
|
80
|
-
|
|
81
|
-
<ListItem
|
|
82
|
-
title="Diagonal orientation"
|
|
83
|
-
subtitle={lorem10}
|
|
84
|
-
media={<ListItem.AvatarLayout {...args} orientation="diagonal" />}
|
|
85
|
-
control={CONTROLS.iconButton}
|
|
86
|
-
/>
|
|
87
|
-
</List>
|
|
88
|
-
);
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* AvatarLayout supports various sizes to fit different list item contexts.
|
|
94
|
-
*/
|
|
95
|
-
export const Sizes: Story = {
|
|
96
|
-
parameters: {
|
|
97
|
-
docs: {
|
|
98
|
-
canvas: {
|
|
99
|
-
sourceState: 'hidden',
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
argTypes: disableControls()(['size', 'orientation']),
|
|
104
|
-
render: (args) => {
|
|
105
|
-
const sizes = [32, 40, 48, 56, 72] as const;
|
|
106
|
-
const orientations = ['horizontal', 'diagonal'] as const;
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<List>
|
|
110
|
-
{orientations.map((orientation) =>
|
|
111
|
-
sizes.map((size) => (
|
|
112
|
-
<ListItem
|
|
113
|
-
key={`${orientation}-${size}`}
|
|
114
|
-
title={`Size ${size}`}
|
|
115
|
-
subtitle={lorem10}
|
|
116
|
-
media={<ListItem.AvatarLayout {...args} size={size} orientation={orientation} />}
|
|
117
|
-
control={CONTROLS.iconButton}
|
|
118
|
-
/>
|
|
119
|
-
)),
|
|
120
|
-
)}
|
|
121
|
-
</List>
|
|
122
|
-
);
|
|
123
|
-
},
|
|
124
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import AvatarLayoutComp, { type AvatarLayoutProps } from '../../avatarLayout';
|
|
2
|
-
import { clsx } from 'clsx';
|
|
3
|
-
import { useListItemMedia } from '../useListItemMedia';
|
|
4
|
-
|
|
5
|
-
type SizeProp = { size?: 32 | 40 | 48 | 56 | 72 };
|
|
6
|
-
|
|
7
|
-
export type ListItemAvatarLayoutProps = Omit<AvatarLayoutProps, 'size' | 'interactive'> & SizeProp;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* This component allows for rendering 2 avatars. It's a thin wrapper around the
|
|
11
|
-
* [AvatarLayout component](https://storybook.wise.design/?path=/docs/content-avatarlayout--docs), but offers only
|
|
12
|
-
* a subset of its sizes, and disallows interactive mode, in line with the ListItem's constraints. <br />
|
|
13
|
-
* <br />
|
|
14
|
-
* Please refer to the [Design documentation](https://wise.design/components/list-item#avatar) for details.
|
|
15
|
-
*/
|
|
16
|
-
export const AvatarLayout = ({ className, size = 48, ...props }: ListItemAvatarLayoutProps) => {
|
|
17
|
-
useListItemMedia(size);
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<AvatarLayoutComp
|
|
21
|
-
{...props}
|
|
22
|
-
size={size}
|
|
23
|
-
className={clsx('wds-list-item-media-avatar-layout', className)}
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
AvatarLayout.displayName = 'ListItem.AvatarLayout';
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { mockMatchMedia, render, screen } from '../../test-utils';
|
|
2
|
-
import { ListItem, type Props as ListItemProps } from '../ListItem';
|
|
3
|
-
|
|
4
|
-
mockMatchMedia();
|
|
5
|
-
|
|
6
|
-
const baseProps = {
|
|
7
|
-
title: 'Test Title',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const avatarProps = {
|
|
11
|
-
imgSrc: 'avatar.jpg',
|
|
12
|
-
profileName: 'User Avatar',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const renderWithMedia = (media: ListItemProps['media']) =>
|
|
16
|
-
render(<ListItem title={baseProps.title} media={media} />);
|
|
17
|
-
|
|
18
|
-
describe('ListItem.AvatarView', () => {
|
|
19
|
-
it('applies custom className alongside default class', () => {
|
|
20
|
-
const { container } = renderWithMedia(
|
|
21
|
-
<ListItem.AvatarView
|
|
22
|
-
className="custom-class"
|
|
23
|
-
imgSrc={avatarProps.imgSrc}
|
|
24
|
-
profileName={avatarProps.profileName}
|
|
25
|
-
/>,
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
expect(container.querySelector('.custom-class')).toBeInTheDocument();
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('renders avatar with correct image src', () => {
|
|
32
|
-
renderWithMedia(
|
|
33
|
-
<ListItem.AvatarView imgSrc={avatarProps.imgSrc} profileName={avatarProps.profileName} />,
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
expect(screen.getByRole('presentation')).toHaveAttribute('src', avatarProps.imgSrc);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('renders without image when no imgSrc provided', () => {
|
|
40
|
-
renderWithMedia(<ListItem.AvatarView profileName={avatarProps.profileName} />);
|
|
41
|
-
expect(screen.queryByRole('img')).not.toBeInTheDocument();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('supports accessibility props', () => {
|
|
45
|
-
renderWithMedia(
|
|
46
|
-
<ListItem.AvatarView
|
|
47
|
-
imgSrc={avatarProps.imgSrc}
|
|
48
|
-
profileName={avatarProps.profileName}
|
|
49
|
-
aria-label="Profile picture"
|
|
50
|
-
/>,
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
expect(screen.getByLabelText('Profile picture')).toBeInTheDocument();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('passes through role attribute', () => {
|
|
57
|
-
renderWithMedia(
|
|
58
|
-
<ListItem.AvatarView
|
|
59
|
-
imgSrc={avatarProps.imgSrc}
|
|
60
|
-
profileName={avatarProps.profileName}
|
|
61
|
-
role="button"
|
|
62
|
-
aria-label="Profile button"
|
|
63
|
-
/>,
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
expect(screen.getByRole('button', { name: 'Profile button' })).toBeInTheDocument();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('renders initials when no image provided', () => {
|
|
70
|
-
const johnDoeProfile = 'John Doe';
|
|
71
|
-
renderWithMedia(<ListItem.AvatarView profileName={johnDoeProfile} />);
|
|
72
|
-
|
|
73
|
-
expect(screen.getByText('JD')).toBeInTheDocument();
|
|
74
|
-
});
|
|
75
|
-
});
|