@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
|
@@ -2,11 +2,11 @@ import { default as IconButtonComp, IconButtonProps } from '../iconButton';
|
|
|
2
2
|
import { useItemControl } from './useItemControl';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
|
-
export type
|
|
5
|
+
export type ListItemIconButtonProps = Pick<IconButtonProps, 'onClick' | 'href' | 'target'> & {
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
export const IconButton = function (props:
|
|
9
|
+
export const IconButton = function (props: ListItemIconButtonProps) {
|
|
10
10
|
const { baseItemProps } = useItemControl('icon-button');
|
|
11
11
|
|
|
12
12
|
return <IconButtonComp {...props} size={32} disabled={baseItemProps.disabled} />;
|
|
@@ -5,31 +5,31 @@ import { clsx } from 'clsx';
|
|
|
5
5
|
|
|
6
6
|
type SizeProp = { size?: 32 | 40 | 48 | 56 | 72 };
|
|
7
7
|
|
|
8
|
-
export type
|
|
8
|
+
export type ListItemAvatarViewProps = Omit<AvatarViewProps, 'size' | 'interactive'> & SizeProp;
|
|
9
9
|
|
|
10
|
-
export const AvatarView = ({ className, size = 48, ...props }:
|
|
10
|
+
export const AvatarView = ({ className, size = 48, ...props }: ListItemAvatarViewProps) => {
|
|
11
11
|
return (
|
|
12
12
|
<AvatarViewComp
|
|
13
13
|
{...props}
|
|
14
14
|
size={size}
|
|
15
|
-
className={clsx('
|
|
15
|
+
className={clsx('wds-list-item-media-avatar-view', className)}
|
|
16
16
|
/>
|
|
17
17
|
);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export type
|
|
20
|
+
export type ListItemAvatarLayoutProps = Omit<AvatarLayoutProps, 'size' | 'interactive'> & SizeProp;
|
|
21
21
|
|
|
22
|
-
export const AvatarLayout = ({ className, size = 48, ...props }:
|
|
22
|
+
export const AvatarLayout = ({ className, size = 48, ...props }: ListItemAvatarLayoutProps) => {
|
|
23
23
|
return (
|
|
24
24
|
<AvatarLayoutComp
|
|
25
25
|
{...props}
|
|
26
26
|
size={size}
|
|
27
|
-
className={clsx('
|
|
27
|
+
className={clsx('wds-list-item-media-avatar-layout', className)}
|
|
28
28
|
/>
|
|
29
29
|
);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
export type
|
|
32
|
+
export type ListItemImageProps = Omit<ImageProps, 'stretch' | 'shrink' | 'id' | 'alt'> &
|
|
33
33
|
SizeProp & {
|
|
34
34
|
alt?: string;
|
|
35
35
|
};
|
|
@@ -37,10 +37,10 @@ export type ItemImageProps = Omit<ImageProps, 'stretch' | 'shrink' | 'id' | 'alt
|
|
|
37
37
|
/**
|
|
38
38
|
* TODO: mention that image is for rare cases not for DS illustrations, they discouraged
|
|
39
39
|
*/
|
|
40
|
-
export const Image = ({ alt = '', size = 48, ...props }:
|
|
40
|
+
export const Image = ({ alt = '', size = 48, ...props }: ListItemImageProps) => {
|
|
41
41
|
return (
|
|
42
42
|
<div
|
|
43
|
-
className={clsx('
|
|
43
|
+
className={clsx('wds-list-item-media-image')}
|
|
44
44
|
style={{
|
|
45
45
|
// @ts-expect-error CSS custom props allowed
|
|
46
46
|
'--item-media-image-size': `${size}px`,
|
|
@@ -2,9 +2,9 @@ import { ChevronRight, BillSplit as Disabled } from '@transferwise/icons';
|
|
|
2
2
|
import { ButtonProps } from '../button/Button.types';
|
|
3
3
|
import { useItemControl } from './useItemControl';
|
|
4
4
|
|
|
5
|
-
export type
|
|
5
|
+
export type ListItemNavigationProps = Pick<ButtonProps, 'onClick' | 'href'>;
|
|
6
6
|
|
|
7
|
-
export const Navigation = function Navigation({ onClick }:
|
|
7
|
+
export const Navigation = function Navigation({ onClick }: ListItemNavigationProps) {
|
|
8
8
|
const { baseItemProps } = useItemControl('navigation');
|
|
9
9
|
|
|
10
10
|
return baseItemProps.disabled ? <Disabled size={24} /> : <ChevronRight size={24} />;
|
package/src/listItem/index.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
1
|
+
export type { Props as ListItemProps } from './ListItem';
|
|
2
|
+
export type { ListItemAdditionalInfoProps } from './ListItemAdditionalInfo';
|
|
3
|
+
export type { ListItemCheckboxProps } from './ListItemCheckbox';
|
|
4
|
+
export type {
|
|
5
|
+
ListItemImageProps,
|
|
6
|
+
ListItemAvatarViewProps,
|
|
7
|
+
ListItemAvatarLayoutProps,
|
|
8
|
+
} from './ListItemMedia';
|
|
9
|
+
|
|
3
10
|
export { default } from './ListItem';
|
|
4
|
-
export type { ListItemProps } from './ListItem';
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { render, screen, mockMatchMedia } from '../../test-utils';
|
|
2
|
-
import {
|
|
2
|
+
import { Prompt } from './Prompt';
|
|
3
3
|
import { Sentiment } from '../../common';
|
|
4
4
|
|
|
5
5
|
mockMatchMedia();
|
|
6
6
|
|
|
7
|
-
describe('
|
|
7
|
+
describe('ListItem.Prompt', () => {
|
|
8
8
|
it('renders the aria-label when provided', () => {
|
|
9
9
|
const ariaLabel = 'Test aria-label';
|
|
10
10
|
render(
|
|
11
|
-
<
|
|
11
|
+
<Prompt
|
|
12
12
|
type={Sentiment.POSITIVE}
|
|
13
13
|
action={{ 'aria-label': ariaLabel, href: 'https://example.com' }}
|
|
14
14
|
>
|
|
15
15
|
Positive prompt
|
|
16
|
-
</
|
|
16
|
+
</Prompt>,
|
|
17
17
|
);
|
|
18
18
|
|
|
19
19
|
expect(screen.getByLabelText(ariaLabel)).toBeInTheDocument();
|
|
@@ -21,12 +21,12 @@ describe('ItemPrompt', () => {
|
|
|
21
21
|
|
|
22
22
|
it('applies the interactive class when href is provided', () => {
|
|
23
23
|
render(
|
|
24
|
-
<
|
|
24
|
+
<Prompt
|
|
25
25
|
type={Sentiment.POSITIVE}
|
|
26
26
|
action={{ href: 'https://example.com', 'aria-label': 'Interactive link' }}
|
|
27
27
|
>
|
|
28
28
|
Interactive link
|
|
29
|
-
</
|
|
29
|
+
</Prompt>,
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
expect(screen.getByRole('link')).toHaveClass('np-prompt-interactive');
|
|
@@ -34,32 +34,32 @@ describe('ItemPrompt', () => {
|
|
|
34
34
|
|
|
35
35
|
it('applies the interactive class when onClick is provided', () => {
|
|
36
36
|
render(
|
|
37
|
-
<
|
|
37
|
+
<Prompt
|
|
38
38
|
type={Sentiment.POSITIVE}
|
|
39
39
|
action={{ onClick: jest.fn(), 'aria-label': 'Interactive button' }}
|
|
40
40
|
>
|
|
41
41
|
Interactive button
|
|
42
|
-
</
|
|
42
|
+
</Prompt>,
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
expect(screen.getByRole('button')).toHaveClass('np-prompt-interactive');
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
it('does not apply the interactive class when no action is provided', () => {
|
|
49
|
-
render(<
|
|
49
|
+
render(<Prompt type={Sentiment.POSITIVE}>Non-interactive prompt</Prompt>);
|
|
50
50
|
|
|
51
51
|
expect(screen.getByText('Non-interactive prompt')).not.toHaveClass('np-prompt-interactive');
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
it('renders the children content', () => {
|
|
55
|
-
render(<
|
|
55
|
+
render(<Prompt type={Sentiment.POSITIVE}>This is a child prompt</Prompt>);
|
|
56
56
|
|
|
57
57
|
expect(screen.getByText('This is a child prompt')).toBeInTheDocument();
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
it('spreads additional props to the wrapper element', () => {
|
|
61
61
|
render(
|
|
62
|
-
<
|
|
62
|
+
<Prompt
|
|
63
63
|
type={Sentiment.POSITIVE}
|
|
64
64
|
action={{
|
|
65
65
|
href: 'https://example.com',
|
|
@@ -68,7 +68,7 @@ describe('ItemPrompt', () => {
|
|
|
68
68
|
}}
|
|
69
69
|
>
|
|
70
70
|
Custom props prompt
|
|
71
|
-
</
|
|
71
|
+
</Prompt>,
|
|
72
72
|
);
|
|
73
73
|
|
|
74
74
|
const link = screen.getByRole('link');
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Link from '../../link';
|
|
2
2
|
import { Sentiment } from '../../common';
|
|
3
|
-
import {
|
|
3
|
+
import { Prompt, ListItemPromptProps } from './Prompt';
|
|
4
4
|
import { lorem40 } from '../../test-utils';
|
|
5
5
|
import { StoryObj } from '@storybook/react';
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
|
-
component:
|
|
9
|
-
title: 'Content/
|
|
8
|
+
component: Prompt,
|
|
9
|
+
title: 'Content/ListItem/Prompt',
|
|
10
10
|
args: {
|
|
11
11
|
type: Sentiment.NEGATIVE,
|
|
12
12
|
children: 'You have done a terrible thing',
|
|
@@ -40,7 +40,7 @@ export default {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
type CustomStory = StoryObj<
|
|
43
|
-
|
|
43
|
+
ListItemPromptProps & {
|
|
44
44
|
interactivity?: 'none' | 'full-anchor' | 'full-button' | 'link';
|
|
45
45
|
}
|
|
46
46
|
>;
|
|
@@ -59,7 +59,7 @@ export const Basic: CustomStory = {
|
|
|
59
59
|
render: ({ interactivity, ...args }) => {
|
|
60
60
|
return (
|
|
61
61
|
<div>
|
|
62
|
-
<
|
|
62
|
+
<Prompt
|
|
63
63
|
type={args.type}
|
|
64
64
|
action={
|
|
65
65
|
interactivity === 'full-anchor'
|
|
@@ -74,7 +74,7 @@ export const Basic: CustomStory = {
|
|
|
74
74
|
}
|
|
75
75
|
>
|
|
76
76
|
{args.children} {interactivity === 'link' && <Link href="www.wise.com">with a link</Link>}
|
|
77
|
-
</
|
|
77
|
+
</Prompt>
|
|
78
78
|
</div>
|
|
79
79
|
);
|
|
80
80
|
},
|
|
@@ -84,37 +84,37 @@ export const Variants = () => {
|
|
|
84
84
|
return (
|
|
85
85
|
<>
|
|
86
86
|
<div className="m-b-2">
|
|
87
|
-
<
|
|
87
|
+
<Prompt type={Sentiment.POSITIVE}>
|
|
88
88
|
Positive prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
89
|
-
</
|
|
89
|
+
</Prompt>
|
|
90
90
|
</div>
|
|
91
91
|
<div className="m-b-2">
|
|
92
|
-
<
|
|
92
|
+
<Prompt type={Sentiment.NEGATIVE}>
|
|
93
93
|
Negative prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
94
|
-
</
|
|
94
|
+
</Prompt>
|
|
95
95
|
</div>
|
|
96
96
|
<div className="m-b-2">
|
|
97
|
-
<
|
|
97
|
+
<Prompt type={Sentiment.NEUTRAL}>
|
|
98
98
|
Neutral prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
99
|
-
</
|
|
99
|
+
</Prompt>
|
|
100
100
|
</div>
|
|
101
101
|
<div className="m-b-2">
|
|
102
|
-
<
|
|
102
|
+
<Prompt type={Sentiment.WARNING}>
|
|
103
103
|
Warning prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
104
|
-
</
|
|
104
|
+
</Prompt>
|
|
105
105
|
</div>
|
|
106
106
|
<div className="m-b-2">
|
|
107
|
-
<
|
|
107
|
+
<Prompt type="discount">
|
|
108
108
|
Discount prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
109
|
-
</
|
|
109
|
+
</Prompt>
|
|
110
110
|
</div>
|
|
111
111
|
<div className="m-b-2">
|
|
112
|
-
<
|
|
112
|
+
<Prompt type="savings">
|
|
113
113
|
Savings prompt <Link href="www.wise.com">with a link to amazing content</Link>
|
|
114
|
-
</
|
|
114
|
+
</Prompt>
|
|
115
115
|
</div>
|
|
116
116
|
<div className="m-b-2">
|
|
117
|
-
<
|
|
117
|
+
<Prompt
|
|
118
118
|
type="discount"
|
|
119
119
|
action={{
|
|
120
120
|
href: 'www.wise.com',
|
|
@@ -123,10 +123,10 @@ export const Variants = () => {
|
|
|
123
123
|
}}
|
|
124
124
|
>
|
|
125
125
|
The whole prompt is secretly clickable
|
|
126
|
-
</
|
|
126
|
+
</Prompt>
|
|
127
127
|
</div>
|
|
128
128
|
<div className="m-b-2">
|
|
129
|
-
<
|
|
129
|
+
<Prompt
|
|
130
130
|
type="negative"
|
|
131
131
|
action={{
|
|
132
132
|
href: 'www.wise.com',
|
|
@@ -135,10 +135,10 @@ export const Variants = () => {
|
|
|
135
135
|
}}
|
|
136
136
|
>
|
|
137
137
|
The whole prompt is secretly clickable as an anchor tag
|
|
138
|
-
</
|
|
138
|
+
</Prompt>
|
|
139
139
|
</div>
|
|
140
140
|
<div className="m-b-2">
|
|
141
|
-
<
|
|
141
|
+
<Prompt
|
|
142
142
|
type="warning"
|
|
143
143
|
action={{
|
|
144
144
|
onClick: () => {
|
|
@@ -148,10 +148,10 @@ export const Variants = () => {
|
|
|
148
148
|
}}
|
|
149
149
|
>
|
|
150
150
|
The whole prompt is secretly clickable as a button
|
|
151
|
-
</
|
|
151
|
+
</Prompt>
|
|
152
152
|
</div>
|
|
153
153
|
<div className="m-b-2">
|
|
154
|
-
<
|
|
154
|
+
<Prompt
|
|
155
155
|
type="neutral"
|
|
156
156
|
action={{
|
|
157
157
|
href: 'www.wise.com',
|
|
@@ -160,10 +160,10 @@ export const Variants = () => {
|
|
|
160
160
|
}}
|
|
161
161
|
>
|
|
162
162
|
The whole prompt is secretly clickable
|
|
163
|
-
</
|
|
163
|
+
</Prompt>
|
|
164
164
|
</div>
|
|
165
165
|
<div className="m-b-2" style={{ maxWidth: '300px' }}>
|
|
166
|
-
<
|
|
166
|
+
<Prompt type="warning">The prompt has very long text that wraps {lorem40}</Prompt>
|
|
167
167
|
</div>
|
|
168
168
|
</>
|
|
169
169
|
);
|
|
@@ -5,7 +5,7 @@ import { clsx } from 'clsx';
|
|
|
5
5
|
import { LinkProps } from '../../link';
|
|
6
6
|
import Body from '../../body';
|
|
7
7
|
|
|
8
|
-
export type
|
|
8
|
+
export type ListItemPromptProps = {
|
|
9
9
|
type:
|
|
10
10
|
| `${Sentiment.POSITIVE | Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.WARNING}`
|
|
11
11
|
| 'discount'
|
|
@@ -14,7 +14,7 @@ export type ItemPromptProps = {
|
|
|
14
14
|
action?: Pick<LinkProps, 'href' | 'target' | 'onClick'> & { 'aria-label'?: string };
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const
|
|
17
|
+
export const Prompt = ({ type, children, action }: ListItemPromptProps) => {
|
|
18
18
|
const Wrapper = action?.href ? 'a' : action?.onClick ? 'button' : 'span';
|
|
19
19
|
|
|
20
20
|
const icon =
|
|
@@ -29,7 +29,7 @@ export const ItemPrompt = ({ type, children, action }: ItemPromptProps) => {
|
|
|
29
29
|
return (
|
|
30
30
|
<Wrapper
|
|
31
31
|
className={clsx(
|
|
32
|
-
'
|
|
32
|
+
'wds-list-item-prompt',
|
|
33
33
|
type,
|
|
34
34
|
(action?.href || action?.onClick) && 'np-prompt-interactive',
|
|
35
35
|
)}
|
|
@@ -41,4 +41,4 @@ export const ItemPrompt = ({ type, children, action }: ItemPromptProps) => {
|
|
|
41
41
|
);
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export default
|
|
44
|
+
export default Prompt;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import { ListItemContext, ListItemContextData, ListItemTypes } from './ListItem';
|
|
3
|
+
|
|
4
|
+
export function useItemControl(controlType: ListItemTypes) {
|
|
5
|
+
const { setControlType, props: baseItemProps } = useContext<ListItemContextData>(ListItemContext);
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
setControlType(controlType);
|
|
9
|
+
}, [controlType, setControlType]);
|
|
10
|
+
|
|
11
|
+
return { baseItemProps };
|
|
12
|
+
}
|
package/src/main.css
CHANGED
|
@@ -2648,7 +2648,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2648
2648
|
border-radius: 9999px !important;
|
|
2649
2649
|
border-radius: var(--radius-full) !important;
|
|
2650
2650
|
}
|
|
2651
|
-
.
|
|
2651
|
+
.wds-list-item {
|
|
2652
2652
|
padding: 16px;
|
|
2653
2653
|
padding: var(--size-16);
|
|
2654
2654
|
border-radius: 24px;
|
|
@@ -2658,63 +2658,63 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2658
2658
|
gap: 16px;
|
|
2659
2659
|
gap: var(--size-16);
|
|
2660
2660
|
}
|
|
2661
|
-
.
|
|
2661
|
+
.wds-list-item-interactive {
|
|
2662
2662
|
cursor: pointer;
|
|
2663
2663
|
}
|
|
2664
|
-
.
|
|
2664
|
+
.wds-list-item-interactive:hover {
|
|
2665
2665
|
background-color: var(--color-background-screen-hover);
|
|
2666
2666
|
}
|
|
2667
|
-
.
|
|
2667
|
+
.wds-list-item-interactive:active {
|
|
2668
2668
|
background-color: var(--color-background-screen-active);
|
|
2669
2669
|
}
|
|
2670
|
-
.
|
|
2670
|
+
.wds-list-item-media-image {
|
|
2671
2671
|
width: var(--item-media-image-size);
|
|
2672
2672
|
height: var(--item-media-image-size);
|
|
2673
2673
|
}
|
|
2674
|
-
.
|
|
2674
|
+
.wds-list-item-body {
|
|
2675
2675
|
width: 100%;
|
|
2676
2676
|
}
|
|
2677
|
-
.
|
|
2677
|
+
.wds-list-item-title {
|
|
2678
2678
|
color: #37517e;
|
|
2679
2679
|
color: var(--color-content-primary);
|
|
2680
2680
|
}
|
|
2681
|
-
.
|
|
2681
|
+
.wds-list-item-additional-info {
|
|
2682
2682
|
color: #768e9c;
|
|
2683
2683
|
color: var(--color-content-tertiary);
|
|
2684
2684
|
}
|
|
2685
|
-
.
|
|
2685
|
+
.wds-list-item-value {
|
|
2686
2686
|
flex: 0 0 auto;
|
|
2687
2687
|
}
|
|
2688
|
-
.
|
|
2688
|
+
.wds-list-item-control {
|
|
2689
2689
|
flex: 0 0 auto;
|
|
2690
2690
|
}
|
|
2691
|
-
.
|
|
2691
|
+
.wds-list-item-spotlight-active {
|
|
2692
2692
|
background-color: rgba(134,167,189,0.10196);
|
|
2693
2693
|
background-color: var(--color-background-neutral);
|
|
2694
2694
|
}
|
|
2695
|
-
.
|
|
2695
|
+
.wds-list-item-spotlight-active:hover {
|
|
2696
2696
|
background-color: var(--color-background-neutral-hover);
|
|
2697
2697
|
}
|
|
2698
|
-
.
|
|
2698
|
+
.wds-list-item-spotlight-active:active {
|
|
2699
2699
|
background-color: var(--color-background-neutral-active);
|
|
2700
2700
|
}
|
|
2701
|
-
.
|
|
2701
|
+
.wds-list-item-spotlight-inactive {
|
|
2702
2702
|
background-color: rgba(134, 167, 189, 0.025);
|
|
2703
2703
|
border: 1px dashed rgba(0,0,0,0.10196);
|
|
2704
2704
|
border: 1px dashed var(--color-border-neutral);
|
|
2705
2705
|
}
|
|
2706
2706
|
@supports (color: color-mix(in lch, red, blue)) {
|
|
2707
|
-
.
|
|
2707
|
+
.wds-list-item-spotlight-inactive {
|
|
2708
2708
|
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
2709
2709
|
}
|
|
2710
2710
|
}
|
|
2711
|
-
.
|
|
2711
|
+
.wds-list-item-spotlight-inactive:hover {
|
|
2712
2712
|
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
2713
2713
|
}
|
|
2714
|
-
.
|
|
2714
|
+
.wds-list-item-spotlight-inactive:active {
|
|
2715
2715
|
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
2716
2716
|
}
|
|
2717
|
-
.
|
|
2717
|
+
.wds-list-item-prompt {
|
|
2718
2718
|
display: inline-flex;
|
|
2719
2719
|
padding-top: calc(8px / 2);
|
|
2720
2720
|
padding-top: calc(var(--padding-x-small) / 2);
|
|
@@ -2729,7 +2729,7 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2729
2729
|
word-break: break-word;
|
|
2730
2730
|
word-wrap: break-word;
|
|
2731
2731
|
}
|
|
2732
|
-
.
|
|
2732
|
+
.wds-list-item-prompt .np-prompt-icon {
|
|
2733
2733
|
padding-right: calc(12px / 2);
|
|
2734
2734
|
padding-right: calc(var(--size-12) / 2);
|
|
2735
2735
|
padding-top: calc(4px - 1px);
|
|
@@ -2737,103 +2737,103 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2737
2737
|
padding-bottom: calc(4px - 1px);
|
|
2738
2738
|
padding-bottom: calc(var(--size-4) - 1px);
|
|
2739
2739
|
}
|
|
2740
|
-
.
|
|
2741
|
-
.
|
|
2740
|
+
.wds-list-item-prompt .np-prompt-icon .tw-icon-tags,
|
|
2741
|
+
.wds-list-item-prompt .np-prompt-icon .tw-icon-confetti {
|
|
2742
2742
|
color: var(--color-sentiment-positive-primary);
|
|
2743
2743
|
}
|
|
2744
|
-
.
|
|
2744
|
+
.wds-list-item-prompt a {
|
|
2745
2745
|
text-underline-offset: calc(4px / 2);
|
|
2746
2746
|
text-underline-offset: calc(var(--size-4) / 2);
|
|
2747
2747
|
}
|
|
2748
|
-
.
|
|
2748
|
+
.wds-list-item-prompt.np-prompt-interactive {
|
|
2749
2749
|
-webkit-text-decoration: none;
|
|
2750
2750
|
text-decoration: none;
|
|
2751
2751
|
cursor: pointer;
|
|
2752
2752
|
border: none;
|
|
2753
2753
|
}
|
|
2754
|
-
.
|
|
2754
|
+
.wds-list-item-prompt.negative {
|
|
2755
2755
|
background-color: var(--color-sentiment-negative-secondary);
|
|
2756
2756
|
color: var(--color-sentiment-negative-primary);
|
|
2757
2757
|
}
|
|
2758
|
-
.
|
|
2758
|
+
.wds-list-item-prompt.negative a {
|
|
2759
2759
|
color: var(--color-sentiment-negative-primary);
|
|
2760
2760
|
}
|
|
2761
|
-
.
|
|
2761
|
+
.wds-list-item-prompt.negative a:hover {
|
|
2762
2762
|
color: var(--color-sentiment-negative-primary-hover);
|
|
2763
2763
|
}
|
|
2764
|
-
.
|
|
2764
|
+
.wds-list-item-prompt.negative a:active {
|
|
2765
2765
|
color: var(--color-sentiment-negative-primary-active);
|
|
2766
2766
|
}
|
|
2767
|
-
.np-prompt-interactive.
|
|
2767
|
+
.np-prompt-interactive.wds-list-item-prompt.negative:hover {
|
|
2768
2768
|
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 95%, var(--color-sentiment-negative-primary));
|
|
2769
2769
|
}
|
|
2770
|
-
.np-prompt-interactive.
|
|
2770
|
+
.np-prompt-interactive.wds-list-item-prompt.negative:active {
|
|
2771
2771
|
background-color: color-mix(in srgb, var(--color-sentiment-negative-secondary) 90%, var(--color-sentiment-negative-primary));
|
|
2772
2772
|
}
|
|
2773
|
-
.
|
|
2774
|
-
.
|
|
2775
|
-
.
|
|
2773
|
+
.wds-list-item-prompt.positive,
|
|
2774
|
+
.wds-list-item-prompt.discount,
|
|
2775
|
+
.wds-list-item-prompt.savings {
|
|
2776
2776
|
background-color: var(--color-sentiment-positive-secondary);
|
|
2777
2777
|
color: var(--color-sentiment-positive-primary);
|
|
2778
2778
|
}
|
|
2779
|
-
.
|
|
2780
|
-
.
|
|
2781
|
-
.
|
|
2779
|
+
.wds-list-item-prompt.positive a,
|
|
2780
|
+
.wds-list-item-prompt.discount a,
|
|
2781
|
+
.wds-list-item-prompt.savings a {
|
|
2782
2782
|
color: var(--color-sentiment-positive-primary);
|
|
2783
2783
|
}
|
|
2784
|
-
.
|
|
2785
|
-
.
|
|
2786
|
-
.
|
|
2784
|
+
.wds-list-item-prompt.positive a:hover,
|
|
2785
|
+
.wds-list-item-prompt.discount a:hover,
|
|
2786
|
+
.wds-list-item-prompt.savings a:hover {
|
|
2787
2787
|
color: var(--color-sentiment-positive-primary-hover);
|
|
2788
2788
|
}
|
|
2789
|
-
.
|
|
2790
|
-
.
|
|
2791
|
-
.
|
|
2789
|
+
.wds-list-item-prompt.positive a:active,
|
|
2790
|
+
.wds-list-item-prompt.discount a:active,
|
|
2791
|
+
.wds-list-item-prompt.savings a:active {
|
|
2792
2792
|
color: var(--color-sentiment-positive-primary-active);
|
|
2793
2793
|
}
|
|
2794
|
-
.np-prompt-interactive.
|
|
2795
|
-
.np-prompt-interactive.
|
|
2796
|
-
.np-prompt-interactive.
|
|
2794
|
+
.np-prompt-interactive.wds-list-item-prompt.positive:hover,
|
|
2795
|
+
.np-prompt-interactive.wds-list-item-prompt.discount:hover,
|
|
2796
|
+
.np-prompt-interactive.wds-list-item-prompt.savings:hover {
|
|
2797
2797
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 95%, var(--color-sentiment-positive-primary));
|
|
2798
2798
|
}
|
|
2799
|
-
.np-prompt-interactive.
|
|
2800
|
-
.np-prompt-interactive.
|
|
2801
|
-
.np-prompt-interactive.
|
|
2799
|
+
.np-prompt-interactive.wds-list-item-prompt.positive:active,
|
|
2800
|
+
.np-prompt-interactive.wds-list-item-prompt.discount:active,
|
|
2801
|
+
.np-prompt-interactive.wds-list-item-prompt.savings:active {
|
|
2802
2802
|
background-color: color-mix(in srgb, var(--color-sentiment-positive-secondary) 90%, var(--color-sentiment-positive-primary));
|
|
2803
2803
|
}
|
|
2804
|
-
.
|
|
2804
|
+
.wds-list-item-prompt.neutral {
|
|
2805
2805
|
background-color: rgba(134,167,189,0.10196);
|
|
2806
2806
|
background-color: var(--color-background-neutral);
|
|
2807
2807
|
color: #37517e;
|
|
2808
2808
|
color: var(--color-content-primary);
|
|
2809
2809
|
}
|
|
2810
|
-
.
|
|
2810
|
+
.wds-list-item-prompt.neutral a {
|
|
2811
2811
|
color: #37517e;
|
|
2812
2812
|
color: var(--color-content-primary);
|
|
2813
2813
|
}
|
|
2814
|
-
.np-prompt-interactive.
|
|
2814
|
+
.np-prompt-interactive.wds-list-item-prompt.neutral:hover {
|
|
2815
2815
|
background-color: var(--color-background-neutral-hover);
|
|
2816
2816
|
}
|
|
2817
|
-
.np-prompt-interactive.
|
|
2817
|
+
.np-prompt-interactive.wds-list-item-prompt.neutral:active {
|
|
2818
2818
|
background-color: var(--color-background-neutral-active);
|
|
2819
2819
|
}
|
|
2820
|
-
.
|
|
2820
|
+
.wds-list-item-prompt.warning {
|
|
2821
2821
|
background-color: var(--color-sentiment-warning-secondary);
|
|
2822
2822
|
color: var(--color-sentiment-warning-content);
|
|
2823
2823
|
}
|
|
2824
|
-
.
|
|
2824
|
+
.wds-list-item-prompt.warning a {
|
|
2825
2825
|
color: var(--color-sentiment-warning-content);
|
|
2826
2826
|
}
|
|
2827
|
-
.
|
|
2827
|
+
.wds-list-item-prompt.warning a:hover {
|
|
2828
2828
|
color: var(--color-sentiment-warning-content-hover);
|
|
2829
2829
|
}
|
|
2830
|
-
.
|
|
2830
|
+
.wds-list-item-prompt.warning a:active {
|
|
2831
2831
|
color: var(--color-sentiment-warning-content-active);
|
|
2832
2832
|
}
|
|
2833
|
-
.np-prompt-interactive.
|
|
2833
|
+
.np-prompt-interactive.wds-list-item-prompt.warning:hover {
|
|
2834
2834
|
background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 90%, var(--color-sentiment-warning-primary));
|
|
2835
2835
|
}
|
|
2836
|
-
.np-prompt-interactive.
|
|
2836
|
+
.np-prompt-interactive.wds-list-item-prompt.warning:active {
|
|
2837
2837
|
background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 80%, var(--color-sentiment-warning-primary));
|
|
2838
2838
|
}
|
|
2839
2839
|
.np-field-control {
|
|
@@ -5353,6 +5353,9 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5353
5353
|
width: 50px;
|
|
5354
5354
|
padding: 2px;
|
|
5355
5355
|
border-radius: 16px;
|
|
5356
|
+
-webkit-user-select: none;
|
|
5357
|
+
-moz-user-select: none;
|
|
5358
|
+
user-select: none;
|
|
5356
5359
|
}
|
|
5357
5360
|
.np-switch:focus {
|
|
5358
5361
|
outline: none;
|
package/src/main.less
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
@import "./image/Image.less";
|
|
40
40
|
@import "./info/Info.less";
|
|
41
41
|
@import "./inputs/Input.less";
|
|
42
|
-
@import "./
|
|
42
|
+
@import "./listItem/ListItem.less";
|
|
43
43
|
@import "./field/Field.less";
|
|
44
44
|
@import "./inputs/InputGroup.less";
|
|
45
45
|
@import "./inputs/SelectInput.less";
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
@import "./uploadInput/uploadItem/UploadItem.less";
|
|
79
79
|
@import "./progress/Progress.less";
|
|
80
80
|
@import "./progressBar/ProgressBar.less";
|
|
81
|
-
@import "./
|
|
81
|
+
@import "./legacylistItem/LegacyListItem.less";
|
|
82
82
|
|
|
83
83
|
// List all less files in src in alphabetical order: find -s src -type f -name '*.less' ! -name 'main.less'
|
|
84
84
|
// Make sure you are not referencing main.less itself in this file!
|
|
@@ -159,11 +159,11 @@ describe('PhoneNumberInput', () => {
|
|
|
159
159
|
});
|
|
160
160
|
});
|
|
161
161
|
|
|
162
|
-
describe('when an
|
|
163
|
-
it('should
|
|
162
|
+
describe('when an partial model is supplied (with a matching prefix)', () => {
|
|
163
|
+
it('should set the select to the matching prefix and put the rest of the number in the suffix', () => {
|
|
164
164
|
customRender({ initialValue: '+123' });
|
|
165
|
-
expect(getPrefixEl()).toHaveTextContent('+
|
|
166
|
-
expect(getInputEl()).toHaveValue('');
|
|
165
|
+
expect(getPrefixEl()).toHaveTextContent('+1');
|
|
166
|
+
expect(getInputEl()).toHaveValue('23');
|
|
167
167
|
});
|
|
168
168
|
});
|
|
169
169
|
});
|