@transferwise/components 0.0.0-experimental-a9e2e05 → 0.0.0-experimental-e92f7ac
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/avatarLayout/AvatarLayout.js +2 -9
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +2 -9
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/button/{LegacyButton/Button.js → Button.js} +24 -25
- package/build/button/Button.js.map +1 -0
- package/build/button/{LegacyButton/Button.mjs → Button.mjs} +24 -25
- package/build/button/Button.mjs.map +1 -0
- package/build/button/classMap.js +42 -0
- package/build/button/classMap.js.map +1 -0
- package/build/button/classMap.mjs +39 -0
- package/build/button/classMap.mjs.map +1 -0
- package/build/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.js +21 -21
- package/build/button/legacyUtils/legacyUtils.js.map +1 -0
- package/build/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.mjs +21 -21
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -0
- package/build/circularButton/CircularButton.js +1 -1
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +1 -1
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/action/Action.js +1 -1
- package/build/common/action/Action.js.map +1 -1
- package/build/common/action/Action.mjs +1 -1
- package/build/common/action/Action.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +1 -1
- package/build/header/Header.js +1 -1
- package/build/header/Header.mjs +1 -1
- package/build/index.js +1 -1
- package/build/index.mjs +1 -1
- package/build/link/Link.js +3 -8
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +3 -8
- package/build/link/Link.mjs.map +1 -1
- package/build/main.css +29 -288
- package/build/nudge/Nudge.js +1 -1
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +1 -1
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/select/Select.js +1 -1
- package/build/select/Select.mjs +1 -1
- package/build/styles/avatarLayout/AvatarLayout.css +0 -11
- package/build/styles/iconButton/IconButton.css +29 -24
- package/build/styles/main.css +29 -288
- package/build/types/avatarLayout/AvatarLayout.d.ts +2 -1
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/avatarLayout/index.d.ts +0 -1
- package/build/types/avatarLayout/index.d.ts.map +1 -1
- package/build/types/button/{LegacyButton/Button.d.ts → Button.d.ts} +5 -8
- package/build/types/button/Button.d.ts.map +1 -0
- package/build/types/button/classMap.d.ts.map +1 -0
- package/build/types/button/index.d.ts +2 -2
- package/build/types/button/index.d.ts.map +1 -1
- package/build/types/button/legacyUtils/index.d.ts.map +1 -0
- package/build/types/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.d.ts +1 -1
- package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -0
- package/build/types/link/Link.d.ts +2 -2
- package/build/types/link/Link.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/build/upload/steps/completeStep/completeStep.js +1 -1
- package/build/upload/steps/completeStep/completeStep.mjs +1 -1
- package/build/upload/steps/processingStep/processingStep.js +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +1 -1
- package/build/uploadInput/UploadInput.js +1 -1
- package/build/uploadInput/UploadInput.mjs +1 -1
- package/package.json +3 -3
- package/src/avatarLayout/AvatarLayout.css +0 -11
- package/src/avatarLayout/AvatarLayout.less +1 -18
- package/src/avatarLayout/AvatarLayout.tsx +3 -11
- package/src/avatarLayout/index.ts +0 -1
- package/src/avatarWrapper/AvatarWrapper.story.tsx +0 -2
- package/src/button/{LegacyButton/Button.less → Button.less} +1 -1
- package/src/button/{LegacyButton/Button.spec.tsx → Button.spec.tsx} +3 -3
- package/src/button/Button.story.tsx +163 -0
- package/src/button/{LegacyButton/Button.tsx → Button.tsx} +9 -14
- package/src/button/{LegacyButton/classMap.ts → classMap.ts} +1 -1
- package/src/button/index.ts +3 -2
- package/src/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.spec.tsx +2 -2
- package/src/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.ts +2 -2
- package/src/circularButton/CircularButton.tsx +1 -1
- package/src/common/action/Action.tsx +1 -1
- package/src/iconButton/IconButton.css +29 -24
- package/src/iconButton/IconButton.less +4 -4
- package/src/link/Link.tsx +6 -15
- package/src/main.css +29 -288
- package/src/main.less +1 -2
- package/src/nudge/Nudge.tsx +1 -1
- package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +283 -0
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +1 -1
- package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +1 -1
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +1 -1
- package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +3 -2
- package/src/test-utils/index.tsx +1 -0
- package/build/button/Button/src/Button.js +0 -93
- package/build/button/Button/src/Button.js.map +0 -1
- package/build/button/Button/src/Button.mjs +0 -91
- package/build/button/Button/src/Button.mjs.map +0 -1
- package/build/button/LegacyButton/Button.js.map +0 -1
- package/build/button/LegacyButton/Button.mjs.map +0 -1
- package/build/button/LegacyButton/classMap.js +0 -42
- package/build/button/LegacyButton/classMap.js.map +0 -1
- package/build/button/LegacyButton/classMap.mjs +0 -39
- package/build/button/LegacyButton/classMap.mjs.map +0 -1
- package/build/button/LegacyButton/legacyUtils/legacyUtils.js.map +0 -1
- package/build/button/LegacyButton/legacyUtils/legacyUtils.mjs.map +0 -1
- package/build/button/src/Button.js +0 -66
- package/build/button/src/Button.js.map +0 -1
- package/build/button/src/Button.mjs +0 -64
- package/build/button/src/Button.mjs.map +0 -1
- package/build/styles/button/Button/less/Button.css +0 -253
- package/build/styles/button/Button/less/Button.vars.css +0 -57
- package/build/types/button/Button/index.d.ts +0 -3
- package/build/types/button/Button/index.d.ts.map +0 -1
- package/build/types/button/Button/src/Button.d.ts +0 -4
- package/build/types/button/Button/src/Button.d.ts.map +0 -1
- package/build/types/button/Button/src/Button.types.d.ts +0 -50
- package/build/types/button/Button/src/Button.types.d.ts.map +0 -1
- package/build/types/button/Button/src/index.d.ts +0 -2
- package/build/types/button/Button/src/index.d.ts.map +0 -1
- package/build/types/button/LegacyButton/Button.d.ts.map +0 -1
- package/build/types/button/LegacyButton/classMap.d.ts.map +0 -1
- package/build/types/button/LegacyButton/index.d.ts +0 -3
- package/build/types/button/LegacyButton/index.d.ts.map +0 -1
- package/build/types/button/LegacyButton/legacyUtils/index.d.ts.map +0 -1
- package/build/types/button/LegacyButton/legacyUtils/legacyUtils.d.ts.map +0 -1
- package/build/types/button/src/Button.d.ts +0 -47
- package/build/types/button/src/Button.d.ts.map +0 -1
- package/build/types/button/src/index.d.ts +0 -3
- package/build/types/button/src/index.d.ts.map +0 -1
- package/src/button/Button/index.ts +0 -2
- package/src/button/Button/less/Button.css +0 -253
- package/src/button/Button/less/Button.less +0 -221
- package/src/button/Button/less/Button.vars.css +0 -57
- package/src/button/Button/less/Button.vars.less +0 -65
- package/src/button/Button/src/Button.tsx +0 -116
- package/src/button/Button/src/Button.types.ts +0 -70
- package/src/button/Button/src/index.ts +0 -1
- package/src/button/Button/stories/Button.story.tsx +0 -314
- package/src/button/Button/stories/Button.tests.story.tsx +0 -288
- package/src/button/Button/test/Button.spec.tsx +0 -328
- package/src/button/LegacyButton/Button.story.tsx +0 -224
- package/src/button/LegacyButton/index.ts +0 -3
- package/src/button/src/Button.tsx +0 -87
- package/src/button/src/index.ts +0 -2
- package/src/button/test/Button.spec.tsx +0 -32
- package/src/phoneNumberInput/PhoneNumberInput.rtl.spec.tsx +0 -32
- package/src/phoneNumberInput/PhoneNumberInput.spec.js +0 -356
- /package/build/styles/button/{LegacyButton/Button.css → Button.css} +0 -0
- /package/build/types/button/{LegacyButton/classMap.d.ts → classMap.d.ts} +0 -0
- /package/build/types/button/{LegacyButton/legacyUtils → legacyUtils}/index.d.ts +0 -0
- /package/src/button/{LegacyButton/Button.css → Button.css} +0 -0
- /package/src/button/{LegacyButton/__snapshots__ → __snapshots__}/Button.spec.tsx.snap +0 -0
- /package/src/button/{LegacyButton/legacyUtils → legacyUtils}/index.ts +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import AvatarView, { AvatarViewProps } from '../avatarView';
|
|
3
|
-
import { useDirection } from '../common/hooks';
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
type SingleAvatarType = { asset?: AvatarViewProps['children'] } & Omit<
|
|
6
5
|
AvatarViewProps,
|
|
7
6
|
'notification' | 'selected' | 'size' | 'badge' | 'children' | 'interactive'
|
|
8
7
|
>;
|
|
@@ -25,7 +24,6 @@ export default function AvatarLayout({
|
|
|
25
24
|
}: Props) {
|
|
26
25
|
const orientation =
|
|
27
26
|
size === 16 && orientationProp === 'diagonal' ? 'horizontal' : orientationProp;
|
|
28
|
-
const { isRTL } = useDirection();
|
|
29
27
|
const isDiagonal = orientation === 'diagonal';
|
|
30
28
|
const avatarSize = isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size]?.avatarSize : size;
|
|
31
29
|
return avatars.length < 1 ? null : avatars.length === 1 ? (
|
|
@@ -46,14 +44,8 @@ export default function AvatarLayout({
|
|
|
46
44
|
// eslint-disable-next-line react/no-array-index-key
|
|
47
45
|
key={index}
|
|
48
46
|
className={clsx(
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
!isDiagonal && isRTL ? index !== avatars.length - 1 : index !== 0,
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
[`np-avatar-layout-${orientation}-mask`]:
|
|
55
|
-
!isDiagonal && isRTL ? index !== 0 : index !== avatars.length - 1,
|
|
56
|
-
},
|
|
47
|
+
{ [`np-avatar-layout-${orientation}-child`]: index !== 0 },
|
|
48
|
+
{ [`np-avatar-layout-${orientation}-mask`]: index !== avatars.length - 1 },
|
|
57
49
|
)}
|
|
58
50
|
>
|
|
59
51
|
<AvatarView
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import { ControlType, Type, Priority, Size } from '
|
|
4
|
-
import { render, screen, userEvent } from '
|
|
3
|
+
import { ControlType, Type, Priority, Size } from '../common';
|
|
4
|
+
import { render, screen, userEvent } from '../test-utils';
|
|
5
5
|
|
|
6
6
|
import Button from '.';
|
|
7
|
-
import messages from '
|
|
7
|
+
import messages from '../i18n/commonMessages/Button.messages';
|
|
8
8
|
import { ButtonReferenceType } from './Button';
|
|
9
9
|
|
|
10
10
|
const { ACCENT, POSITIVE, NEGATIVE } = ControlType;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { userEvent, within, fn } from '@storybook/test';
|
|
3
|
+
|
|
4
|
+
import { ControlType, Priority } from '../common';
|
|
5
|
+
import { storyConfig } from '../test-utils';
|
|
6
|
+
|
|
7
|
+
import Button from './Button';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
component: Button,
|
|
11
|
+
title: 'Actions/Button',
|
|
12
|
+
args: {
|
|
13
|
+
children: 'Button text',
|
|
14
|
+
loading: false,
|
|
15
|
+
onClick: fn(),
|
|
16
|
+
onBlur: fn(),
|
|
17
|
+
onFocus: fn(),
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
as: {
|
|
21
|
+
type: {
|
|
22
|
+
name: 'enum',
|
|
23
|
+
value: ['button', 'a'],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
tags: ['autodocs'],
|
|
28
|
+
} satisfies Meta<typeof Button>;
|
|
29
|
+
|
|
30
|
+
type Story = StoryObj<typeof Button>;
|
|
31
|
+
|
|
32
|
+
export const Basic: Story = {};
|
|
33
|
+
|
|
34
|
+
export const Focused = storyConfig<Story>(
|
|
35
|
+
{
|
|
36
|
+
parameters: {
|
|
37
|
+
chromatic: {
|
|
38
|
+
delay: 1000,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
play: async ({ canvasElement }) => {
|
|
42
|
+
const canvas = within(canvasElement);
|
|
43
|
+
await userEvent.click(canvas.getByRole('button'));
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
variants: ['dark'],
|
|
48
|
+
},
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const Variants = storyConfig<Story>(
|
|
52
|
+
{
|
|
53
|
+
render: (args) => {
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
<div className="m-b-2">
|
|
57
|
+
<div className="title-4 m-b-1">Accent</div>
|
|
58
|
+
<div className="d-flex flex-wrap" style={{ gap: 'var(--size-16)' }}>
|
|
59
|
+
<Button {...args} priority={Priority.PRIMARY} type={ControlType.ACCENT} />
|
|
60
|
+
<Button {...args} priority={Priority.SECONDARY} type={ControlType.ACCENT} />
|
|
61
|
+
<Button {...args} priority={Priority.TERTIARY} type={ControlType.ACCENT} />
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div className="m-b-2">
|
|
65
|
+
<div className="title-4 m-b-1">Positive</div>
|
|
66
|
+
<div className="d-flex flex-wrap" style={{ gap: 'var(--size-16)' }}>
|
|
67
|
+
<Button {...args} priority={Priority.PRIMARY} type={ControlType.POSITIVE} />
|
|
68
|
+
<Button {...args} priority={Priority.SECONDARY} type={ControlType.POSITIVE} />
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
<div className="m-b-2">
|
|
72
|
+
<div className="title-4 m-b-1">Negative</div>
|
|
73
|
+
<div className="d-flex flex-wrap" style={{ gap: 'var(--size-16)' }}>
|
|
74
|
+
<Button {...args} priority={Priority.PRIMARY} type={ControlType.NEGATIVE} />
|
|
75
|
+
<Button {...args} priority={Priority.SECONDARY} type={ControlType.NEGATIVE} />
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
<div className="m-b-2">
|
|
79
|
+
<div className="title-4 m-b-1">Disabled</div>
|
|
80
|
+
<div className="d-flex flex-wrap" style={{ gap: 'var(--size-16)' }}>
|
|
81
|
+
<Button {...args} priority={Priority.PRIMARY} disabled />
|
|
82
|
+
<Button {...args} priority={Priority.SECONDARY} disabled />
|
|
83
|
+
<Button {...args} priority={Priority.TERTIARY} disabled />
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</>
|
|
87
|
+
);
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{ variants: ['default', 'dark', 'rtl'] },
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The purpose of the `loading` mode is to convey a message to the
|
|
95
|
+
* user that some asynchronous process has been triggered, likely
|
|
96
|
+
* in response to their previous action.
|
|
97
|
+
*
|
|
98
|
+
* Although it carries some similarities with the `disabled` mode
|
|
99
|
+
* (users cannot activate a loading button), it's not hidden from
|
|
100
|
+
* the keyboard and assistive tech users (users can focus on it,
|
|
101
|
+
* and it's announced by screen readers), and is also much more
|
|
102
|
+
* accessible to sighted users due to its default, high contrast.
|
|
103
|
+
*/
|
|
104
|
+
export const Loading = storyConfig<Story>(
|
|
105
|
+
{
|
|
106
|
+
render: (args) => {
|
|
107
|
+
return (
|
|
108
|
+
<div className="d-flex flex-wrap" style={{ gap: 'var(--size-16)' }}>
|
|
109
|
+
<Button {...args} loading priority={Priority.PRIMARY} />
|
|
110
|
+
<Button {...args} loading priority={Priority.SECONDARY} />
|
|
111
|
+
<Button {...args} loading priority={Priority.TERTIARY} />
|
|
112
|
+
<Button {...args} loading priority={Priority.PRIMARY} type={ControlType.NEGATIVE} />
|
|
113
|
+
<Button {...args} loading priority={Priority.SECONDARY} type={ControlType.NEGATIVE} />
|
|
114
|
+
</div>
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
args: {
|
|
118
|
+
loading: true,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{ variants: ['default', 'dark', 'rtl'] },
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
export const SocialMedia = storyConfig<Story>(
|
|
125
|
+
{
|
|
126
|
+
render: () => {
|
|
127
|
+
return (
|
|
128
|
+
<>
|
|
129
|
+
<div className="m-b-2">
|
|
130
|
+
<button type="button" className="btn btn-google">
|
|
131
|
+
Login with Google
|
|
132
|
+
</button>
|
|
133
|
+
</div>
|
|
134
|
+
<div className="m-b-2">
|
|
135
|
+
<button type="button" className="btn btn-facebook">
|
|
136
|
+
Login with Facebook
|
|
137
|
+
</button>
|
|
138
|
+
</div>
|
|
139
|
+
<div className="m-b-2">
|
|
140
|
+
<button type="button" className="btn btn-lg btn-facebook">
|
|
141
|
+
Large Button
|
|
142
|
+
</button>
|
|
143
|
+
</div>
|
|
144
|
+
<div className="m-b-2">
|
|
145
|
+
<button type="button" className="btn btn-block btn-facebook">
|
|
146
|
+
Block Button
|
|
147
|
+
</button>
|
|
148
|
+
</div>
|
|
149
|
+
<div className="m-b-2">
|
|
150
|
+
<button type="button" className="btn btn-lg btn-block btn-facebook">
|
|
151
|
+
Large Block Button
|
|
152
|
+
</button>
|
|
153
|
+
</div>
|
|
154
|
+
</>
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{ variants: ['default', 'dark', 'rtl'] },
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
export const SocialMediaMobile = storyConfig<Story>(SocialMedia, {
|
|
162
|
+
variants: ['default', 'dark', 'rtl', 'mobile'],
|
|
163
|
+
});
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
SizeSmall,
|
|
17
17
|
SizeMedium,
|
|
18
18
|
SizeLarge,
|
|
19
|
-
} from '
|
|
20
|
-
import ProcessIndicator from '
|
|
19
|
+
} from '../common';
|
|
20
|
+
import ProcessIndicator from '../processIndicator';
|
|
21
21
|
|
|
22
|
-
import messages from '
|
|
22
|
+
import messages from '../i18n/commonMessages/Button.messages';
|
|
23
23
|
import { typeClassMap, priorityClassMap } from './classMap';
|
|
24
24
|
import { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';
|
|
25
25
|
|
|
@@ -33,23 +33,20 @@ type CommonProps = {
|
|
|
33
33
|
block?: boolean;
|
|
34
34
|
disabled?: boolean;
|
|
35
35
|
loading?: boolean;
|
|
36
|
-
/** @deprecated */
|
|
37
36
|
type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;
|
|
38
37
|
priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;
|
|
39
38
|
size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;
|
|
40
39
|
};
|
|
41
40
|
|
|
42
|
-
|
|
41
|
+
type ButtonProps = CommonProps &
|
|
43
42
|
Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {
|
|
44
|
-
as?: 'button'
|
|
45
|
-
/** @deprecated */
|
|
43
|
+
as?: 'button';
|
|
46
44
|
htmlType?: 'submit' | 'reset' | 'button';
|
|
47
45
|
};
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
type AnchorProps = CommonProps &
|
|
50
48
|
Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {
|
|
51
|
-
as?: 'a'
|
|
52
|
-
href?: string;
|
|
49
|
+
as?: 'a';
|
|
53
50
|
};
|
|
54
51
|
|
|
55
52
|
export type Props = ButtonProps | AnchorProps;
|
|
@@ -71,7 +68,7 @@ const Button = forwardRef<ButtonReferenceType, Props>(
|
|
|
71
68
|
onClick,
|
|
72
69
|
...rest
|
|
73
70
|
}: Props,
|
|
74
|
-
|
|
71
|
+
reference,
|
|
75
72
|
) => {
|
|
76
73
|
const intl = useIntl();
|
|
77
74
|
|
|
@@ -135,7 +132,7 @@ const Button = forwardRef<ButtonReferenceType, Props>(
|
|
|
135
132
|
|
|
136
133
|
return (
|
|
137
134
|
<Element
|
|
138
|
-
ref={
|
|
135
|
+
ref={reference}
|
|
139
136
|
className={classes}
|
|
140
137
|
onClick={handleClick(onClick)}
|
|
141
138
|
{...props}
|
|
@@ -156,6 +153,4 @@ const Button = forwardRef<ButtonReferenceType, Props>(
|
|
|
156
153
|
},
|
|
157
154
|
);
|
|
158
155
|
|
|
159
|
-
Button.displayName = 'Button';
|
|
160
|
-
|
|
161
156
|
export default Button;
|
package/src/button/index.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { default } from './
|
|
2
|
-
|
|
1
|
+
export { default } from './Button';
|
|
2
|
+
|
|
3
|
+
export type { Props as ButtonProps } from './Button';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import { ControlType, Priority, Size, Type } from '
|
|
3
|
-
import { cleanup } from '
|
|
2
|
+
import { ControlType, Priority, Size, Type } from '../../common';
|
|
3
|
+
import { cleanup } from '../../test-utils';
|
|
4
4
|
|
|
5
5
|
import { establishNewPriority, establishNewType, logDeprecationNotices } from '.';
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ControlType, Priority, Size, Type } from '
|
|
2
|
-
import { logActionRequired, logActionRequiredIf } from '
|
|
1
|
+
import { ControlType, Priority, Size, Type } from '../../common';
|
|
2
|
+
import { logActionRequired, logActionRequiredIf } from '../../utilities';
|
|
3
3
|
|
|
4
4
|
const deprecatedTypeMap: Record<Type, ControlType> = {
|
|
5
5
|
[Type.PRIMARY]: ControlType.ACCENT,
|
|
@@ -2,7 +2,7 @@ import { clsx } from 'clsx';
|
|
|
2
2
|
import { cloneElement } from 'react';
|
|
3
3
|
|
|
4
4
|
import Body from '../body/Body';
|
|
5
|
-
import { typeClassMap, priorityClassMap } from '../button/
|
|
5
|
+
import { typeClassMap, priorityClassMap } from '../button/classMap';
|
|
6
6
|
import { Breakpoint, ControlType, Priority, Typography } from '../common';
|
|
7
7
|
import Circle from '../common/circle';
|
|
8
8
|
import { useMedia } from '../common/hooks/useMedia';
|
|
@@ -22,7 +22,7 @@ export function Action({ action, className, variant = 'button' }: Props) {
|
|
|
22
22
|
if ('href' in action) {
|
|
23
23
|
return (
|
|
24
24
|
<Link
|
|
25
|
-
href={action.href
|
|
25
|
+
href={action.href}
|
|
26
26
|
className={className}
|
|
27
27
|
aria-label={action['aria-label']}
|
|
28
28
|
target={action.target}
|
|
@@ -2,72 +2,77 @@
|
|
|
2
2
|
border: none;
|
|
3
3
|
}
|
|
4
4
|
.np-icon-button-tertiary-default {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
color: var(--color-interactive-primary);
|
|
6
|
+
background-color: rgba(134,167,189,0.10196);
|
|
7
|
+
background-color: var(--color-background-neutral);
|
|
7
8
|
}
|
|
8
9
|
.np-icon-button-tertiary-default:not(.disabled):not(:disabled):hover {
|
|
9
|
-
|
|
10
|
+
background-color: var(--color-background-neutral-hover);
|
|
10
11
|
}
|
|
11
12
|
.np-icon-button-tertiary-default:not(.disabled):not(:disabled):active {
|
|
12
|
-
|
|
13
|
+
background-color: var(--color-background-neutral-active);
|
|
13
14
|
}
|
|
14
15
|
.np-icon-button-primary-default {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
color: var(--color-interactive-control);
|
|
17
|
+
background-color: #00a2dd;
|
|
18
|
+
background-color: var(--color-interactive-accent);
|
|
17
19
|
}
|
|
18
20
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):hover {
|
|
19
|
-
|
|
21
|
+
background-color: #008fc9;
|
|
22
|
+
background-color: var(--color-interactive-accent-hover);
|
|
20
23
|
}
|
|
21
24
|
.np-icon-button-primary-default:not(.disabled):not(:disabled):active {
|
|
22
|
-
|
|
25
|
+
background-color: #0081ba;
|
|
26
|
+
background-color: var(--color-interactive-accent-active);
|
|
23
27
|
}
|
|
24
28
|
.np-icon-button-primary-negative {
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
color: var(--color-contrast-overlay);
|
|
30
|
+
background-color: var(--color-sentiment-negative-primary);
|
|
27
31
|
}
|
|
28
32
|
.np-icon-button-primary-negative:not(.disabled):not(:disabled):hover {
|
|
29
|
-
|
|
33
|
+
background-color: var(--color-sentiment-negative-primary-hover);
|
|
30
34
|
}
|
|
31
35
|
.np-icon-button-primary-negative:not(.disabled):not(:disabled):active {
|
|
32
|
-
|
|
36
|
+
background-color: var(--color-sentiment-negative-primary-active);
|
|
33
37
|
}
|
|
34
38
|
.np-theme-personal--bright-green .np-icon-button-primary-negative {
|
|
35
39
|
color: var(--color-white);
|
|
36
40
|
}
|
|
37
41
|
.np-icon-button-minimal-default {
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
color: var(--color-interactive-primary);
|
|
43
|
+
background-color: #ffffff;
|
|
44
|
+
background-color: var(--color-background-screen);
|
|
40
45
|
background-color: transparent;
|
|
41
46
|
}
|
|
42
47
|
.np-icon-button-minimal-default:not(.disabled):not(:disabled):hover {
|
|
43
|
-
|
|
48
|
+
background-color: var(--color-background-screen-hover);
|
|
44
49
|
}
|
|
45
50
|
.np-icon-button-minimal-default:not(.disabled):not(:disabled):active {
|
|
46
|
-
|
|
51
|
+
background-color: var(--color-background-screen-active);
|
|
47
52
|
}
|
|
48
53
|
.np-icon-button-secondary-default {
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
color: var(--color-interactive-primary);
|
|
55
|
+
background-color: var(--color-interactive-neutral);
|
|
51
56
|
}
|
|
52
57
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):hover {
|
|
53
|
-
|
|
58
|
+
background-color: var(--color-interactive-neutral-hover);
|
|
54
59
|
}
|
|
55
60
|
.np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
|
|
56
|
-
|
|
61
|
+
background-color: var(--color-interactive-neutral-active);
|
|
57
62
|
}
|
|
58
63
|
.np-theme-personal--bright-green .np-icon-button-secondary-default,
|
|
59
64
|
.np-theme-personal--forest-green .np-icon-button-secondary-default {
|
|
60
65
|
color: var(--color-interactive-control);
|
|
61
66
|
}
|
|
62
67
|
.np-icon-button-secondary-negative {
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
color: var(--color-sentiment-negative-primary);
|
|
69
|
+
background-color: var(--color-sentiment-negative-secondary);
|
|
65
70
|
}
|
|
66
71
|
.np-icon-button-secondary-negative:not(.disabled):not(:disabled):hover {
|
|
67
|
-
|
|
72
|
+
background-color: var(--color-sentiment-negative-secondary-hover);
|
|
68
73
|
}
|
|
69
74
|
.np-icon-button-secondary-negative:not(.disabled):not(:disabled):active {
|
|
70
|
-
|
|
75
|
+
background-color: var(--color-sentiment-negative-secondary-active);
|
|
71
76
|
}
|
|
72
77
|
.np-theme-personal--bright-green .np-icon-button-secondary-negative {
|
|
73
78
|
color: var(--color-white);
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.colors(@icon-color, @bg-color) {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
color: var(@icon-color);
|
|
46
|
+
background-color: var(@bg-color);
|
|
47
47
|
|
|
48
48
|
&:not(.disabled, :disabled):hover {
|
|
49
|
-
|
|
49
|
+
background-color:~"var(@{bg-color}-hover)";
|
|
50
50
|
}
|
|
51
51
|
&:not(.disabled, :disabled):active {
|
|
52
|
-
|
|
52
|
+
background-color:~"var(@{bg-color}-active)";
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/link/Link.tsx
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { NavigateAway as NavigateAwayIcon } from '@transferwise/icons';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
+
import { AnchorHTMLAttributes } from 'react';
|
|
3
4
|
import { useIntl } from 'react-intl';
|
|
4
|
-
import { PrimitiveAnchor } from '../primitives';
|
|
5
|
-
import type { PrimitiveAnchorProps } from '../primitives';
|
|
6
5
|
|
|
7
6
|
import { LinkLarge, LinkDefault } from '../common';
|
|
8
7
|
|
|
9
8
|
import messages from './Link.messages';
|
|
10
9
|
|
|
11
|
-
export type Props =
|
|
10
|
+
export type Props = AnchorHTMLAttributes<HTMLAnchorElement> & { type?: LinkLarge | LinkDefault };
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Standard Link component with navigate away icon
|
|
@@ -25,30 +24,22 @@ const Link = ({
|
|
|
25
24
|
onClick,
|
|
26
25
|
...props
|
|
27
26
|
}: Props) => {
|
|
28
|
-
const { formatMessage } = useIntl();
|
|
29
27
|
const isBlank = target === '_blank';
|
|
30
28
|
|
|
31
|
-
const
|
|
32
|
-
'np-link',
|
|
33
|
-
'd-inline-flex',
|
|
34
|
-
{
|
|
35
|
-
[`np-text-${type}`]: type,
|
|
36
|
-
},
|
|
37
|
-
className,
|
|
38
|
-
);
|
|
29
|
+
const { formatMessage } = useIntl();
|
|
39
30
|
|
|
40
31
|
return (
|
|
41
|
-
<
|
|
32
|
+
<a
|
|
42
33
|
href={href}
|
|
43
34
|
target={target}
|
|
44
|
-
className={
|
|
35
|
+
className={clsx('np-link', type ? `np-text-${type}` : undefined, 'd-inline-flex', className)}
|
|
45
36
|
aria-label={ariaLabel}
|
|
46
37
|
rel={isBlank ? 'noreferrer' : undefined}
|
|
47
38
|
onClick={onClick}
|
|
48
39
|
{...props}
|
|
49
40
|
>
|
|
50
41
|
{children} {isBlank && <NavigateAwayIcon title={formatMessage(messages.opensInNewTab)} />}
|
|
51
|
-
</
|
|
42
|
+
</a>
|
|
52
43
|
);
|
|
53
44
|
};
|
|
54
45
|
|