@transferwise/components 0.0.0-experimental-4533565 → 0.0.0-experimental-da1781d
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/flowNavigation/animatedLabel/AnimatedLabel.js +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
- package/build/index.js +3 -3
- package/build/index.mjs +2 -2
- package/build/{listItem/ListItem.js → legacylistItem/LegacyListItem.js} +3 -3
- package/build/legacylistItem/LegacyListItem.js.map +1 -0
- package/build/{listItem/ListItem.mjs → legacylistItem/LegacyListItem.mjs} +3 -3
- package/build/legacylistItem/LegacyListItem.mjs.map +1 -0
- package/build/legacylistItem/List.js.map +1 -0
- package/build/legacylistItem/List.mjs.map +1 -0
- package/build/main.css +60 -57
- package/build/phoneNumberInput/PhoneNumberInput.js +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js +2 -2
- package/build/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.js.map +1 -1
- package/build/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.mjs +2 -2
- package/build/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.mjs.map +1 -1
- package/build/styles/legacylistItem/LegacyListItem.css +6 -0
- package/build/styles/listItem/ListItem.css +185 -3
- package/build/styles/main.css +60 -57
- package/build/styles/switch/Switch.css +3 -0
- package/build/types/index.d.ts +3 -3
- package/build/types/index.d.ts.map +1 -1
- package/build/types/legacylistItem/LegacyListItem.d.ts +13 -0
- package/build/types/legacylistItem/LegacyListItem.d.ts.map +1 -0
- package/build/types/legacylistItem/List.d.ts.map +1 -0
- package/build/types/legacylistItem/index.d.ts +5 -0
- package/build/types/legacylistItem/index.d.ts.map +1 -0
- package/build/types/listItem/ListItem.d.ts +38 -8
- package/build/types/listItem/ListItem.d.ts.map +1 -1
- package/build/types/listItem/ListItemAdditionalInfo.d.ts +9 -0
- package/build/types/listItem/ListItemAdditionalInfo.d.ts.map +1 -0
- package/build/types/listItem/ListItemButton.d.ts +4 -0
- package/build/types/listItem/ListItemButton.d.ts.map +1 -0
- package/build/types/listItem/ListItemCheckbox.d.ts +4 -0
- package/build/types/listItem/ListItemCheckbox.d.ts.map +1 -0
- package/build/types/listItem/ListItemIconButton.d.ts +7 -0
- package/build/types/listItem/ListItemIconButton.d.ts.map +1 -0
- package/build/types/listItem/ListItemMedia.d.ts +19 -0
- package/build/types/listItem/ListItemMedia.d.ts.map +1 -0
- package/build/types/listItem/ListItemNavigation.d.ts +4 -0
- package/build/types/listItem/ListItemNavigation.d.ts.map +1 -0
- package/build/types/{item/ItemSwitch.d.ts → listItem/ListItemSwitch.d.ts} +1 -1
- package/build/types/listItem/ListItemSwitch.d.ts.map +1 -0
- package/build/types/listItem/index.d.ts +4 -3
- package/build/types/listItem/index.d.ts.map +1 -1
- package/build/types/{item → listItem}/prompt/Prompt.d.ts +3 -3
- package/build/types/listItem/prompt/Prompt.d.ts.map +1 -0
- package/build/types/listItem/useItemControl.d.ts +5 -0
- package/build/types/listItem/useItemControl.d.ts.map +1 -0
- package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts +2 -2
- package/build/types/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +1 -1
- package/src/index.ts +3 -3
- package/src/legacylistItem/LegacyListItem.css +6 -0
- package/src/legacylistItem/LegacyListItem.less +7 -0
- package/src/legacylistItem/LegacyListItem.story.tsx +120 -0
- package/src/{listItem/ListItem.tests.story.tsx → legacylistItem/LegacyListItem.tests.story.tsx} +7 -7
- package/src/legacylistItem/LegacyListItem.tsx +53 -0
- package/src/legacylistItem/index.ts +4 -0
- package/src/listItem/ListItem.css +185 -3
- package/src/listItem/ListItem.less +180 -5
- package/src/listItem/ListItem.story.tsx +250 -97
- package/src/listItem/ListItem.tsx +167 -37
- package/src/{item/ItemAdditionalInfo.tsx → listItem/ListItemAdditionalInfo.tsx} +5 -5
- package/src/{item/ItemButton.spec.tsx → listItem/ListItemButton.spec.tsx} +4 -4
- package/src/{item/ItemButton.tsx → listItem/ListItemButton.tsx} +2 -2
- package/src/{item/ItemCheckbox.tsx → listItem/ListItemCheckbox.tsx} +5 -2
- package/src/{item/ItemIconButton.tsx → listItem/ListItemIconButton.tsx} +2 -2
- package/src/{item/ItemMedia.tsx → listItem/ListItemMedia.tsx} +9 -9
- package/src/{item/ItemNavigation.tsx → listItem/ListItemNavigation.tsx} +2 -2
- package/src/listItem/index.ts +9 -3
- package/src/{item → listItem}/prompt/Prompt.spec.tsx +12 -12
- package/src/{item → listItem}/prompt/Prompt.story.tsx +27 -27
- package/src/{item → listItem}/prompt/Prompt.tsx +4 -4
- package/src/listItem/useItemControl.tsx +12 -0
- package/src/main.css +60 -57
- package/src/main.less +2 -2
- package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +4 -4
- package/src/phoneNumberInput/PhoneNumberInput.story.tsx +22 -0
- package/src/phoneNumberInput/PhoneNumberInput.tsx +1 -1
- package/src/phoneNumberInput/utils/isValidPhoneNumber/isValidPhoneNumber.ts +4 -3
- package/src/switch/Switch.css +3 -0
- package/src/switch/Switch.less +1 -0
- package/build/listItem/List.js.map +0 -1
- package/build/listItem/List.mjs.map +0 -1
- package/build/listItem/ListItem.js.map +0 -1
- package/build/listItem/ListItem.mjs.map +0 -1
- package/build/styles/item/Item.css +0 -188
- package/build/types/item/Item.d.ts +0 -43
- package/build/types/item/Item.d.ts.map +0 -1
- package/build/types/item/ItemAdditionalInfo.d.ts +0 -9
- package/build/types/item/ItemAdditionalInfo.d.ts.map +0 -1
- package/build/types/item/ItemButton.d.ts +0 -4
- package/build/types/item/ItemButton.d.ts.map +0 -1
- package/build/types/item/ItemCheckbox.d.ts +0 -4
- package/build/types/item/ItemCheckbox.d.ts.map +0 -1
- package/build/types/item/ItemIconButton.d.ts +0 -7
- package/build/types/item/ItemIconButton.d.ts.map +0 -1
- package/build/types/item/ItemMedia.d.ts +0 -19
- package/build/types/item/ItemMedia.d.ts.map +0 -1
- package/build/types/item/ItemNavigation.d.ts +0 -4
- package/build/types/item/ItemNavigation.d.ts.map +0 -1
- package/build/types/item/ItemSwitch.d.ts.map +0 -1
- package/build/types/item/index.d.ts +0 -6
- package/build/types/item/index.d.ts.map +0 -1
- package/build/types/item/prompt/Prompt.d.ts.map +0 -1
- package/build/types/item/useItemControl.d.ts +0 -5
- package/build/types/item/useItemControl.d.ts.map +0 -1
- package/build/types/listItem/List.d.ts.map +0 -1
- package/src/item/Item.css +0 -188
- package/src/item/Item.less +0 -182
- package/src/item/Item.story.tsx +0 -273
- package/src/item/Item.tsx +0 -181
- package/src/item/index.ts +0 -6
- package/src/item/useItemControl.tsx +0 -12
- /package/build/{listItem → legacylistItem}/List.js +0 -0
- /package/build/{listItem → legacylistItem}/List.mjs +0 -0
- /package/build/types/{listItem → legacylistItem}/List.d.ts +0 -0
- /package/src/{listItem/ListItem.spec.tsx → legacylistItem/LegacyListItem.spec.tsx} +0 -0
- /package/src/{listItem → legacylistItem}/List.tsx +0 -0
- /package/src/{item/ItemSwitch.tsx → listItem/ListItemSwitch.tsx} +0 -0
package/src/item/Item.less
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
.np-item {
|
|
2
|
-
padding: var(--size-16);
|
|
3
|
-
border-radius: var(--radius-large);
|
|
4
|
-
background-color: var(--color-background-screen);
|
|
5
|
-
gap: var(--size-16);
|
|
6
|
-
|
|
7
|
-
&-interactive {
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
&:hover {
|
|
10
|
-
background-color: var(--color-background-screen-hover);
|
|
11
|
-
}
|
|
12
|
-
&:active {
|
|
13
|
-
background-color: var(--color-background-screen-active);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
&-media {
|
|
18
|
-
|
|
19
|
-
&-image {
|
|
20
|
-
width: var(--item-media-image-size);
|
|
21
|
-
height: var(--item-media-image-size);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
&-body {
|
|
26
|
-
width: 100%;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&-title {
|
|
30
|
-
color: var(--color-content-primary);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&-additional-info {
|
|
34
|
-
color: var(--color-content-tertiary);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&-value {
|
|
38
|
-
flex: 0 0 auto;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&-control {
|
|
42
|
-
flex: 0 0 auto;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&-spotlight {
|
|
46
|
-
&-active {
|
|
47
|
-
background-color: var(--color-background-neutral);
|
|
48
|
-
|
|
49
|
-
&:hover {
|
|
50
|
-
background-color: var(--color-background-neutral-hover);
|
|
51
|
-
}
|
|
52
|
-
&:active {
|
|
53
|
-
background-color: var(--color-background-neutral-active);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
&-inactive {
|
|
58
|
-
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
59
|
-
border: 1px dashed var(--color-border-neutral);
|
|
60
|
-
|
|
61
|
-
&:hover {
|
|
62
|
-
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
63
|
-
}
|
|
64
|
-
&:active {
|
|
65
|
-
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&-prompt {
|
|
71
|
-
display: inline-flex;
|
|
72
|
-
padding-top: calc(var(--padding-x-small) / 2);
|
|
73
|
-
padding-bottom: calc(var(--padding-x-small) / 2);
|
|
74
|
-
padding-left: calc(var(--padding-x-small) - 1px);
|
|
75
|
-
padding-right: var(--padding-x-small);
|
|
76
|
-
border-radius: var(--radius-small);
|
|
77
|
-
word-break: break-word;
|
|
78
|
-
overflow-wrap: break-word;
|
|
79
|
-
|
|
80
|
-
.np-prompt-icon {
|
|
81
|
-
padding-right: calc(var(--size-12) / 2);
|
|
82
|
-
padding-top: calc(var(--size-4) - 1px);
|
|
83
|
-
padding-bottom: calc(var(--size-4) - 1px);
|
|
84
|
-
|
|
85
|
-
.tw-icon-tags,
|
|
86
|
-
.tw-icon-confetti {
|
|
87
|
-
color: var(--color-sentiment-positive-primary);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
a {
|
|
92
|
-
text-underline-offset: calc(var(--size-4) / 2);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
&.np-prompt-interactive {
|
|
96
|
-
text-decoration: none;
|
|
97
|
-
cursor: pointer;
|
|
98
|
-
border: none;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&.negative {
|
|
102
|
-
background-color: var(--color-sentiment-negative-secondary);
|
|
103
|
-
color: var(--color-sentiment-negative-primary);
|
|
104
|
-
a {
|
|
105
|
-
color: var(--color-sentiment-negative-primary);
|
|
106
|
-
&:hover {
|
|
107
|
-
color: var(--color-sentiment-negative-primary-hover);
|
|
108
|
-
}
|
|
109
|
-
&:active {
|
|
110
|
-
color: var(--color-sentiment-negative-primary-active);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
.np-prompt-interactive& {
|
|
114
|
-
&:hover {
|
|
115
|
-
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 95%, var(--color-sentiment-negative-primary));
|
|
116
|
-
}
|
|
117
|
-
&:active {
|
|
118
|
-
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
&.positive,
|
|
123
|
-
&.discount,
|
|
124
|
-
&.savings {
|
|
125
|
-
background-color: var(--color-sentiment-positive-secondary);
|
|
126
|
-
color: var(--color-sentiment-positive-primary);
|
|
127
|
-
a {
|
|
128
|
-
color: var(--color-sentiment-positive-primary);
|
|
129
|
-
&:hover {
|
|
130
|
-
color: var(--color-sentiment-positive-primary-hover);
|
|
131
|
-
}
|
|
132
|
-
&:active {
|
|
133
|
-
color: var(--color-sentiment-positive-primary-active);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
.np-prompt-interactive& {
|
|
137
|
-
&:hover {
|
|
138
|
-
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
|
|
139
|
-
}
|
|
140
|
-
&:active {
|
|
141
|
-
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
&.neutral {
|
|
146
|
-
background-color: var(--color-background-neutral);
|
|
147
|
-
color: var(--color-content-primary);
|
|
148
|
-
a {
|
|
149
|
-
color: var(--color-content-primary);
|
|
150
|
-
}
|
|
151
|
-
.np-prompt-interactive& {
|
|
152
|
-
&:hover {
|
|
153
|
-
background-color: var(--color-background-neutral-hover);
|
|
154
|
-
}
|
|
155
|
-
&:active {
|
|
156
|
-
background-color: var(--color-background-neutral-active);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
&.warning {
|
|
161
|
-
background-color: var(--color-sentiment-warning-secondary);
|
|
162
|
-
color: var(--color-sentiment-warning-content);
|
|
163
|
-
a {
|
|
164
|
-
color: var(--color-sentiment-warning-content);
|
|
165
|
-
&:hover {
|
|
166
|
-
color: var(--color-sentiment-warning-content-hover);
|
|
167
|
-
}
|
|
168
|
-
&:active {
|
|
169
|
-
color: var(--color-sentiment-warning-content-active);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
.np-prompt-interactive& {
|
|
173
|
-
&:hover {
|
|
174
|
-
background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 90%, var(--color-sentiment-warning-primary));
|
|
175
|
-
}
|
|
176
|
-
&:active {
|
|
177
|
-
background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 80%, var(--color-sentiment-warning-primary));
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
package/src/item/Item.story.tsx
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import Item, { Props as ItemProps } from './Item';
|
|
2
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
-
import { FastFlag, MultiCurrency, Plus, Receipt, Savings } from '@transferwise/icons';
|
|
5
|
-
|
|
6
|
-
import { lorem10, lorem20, lorem40, lorem5 } from '../test-utils';
|
|
7
|
-
import { Flag } from '@wise/art';
|
|
8
|
-
import { List } from '../listItem';
|
|
9
|
-
import Money from '../money';
|
|
10
|
-
import Section from '../section';
|
|
11
|
-
import Header from '../header';
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
component: Item,
|
|
15
|
-
title: 'Content/Item',
|
|
16
|
-
} satisfies Meta<ItemProps>;
|
|
17
|
-
|
|
18
|
-
type Story = StoryObj<ItemProps>;
|
|
19
|
-
|
|
20
|
-
// TODO: delete this story later when we have more peace of the List Item puzzle
|
|
21
|
-
export const TempPlayground: Story = {
|
|
22
|
-
render: () => {
|
|
23
|
-
const [checked, setChecked] = useState(false);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<div>
|
|
27
|
-
<Item
|
|
28
|
-
media={
|
|
29
|
-
<Item.AvatarView badge={{ type: 'action' }}>
|
|
30
|
-
<Flag code="BBD" />
|
|
31
|
-
</Item.AvatarView>
|
|
32
|
-
}
|
|
33
|
-
title="Test title"
|
|
34
|
-
subtitle="Test subtitle"
|
|
35
|
-
additionalInfo={<Item.AdditionalInfo>{lorem10}</Item.AdditionalInfo>}
|
|
36
|
-
/>
|
|
37
|
-
<Item
|
|
38
|
-
media={
|
|
39
|
-
<Item.AvatarLayout
|
|
40
|
-
avatars={[{ asset: <Flag code="BBD" /> }, { asset: <Flag code="MXN" /> }]}
|
|
41
|
-
/>
|
|
42
|
-
}
|
|
43
|
-
title="Test title"
|
|
44
|
-
subtitle={lorem10}
|
|
45
|
-
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
46
|
-
/>
|
|
47
|
-
<Item
|
|
48
|
-
media={
|
|
49
|
-
<Item.AvatarLayout
|
|
50
|
-
size={72}
|
|
51
|
-
orientation="diagonal"
|
|
52
|
-
avatars={[{ asset: <Flag code="BBD" /> }, { asset: <Flag code="MXN" /> }]}
|
|
53
|
-
/>
|
|
54
|
-
}
|
|
55
|
-
title="Test title"
|
|
56
|
-
subtitle={lorem10}
|
|
57
|
-
valueTitle="100 GBP"
|
|
58
|
-
valueSubtitle="100 USD"
|
|
59
|
-
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
60
|
-
/>
|
|
61
|
-
<Item
|
|
62
|
-
media={<Item.AvatarView profileType="BUSINESS" notification />}
|
|
63
|
-
title="Test title"
|
|
64
|
-
subtitle="Test subtitle"
|
|
65
|
-
additionalInfo={
|
|
66
|
-
<Item.AdditionalInfo
|
|
67
|
-
action={{ label: 'Learn more', href: 'https://wise.com', target: '_blank' }}
|
|
68
|
-
>
|
|
69
|
-
{lorem10}
|
|
70
|
-
</Item.AdditionalInfo>
|
|
71
|
-
}
|
|
72
|
-
prompt={<Item.Prompt type="negative">You have done something wrong</Item.Prompt>}
|
|
73
|
-
/>
|
|
74
|
-
<Item
|
|
75
|
-
media={<Item.AvatarView imgSrc="../avatar-square-dude.webp" selected />}
|
|
76
|
-
title="Test title"
|
|
77
|
-
additionalInfo={<Item.AdditionalInfo>{lorem10}</Item.AdditionalInfo>}
|
|
78
|
-
prompt={
|
|
79
|
-
<Item.Prompt
|
|
80
|
-
type="discount"
|
|
81
|
-
action={{
|
|
82
|
-
href: 'https://wise.com',
|
|
83
|
-
target: '_blank',
|
|
84
|
-
'aria-label': 'clickable prompt',
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
The whole prompt is secretly clickable
|
|
88
|
-
</Item.Prompt>
|
|
89
|
-
}
|
|
90
|
-
/>
|
|
91
|
-
|
|
92
|
-
<Item
|
|
93
|
-
media={<Item.Image src="../apple-pay-logo.svg" />}
|
|
94
|
-
title="Accepting Apple Pay"
|
|
95
|
-
subtitle={lorem10}
|
|
96
|
-
/>
|
|
97
|
-
|
|
98
|
-
<Item
|
|
99
|
-
media={<Item.Image src="../wise-card.svg" />}
|
|
100
|
-
title="Wise Business Card"
|
|
101
|
-
subtitle={lorem5}
|
|
102
|
-
/>
|
|
103
|
-
|
|
104
|
-
<Item
|
|
105
|
-
title="Test title"
|
|
106
|
-
disabled
|
|
107
|
-
subtitle={lorem10}
|
|
108
|
-
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
109
|
-
control={<Item.Button priority="secondary-neutral">as Button</Item.Button>}
|
|
110
|
-
/>
|
|
111
|
-
<Item
|
|
112
|
-
title="Test title"
|
|
113
|
-
disabled
|
|
114
|
-
subtitle={lorem10}
|
|
115
|
-
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
116
|
-
control={
|
|
117
|
-
<Item.IconButton>
|
|
118
|
-
<Plus />
|
|
119
|
-
</Item.IconButton>
|
|
120
|
-
}
|
|
121
|
-
/>
|
|
122
|
-
|
|
123
|
-
<Item
|
|
124
|
-
title="Test title"
|
|
125
|
-
subtitle={lorem10}
|
|
126
|
-
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
127
|
-
control={
|
|
128
|
-
<Item.Button
|
|
129
|
-
priority="secondary-neutral"
|
|
130
|
-
as="a"
|
|
131
|
-
target="dfdf"
|
|
132
|
-
aria-label="adsfasfd"
|
|
133
|
-
href="wise.com"
|
|
134
|
-
>
|
|
135
|
-
as Link
|
|
136
|
-
</Item.Button>
|
|
137
|
-
}
|
|
138
|
-
/>
|
|
139
|
-
|
|
140
|
-
<Item
|
|
141
|
-
title="Test title"
|
|
142
|
-
subtitle={lorem10}
|
|
143
|
-
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
144
|
-
control={<Item.Checkbox indeterminate />}
|
|
145
|
-
/>
|
|
146
|
-
|
|
147
|
-
<Item
|
|
148
|
-
title="Test title"
|
|
149
|
-
subtitle={lorem10}
|
|
150
|
-
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
151
|
-
control={
|
|
152
|
-
<Item.Switch
|
|
153
|
-
checked={checked}
|
|
154
|
-
onClick={() => {
|
|
155
|
-
setChecked(!checked);
|
|
156
|
-
}}
|
|
157
|
-
/>
|
|
158
|
-
}
|
|
159
|
-
/>
|
|
160
|
-
</div>
|
|
161
|
-
);
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export const ItemRadio: Story = {
|
|
166
|
-
render: () => (
|
|
167
|
-
<div>
|
|
168
|
-
{/* Basic */}
|
|
169
|
-
{/* with additional info */}
|
|
170
|
-
{/* with prompt */}
|
|
171
|
-
{/* Disabled */}
|
|
172
|
-
{/* Spotlight */}
|
|
173
|
-
{/* Active */}
|
|
174
|
-
</div>
|
|
175
|
-
),
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
export const ItemButton: Story = {
|
|
179
|
-
render: () => (
|
|
180
|
-
<div>
|
|
181
|
-
{/* Basic */}
|
|
182
|
-
{/* with additional info */}
|
|
183
|
-
{/* with prompt */}
|
|
184
|
-
{/* partially interactive */}
|
|
185
|
-
{/* Disabled */}
|
|
186
|
-
{/* Spotlight */}
|
|
187
|
-
{/* Active */}
|
|
188
|
-
</div>
|
|
189
|
-
),
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
export const ItemNonInteractive: Story = {
|
|
193
|
-
render: () => (
|
|
194
|
-
<div>
|
|
195
|
-
<Section>
|
|
196
|
-
<Header title="Transcation Details" />
|
|
197
|
-
<List>
|
|
198
|
-
<Item
|
|
199
|
-
media={
|
|
200
|
-
<Item.AvatarView>
|
|
201
|
-
<MultiCurrency />
|
|
202
|
-
</Item.AvatarView>
|
|
203
|
-
}
|
|
204
|
-
title="Estimated costs"
|
|
205
|
-
subtitle="Other providers"
|
|
206
|
-
valueTitle={<Money amount={100} currency="GBP" />}
|
|
207
|
-
/>
|
|
208
|
-
<Item
|
|
209
|
-
media={
|
|
210
|
-
<Item.AvatarView>
|
|
211
|
-
<FastFlag />
|
|
212
|
-
</Item.AvatarView>
|
|
213
|
-
}
|
|
214
|
-
title="Total paid"
|
|
215
|
-
subtitle="Wise"
|
|
216
|
-
valueTitle={<Money amount={12.15} currency="GBP" />}
|
|
217
|
-
valueSubtitle={<Money amount={100.9} currency="GBP" />}
|
|
218
|
-
/>
|
|
219
|
-
<Item
|
|
220
|
-
media={
|
|
221
|
-
<Item.AvatarView>
|
|
222
|
-
<Receipt />
|
|
223
|
-
</Item.AvatarView>
|
|
224
|
-
}
|
|
225
|
-
title="Total fees"
|
|
226
|
-
subtitle={lorem5}
|
|
227
|
-
valueSubtitle={<Money amount={5.5} currency="GBP" />}
|
|
228
|
-
/>
|
|
229
|
-
<Item
|
|
230
|
-
media={
|
|
231
|
-
<Item.AvatarView>
|
|
232
|
-
<Savings />
|
|
233
|
-
</Item.AvatarView>
|
|
234
|
-
}
|
|
235
|
-
title="You saved"
|
|
236
|
-
valueSubtitle={<Money amount={1000} currency="GBP" />}
|
|
237
|
-
/>
|
|
238
|
-
</List>
|
|
239
|
-
</Section>
|
|
240
|
-
|
|
241
|
-
<Item
|
|
242
|
-
as="div"
|
|
243
|
-
title="Bank name and address"
|
|
244
|
-
subtitle="Bank Ltd, 2 Street Boulevard, Singapore, 1213423"
|
|
245
|
-
additionalInfo={
|
|
246
|
-
<Item.AdditionalInfo
|
|
247
|
-
action={{ label: 'Learn more', href: 'https://wise.com', target: '_blank' }}
|
|
248
|
-
>
|
|
249
|
-
This is our partner bank in Singapore.
|
|
250
|
-
</Item.AdditionalInfo>
|
|
251
|
-
}
|
|
252
|
-
/>
|
|
253
|
-
<Item
|
|
254
|
-
as="div"
|
|
255
|
-
title="Bank name and address"
|
|
256
|
-
subtitle="Capital Ltd, 2 Canal Street, London, E14 111"
|
|
257
|
-
additionalInfo={
|
|
258
|
-
<Item.AdditionalInfo
|
|
259
|
-
action={{ label: 'Learn more', href: 'https://wise.com', target: '_blank' }}
|
|
260
|
-
/>
|
|
261
|
-
}
|
|
262
|
-
/>
|
|
263
|
-
{/* Basic */}
|
|
264
|
-
{/* with additional info */}
|
|
265
|
-
{/* with prompt */}
|
|
266
|
-
{/* Disabled */}
|
|
267
|
-
{/* Spotlight */}
|
|
268
|
-
{/* Active */}
|
|
269
|
-
</div>
|
|
270
|
-
),
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
// add intaces with dark mode
|
package/src/item/Item.tsx
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { createContext, ReactNode, useId, useMemo, useState } from 'react';
|
|
2
|
-
import { Typography } from '../common';
|
|
3
|
-
import Body from '../body';
|
|
4
|
-
import { AdditionalInfo } from './ItemAdditionalInfo';
|
|
5
|
-
import { IconButton } from './ItemIconButton';
|
|
6
|
-
import { Checkbox } from './ItemCheckbox';
|
|
7
|
-
import { Navigation } from './ItemNavigation';
|
|
8
|
-
import { clsx } from 'clsx';
|
|
9
|
-
import { Button } from './ItemButton';
|
|
10
|
-
import { Switch } from './ItemSwitch';
|
|
11
|
-
import { AvatarLayout, AvatarView, Image } from './ItemMedia';
|
|
12
|
-
import Prompt from './prompt/Prompt';
|
|
13
|
-
|
|
14
|
-
export type ItemTypes =
|
|
15
|
-
| 'non-interactive'
|
|
16
|
-
| 'navigation'
|
|
17
|
-
| 'radio'
|
|
18
|
-
| 'checkbox'
|
|
19
|
-
| 'switch'
|
|
20
|
-
| 'button'
|
|
21
|
-
| 'icon-button';
|
|
22
|
-
|
|
23
|
-
export type Props = {
|
|
24
|
-
as?: 'li' | 'div' | 'span';
|
|
25
|
-
inverted?: boolean;
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
spotlight?: 'active' | 'inactive';
|
|
28
|
-
title: ReactNode;
|
|
29
|
-
subtitle?: ReactNode;
|
|
30
|
-
additionalInfo?: ReactNode;
|
|
31
|
-
valueTitle?: ReactNode;
|
|
32
|
-
valueSubtitle?: ReactNode;
|
|
33
|
-
media?: ReactNode;
|
|
34
|
-
control?: ReactNode;
|
|
35
|
-
prompt?: ReactNode;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export type ItemContextData = {
|
|
39
|
-
setControlType: (type: ItemTypes) => void;
|
|
40
|
-
ids: {
|
|
41
|
-
label: string;
|
|
42
|
-
additionalInfo: string;
|
|
43
|
-
value: string;
|
|
44
|
-
control: string;
|
|
45
|
-
prompt: string;
|
|
46
|
-
};
|
|
47
|
-
props: Pick<Props, 'as' | 'disabled' | 'inverted'>;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// @ts-expect-error for now let's mock it with `null` value
|
|
51
|
-
// but actually by default we should specify `setControlType('none')`
|
|
52
|
-
export const ItemContext = createContext<ItemContextData>(null);
|
|
53
|
-
|
|
54
|
-
export const Item = ({
|
|
55
|
-
as: View = 'li',
|
|
56
|
-
title,
|
|
57
|
-
subtitle,
|
|
58
|
-
additionalInfo,
|
|
59
|
-
prompt,
|
|
60
|
-
inverted,
|
|
61
|
-
media,
|
|
62
|
-
spotlight = undefined,
|
|
63
|
-
valueTitle,
|
|
64
|
-
valueSubtitle,
|
|
65
|
-
control = null,
|
|
66
|
-
disabled,
|
|
67
|
-
}: Props) => {
|
|
68
|
-
/*
|
|
69
|
-
const returnType = (): ReactNode => {
|
|
70
|
-
switch (type) {
|
|
71
|
-
case 'Navigation':
|
|
72
|
-
return <Chevron orientation={Position.RIGHT} disabled />;
|
|
73
|
-
case 'Radio':
|
|
74
|
-
return <RadioButton name="Hello" checked />;
|
|
75
|
-
case 'Checkbox':
|
|
76
|
-
return <CheckboxButton name="Hello" checked />;
|
|
77
|
-
case 'Switch':
|
|
78
|
-
return <Switch onClick={() => console.log('clicked')} />;
|
|
79
|
-
case 'Button':
|
|
80
|
-
return <Button v2>Hello</Button>;
|
|
81
|
-
case 'IconButton':
|
|
82
|
-
return (
|
|
83
|
-
<IconButton size={40} priority="minimal">
|
|
84
|
-
<InfoCircle />
|
|
85
|
-
</IconButton>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
*/
|
|
90
|
-
const idPrefix = useId();
|
|
91
|
-
|
|
92
|
-
const [controlType, setControlType] = useState<ItemTypes>('non-interactive');
|
|
93
|
-
const ids = {
|
|
94
|
-
label: `${idPrefix}_label`,
|
|
95
|
-
value: `${idPrefix}_value`,
|
|
96
|
-
control: `${idPrefix}_control`,
|
|
97
|
-
prompt: `${idPrefix}_prompt`,
|
|
98
|
-
additionalInfo: `${idPrefix}_additional-info`,
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const itemCtx = useMemo(
|
|
102
|
-
() => ({ setControlType, ids, props: { as: View, disabled, inverted } }),
|
|
103
|
-
[],
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<ItemContext.Provider value={itemCtx}>
|
|
108
|
-
<View
|
|
109
|
-
className={clsx(
|
|
110
|
-
'np-item',
|
|
111
|
-
{ 'np-item-interactive': controlType !== 'non-interactive' },
|
|
112
|
-
`np-item-${controlType}`,
|
|
113
|
-
'd-flex flex-row',
|
|
114
|
-
{ 'align-items-center': !subtitle },
|
|
115
|
-
{
|
|
116
|
-
[`np-item-spotlight-${spotlight}`]: !!spotlight,
|
|
117
|
-
},
|
|
118
|
-
)}
|
|
119
|
-
aria-describedby={[ids.additionalInfo].join(' ')}
|
|
120
|
-
>
|
|
121
|
-
{media && <div className="np-item-media">{media}</div>}
|
|
122
|
-
|
|
123
|
-
{/* Title + Subtitle + Values + Additional Info - Group */}
|
|
124
|
-
<div className="np-item-body">
|
|
125
|
-
{/* Title + Subtitle + Values - Group */}
|
|
126
|
-
<div className="d-flex justify-content-between">
|
|
127
|
-
<span>
|
|
128
|
-
{/* @ts-expect-error div can have role and aria-lavel props */}
|
|
129
|
-
<Body
|
|
130
|
-
type={Typography.BODY_LARGE_BOLD}
|
|
131
|
-
className="np-item-title"
|
|
132
|
-
// for a11y this needs to be a header but for SEO it shouldn't be `h*` tag
|
|
133
|
-
// so we enable header semantics via `role` and `aria-level` attrs
|
|
134
|
-
role="heading"
|
|
135
|
-
aria-level="4"
|
|
136
|
-
>
|
|
137
|
-
{title}
|
|
138
|
-
</Body>
|
|
139
|
-
<Body className="np-item-subtitle">{subtitle}</Body>
|
|
140
|
-
</span>
|
|
141
|
-
{(valueTitle || valueSubtitle) && (
|
|
142
|
-
<span
|
|
143
|
-
id={ids.value}
|
|
144
|
-
className={clsx('np-item-value', 'd-flex align-items-center', {
|
|
145
|
-
'flex-column': valueTitle !== undefined && valueSubtitle !== undefined,
|
|
146
|
-
})}
|
|
147
|
-
>
|
|
148
|
-
{valueTitle && (
|
|
149
|
-
<Body type={Typography.BODY_LARGE_BOLD} className="np-item-title-value">
|
|
150
|
-
{valueTitle}
|
|
151
|
-
</Body>
|
|
152
|
-
)}
|
|
153
|
-
{valueSubtitle && <Body className="np-item-subtitle-value">{valueSubtitle}</Body>}
|
|
154
|
-
</span>
|
|
155
|
-
)}
|
|
156
|
-
</div>
|
|
157
|
-
|
|
158
|
-
{/* Additional Info and Prompt here */}
|
|
159
|
-
{Boolean(subtitle) && additionalInfo}
|
|
160
|
-
</div>
|
|
161
|
-
{control === null ? null : <Body className="np-item-control">{control}</Body>}
|
|
162
|
-
{prompt}
|
|
163
|
-
</View>
|
|
164
|
-
</ItemContext.Provider>
|
|
165
|
-
);
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
/* eslint-disable functional/immutable-data */
|
|
169
|
-
Item.Image = Image;
|
|
170
|
-
Item.AvatarView = AvatarView;
|
|
171
|
-
Item.AvatarLayout = AvatarLayout;
|
|
172
|
-
Item.AdditionalInfo = AdditionalInfo;
|
|
173
|
-
Item.Checkbox = Checkbox;
|
|
174
|
-
Item.IconButton = IconButton;
|
|
175
|
-
Item.Navigation = Navigation;
|
|
176
|
-
Item.Button = Button;
|
|
177
|
-
Item.Switch = Switch;
|
|
178
|
-
Item.Prompt = Prompt;
|
|
179
|
-
/* eslint-enable functional/immutable-data */
|
|
180
|
-
|
|
181
|
-
export default Item;
|
package/src/item/index.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type { Props as ItemProps } from './Item';
|
|
2
|
-
export type { ItemAdditionalInfoProps } from './ItemAdditionalInfo';
|
|
3
|
-
export type { ItemCheckboxProps } from './ItemCheckbox';
|
|
4
|
-
export type { ItemImageProps, ItemAvatarViewProps, ItemAvatarLayoutProps } from './ItemMedia';
|
|
5
|
-
|
|
6
|
-
export { default } from './Item';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { useContext, useEffect } from 'react';
|
|
2
|
-
import { ItemContext, ItemContextData, ItemTypes } from './Item';
|
|
3
|
-
|
|
4
|
-
export function useItemControl(controlType: ItemTypes) {
|
|
5
|
-
const { setControlType, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
setControlType(controlType);
|
|
9
|
-
}, [controlType, setControlType]);
|
|
10
|
-
|
|
11
|
-
return { baseItemProps };
|
|
12
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|