@transferwise/components 0.0.0-experimental-7bd726b → 0.0.0-experimental-812a5b7
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/ListItem.js +17 -9
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +17 -9
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/listItem/Prompt/InlinePrompt/InlinePrompt.js +2 -5
- package/build/listItem/Prompt/InlinePrompt/InlinePrompt.js.map +1 -1
- package/build/listItem/Prompt/InlinePrompt/InlinePrompt.mjs +2 -5
- package/build/listItem/Prompt/InlinePrompt/InlinePrompt.mjs.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.js +1 -2
- package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
- package/build/listItem/Prompt/ListItemPrompt.mjs +1 -2
- package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
- package/build/main.css +4 -7
- package/build/statusIcon/StatusIcon.js +2 -3
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +2 -3
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/listItem/ListItem.css +4 -7
- package/build/styles/listItem/Prompt/InlinePrompt/InlinePrompt.css +1 -1
- package/build/styles/listItem/Prompt/ListItemPrompt.css +1 -1
- package/build/styles/main.css +4 -7
- package/build/types/listItem/ListItem.d.ts.map +1 -1
- package/build/types/listItem/Prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -1
- package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +1 -2
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/listItem/ListItem.css +4 -7
- package/src/listItem/ListItem.less +5 -7
- package/src/listItem/ListItem.spec.tsx +33 -0
- package/src/listItem/ListItem.tsx +25 -11
- package/src/listItem/Navigation/ListItemNavigation.story.tsx +0 -22
- package/src/listItem/Prompt/InlinePrompt/InlinePrompt.css +1 -1
- package/src/listItem/Prompt/InlinePrompt/InlinePrompt.less +1 -1
- package/src/listItem/Prompt/InlinePrompt/InlinePrompt.tsx +3 -15
- package/src/listItem/Prompt/ListItemPrompt.css +1 -1
- package/src/listItem/Prompt/ListItemPrompt.spec.tsx +34 -5
- package/src/listItem/Prompt/ListItemPrompt.tsx +1 -2
- package/src/listItem/_stories/ListItem.disabled.story.tsx +86 -59
- package/src/main.css +4 -7
- package/src/statusIcon/StatusIcon.tsx +2 -8
|
@@ -14,14 +14,13 @@ export type ListItemPromptProps = Pick<InlinePromptProps, 'children' | 'sentimen
|
|
|
14
14
|
*/
|
|
15
15
|
export const Prompt = ({ sentiment = Sentiment.NEUTRAL, children }: ListItemPromptProps) => {
|
|
16
16
|
const { ids, props } = useContext<ListItemContextData>(ListItemContext);
|
|
17
|
-
const isShortLivedMuted = props.disabled;
|
|
18
17
|
const isLongLivedMuted = props.disabled && Boolean(props.disabledPromptMessage);
|
|
19
18
|
|
|
20
19
|
return (
|
|
21
20
|
<InlinePrompt
|
|
22
21
|
id={ids.prompt}
|
|
23
22
|
sentiment={sentiment}
|
|
24
|
-
muted={isLongLivedMuted
|
|
23
|
+
muted={isLongLivedMuted}
|
|
25
24
|
className="wds-list-item-prompt"
|
|
26
25
|
>
|
|
27
26
|
{isLongLivedMuted ? props.disabledPromptMessage : children}
|
|
@@ -50,8 +50,18 @@ export default {
|
|
|
50
50
|
tags: ['autodocs'],
|
|
51
51
|
decorators: [withoutKey],
|
|
52
52
|
argTypes: hideControls(),
|
|
53
|
+
args: {
|
|
54
|
+
disabled: true,
|
|
55
|
+
subtitle: TEXT.subtitle,
|
|
56
|
+
valueTitle: TEXT.valueTitle,
|
|
57
|
+
valueSubtitle: TEXT.valueSubtitle,
|
|
58
|
+
media: MEDIA.avatarFlag,
|
|
59
|
+
},
|
|
53
60
|
parameters: {
|
|
54
61
|
docs: {
|
|
62
|
+
canvas: {
|
|
63
|
+
sourceState: 'hidden',
|
|
64
|
+
},
|
|
55
65
|
toc: true,
|
|
56
66
|
page: () => (
|
|
57
67
|
<>
|
|
@@ -71,40 +81,30 @@ type Story = StoryObj<ListItemProps>;
|
|
|
71
81
|
* to stop the users from making changes to the inputs while the form is being processed.
|
|
72
82
|
*
|
|
73
83
|
* Because these form states are usually short-lived, and would take at most few seconds to
|
|
74
|
-
* complete,
|
|
75
|
-
* the user or,
|
|
84
|
+
* complete, we don't want to introduce any major content changes that could distract
|
|
85
|
+
* the user or, even worse, cause layout shift. That's why, by default, toggling the `disabled`
|
|
76
86
|
* prop will not show any additional visual indicators, apart from the luminosity and opacity
|
|
77
87
|
* changes.
|
|
78
88
|
*/
|
|
79
89
|
export const ShortLived: Story = {
|
|
80
90
|
name: 'Short-lived: fully interactive',
|
|
81
91
|
args: {
|
|
82
|
-
|
|
83
|
-
title: TEXT.title,
|
|
84
|
-
subtitle: TEXT.subtitle,
|
|
85
|
-
valueTitle: TEXT.valueTitle,
|
|
86
|
-
valueSubtitle: TEXT.valueSubtitle,
|
|
87
|
-
media: MEDIA.avatarFlag,
|
|
88
|
-
control: (
|
|
89
|
-
<ListItem.Button priority="secondary" onClick={() => {}}>
|
|
90
|
-
Click me
|
|
91
|
-
</ListItem.Button>
|
|
92
|
-
),
|
|
92
|
+
control: CONTROLS.button,
|
|
93
93
|
},
|
|
94
94
|
argTypes: hideControls(['disabledPromptMessage']),
|
|
95
95
|
render: function Render(args) {
|
|
96
|
-
const renderPrompt = (sentiment: ListItemPromptProps['sentiment']) => (
|
|
97
|
-
<ListItem.Prompt sentiment={sentiment}>
|
|
98
|
-
This prompt contains an <Link href="#target">external link</Link> too.
|
|
99
|
-
</ListItem.Prompt>
|
|
100
|
-
);
|
|
101
|
-
|
|
102
96
|
return (
|
|
103
97
|
<List>
|
|
104
|
-
<ListItem {...args} control={CONTROLS.navigation} />
|
|
105
|
-
<ListItem
|
|
106
|
-
|
|
107
|
-
|
|
98
|
+
<ListItem {...args} title="No prompt" control={CONTROLS.navigation} />
|
|
99
|
+
<ListItem
|
|
100
|
+
{...args}
|
|
101
|
+
title="Neutral prompt"
|
|
102
|
+
prompt={renderPrompt('neutral')}
|
|
103
|
+
control={CONTROLS.navigation}
|
|
104
|
+
/>
|
|
105
|
+
<ListItem {...args} title="Positive prompt" prompt={renderPrompt('positive')} />
|
|
106
|
+
<ListItem {...args} title="Warning prompt" prompt={renderPrompt('warning')} />
|
|
107
|
+
<ListItem {...args} title="Negative prompt" prompt={renderPrompt('negative')} />
|
|
108
108
|
</List>
|
|
109
109
|
);
|
|
110
110
|
},
|
|
@@ -121,27 +121,26 @@ export const ShortLived: Story = {
|
|
|
121
121
|
export const ShortLivedPartially: Story = {
|
|
122
122
|
name: 'Short-lived: partially interactive',
|
|
123
123
|
args: {
|
|
124
|
-
disabled: true,
|
|
125
|
-
title: TEXT.title,
|
|
126
|
-
subtitle: TEXT.subtitle,
|
|
127
|
-
valueTitle: TEXT.valueTitle,
|
|
128
|
-
valueSubtitle: TEXT.valueSubtitle,
|
|
129
|
-
media: MEDIA.avatarFlag,
|
|
130
124
|
additionalInfo: INFO.interactive,
|
|
131
125
|
},
|
|
132
126
|
argTypes: hideControls(['spotlight', 'disabledPromptMessage']),
|
|
133
127
|
render: function Render(args) {
|
|
134
|
-
const renderPrompt = (sentiment: ListItemPromptProps['sentiment']) => (
|
|
135
|
-
<ListItem.Prompt sentiment={sentiment}>
|
|
136
|
-
This prompt contains an <Link href="#target">external link</Link> too.
|
|
137
|
-
</ListItem.Prompt>
|
|
138
|
-
);
|
|
139
|
-
|
|
140
128
|
return (
|
|
141
129
|
<List>
|
|
142
|
-
<ListItem {...args} prompt={renderPrompt('warning')} control={CONTROLS.partialButton} />
|
|
143
130
|
<ListItem
|
|
144
131
|
{...args}
|
|
132
|
+
title="No prompt and disabled control"
|
|
133
|
+
control={CONTROLS.partialButton}
|
|
134
|
+
/>
|
|
135
|
+
<ListItem
|
|
136
|
+
{...args}
|
|
137
|
+
title="Prompt and disabled Button control"
|
|
138
|
+
prompt={renderPrompt('warning')}
|
|
139
|
+
control={CONTROLS.partialButton}
|
|
140
|
+
/>
|
|
141
|
+
<ListItem
|
|
142
|
+
{...args}
|
|
143
|
+
title="Prompt and disabled IconButton control"
|
|
145
144
|
prompt={renderPrompt('positive')}
|
|
146
145
|
control={CONTROLS.partialIconButton}
|
|
147
146
|
/>
|
|
@@ -169,27 +168,45 @@ export const ShortLivedPartially: Story = {
|
|
|
169
168
|
export const LongLived: Story = {
|
|
170
169
|
name: 'Long-lived: fully interactive',
|
|
171
170
|
args: {
|
|
172
|
-
disabled: true,
|
|
173
171
|
disabledPromptMessage,
|
|
174
|
-
|
|
175
|
-
subtitle: TEXT.subtitle,
|
|
176
|
-
valueTitle: TEXT.valueTitle,
|
|
177
|
-
valueSubtitle: TEXT.valueSubtitle,
|
|
178
|
-
media: MEDIA.avatarFlag,
|
|
179
|
-
control: (
|
|
180
|
-
<ListItem.Button priority="secondary" onClick={() => {}}>
|
|
181
|
-
Click me
|
|
182
|
-
</ListItem.Button>
|
|
183
|
-
),
|
|
172
|
+
control: CONTROLS.button,
|
|
184
173
|
},
|
|
185
174
|
argTypes: hideControls(['disabledPromptMessage']),
|
|
186
175
|
render: function Render(args) {
|
|
187
176
|
return (
|
|
188
177
|
<List>
|
|
189
|
-
<ListItem
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
178
|
+
<ListItem
|
|
179
|
+
{...args}
|
|
180
|
+
title="No prompt, no disabledPromptMessage"
|
|
181
|
+
disabledPromptMessage={undefined}
|
|
182
|
+
control={CONTROLS.navigation}
|
|
183
|
+
/>
|
|
184
|
+
<ListItem
|
|
185
|
+
{...args}
|
|
186
|
+
title="No prompt, disabledPromptMessage set"
|
|
187
|
+
control={CONTROLS.navigation}
|
|
188
|
+
/>
|
|
189
|
+
<ListItem
|
|
190
|
+
{...args}
|
|
191
|
+
title="Neutral prompt, disabledPromptMessage set"
|
|
192
|
+
prompt={renderPrompt('neutral')}
|
|
193
|
+
control={CONTROLS.navigation}
|
|
194
|
+
/>
|
|
195
|
+
<ListItem
|
|
196
|
+
{...args}
|
|
197
|
+
title="Positive prompt, disabledPromptMessage set"
|
|
198
|
+
prompt={renderPrompt('positive')}
|
|
199
|
+
/>
|
|
200
|
+
<ListItem
|
|
201
|
+
{...args}
|
|
202
|
+
title="Warning prompt, disabledPromptMessage set"
|
|
203
|
+
prompt={renderPrompt('warning')}
|
|
204
|
+
/>
|
|
205
|
+
<ListItem
|
|
206
|
+
{...args}
|
|
207
|
+
title="Negative prompt, disabledPromptMessage set"
|
|
208
|
+
prompt={renderPrompt('negative')}
|
|
209
|
+
/>
|
|
193
210
|
</List>
|
|
194
211
|
);
|
|
195
212
|
},
|
|
@@ -206,23 +223,33 @@ export const LongLived: Story = {
|
|
|
206
223
|
export const LongLivedPartially: Story = {
|
|
207
224
|
name: 'Long-lived: partially interactive',
|
|
208
225
|
args: {
|
|
209
|
-
disabled: true,
|
|
210
226
|
disabledPromptMessage,
|
|
211
|
-
title: TEXT.title,
|
|
212
|
-
subtitle: TEXT.subtitle,
|
|
213
|
-
valueTitle: TEXT.valueTitle,
|
|
214
|
-
valueSubtitle: TEXT.valueSubtitle,
|
|
215
|
-
media: MEDIA.avatarFlag,
|
|
216
227
|
additionalInfo: INFO.interactive,
|
|
217
228
|
},
|
|
218
229
|
argTypes: hideControls(['spotlight', 'disabledPromptMessage']),
|
|
219
230
|
render: function Render(args) {
|
|
220
231
|
return (
|
|
221
232
|
<List>
|
|
222
|
-
<ListItem {...args} control={CONTROLS.partialButton} />
|
|
223
|
-
<ListItem {...args} prompt={renderPrompt('warning')} control={CONTROLS.partialButton} />
|
|
224
233
|
<ListItem
|
|
225
234
|
{...args}
|
|
235
|
+
disabledPromptMessage={undefined}
|
|
236
|
+
title="No prompt, no disabledPromptMessage"
|
|
237
|
+
control={CONTROLS.partialButton}
|
|
238
|
+
/>
|
|
239
|
+
<ListItem
|
|
240
|
+
{...args}
|
|
241
|
+
title="No prompt, disabledPromptMessage set"
|
|
242
|
+
control={CONTROLS.partialButton}
|
|
243
|
+
/>
|
|
244
|
+
<ListItem
|
|
245
|
+
{...args}
|
|
246
|
+
title="Prompt set, disabledPromptMessage set"
|
|
247
|
+
prompt={renderPrompt('warning')}
|
|
248
|
+
control={CONTROLS.partialIconButton}
|
|
249
|
+
/>
|
|
250
|
+
<ListItem
|
|
251
|
+
{...args}
|
|
252
|
+
title="Prompt set, disabledPromptMessage set"
|
|
226
253
|
prompt={renderPrompt('positive')}
|
|
227
254
|
control={CONTROLS.partialIconButton}
|
|
228
255
|
/>
|
package/src/main.css
CHANGED
|
@@ -3049,7 +3049,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3049
3049
|
}
|
|
3050
3050
|
.wds-inline-prompt--muted {
|
|
3051
3051
|
opacity: 0.93;
|
|
3052
|
-
|
|
3052
|
+
filter: grayscale(1);
|
|
3053
3053
|
}
|
|
3054
3054
|
.wds-inline-prompt a,
|
|
3055
3055
|
.wds-inline-prompt button {
|
|
@@ -3356,10 +3356,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3356
3356
|
.wds-list-item-control-wrapper {
|
|
3357
3357
|
grid-area: control;
|
|
3358
3358
|
}
|
|
3359
|
-
.wds-list-item-control-wrapper-disabled {
|
|
3360
|
-
opacity: 0.45;
|
|
3361
|
-
mix-blend-mode: luminosity;
|
|
3362
|
-
}
|
|
3363
3359
|
.wds-list-item-navigation .tw-icon-chevron-right {
|
|
3364
3360
|
color: #c9cbce;
|
|
3365
3361
|
color: var(--color-interactive-secondary);
|
|
@@ -3370,7 +3366,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3370
3366
|
.wds-list-item.disabled {
|
|
3371
3367
|
opacity: 1;
|
|
3372
3368
|
opacity: initial;
|
|
3373
|
-
filter: initial;
|
|
3374
3369
|
}
|
|
3375
3370
|
.wds-list-item.disabled,
|
|
3376
3371
|
.wds-list-item.disabled label {
|
|
@@ -3388,7 +3383,9 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
3388
3383
|
.wds-list-item.disabled .wds-list-item-body,
|
|
3389
3384
|
.wds-list-item.disabled .wds-list-item-additional-info {
|
|
3390
3385
|
opacity: 0.93;
|
|
3391
|
-
|
|
3386
|
+
}
|
|
3387
|
+
.wds-list-item.disabled--has-prompt-reason .wds-list-item-prompt {
|
|
3388
|
+
opacity: 0.93;
|
|
3392
3389
|
}
|
|
3393
3390
|
.wds-list-item-spotlight {
|
|
3394
3391
|
padding-left: 12px;
|
|
@@ -24,7 +24,6 @@ export type StatusIconProps = {
|
|
|
24
24
|
* Using `null` will render the icon purely presentational.
|
|
25
25
|
* */
|
|
26
26
|
iconLabel?: string | null;
|
|
27
|
-
className?: string;
|
|
28
27
|
};
|
|
29
28
|
|
|
30
29
|
const mapLegacySize = {
|
|
@@ -33,12 +32,7 @@ const mapLegacySize = {
|
|
|
33
32
|
[String(Size.LARGE)]: 48,
|
|
34
33
|
} satisfies Record<string, CircleProps['size']>;
|
|
35
34
|
|
|
36
|
-
const StatusIcon = ({
|
|
37
|
-
sentiment = 'neutral',
|
|
38
|
-
size: sizeProp = 40,
|
|
39
|
-
iconLabel,
|
|
40
|
-
className,
|
|
41
|
-
}: StatusIconProps) => {
|
|
35
|
+
const StatusIcon = ({ sentiment = 'neutral', size: sizeProp = 40, iconLabel }: StatusIconProps) => {
|
|
42
36
|
const intl = useIntl();
|
|
43
37
|
|
|
44
38
|
const iconMetaBySentiment: Record<
|
|
@@ -92,7 +86,7 @@ const StatusIcon = ({
|
|
|
92
86
|
as="span"
|
|
93
87
|
size={isTinyViewport && size < 40 ? 32 : size}
|
|
94
88
|
data-testid="status-icon"
|
|
95
|
-
className={clsx('status-circle', sentiment
|
|
89
|
+
className={clsx('status-circle', sentiment)}
|
|
96
90
|
>
|
|
97
91
|
<Icon
|
|
98
92
|
className={clsx('status-icon', iconColor)}
|