@transferwise/components 0.0.0-experimental-d7fd1c8 → 0.0.0-experimental-55ad5c7
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/listItem/AvatarLayout/ListItemAvatarLayout.js +2 -0
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.js.map +1 -1
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs +2 -0
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs.map +1 -1
- package/build/listItem/AvatarView/ListItemAvatarView.js +2 -0
- package/build/listItem/AvatarView/ListItemAvatarView.js.map +1 -1
- package/build/listItem/AvatarView/ListItemAvatarView.mjs +2 -0
- package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +1 -1
- package/build/listItem/Image/ListItemImage.js +3 -0
- package/build/listItem/Image/ListItemImage.js.map +1 -1
- package/build/listItem/Image/ListItemImage.mjs +3 -0
- package/build/listItem/Image/ListItemImage.mjs.map +1 -1
- package/build/listItem/ListItem.js +13 -7
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +13 -7
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/listItem/ListItemContext.js.map +1 -1
- package/build/listItem/ListItemContext.mjs.map +1 -1
- package/build/listItem/Navigation/ListItemNavigation.js +1 -1
- package/build/listItem/Navigation/ListItemNavigation.js.map +1 -1
- package/build/listItem/Navigation/ListItemNavigation.mjs +1 -1
- package/build/listItem/Navigation/ListItemNavigation.mjs.map +1 -1
- 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 +23 -12
- package/build/styles/listItem/ListItem.css +23 -12
- package/build/styles/listItem/ListItem.grid.css +7 -7
- package/build/styles/main.css +23 -12
- package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts.map +1 -1
- package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts.map +1 -1
- package/build/types/listItem/Image/ListItemImage.d.ts +5 -1
- package/build/types/listItem/Image/ListItemImage.d.ts.map +1 -1
- package/build/types/listItem/ListItem.d.ts +1 -1
- package/build/types/listItem/ListItem.d.ts.map +1 -1
- package/build/types/listItem/ListItemContext.d.ts +3 -0
- package/build/types/listItem/ListItemContext.d.ts.map +1 -1
- package/build/types/listItem/_stories/subcomponents.d.ts.map +1 -1
- 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/useListItemMedia.d.ts +5 -0
- package/build/types/listItem/useListItemMedia.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.tsx +3 -0
- package/src/listItem/AvatarView/ListItemAvatarView.tsx +3 -0
- package/src/listItem/Button/ListItemButton.spec.tsx +10 -35
- package/src/listItem/Image/ListItemImage.spec.tsx +8 -5
- package/src/listItem/Image/ListItemImage.story.tsx +2 -1
- package/src/listItem/Image/ListItemImage.tsx +8 -1
- package/src/listItem/ListItem.css +23 -12
- package/src/listItem/ListItem.grid.css +7 -7
- package/src/listItem/ListItem.grid.less +11 -11
- package/src/listItem/ListItem.less +20 -7
- package/src/listItem/ListItem.tsx +24 -12
- package/src/listItem/ListItemContext.tsx +5 -0
- package/src/listItem/Navigation/ListItemNavigation.tsx +1 -1
- package/src/listItem/_stories/ListItem.story.tsx +2 -39
- package/src/listItem/_stories/ListItem.variants.test.story.tsx +7 -2
- package/src/listItem/_stories/subcomponents.tsx +1 -0
- package/src/listItem/test-utils.tsx +33 -0
- package/src/listItem/useListItemMedia.tsx +12 -0
- package/src/main.css +23 -12
|
@@ -71,18 +71,23 @@ const generateVariantsForControl = (controlType: ControlType): Story => {
|
|
|
71
71
|
const additionalInfo = isInteractive ? infoWithLink : infoWithoutLink;
|
|
72
72
|
const variants = [
|
|
73
73
|
{ title },
|
|
74
|
+
{ title, valueTitle },
|
|
74
75
|
{ title, subtitle },
|
|
76
|
+
{ title, valueTitle, valueSubtitle },
|
|
75
77
|
{ title, subtitle, inverted: true },
|
|
76
78
|
{ title, subtitle, valueTitle },
|
|
77
79
|
{ title, subtitle, valueTitle, inverted: true },
|
|
78
80
|
{ title, subtitle, valueTitle, valueSubtitle },
|
|
79
81
|
{ title, subtitle, valueTitle, valueSubtitle, inverted: true },
|
|
80
82
|
{ media, title },
|
|
83
|
+
{ media, title, valueTitle },
|
|
84
|
+
{ media, title, subtitle },
|
|
85
|
+
{ media, title, valueTitle, valueSubtitle },
|
|
86
|
+
{ media, title, valueTitle },
|
|
87
|
+
{ media, title, valueSubtitle },
|
|
81
88
|
{ media, title, subtitle },
|
|
82
89
|
{ media, title, subtitle, valueTitle },
|
|
83
90
|
{ media, title, subtitle, valueTitle, valueSubtitle },
|
|
84
|
-
{ media, title },
|
|
85
|
-
{ media, title, subtitle },
|
|
86
91
|
{ media, title, subtitle, additionalInfo: infoWithoutLink },
|
|
87
92
|
isInteractive ? { media, title, subtitle, additionalInfo: infoWithLink } : null,
|
|
88
93
|
{ media, title, subtitle, additionalInfo, valueTitle },
|
|
@@ -121,6 +121,7 @@ export const SB_LIST_ITEM_MEDIA = {
|
|
|
121
121
|
<ListItem.Image
|
|
122
122
|
alt="An illustration of a multi-currency account"
|
|
123
123
|
src="https://wise.com/public-resources/assets/spend/card-asset/medium/v2/personal_green_wise_2023_active.svg"
|
|
124
|
+
height={31.5}
|
|
124
125
|
/>
|
|
125
126
|
),
|
|
126
127
|
avatarSingle: (
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { render, type RenderResult } from '../test-utils';
|
|
2
|
+
import { ListItemContext } from './ListItemContext';
|
|
3
|
+
|
|
4
|
+
export const mockSetControlType = jest.fn();
|
|
5
|
+
export const mockSetControlProps = jest.fn();
|
|
6
|
+
export const mockSetMediaSize = jest.fn();
|
|
7
|
+
|
|
8
|
+
export const renderWithListItemContext = (ui: React.ReactNode): RenderResult => {
|
|
9
|
+
return render(
|
|
10
|
+
<ListItemContext.Provider
|
|
11
|
+
value={{
|
|
12
|
+
setControlType: mockSetControlType,
|
|
13
|
+
setControlProps: mockSetControlProps,
|
|
14
|
+
setMediaSize: mockSetMediaSize,
|
|
15
|
+
ids: {
|
|
16
|
+
title: 'title',
|
|
17
|
+
additionalInfo: 'additional-info',
|
|
18
|
+
valueTitle: 'value-title',
|
|
19
|
+
control: 'control',
|
|
20
|
+
prompt: 'prompt',
|
|
21
|
+
},
|
|
22
|
+
props: {},
|
|
23
|
+
describedByIds: 'described-by-ids',
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
{ui}
|
|
27
|
+
</ListItemContext.Provider>,
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const clearListItemMocks = () => {
|
|
32
|
+
jest.clearAllMocks();
|
|
33
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import { ListItemContext, type ListItemContextData } from './ListItemContext';
|
|
3
|
+
|
|
4
|
+
export function useListItemMedia(size?: number) {
|
|
5
|
+
const { setMediaSize, mediaSize } = useContext<ListItemContextData>(ListItemContext);
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
setMediaSize(size);
|
|
9
|
+
}, [size, setMediaSize]);
|
|
10
|
+
|
|
11
|
+
return { mediaSize, setMediaSize };
|
|
12
|
+
}
|
package/src/main.css
CHANGED
|
@@ -2644,17 +2644,17 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2644
2644
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-hasInfo-hasPrompt {
|
|
2645
2645
|
grid-template-columns: auto 1fr auto;
|
|
2646
2646
|
grid-template-rows: auto auto auto;
|
|
2647
|
-
grid-template-areas: "media body control" "media info
|
|
2647
|
+
grid-template-areas: "media body control" "media info ." ". prompt prompt";
|
|
2648
2648
|
}
|
|
2649
2649
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-hasInfo-noPrompt {
|
|
2650
2650
|
grid-template-columns: auto 1fr auto;
|
|
2651
2651
|
grid-template-rows: auto auto;
|
|
2652
|
-
grid-template-areas: "media body control" "media info
|
|
2652
|
+
grid-template-areas: "media body control" "media info .";
|
|
2653
2653
|
}
|
|
2654
2654
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-noInfo-hasPrompt {
|
|
2655
2655
|
grid-template-columns: auto 1fr auto;
|
|
2656
2656
|
grid-template-rows: auto auto;
|
|
2657
|
-
grid-template-areas: "media body control" "
|
|
2657
|
+
grid-template-areas: "media body control" ". prompt prompt";
|
|
2658
2658
|
}
|
|
2659
2659
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-noInfo-noPrompt {
|
|
2660
2660
|
grid-template-columns: auto 1fr auto;
|
|
@@ -2664,7 +2664,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2664
2664
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-noControl.wds-list-item-hasInfo-hasPrompt {
|
|
2665
2665
|
grid-template-columns: auto 1fr;
|
|
2666
2666
|
grid-template-rows: auto auto;
|
|
2667
|
-
grid-template-areas: "media body" "media info" "
|
|
2667
|
+
grid-template-areas: "media body" "media info" ". prompt";
|
|
2668
2668
|
}
|
|
2669
2669
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-noControl.wds-list-item-hasInfo-noPrompt {
|
|
2670
2670
|
grid-template-columns: auto 1fr;
|
|
@@ -2687,12 +2687,12 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2687
2687
|
.wds-list-item-gridWrapper.wds-list-item-noMedia-hasControl.wds-list-item-hasInfo-hasPrompt {
|
|
2688
2688
|
grid-template-columns: 1fr auto;
|
|
2689
2689
|
grid-template-rows: auto auto auto;
|
|
2690
|
-
grid-template-areas: "body control" "info
|
|
2690
|
+
grid-template-areas: "body control" "info ." "prompt prompt";
|
|
2691
2691
|
}
|
|
2692
2692
|
.wds-list-item-gridWrapper.wds-list-item-noMedia-hasControl.wds-list-item-hasInfo-noPrompt {
|
|
2693
2693
|
grid-template-columns: 1fr auto;
|
|
2694
2694
|
grid-template-rows: auto auto;
|
|
2695
|
-
grid-template-areas: "body control" "info
|
|
2695
|
+
grid-template-areas: "body control" "info .";
|
|
2696
2696
|
}
|
|
2697
2697
|
.wds-list-item-gridWrapper.wds-list-item-noMedia-hasControl.wds-list-item-noInfo-hasPrompt {
|
|
2698
2698
|
grid-template-columns: 1fr auto;
|
|
@@ -2856,7 +2856,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2856
2856
|
grid-template-areas: "body";
|
|
2857
2857
|
}
|
|
2858
2858
|
}
|
|
2859
|
-
@container (max-width:
|
|
2859
|
+
@container (max-width: 297px) {
|
|
2860
2860
|
.wds-list-item-gridWrapper.wds-list-item-hasMedia-hasControl.wds-list-item-hasInfo-hasPrompt {
|
|
2861
2861
|
grid-template-columns: auto 1fr;
|
|
2862
2862
|
grid-template-rows: auto auto auto;
|
|
@@ -3085,7 +3085,8 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3085
3085
|
}
|
|
3086
3086
|
.wds-list-item-media-image {
|
|
3087
3087
|
width: var(--item-media-image-size);
|
|
3088
|
-
height:
|
|
3088
|
+
height: auto;
|
|
3089
|
+
height: var(--wds-list-item-control-wrapper-height, auto);
|
|
3089
3090
|
}
|
|
3090
3091
|
.wds-list-item-body {
|
|
3091
3092
|
grid-area: body;
|
|
@@ -3103,6 +3104,14 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3103
3104
|
color: #37517e;
|
|
3104
3105
|
color: var(--color-content-primary);
|
|
3105
3106
|
}
|
|
3107
|
+
.wds-list-item-value {
|
|
3108
|
+
text-align: right;
|
|
3109
|
+
}
|
|
3110
|
+
.wds-list-item-body-center {
|
|
3111
|
+
display: flex;
|
|
3112
|
+
flex-direction: row;
|
|
3113
|
+
align-items: center;
|
|
3114
|
+
}
|
|
3106
3115
|
.wds-list-item-additional-info {
|
|
3107
3116
|
grid-area: info;
|
|
3108
3117
|
color: #768e9c;
|
|
@@ -3110,12 +3119,14 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3110
3119
|
margin-top: calc(4px * -1);
|
|
3111
3120
|
margin-top: calc(var(--size-4) * -1);
|
|
3112
3121
|
}
|
|
3113
|
-
.wds-list-item-value {
|
|
3114
|
-
align-items: end;
|
|
3115
|
-
text-align: right;
|
|
3116
|
-
}
|
|
3117
3122
|
.wds-list-item-control-wrapper {
|
|
3118
3123
|
grid-area: control;
|
|
3124
|
+
align-content: center;
|
|
3125
|
+
max-height: var(--wds-list-item-control-wrapper-height);
|
|
3126
|
+
}
|
|
3127
|
+
.wds-list-item-navigation .tw-icon-chevron-right {
|
|
3128
|
+
color: #c9cbce;
|
|
3129
|
+
color: var(--color-interactive-secondary);
|
|
3119
3130
|
}
|
|
3120
3131
|
.wds-list-item-control {
|
|
3121
3132
|
flex: 0 0 auto;
|