@transferwise/components 0.0.0-experimental-850e2db → 0.0.0-experimental-308f971
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/dateInput/DateInput.js +4 -4
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +4 -4
- package/build/dateInput/DateInput.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 +13 -213
- package/build/styles/dateInput/DateInput.css +13 -1
- package/build/styles/main.css +13 -213
- package/build/types/index.d.ts +0 -2
- package/build/types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/dateInput/DateInput.css +13 -1
- package/src/dateInput/DateInput.less +20 -3
- package/src/dateInput/DateInput.tests.story.tsx +14 -2
- package/src/dateInput/DateInput.tsx +4 -4
- package/src/index.ts +0 -2
- package/src/main.css +13 -213
- package/src/main.less +0 -1
- package/build/styles/listItem/ListItem.css +0 -212
- package/build/types/listItem/ListItem.d.ts +0 -50
- package/build/types/listItem/ListItem.d.ts.map +0 -1
- package/build/types/listItem/ListItemAdditionalInfo.d.ts +0 -9
- package/build/types/listItem/ListItemAdditionalInfo.d.ts.map +0 -1
- package/build/types/listItem/ListItemButton.d.ts +0 -6
- package/build/types/listItem/ListItemButton.d.ts.map +0 -1
- package/build/types/listItem/ListItemCheckbox.d.ts +0 -4
- package/build/types/listItem/ListItemCheckbox.d.ts.map +0 -1
- package/build/types/listItem/ListItemIconButton.d.ts +0 -8
- package/build/types/listItem/ListItemIconButton.d.ts.map +0 -1
- package/build/types/listItem/ListItemMedia.d.ts +0 -19
- package/build/types/listItem/ListItemMedia.d.ts.map +0 -1
- package/build/types/listItem/ListItemNavigation.d.ts +0 -4
- package/build/types/listItem/ListItemNavigation.d.ts.map +0 -1
- package/build/types/listItem/ListItemSwitch.d.ts +0 -3
- package/build/types/listItem/ListItemSwitch.d.ts.map +0 -1
- package/build/types/listItem/index.d.ts +0 -6
- package/build/types/listItem/index.d.ts.map +0 -1
- package/build/types/listItem/prompt/Prompt.d.ts +0 -12
- package/build/types/listItem/prompt/Prompt.d.ts.map +0 -1
- package/build/types/listItem/useItemControl.d.ts +0 -5
- package/build/types/listItem/useItemControl.d.ts.map +0 -1
- package/src/listItem/ListItem.css +0 -212
- package/src/listItem/ListItem.less +0 -210
- package/src/listItem/ListItem.spec.tsx +0 -35
- package/src/listItem/ListItem.story.tsx +0 -461
- package/src/listItem/ListItem.tsx +0 -282
- package/src/listItem/ListItemAdditionalInfo.tsx +0 -31
- package/src/listItem/ListItemButton.spec.tsx +0 -92
- package/src/listItem/ListItemButton.tsx +0 -24
- package/src/listItem/ListItemCheckbox.tsx +0 -14
- package/src/listItem/ListItemIconButton.tsx +0 -16
- package/src/listItem/ListItemMedia.tsx +0 -52
- package/src/listItem/ListItemNavigation.tsx +0 -23
- package/src/listItem/ListItemSwitch.tsx +0 -8
- package/src/listItem/index.ts +0 -10
- package/src/listItem/prompt/Prompt.spec.tsx +0 -77
- package/src/listItem/prompt/Prompt.story.tsx +0 -170
- package/src/listItem/prompt/Prompt.tsx +0 -44
- package/src/listItem/useItemControl.tsx +0 -23
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import Link from '../../link';
|
|
2
|
-
import { Sentiment } from '../../common';
|
|
3
|
-
import { Prompt, ListItemPromptProps } from './Prompt';
|
|
4
|
-
import { lorem40 } from '../../test-utils';
|
|
5
|
-
import { StoryObj } from '@storybook/react';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
component: Prompt,
|
|
9
|
-
title: 'Content/ListItem/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
|
-
ListItemPromptProps & {
|
|
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
|
-
<Prompt
|
|
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
|
-
</Prompt>
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const Variants = () => {
|
|
84
|
-
return (
|
|
85
|
-
<>
|
|
86
|
-
<div className="m-b-2">
|
|
87
|
-
<Prompt type={Sentiment.POSITIVE}>
|
|
88
|
-
Positive prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
89
|
-
</Prompt>
|
|
90
|
-
</div>
|
|
91
|
-
<div className="m-b-2">
|
|
92
|
-
<Prompt type={Sentiment.NEGATIVE}>
|
|
93
|
-
Negative prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
94
|
-
</Prompt>
|
|
95
|
-
</div>
|
|
96
|
-
<div className="m-b-2">
|
|
97
|
-
<Prompt type={Sentiment.NEUTRAL}>
|
|
98
|
-
Neutral prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
99
|
-
</Prompt>
|
|
100
|
-
</div>
|
|
101
|
-
<div className="m-b-2">
|
|
102
|
-
<Prompt type={Sentiment.WARNING}>
|
|
103
|
-
Warning prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
104
|
-
</Prompt>
|
|
105
|
-
</div>
|
|
106
|
-
<div className="m-b-2">
|
|
107
|
-
<Prompt type="discount">
|
|
108
|
-
Discount prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
109
|
-
</Prompt>
|
|
110
|
-
</div>
|
|
111
|
-
<div className="m-b-2">
|
|
112
|
-
<Prompt type="savings">
|
|
113
|
-
Savings prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
114
|
-
</Prompt>
|
|
115
|
-
</div>
|
|
116
|
-
<div className="m-b-2">
|
|
117
|
-
<Prompt
|
|
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
|
-
</Prompt>
|
|
127
|
-
</div>
|
|
128
|
-
<div className="m-b-2">
|
|
129
|
-
<Prompt
|
|
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
|
-
</Prompt>
|
|
139
|
-
</div>
|
|
140
|
-
<div className="m-b-2">
|
|
141
|
-
<Prompt
|
|
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
|
-
</Prompt>
|
|
152
|
-
</div>
|
|
153
|
-
<div className="m-b-2">
|
|
154
|
-
<Prompt
|
|
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
|
-
</Prompt>
|
|
164
|
-
</div>
|
|
165
|
-
<div className="m-b-2" style={{ maxWidth: '300px' }}>
|
|
166
|
-
<Prompt type="warning">The prompt has very long text that wraps {lorem40}</Prompt>
|
|
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 ListItemPromptProps = {
|
|
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 Prompt = ({ type, children, action }: ListItemPromptProps) => {
|
|
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
|
-
'wds-list-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 Prompt;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useContext, useEffect } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
ListItemContext,
|
|
4
|
-
ListItemContextData,
|
|
5
|
-
ListItemControlProps,
|
|
6
|
-
ListItemTypes,
|
|
7
|
-
} from './ListItem';
|
|
8
|
-
|
|
9
|
-
export function useItemControl(controlType: ListItemTypes, controlProps?: ListItemControlProps) {
|
|
10
|
-
const {
|
|
11
|
-
setControlType,
|
|
12
|
-
setControlProps,
|
|
13
|
-
props: baseItemProps,
|
|
14
|
-
} = useContext<ListItemContextData>(ListItemContext);
|
|
15
|
-
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
setControlType(controlType);
|
|
18
|
-
// @ts-expect-error TODO: fix the type error later
|
|
19
|
-
setControlProps(controlProps);
|
|
20
|
-
}, [controlType, controlProps, setControlType, setControlProps]);
|
|
21
|
-
|
|
22
|
-
return { baseItemProps };
|
|
23
|
-
}
|