@transferwise/components 0.0.0-experimental-fed4f10 → 0.0.0-experimental-8d08be7
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/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/common/propsValues/sentiment.js +1 -0
- package/build/common/propsValues/sentiment.js.map +1 -1
- package/build/common/propsValues/sentiment.mjs +1 -0
- package/build/common/propsValues/sentiment.mjs.map +1 -1
- package/build/index.js +0 -1
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -1
- package/build/main.css +60 -188
- package/build/statusIcon/StatusIcon.js +2 -2
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +2 -2
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/inputs/Input.css +28 -2
- package/build/styles/inputs/TextArea.css +28 -2
- package/build/styles/main.css +60 -188
- package/build/styles/popover/Popover.css +28 -2
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs.map +1 -1
- package/build/types/alert/Alert.d.ts +2 -2
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +2 -2
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
- package/build/types/index.d.ts +0 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +3 -2
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/test-utils/fake-data.d.ts +0 -1
- package/build/types/test-utils/fake-data.d.ts.map +1 -1
- package/build/types/title/Title.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/alert/Alert.story.tsx +5 -3
- package/src/alert/Alert.tsx +11 -2
- package/src/avatarWrapper/AvatarWrapper.story.tsx +2 -2
- package/src/avatarWrapper/AvatarWrapper.tsx +3 -2
- package/src/common/propsValues/sentiment.ts +1 -0
- package/src/index.ts +0 -2
- package/src/inputs/Input.css +28 -2
- package/src/inputs/TextArea.css +28 -2
- package/src/main.css +60 -188
- package/src/main.less +0 -1
- package/src/popover/Popover.css +28 -2
- package/src/statusIcon/StatusIcon.docs.mdx +1 -1
- package/src/statusIcon/StatusIcon.spec.tsx +10 -4
- package/src/statusIcon/StatusIcon.story.tsx +10 -5
- package/src/statusIcon/StatusIcon.tsx +6 -4
- package/src/test-utils/fake-data.ts +0 -3
- package/src/title/Title.test.story.tsx +19 -12
- package/src/title/Title.tsx +1 -0
- package/build/styles/item/Item.css +0 -184
- package/build/types/item/Item.d.ts +0 -40
- 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/ItemCheckbox.d.ts +0 -4
- package/build/types/item/ItemCheckbox.d.ts.map +0 -1
- package/build/types/item/ItemIconButton.d.ts +0 -4
- package/build/types/item/ItemIconButton.d.ts.map +0 -1
- package/build/types/item/ItemImage.d.ts +0 -4
- package/build/types/item/ItemImage.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/index.d.ts +0 -5
- package/build/types/item/index.d.ts.map +0 -1
- package/build/types/item/prompt/Prompt.d.ts +0 -12
- package/build/types/item/prompt/Prompt.d.ts.map +0 -1
- package/src/item/Item.css +0 -184
- package/src/item/Item.less +0 -178
- package/src/item/Item.story.tsx +0 -93
- package/src/item/Item.tsx +0 -165
- package/src/item/ItemAdditionalInfo.tsx +0 -31
- package/src/item/ItemCheckbox.tsx +0 -16
- package/src/item/ItemIconButton.tsx +0 -15
- package/src/item/ItemImage.tsx +0 -11
- package/src/item/ItemNavigation.tsx +0 -16
- package/src/item/index.ts +0 -4
- package/src/item/prompt/Prompt.spec.tsx +0 -77
- package/src/item/prompt/Prompt.story.tsx +0 -170
- package/src/item/prompt/Prompt.tsx +0 -44
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import Link from '../../link';
|
|
2
|
-
import { Sentiment } from '../../common';
|
|
3
|
-
import { ItemPrompt, ItemPromptProps } from './Prompt';
|
|
4
|
-
import { lorem40 } from '../../test-utils';
|
|
5
|
-
import { StoryObj } from '@storybook/react';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
component: ItemPrompt,
|
|
9
|
-
title: 'Content/Item/Prompt',
|
|
10
|
-
args: {
|
|
11
|
-
type: Sentiment.NEGATIVE,
|
|
12
|
-
children: 'You have done a terrible thing',
|
|
13
|
-
},
|
|
14
|
-
argTypes: {
|
|
15
|
-
type: {
|
|
16
|
-
options: [
|
|
17
|
-
Sentiment.POSITIVE,
|
|
18
|
-
Sentiment.NEGATIVE,
|
|
19
|
-
Sentiment.NEUTRAL,
|
|
20
|
-
Sentiment.WARNING,
|
|
21
|
-
'discount',
|
|
22
|
-
'savings',
|
|
23
|
-
],
|
|
24
|
-
control: { type: 'radio' },
|
|
25
|
-
description: 'The type of prompt to display',
|
|
26
|
-
},
|
|
27
|
-
action: {
|
|
28
|
-
table: {
|
|
29
|
-
disable: true,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
children: {
|
|
33
|
-
type: {
|
|
34
|
-
name: 'string',
|
|
35
|
-
required: true,
|
|
36
|
-
description: 'The content of the prompt',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
type CustomStory = StoryObj<
|
|
43
|
-
ItemPromptProps & {
|
|
44
|
-
interactivity?: 'none' | 'full-anchor' | 'full-button' | 'link';
|
|
45
|
-
}
|
|
46
|
-
>;
|
|
47
|
-
|
|
48
|
-
export const Basic: CustomStory = {
|
|
49
|
-
args: {
|
|
50
|
-
interactivity: 'none',
|
|
51
|
-
},
|
|
52
|
-
argTypes: {
|
|
53
|
-
interactivity: {
|
|
54
|
-
options: ['none', 'full-button', 'full-anchor', 'link'],
|
|
55
|
-
control: { type: 'radio' },
|
|
56
|
-
description: 'The type of interactivity to display',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
render: ({ interactivity, ...args }) => {
|
|
60
|
-
return (
|
|
61
|
-
<div>
|
|
62
|
-
<ItemPrompt
|
|
63
|
-
type={args.type}
|
|
64
|
-
action={
|
|
65
|
-
interactivity === 'full-anchor'
|
|
66
|
-
? { href: 'wise.com' }
|
|
67
|
-
: interactivity === 'full-button'
|
|
68
|
-
? {
|
|
69
|
-
onClick: () => {
|
|
70
|
-
console.log('clicked');
|
|
71
|
-
},
|
|
72
|
-
}
|
|
73
|
-
: undefined
|
|
74
|
-
}
|
|
75
|
-
>
|
|
76
|
-
{args.children} {interactivity === 'link' && <Link href="www.wise.com">with a link</Link>}
|
|
77
|
-
</ItemPrompt>
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const Variants = () => {
|
|
84
|
-
return (
|
|
85
|
-
<>
|
|
86
|
-
<div className="m-b-2">
|
|
87
|
-
<ItemPrompt type={Sentiment.POSITIVE}>
|
|
88
|
-
Positive prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
89
|
-
</ItemPrompt>
|
|
90
|
-
</div>
|
|
91
|
-
<div className="m-b-2">
|
|
92
|
-
<ItemPrompt type={Sentiment.NEGATIVE}>
|
|
93
|
-
Negative prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
94
|
-
</ItemPrompt>
|
|
95
|
-
</div>
|
|
96
|
-
<div className="m-b-2">
|
|
97
|
-
<ItemPrompt type={Sentiment.NEUTRAL}>
|
|
98
|
-
Neutral prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
99
|
-
</ItemPrompt>
|
|
100
|
-
</div>
|
|
101
|
-
<div className="m-b-2">
|
|
102
|
-
<ItemPrompt type={Sentiment.WARNING}>
|
|
103
|
-
Warning prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
104
|
-
</ItemPrompt>
|
|
105
|
-
</div>
|
|
106
|
-
<div className="m-b-2">
|
|
107
|
-
<ItemPrompt type="discount">
|
|
108
|
-
Discount prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
109
|
-
</ItemPrompt>
|
|
110
|
-
</div>
|
|
111
|
-
<div className="m-b-2">
|
|
112
|
-
<ItemPrompt type="savings">
|
|
113
|
-
Savings prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
114
|
-
</ItemPrompt>
|
|
115
|
-
</div>
|
|
116
|
-
<div className="m-b-2">
|
|
117
|
-
<ItemPrompt
|
|
118
|
-
type="discount"
|
|
119
|
-
action={{
|
|
120
|
-
href: 'www.wise.com',
|
|
121
|
-
target: '_self',
|
|
122
|
-
'aria-label': 'hidden anchor tags are accessible, right?',
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
The whole prompt is secretly clickable
|
|
126
|
-
</ItemPrompt>
|
|
127
|
-
</div>
|
|
128
|
-
<div className="m-b-2">
|
|
129
|
-
<ItemPrompt
|
|
130
|
-
type="negative"
|
|
131
|
-
action={{
|
|
132
|
-
href: 'www.wise.com',
|
|
133
|
-
target: '_self',
|
|
134
|
-
'aria-label': 'clickable <a>',
|
|
135
|
-
}}
|
|
136
|
-
>
|
|
137
|
-
The whole prompt is secretly clickable as an anchor tag
|
|
138
|
-
</ItemPrompt>
|
|
139
|
-
</div>
|
|
140
|
-
<div className="m-b-2">
|
|
141
|
-
<ItemPrompt
|
|
142
|
-
type="warning"
|
|
143
|
-
action={{
|
|
144
|
-
onClick: () => {
|
|
145
|
-
console.log('clicked');
|
|
146
|
-
},
|
|
147
|
-
'aria-label': 'clickable button',
|
|
148
|
-
}}
|
|
149
|
-
>
|
|
150
|
-
The whole prompt is secretly clickable as a button
|
|
151
|
-
</ItemPrompt>
|
|
152
|
-
</div>
|
|
153
|
-
<div className="m-b-2">
|
|
154
|
-
<ItemPrompt
|
|
155
|
-
type="neutral"
|
|
156
|
-
action={{
|
|
157
|
-
href: 'www.wise.com',
|
|
158
|
-
target: '_self',
|
|
159
|
-
'aria-label': 'clickable prompt',
|
|
160
|
-
}}
|
|
161
|
-
>
|
|
162
|
-
The whole prompt is secretly clickable
|
|
163
|
-
</ItemPrompt>
|
|
164
|
-
</div>
|
|
165
|
-
<div className="m-b-2" style={{ maxWidth: '300px' }}>
|
|
166
|
-
<ItemPrompt type="warning">The prompt has very long text that wraps {lorem40}</ItemPrompt>
|
|
167
|
-
</div>
|
|
168
|
-
</>
|
|
169
|
-
);
|
|
170
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Confetti, Tags } from '@transferwise/icons';
|
|
2
|
-
import { Sentiment } from '../../common';
|
|
3
|
-
import StatusIcon from '../../statusIcon';
|
|
4
|
-
import { clsx } from 'clsx';
|
|
5
|
-
import { LinkProps } from '../../link';
|
|
6
|
-
import Body from '../../body';
|
|
7
|
-
|
|
8
|
-
export type ItemPromptProps = {
|
|
9
|
-
type:
|
|
10
|
-
| `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`
|
|
11
|
-
| 'discount'
|
|
12
|
-
| 'savings';
|
|
13
|
-
children: React.ReactNode;
|
|
14
|
-
action?: Pick<LinkProps, 'href' | 'target' | 'onClick'> & { 'aria-label'?: string };
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const ItemPrompt = ({ type, children, action }: ItemPromptProps) => {
|
|
18
|
-
const Wrapper = action?.href ? 'a' : action?.onClick ? 'button' : 'span';
|
|
19
|
-
|
|
20
|
-
const icon =
|
|
21
|
-
type === 'discount' ? (
|
|
22
|
-
<Tags size={16} />
|
|
23
|
-
) : type === 'savings' ? (
|
|
24
|
-
<Confetti size={16} />
|
|
25
|
-
) : (
|
|
26
|
-
<StatusIcon size={16} sentiment={type} />
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Wrapper
|
|
31
|
-
className={clsx(
|
|
32
|
-
'np-item-prompt',
|
|
33
|
-
type,
|
|
34
|
-
(action?.href || action?.onClick) && 'np-prompt-interactive',
|
|
35
|
-
)}
|
|
36
|
-
{...(action ?? {})}
|
|
37
|
-
>
|
|
38
|
-
<div className="np-prompt-icon">{icon}</div>
|
|
39
|
-
<Body>{children}</Body>
|
|
40
|
-
</Wrapper>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default ItemPrompt;
|