@transferwise/components 46.103.0 → 46.104.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/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -0
- package/build/index.mjs.map +1 -1
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js +56 -0
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.js.map +1 -0
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs +54 -0
- package/build/listItem/AdditionalInfo/ListItemAdditionalInfo.mjs.map +1 -0
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.js +23 -0
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.js.map +1 -0
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs +21 -0
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs.map +1 -0
- package/build/listItem/AvatarView/ListItemAvatarView.js +23 -0
- package/build/listItem/AvatarView/ListItemAvatarView.js.map +1 -0
- package/build/listItem/AvatarView/ListItemAvatarView.mjs +21 -0
- package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +1 -0
- package/build/listItem/Button/ListItemButton.js +43 -0
- package/build/listItem/Button/ListItemButton.js.map +1 -0
- package/build/listItem/Button/ListItemButton.mjs +41 -0
- package/build/listItem/Button/ListItemButton.mjs.map +1 -0
- package/build/listItem/Checkbox/ListItemCheckbox.js +30 -0
- package/build/listItem/Checkbox/ListItemCheckbox.js.map +1 -0
- package/build/listItem/Checkbox/ListItemCheckbox.mjs +28 -0
- package/build/listItem/Checkbox/ListItemCheckbox.mjs.map +1 -0
- package/build/listItem/IconButton/ListItemIconButton.js +56 -0
- package/build/listItem/IconButton/ListItemIconButton.js.map +1 -0
- package/build/listItem/IconButton/ListItemIconButton.mjs +54 -0
- package/build/listItem/IconButton/ListItemIconButton.mjs.map +1 -0
- package/build/listItem/Image/ListItemImage.js +31 -0
- package/build/listItem/Image/ListItemImage.js.map +1 -0
- package/build/listItem/Image/ListItemImage.mjs +29 -0
- package/build/listItem/Image/ListItemImage.mjs.map +1 -0
- package/build/listItem/ListItem.js +309 -0
- package/build/listItem/ListItem.js.map +1 -0
- package/build/listItem/ListItem.mjs +304 -0
- package/build/listItem/ListItem.mjs.map +1 -0
- package/build/listItem/ListItemContext.js +8 -0
- package/build/listItem/ListItemContext.js.map +1 -0
- package/build/listItem/ListItemContext.mjs +6 -0
- package/build/listItem/ListItemContext.mjs.map +1 -0
- package/build/listItem/Navigation/ListItemNavigation.js +44 -0
- package/build/listItem/Navigation/ListItemNavigation.js.map +1 -0
- package/build/listItem/Navigation/ListItemNavigation.mjs +42 -0
- package/build/listItem/Navigation/ListItemNavigation.mjs.map +1 -0
- package/build/listItem/Prompt/ListItemPrompt.js +59 -0
- package/build/listItem/Prompt/ListItemPrompt.js.map +1 -0
- package/build/listItem/Prompt/ListItemPrompt.mjs +54 -0
- package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -0
- package/build/listItem/Radio/ListItemRadio.js +30 -0
- package/build/listItem/Radio/ListItemRadio.js.map +1 -0
- package/build/listItem/Radio/ListItemRadio.mjs +28 -0
- package/build/listItem/Radio/ListItemRadio.mjs.map +1 -0
- package/build/listItem/Switch/ListItemSwitch.js +30 -0
- package/build/listItem/Switch/ListItemSwitch.js.map +1 -0
- package/build/listItem/Switch/ListItemSwitch.mjs +28 -0
- package/build/listItem/Switch/ListItemSwitch.mjs.map +1 -0
- package/build/listItem/useListItemControl.js +22 -0
- package/build/listItem/useListItemControl.js.map +1 -0
- package/build/listItem/useListItemControl.mjs +20 -0
- package/build/listItem/useListItemControl.mjs.map +1 -0
- package/build/listItem/useListItemMedia.js +21 -0
- package/build/listItem/useListItemMedia.js.map +1 -0
- package/build/listItem/useListItemMedia.mjs +19 -0
- package/build/listItem/useListItemMedia.mjs.map +1 -0
- package/build/main.css +771 -1
- package/build/styles/button/Button.css +1 -1
- package/build/styles/listItem/ListItem.css +770 -0
- package/build/styles/listItem/ListItem.grid.css +370 -0
- package/build/styles/listItem/Prompt/ListItemPrompt.css +157 -0
- package/build/styles/main.css +771 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts +15 -0
- package/build/types/listItem/AdditionalInfo/ListItemAdditionalInfo.d.ts.map +1 -0
- package/build/types/listItem/AdditionalInfo/index.d.ts +3 -0
- package/build/types/listItem/AdditionalInfo/index.d.ts.map +1 -0
- package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts +18 -0
- package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts.map +1 -0
- package/build/types/listItem/AvatarLayout/index.d.ts +3 -0
- package/build/types/listItem/AvatarLayout/index.d.ts.map +1 -0
- package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts +16 -0
- package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts.map +1 -0
- package/build/types/listItem/AvatarView/index.d.ts +3 -0
- package/build/types/listItem/AvatarView/index.d.ts.map +1 -0
- package/build/types/listItem/Button/ListItemButton.d.ts +20 -0
- package/build/types/listItem/Button/ListItemButton.d.ts.map +1 -0
- package/build/types/listItem/Button/index.d.ts +3 -0
- package/build/types/listItem/Button/index.d.ts.map +1 -0
- package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts +14 -0
- package/build/types/listItem/Checkbox/ListItemCheckbox.d.ts.map +1 -0
- package/build/types/listItem/Checkbox/index.d.ts +3 -0
- package/build/types/listItem/Checkbox/index.d.ts.map +1 -0
- package/build/types/listItem/IconButton/ListItemIconButton.d.ts +18 -0
- package/build/types/listItem/IconButton/ListItemIconButton.d.ts.map +1 -0
- package/build/types/listItem/IconButton/index.d.ts +3 -0
- package/build/types/listItem/IconButton/index.d.ts.map +1 -0
- package/build/types/listItem/Image/ListItemImage.d.ts +25 -0
- package/build/types/listItem/Image/ListItemImage.d.ts.map +1 -0
- package/build/types/listItem/Image/index.d.ts +3 -0
- package/build/types/listItem/Image/index.d.ts.map +1 -0
- package/build/types/listItem/ListItem.d.ts +111 -0
- package/build/types/listItem/ListItem.d.ts.map +1 -0
- package/build/types/listItem/ListItemContext.d.ts +21 -0
- package/build/types/listItem/ListItemContext.d.ts.map +1 -0
- package/build/types/listItem/Navigation/ListItemNavigation.d.ts +15 -0
- package/build/types/listItem/Navigation/ListItemNavigation.d.ts.map +1 -0
- package/build/types/listItem/Navigation/index.d.ts +3 -0
- package/build/types/listItem/Navigation/index.d.ts.map +1 -0
- package/build/types/listItem/Prompt/ListItemPrompt.d.ts +16 -0
- package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -0
- package/build/types/listItem/Prompt/index.d.ts +3 -0
- package/build/types/listItem/Prompt/index.d.ts.map +1 -0
- package/build/types/listItem/Radio/ListItemRadio.d.ts +14 -0
- package/build/types/listItem/Radio/ListItemRadio.d.ts.map +1 -0
- package/build/types/listItem/Radio/index.d.ts +3 -0
- package/build/types/listItem/Radio/index.d.ts.map +1 -0
- package/build/types/listItem/Switch/ListItemSwitch.d.ts +14 -0
- package/build/types/listItem/Switch/ListItemSwitch.d.ts.map +1 -0
- package/build/types/listItem/Switch/index.d.ts +3 -0
- package/build/types/listItem/Switch/index.d.ts.map +1 -0
- package/build/types/listItem/_stories/helpers.d.ts +27 -0
- package/build/types/listItem/_stories/helpers.d.ts.map +1 -0
- package/build/types/listItem/_stories/subcomponents.d.ts +18 -0
- package/build/types/listItem/_stories/subcomponents.d.ts.map +1 -0
- package/build/types/listItem/index.d.ts +14 -0
- package/build/types/listItem/index.d.ts.map +1 -0
- package/build/types/listItem/test-utils.d.ts +7 -0
- package/build/types/listItem/test-utils.d.ts.map +1 -0
- package/build/types/listItem/useListItemControl.d.ts +5 -0
- package/build/types/listItem/useListItemControl.d.ts.map +1 -0
- package/build/types/listItem/useListItemMedia.d.ts +6 -0
- package/build/types/listItem/useListItemMedia.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/actionButton/ActionButton.story.tsx +1 -1
- package/src/avatar/Avatar.story.tsx +1 -1
- package/src/avatarWrapper/AvatarWrapper.story.tsx +1 -1
- package/src/badge/Badge.story.tsx +1 -1
- package/src/button/Button.css +1 -1
- package/src/button/Button.less +1 -1
- package/src/button/Button.story.tsx +95 -9
- package/src/button/LegacyButton.story.tsx +1 -1
- package/src/index.ts +15 -0
- package/src/legacylistItem/LegacyListItem.story.tsx +1 -1
- package/src/legacylistItem/LegacyListItem.tests.story.tsx +2 -1
- package/src/list/List.story.tsx +13 -3
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.spec.tsx +56 -0
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +198 -0
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.tsx +36 -0
- package/src/listItem/AdditionalInfo/index.ts +2 -0
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.spec.tsx +59 -0
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +124 -0
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.tsx +27 -0
- package/src/listItem/AvatarLayout/index.ts +2 -0
- package/src/listItem/AvatarView/ListItemAvatarView.spec.tsx +75 -0
- package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +339 -0
- package/src/listItem/AvatarView/ListItemAvatarView.tsx +27 -0
- package/src/listItem/AvatarView/index.ts +2 -0
- package/src/listItem/Button/ListItemButton.spec.tsx +68 -0
- package/src/listItem/Button/ListItemButton.story.tsx +473 -0
- package/src/listItem/Button/ListItemButton.tsx +56 -0
- package/src/listItem/Button/index.ts +2 -0
- package/src/listItem/Checkbox/ListItemCheckbox.spec.tsx +82 -0
- package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +128 -0
- package/src/listItem/Checkbox/ListItemCheckbox.tsx +33 -0
- package/src/listItem/Checkbox/index.ts +2 -0
- package/src/listItem/IconButton/ListItemIconButton.spec.tsx +119 -0
- package/src/listItem/IconButton/ListItemIconButton.story.tsx +284 -0
- package/src/listItem/IconButton/ListItemIconButton.tsx +73 -0
- package/src/listItem/IconButton/index.ts +2 -0
- package/src/listItem/Image/ListItemImage.spec.tsx +30 -0
- package/src/listItem/Image/ListItemImage.story.tsx +80 -0
- package/src/listItem/Image/ListItemImage.tsx +46 -0
- package/src/listItem/Image/index.ts +2 -0
- package/src/listItem/ListItem.css +770 -0
- package/src/listItem/ListItem.grid.css +370 -0
- package/src/listItem/ListItem.grid.less +622 -0
- package/src/listItem/ListItem.less +287 -0
- package/src/listItem/ListItem.spec.tsx +1511 -0
- package/src/listItem/ListItem.tsx +438 -0
- package/src/listItem/ListItemContext.tsx +26 -0
- package/src/listItem/Navigation/ListItemNavigation.spec.tsx +59 -0
- package/src/listItem/Navigation/ListItemNavigation.story.tsx +112 -0
- package/src/listItem/Navigation/ListItemNavigation.tsx +39 -0
- package/src/listItem/Navigation/index.ts +2 -0
- package/src/listItem/Prompt/ListItemPrompt.css +157 -0
- package/src/listItem/Prompt/ListItemPrompt.less +134 -0
- package/src/listItem/Prompt/ListItemPrompt.spec.tsx +36 -0
- package/src/listItem/Prompt/ListItemPrompt.story.tsx +204 -0
- package/src/listItem/Prompt/ListItemPrompt.tsx +32 -0
- package/src/listItem/Prompt/index.ts +2 -0
- package/src/listItem/Radio/ListItemRadio.spec.tsx +66 -0
- package/src/listItem/Radio/ListItemRadio.story.tsx +111 -0
- package/src/listItem/Radio/ListItemRadio.tsx +33 -0
- package/src/listItem/Radio/index.ts +2 -0
- package/src/listItem/Switch/ListItemSwitch.spec.tsx +47 -0
- package/src/listItem/Switch/ListItemSwitch.story.tsx +79 -0
- package/src/listItem/Switch/ListItemSwitch.tsx +33 -0
- package/src/listItem/Switch/index.ts +2 -0
- package/src/listItem/_stories/ListItem.focus.test.story.tsx +265 -0
- package/src/listItem/_stories/ListItem.layout.test.story.tsx +354 -0
- package/src/listItem/_stories/ListItem.scenarios.story.tsx +228 -0
- package/src/listItem/_stories/ListItem.story.tsx +774 -0
- package/src/listItem/_stories/ListItem.variants.test.story.tsx +271 -0
- package/src/listItem/_stories/helpers.tsx +53 -0
- package/src/listItem/_stories/subcomponents.tsx +139 -0
- package/src/listItem/index.ts +14 -0
- package/src/listItem/test-utils.tsx +33 -0
- package/src/listItem/useListItemControl.tsx +18 -0
- package/src/listItem/useListItemMedia.tsx +16 -0
- package/src/main.css +771 -1
- package/src/main.less +1 -0
- package/src/select/Select.story.tsx +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subcomponents.d.ts","sourceRoot":"","sources":["../../../../src/listItem/_stories/subcomponents.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOlC,MAAM,MAAM,uBAAuB,GAC/B,QAAQ,GACR,cAAc,GACd,eAAe,GACf,qBAAqB,GACrB,YAAY,GACZ,kBAAkB,GAClB,qBAAqB,GACrB,2BAA2B,GAC3B,mBAAmB,GACnB,yBAAyB,GACzB,4BAA4B,GAC5B,kCAAkC,GAClC,YAAY,GACZ,oBAAoB,GACpB,UAAU,GACV,OAAO,GACP,QAAQ,CAAC;AAEb,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,uBAAuB,EAAE,SAAS,CA0DnE,CAAC;AAEX,eAAO,MAAM,4BAA4B;;;CAe/B,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;CAavB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;CAoBrB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type { ListItemProps } from './ListItem';
|
|
2
|
+
export type { ListItemAdditionalInfoProps } from './AdditionalInfo';
|
|
3
|
+
export type { ListItemAvatarLayoutProps } from './AvatarLayout';
|
|
4
|
+
export type { ListItemAvatarViewProps } from './AvatarView';
|
|
5
|
+
export type { ListItemButtonProps } from './Button';
|
|
6
|
+
export type { ListItemCheckboxProps } from './Checkbox';
|
|
7
|
+
export type { ListItemIconButtonProps } from './IconButton';
|
|
8
|
+
export type { ListItemImageProps } from './Image';
|
|
9
|
+
export type { ListItemNavigationProps } from './Navigation';
|
|
10
|
+
export type { ListItemPromptProps } from './Prompt';
|
|
11
|
+
export type { ListItemRadioProps } from './Radio';
|
|
12
|
+
export type { ListItemSwitchProps } from './Switch';
|
|
13
|
+
export { default } from './ListItem';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/listItem/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AACpE,YAAY,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAChE,YAAY,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,YAAY,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type RenderResult } from '../test-utils';
|
|
2
|
+
export declare const mockSetControlType: jest.Mock<any, any, any>;
|
|
3
|
+
export declare const mockSetControlProps: jest.Mock<any, any, any>;
|
|
4
|
+
export declare const mockSetMediaSize: jest.Mock<any, any, any>;
|
|
5
|
+
export declare const renderWithListItemContext: (ui: React.ReactNode) => RenderResult;
|
|
6
|
+
export declare const clearListItemMocks: () => void;
|
|
7
|
+
//# sourceMappingURL=test-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../src/listItem/test-utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAG1D,eAAO,MAAM,kBAAkB,0BAAY,CAAC;AAC5C,eAAO,MAAM,mBAAmB,0BAAY,CAAC;AAC7C,eAAO,MAAM,gBAAgB,0BAAY,CAAC;AAE1C,eAAO,MAAM,yBAAyB,GAAI,IAAI,KAAK,CAAC,SAAS,KAAG,YAqB/D,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAE9B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ListItemTypes, ListItemControlProps } from './ListItem';
|
|
2
|
+
export declare function useListItemControl(controlType: ListItemTypes, controlProps: ListItemControlProps): {
|
|
3
|
+
baseItemProps: Pick<import("./ListItem").ListItemProps, "disabled" | "inverted">;
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=useListItemControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useListItemControl.d.ts","sourceRoot":"","sources":["../../../src/listItem/useListItemControl.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEtE,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB;;EAahG"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ListItemMediaSize } from './ListItemContext';
|
|
2
|
+
export declare function useListItemMedia(size?: ListItemMediaSize): {
|
|
3
|
+
mediaSize: ListItemMediaSize | undefined;
|
|
4
|
+
setMediaSize: (size: ListItemMediaSize | undefined) => void;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=useListItemMedia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useListItemMedia.d.ts","sourceRoot":"","sources":["../../../src/listItem/useListItemMedia.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,iBAAiB;;;EAQxD"}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ import ActionButton from './ActionButton';
|
|
|
13
13
|
export default {
|
|
14
14
|
component: ActionButton,
|
|
15
15
|
title: 'Actions/ActionButton',
|
|
16
|
-
tags: ['deprecated'],
|
|
16
|
+
tags: ['wds:deprecated'],
|
|
17
17
|
} satisfies Meta<typeof ActionButton>;
|
|
18
18
|
|
|
19
19
|
type Story = StoryObj<typeof ActionButton>;
|
|
@@ -10,7 +10,7 @@ import AvatarWrapper from './AvatarWrapper';
|
|
|
10
10
|
export default {
|
|
11
11
|
component: AvatarWrapper,
|
|
12
12
|
title: 'Content/AvatarWrapper',
|
|
13
|
-
tags: ['deprecated'],
|
|
13
|
+
tags: ['wds:deprecated'],
|
|
14
14
|
} satisfies Meta<typeof AvatarWrapper>;
|
|
15
15
|
|
|
16
16
|
type Story = StoryObj<typeof AvatarWrapper>;
|
package/src/button/Button.css
CHANGED
package/src/button/Button.less
CHANGED
|
@@ -4,7 +4,7 @@ import { Freeze, ArrowRight, ChevronRight } from '@transferwise/icons';
|
|
|
4
4
|
import { Flag } from '@wise/art';
|
|
5
5
|
import Button from './Button.resolver';
|
|
6
6
|
import type { ButtonProps, ButtonPriority } from './Button.types';
|
|
7
|
-
import { lorem20, storyConfig } from '../test-utils';
|
|
7
|
+
import { lorem10, lorem20, storyConfig } from '../test-utils';
|
|
8
8
|
|
|
9
9
|
const withContainer = (Story: any) => (
|
|
10
10
|
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
|
@@ -152,6 +152,7 @@ const getPropsForPreview = (args: PreviewStoryArgs) => {
|
|
|
152
152
|
const meta: Meta<typeof Button> = {
|
|
153
153
|
component: Button,
|
|
154
154
|
title: 'Actions/Button',
|
|
155
|
+
tags: ['wds:new'],
|
|
155
156
|
argTypes: {
|
|
156
157
|
v2: {
|
|
157
158
|
table: {
|
|
@@ -503,14 +504,9 @@ export const DisplayBlock: StoryObj<PreviewStoryArgs> = {
|
|
|
503
504
|
const [props, previewProps] = getPropsForPreview(args);
|
|
504
505
|
|
|
505
506
|
return (
|
|
506
|
-
<
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
</Button>
|
|
510
|
-
<Button {...props} {...previewProps}>
|
|
511
|
-
{lorem20}
|
|
512
|
-
</Button>
|
|
513
|
-
</div>
|
|
507
|
+
<Button {...props} {...previewProps}>
|
|
508
|
+
Full-width button
|
|
509
|
+
</Button>
|
|
514
510
|
);
|
|
515
511
|
},
|
|
516
512
|
argTypes: {
|
|
@@ -809,6 +805,96 @@ export const AllVariants = storyConfig(
|
|
|
809
805
|
{ variants: ['default', 'dark', 'bright-green', 'forest-green', 'rtl'] },
|
|
810
806
|
);
|
|
811
807
|
|
|
808
|
+
/**
|
|
809
|
+
* **NB:** The button doesn't know how long its label is, how many words it consists of and
|
|
810
|
+
* how zoomed in it is. That is likely to lead to scenarios in which the text will overflow
|
|
811
|
+
* its container. This is being investigated.
|
|
812
|
+
*/
|
|
813
|
+
export const DealingWithLongText: StoryObj<PreviewStoryArgs> = {
|
|
814
|
+
render: function Render(args: PreviewStoryArgs) {
|
|
815
|
+
const [props, previewProps] = getPropsForPreview(args);
|
|
816
|
+
|
|
817
|
+
return (
|
|
818
|
+
<div>
|
|
819
|
+
<div>
|
|
820
|
+
<div>
|
|
821
|
+
<Button {...props} {...previewProps}>
|
|
822
|
+
{lorem10}
|
|
823
|
+
</Button>
|
|
824
|
+
</div>
|
|
825
|
+
<div className="m-y-2">
|
|
826
|
+
<Button {...props} {...previewProps}>
|
|
827
|
+
Forderungsabtretungsvereinbarung
|
|
828
|
+
</Button>
|
|
829
|
+
</div>
|
|
830
|
+
<div
|
|
831
|
+
className="d-flex"
|
|
832
|
+
style={{
|
|
833
|
+
width: '100%',
|
|
834
|
+
justifyContent: 'space-between',
|
|
835
|
+
alignItems: 'center',
|
|
836
|
+
}}
|
|
837
|
+
>
|
|
838
|
+
<span>{lorem20}</span>
|
|
839
|
+
<div>
|
|
840
|
+
<Button {...props} {...previewProps}>
|
|
841
|
+
Register interest
|
|
842
|
+
</Button>
|
|
843
|
+
</div>
|
|
844
|
+
</div>
|
|
845
|
+
</div>
|
|
846
|
+
<div style={{ width: 260 }} className="m-t-2">
|
|
847
|
+
<div>
|
|
848
|
+
<Button {...props} {...previewProps}>
|
|
849
|
+
{lorem10}
|
|
850
|
+
</Button>
|
|
851
|
+
</div>
|
|
852
|
+
<div className="m-y-2">
|
|
853
|
+
<Button {...props} {...previewProps}>
|
|
854
|
+
Forderungsabtretungsvereinbarung
|
|
855
|
+
</Button>
|
|
856
|
+
</div>
|
|
857
|
+
<div
|
|
858
|
+
className="d-flex"
|
|
859
|
+
style={{
|
|
860
|
+
width: '100%',
|
|
861
|
+
justifyContent: 'space-between',
|
|
862
|
+
alignItems: 'center',
|
|
863
|
+
}}
|
|
864
|
+
>
|
|
865
|
+
<span>{lorem20}</span>
|
|
866
|
+
<div>
|
|
867
|
+
<Button {...props} {...previewProps}>
|
|
868
|
+
Register interest
|
|
869
|
+
</Button>
|
|
870
|
+
</div>
|
|
871
|
+
</div>
|
|
872
|
+
</div>
|
|
873
|
+
</div>
|
|
874
|
+
);
|
|
875
|
+
},
|
|
876
|
+
argTypes: {
|
|
877
|
+
...hideControls([
|
|
878
|
+
'href',
|
|
879
|
+
'target',
|
|
880
|
+
'priority',
|
|
881
|
+
'sentiment',
|
|
882
|
+
'disabled',
|
|
883
|
+
'loading',
|
|
884
|
+
'children',
|
|
885
|
+
'as',
|
|
886
|
+
'type',
|
|
887
|
+
'className',
|
|
888
|
+
]),
|
|
889
|
+
...previewArgTypes,
|
|
890
|
+
},
|
|
891
|
+
args: {
|
|
892
|
+
block: true,
|
|
893
|
+
previewAddonStart: false,
|
|
894
|
+
previewAddonEnd: false,
|
|
895
|
+
},
|
|
896
|
+
};
|
|
897
|
+
|
|
812
898
|
export const AccessibilityAddons: Story = {
|
|
813
899
|
args: {
|
|
814
900
|
v2: true,
|
|
@@ -25,7 +25,7 @@ const withContainer = (Story: any) => (
|
|
|
25
25
|
const meta: Meta<typeof LegacyButton> = {
|
|
26
26
|
component: LegacyButton,
|
|
27
27
|
title: 'Actions/Button/Legacy Button',
|
|
28
|
-
tags: ['deprecated'],
|
|
28
|
+
tags: ['wds:deprecated'],
|
|
29
29
|
args: {
|
|
30
30
|
size: undefined,
|
|
31
31
|
priority: undefined,
|
package/src/index.ts
CHANGED
|
@@ -108,6 +108,20 @@ export type {
|
|
|
108
108
|
TableCellStatus,
|
|
109
109
|
TableCellType,
|
|
110
110
|
} from './table';
|
|
111
|
+
export type {
|
|
112
|
+
ListItemProps,
|
|
113
|
+
ListItemSwitchProps,
|
|
114
|
+
ListItemRadioProps,
|
|
115
|
+
ListItemPromptProps,
|
|
116
|
+
ListItemNavigationProps,
|
|
117
|
+
ListItemImageProps,
|
|
118
|
+
ListItemIconButtonProps,
|
|
119
|
+
ListItemAdditionalInfoProps,
|
|
120
|
+
ListItemButtonProps,
|
|
121
|
+
ListItemCheckboxProps,
|
|
122
|
+
ListItemAvatarLayoutProps,
|
|
123
|
+
ListItemAvatarViewProps,
|
|
124
|
+
} from './listItem';
|
|
111
125
|
export type { ListProps } from './list';
|
|
112
126
|
|
|
113
127
|
/**
|
|
@@ -210,6 +224,7 @@ export { default as Typeahead } from './typeahead';
|
|
|
210
224
|
export { default as Upload } from './upload';
|
|
211
225
|
export { default as UploadInput } from './uploadInput';
|
|
212
226
|
export { default as Table } from './table';
|
|
227
|
+
export { default as ListItem } from './listItem';
|
|
213
228
|
export { default as List } from './list';
|
|
214
229
|
|
|
215
230
|
/**
|
package/src/list/List.story.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
import
|
|
2
|
+
import ListItem from '../listItem';
|
|
3
3
|
import List from './List';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
@@ -13,8 +13,18 @@ type Story = StoryObj<typeof List>;
|
|
|
13
13
|
export const Basic: Story = {
|
|
14
14
|
render: (args) => (
|
|
15
15
|
<List {...args}>
|
|
16
|
-
<
|
|
17
|
-
|
|
16
|
+
<ListItem
|
|
17
|
+
as={args.as === 'div' ? 'div' : undefined}
|
|
18
|
+
title="First item"
|
|
19
|
+
subtitle="This is the first item."
|
|
20
|
+
media={<ListItem.AvatarView />}
|
|
21
|
+
/>
|
|
22
|
+
<ListItem
|
|
23
|
+
as={args.as === 'div' ? 'div' : undefined}
|
|
24
|
+
title="Second item"
|
|
25
|
+
subtitle="This is the second item."
|
|
26
|
+
media={<ListItem.AvatarView />}
|
|
27
|
+
/>
|
|
18
28
|
</List>
|
|
19
29
|
),
|
|
20
30
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { render, screen } from '../../test-utils';
|
|
2
|
+
import { ListItem, type ListItemProps } from '../ListItem';
|
|
3
|
+
|
|
4
|
+
describe('ListItem.AdditionalInfo', () => {
|
|
5
|
+
const renderWithInfo = (info: ListItemProps['additionalInfo']) =>
|
|
6
|
+
render(<ListItem title="Test title" subtitle="Test subtitle" additionalInfo={info} />);
|
|
7
|
+
|
|
8
|
+
it('renders children content', () => {
|
|
9
|
+
renderWithInfo(
|
|
10
|
+
<ListItem.AdditionalInfo>Additional information content</ListItem.AdditionalInfo>,
|
|
11
|
+
);
|
|
12
|
+
expect(screen.getByText('Additional information content')).toBeInTheDocument();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('renders action button when onClick provided', () => {
|
|
16
|
+
const handleActionClick = jest.fn();
|
|
17
|
+
renderWithInfo(
|
|
18
|
+
<ListItem.AdditionalInfo action={{ label: 'Learn more', onClick: handleActionClick }}>
|
|
19
|
+
Additional info
|
|
20
|
+
</ListItem.AdditionalInfo>,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
expect(screen.getByRole('button', { name: 'Learn more' })).toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('renders action link with href when provided', () => {
|
|
27
|
+
renderWithInfo(
|
|
28
|
+
<ListItem.AdditionalInfo action={{ label: 'Learn more', href: '/learn' }}>
|
|
29
|
+
Additional info
|
|
30
|
+
</ListItem.AdditionalInfo>,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const actionLink = screen.getByRole('link', { name: 'Learn more' });
|
|
34
|
+
expect(actionLink).toBeInTheDocument();
|
|
35
|
+
expect(actionLink).toHaveAttribute('href', '/learn');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('renders action link with target when provided', () => {
|
|
39
|
+
renderWithInfo(
|
|
40
|
+
<ListItem.AdditionalInfo action={{ label: 'Learn more', href: '/learn', target: '_blank' }}>
|
|
41
|
+
Additional info
|
|
42
|
+
</ListItem.AdditionalInfo>,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const actionLink = screen.getByRole('link', { name: 'Learn more (opens in new tab)' });
|
|
46
|
+
expect(actionLink).toBeInTheDocument();
|
|
47
|
+
expect(actionLink).toHaveAttribute('target', '_blank');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('does not render action when not provided', () => {
|
|
51
|
+
renderWithInfo(<ListItem.AdditionalInfo>Additional info only</ListItem.AdditionalInfo>);
|
|
52
|
+
|
|
53
|
+
expect(screen.queryByRole('link')).not.toBeInTheDocument();
|
|
54
|
+
expect(screen.queryByRole('button')).not.toBeInTheDocument();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,198 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { PropsWithChildren, useContext } from 'react';
|
|
2
|
+
import { ListItemContext, type ListItemContextData } from '../ListItemContext';
|
|
3
|
+
import Body from '../../body';
|
|
4
|
+
import Link, { type 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';
|