@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.
Files changed (153) hide show
  1. package/build/avatarLayout/AvatarLayout.js +2 -9
  2. package/build/avatarLayout/AvatarLayout.js.map +1 -1
  3. package/build/avatarLayout/AvatarLayout.mjs +2 -9
  4. package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
  5. package/build/button/{LegacyButton/Button.js → Button.js} +24 -25
  6. package/build/button/Button.js.map +1 -0
  7. package/build/button/{LegacyButton/Button.mjs → Button.mjs} +24 -25
  8. package/build/button/Button.mjs.map +1 -0
  9. package/build/button/classMap.js +42 -0
  10. package/build/button/classMap.js.map +1 -0
  11. package/build/button/classMap.mjs +39 -0
  12. package/build/button/classMap.mjs.map +1 -0
  13. package/build/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.js +21 -21
  14. package/build/button/legacyUtils/legacyUtils.js.map +1 -0
  15. package/build/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.mjs +21 -21
  16. package/build/button/legacyUtils/legacyUtils.mjs.map +1 -0
  17. package/build/circularButton/CircularButton.js +1 -1
  18. package/build/circularButton/CircularButton.js.map +1 -1
  19. package/build/circularButton/CircularButton.mjs +1 -1
  20. package/build/circularButton/CircularButton.mjs.map +1 -1
  21. package/build/common/action/Action.js +1 -1
  22. package/build/common/action/Action.js.map +1 -1
  23. package/build/common/action/Action.mjs +1 -1
  24. package/build/common/action/Action.mjs.map +1 -1
  25. package/build/criticalBanner/CriticalCommsBanner.js +1 -1
  26. package/build/criticalBanner/CriticalCommsBanner.mjs +1 -1
  27. package/build/header/Header.js +1 -1
  28. package/build/header/Header.mjs +1 -1
  29. package/build/index.js +1 -1
  30. package/build/index.mjs +1 -1
  31. package/build/link/Link.js +3 -8
  32. package/build/link/Link.js.map +1 -1
  33. package/build/link/Link.mjs +3 -8
  34. package/build/link/Link.mjs.map +1 -1
  35. package/build/main.css +29 -288
  36. package/build/nudge/Nudge.js +1 -1
  37. package/build/nudge/Nudge.js.map +1 -1
  38. package/build/nudge/Nudge.mjs +1 -1
  39. package/build/nudge/Nudge.mjs.map +1 -1
  40. package/build/select/Select.js +1 -1
  41. package/build/select/Select.mjs +1 -1
  42. package/build/styles/avatarLayout/AvatarLayout.css +0 -11
  43. package/build/styles/iconButton/IconButton.css +29 -24
  44. package/build/styles/main.css +29 -288
  45. package/build/types/avatarLayout/AvatarLayout.d.ts +2 -1
  46. package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
  47. package/build/types/avatarLayout/index.d.ts +0 -1
  48. package/build/types/avatarLayout/index.d.ts.map +1 -1
  49. package/build/types/button/{LegacyButton/Button.d.ts → Button.d.ts} +5 -8
  50. package/build/types/button/Button.d.ts.map +1 -0
  51. package/build/types/button/classMap.d.ts.map +1 -0
  52. package/build/types/button/index.d.ts +2 -2
  53. package/build/types/button/index.d.ts.map +1 -1
  54. package/build/types/button/legacyUtils/index.d.ts.map +1 -0
  55. package/build/types/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.d.ts +1 -1
  56. package/build/types/button/legacyUtils/legacyUtils.d.ts.map +1 -0
  57. package/build/types/link/Link.d.ts +2 -2
  58. package/build/types/link/Link.d.ts.map +1 -1
  59. package/build/types/test-utils/index.d.ts.map +1 -1
  60. package/build/upload/steps/completeStep/completeStep.js +1 -1
  61. package/build/upload/steps/completeStep/completeStep.mjs +1 -1
  62. package/build/upload/steps/processingStep/processingStep.js +1 -1
  63. package/build/upload/steps/processingStep/processingStep.mjs +1 -1
  64. package/build/uploadInput/UploadInput.js +1 -1
  65. package/build/uploadInput/UploadInput.mjs +1 -1
  66. package/package.json +3 -3
  67. package/src/avatarLayout/AvatarLayout.css +0 -11
  68. package/src/avatarLayout/AvatarLayout.less +1 -18
  69. package/src/avatarLayout/AvatarLayout.tsx +3 -11
  70. package/src/avatarLayout/index.ts +0 -1
  71. package/src/avatarWrapper/AvatarWrapper.story.tsx +0 -2
  72. package/src/button/{LegacyButton/Button.less → Button.less} +1 -1
  73. package/src/button/{LegacyButton/Button.spec.tsx → Button.spec.tsx} +3 -3
  74. package/src/button/Button.story.tsx +163 -0
  75. package/src/button/{LegacyButton/Button.tsx → Button.tsx} +9 -14
  76. package/src/button/{LegacyButton/classMap.ts → classMap.ts} +1 -1
  77. package/src/button/index.ts +3 -2
  78. package/src/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.spec.tsx +2 -2
  79. package/src/button/{LegacyButton/legacyUtils → legacyUtils}/legacyUtils.ts +2 -2
  80. package/src/circularButton/CircularButton.tsx +1 -1
  81. package/src/common/action/Action.tsx +1 -1
  82. package/src/iconButton/IconButton.css +29 -24
  83. package/src/iconButton/IconButton.less +4 -4
  84. package/src/link/Link.tsx +6 -15
  85. package/src/main.css +29 -288
  86. package/src/main.less +1 -2
  87. package/src/nudge/Nudge.tsx +1 -1
  88. package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +283 -0
  89. package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +1 -1
  90. package/src/primitives/PrimitiveAnchor/test/PrimitiveAnchor.spec.tsx +1 -1
  91. package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +1 -1
  92. package/src/primitives/PrimitiveButton/test/PrimitiveButton.spec.tsx +3 -2
  93. package/src/test-utils/index.tsx +1 -0
  94. package/build/button/Button/src/Button.js +0 -93
  95. package/build/button/Button/src/Button.js.map +0 -1
  96. package/build/button/Button/src/Button.mjs +0 -91
  97. package/build/button/Button/src/Button.mjs.map +0 -1
  98. package/build/button/LegacyButton/Button.js.map +0 -1
  99. package/build/button/LegacyButton/Button.mjs.map +0 -1
  100. package/build/button/LegacyButton/classMap.js +0 -42
  101. package/build/button/LegacyButton/classMap.js.map +0 -1
  102. package/build/button/LegacyButton/classMap.mjs +0 -39
  103. package/build/button/LegacyButton/classMap.mjs.map +0 -1
  104. package/build/button/LegacyButton/legacyUtils/legacyUtils.js.map +0 -1
  105. package/build/button/LegacyButton/legacyUtils/legacyUtils.mjs.map +0 -1
  106. package/build/button/src/Button.js +0 -66
  107. package/build/button/src/Button.js.map +0 -1
  108. package/build/button/src/Button.mjs +0 -64
  109. package/build/button/src/Button.mjs.map +0 -1
  110. package/build/styles/button/Button/less/Button.css +0 -253
  111. package/build/styles/button/Button/less/Button.vars.css +0 -57
  112. package/build/types/button/Button/index.d.ts +0 -3
  113. package/build/types/button/Button/index.d.ts.map +0 -1
  114. package/build/types/button/Button/src/Button.d.ts +0 -4
  115. package/build/types/button/Button/src/Button.d.ts.map +0 -1
  116. package/build/types/button/Button/src/Button.types.d.ts +0 -50
  117. package/build/types/button/Button/src/Button.types.d.ts.map +0 -1
  118. package/build/types/button/Button/src/index.d.ts +0 -2
  119. package/build/types/button/Button/src/index.d.ts.map +0 -1
  120. package/build/types/button/LegacyButton/Button.d.ts.map +0 -1
  121. package/build/types/button/LegacyButton/classMap.d.ts.map +0 -1
  122. package/build/types/button/LegacyButton/index.d.ts +0 -3
  123. package/build/types/button/LegacyButton/index.d.ts.map +0 -1
  124. package/build/types/button/LegacyButton/legacyUtils/index.d.ts.map +0 -1
  125. package/build/types/button/LegacyButton/legacyUtils/legacyUtils.d.ts.map +0 -1
  126. package/build/types/button/src/Button.d.ts +0 -47
  127. package/build/types/button/src/Button.d.ts.map +0 -1
  128. package/build/types/button/src/index.d.ts +0 -3
  129. package/build/types/button/src/index.d.ts.map +0 -1
  130. package/src/button/Button/index.ts +0 -2
  131. package/src/button/Button/less/Button.css +0 -253
  132. package/src/button/Button/less/Button.less +0 -221
  133. package/src/button/Button/less/Button.vars.css +0 -57
  134. package/src/button/Button/less/Button.vars.less +0 -65
  135. package/src/button/Button/src/Button.tsx +0 -116
  136. package/src/button/Button/src/Button.types.ts +0 -70
  137. package/src/button/Button/src/index.ts +0 -1
  138. package/src/button/Button/stories/Button.story.tsx +0 -314
  139. package/src/button/Button/stories/Button.tests.story.tsx +0 -288
  140. package/src/button/Button/test/Button.spec.tsx +0 -328
  141. package/src/button/LegacyButton/Button.story.tsx +0 -224
  142. package/src/button/LegacyButton/index.ts +0 -3
  143. package/src/button/src/Button.tsx +0 -87
  144. package/src/button/src/index.ts +0 -2
  145. package/src/button/test/Button.spec.tsx +0 -32
  146. package/src/phoneNumberInput/PhoneNumberInput.rtl.spec.tsx +0 -32
  147. package/src/phoneNumberInput/PhoneNumberInput.spec.js +0 -356
  148. /package/build/styles/button/{LegacyButton/Button.css → Button.css} +0 -0
  149. /package/build/types/button/{LegacyButton/classMap.d.ts → classMap.d.ts} +0 -0
  150. /package/build/types/button/{LegacyButton/legacyUtils → legacyUtils}/index.d.ts +0 -0
  151. /package/src/button/{LegacyButton/Button.css → Button.css} +0 -0
  152. /package/src/button/{LegacyButton/__snapshots__ → __snapshots__}/Button.spec.tsx.snap +0 -0
  153. /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
- export type SingleAvatarType = { asset?: AvatarViewProps['children'] } & Omit<
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
- [`np-avatar-layout-${orientation}-child`]:
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,3 +1,2 @@
1
1
  export type { Props as AvatarLayoutProps } from './AvatarLayout';
2
- export type { SingleAvatarType } from './AvatarLayout';
3
2
  export { default } from './AvatarLayout';
@@ -11,8 +11,6 @@ export default {
11
11
 
12
12
  type Story = StoryObj<typeof AvatarWrapper>;
13
13
 
14
- export const Basic: Story = {}
15
-
16
14
  export const All: Story = {
17
15
  args: {
18
16
  avatarProps: { outlined: true },
@@ -1,4 +1,4 @@
1
- @import (reference) "../../../node_modules/@transferwise/neptune-css/src/less/mixins/_logical-properties.less";
1
+ @import (reference) "../../node_modules/@transferwise/neptune-css/src/less/mixins/_logical-properties.less";
2
2
 
3
3
  .np-btn {
4
4
  position: relative;
@@ -1,10 +1,10 @@
1
1
  import { createRef } from 'react';
2
2
 
3
- import { ControlType, Type, Priority, Size } from '../../common';
4
- import { render, screen, userEvent } from '../../test-utils';
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 '../../i18n/commonMessages/Button.messages';
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 '../../common';
20
- import ProcessIndicator from '../../processIndicator';
19
+ } from '../common';
20
+ import ProcessIndicator from '../processIndicator';
21
21
 
22
- import messages from '../../i18n/commonMessages/Button.messages';
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
- export type ButtonProps = CommonProps &
41
+ type ButtonProps = CommonProps &
43
42
  Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {
44
- as?: 'button' | undefined;
45
- /** @deprecated */
43
+ as?: 'button';
46
44
  htmlType?: 'submit' | 'reset' | 'button';
47
45
  };
48
46
 
49
- export type AnchorProps = CommonProps &
47
+ type AnchorProps = CommonProps &
50
48
  Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {
51
- as?: 'a' | undefined;
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
- ref,
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={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;
@@ -1,4 +1,4 @@
1
- import { ControlType, Priority } from '../../common';
1
+ import { ControlType, Priority } from '../common';
2
2
 
3
3
  export const typeClassMap = {
4
4
  [ControlType.ACCENT]: 'btn-accent',
@@ -1,2 +1,3 @@
1
- export { default } from './src';
2
- export * from './src';
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 '../../../common';
3
- import { cleanup } from '../../../test-utils';
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 '../../../common';
2
- import { logActionRequired, logActionRequiredIf } from '../../../utilities';
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/LegacyButton/classMap';
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
- --Button-color: var(--color-interactive-primary);
6
- --Button-background: var(--color-background-neutral);
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
- --Button-background-hover: var(--color-background-neutral-hover);
10
+ background-color: var(--color-background-neutral-hover);
10
11
  }
11
12
  .np-icon-button-tertiary-default:not(.disabled):not(:disabled):active {
12
- --Button-background-active: var(--color-background-neutral-active);
13
+ background-color: var(--color-background-neutral-active);
13
14
  }
14
15
  .np-icon-button-primary-default {
15
- --Button-color: var(--color-interactive-control);
16
- --Button-background: var(--color-interactive-accent);
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
- --Button-background-hover: var(--color-interactive-accent-hover);
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
- --Button-background-active: var(--color-interactive-accent-active);
25
+ background-color: #0081ba;
26
+ background-color: var(--color-interactive-accent-active);
23
27
  }
24
28
  .np-icon-button-primary-negative {
25
- --Button-color: var(--color-contrast-overlay);
26
- --Button-background: var(--color-sentiment-negative-primary);
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
- --Button-background-hover: var(--color-sentiment-negative-primary-hover);
33
+ background-color: var(--color-sentiment-negative-primary-hover);
30
34
  }
31
35
  .np-icon-button-primary-negative:not(.disabled):not(:disabled):active {
32
- --Button-background-active: var(--color-sentiment-negative-primary-active);
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
- --Button-color: var(--color-interactive-primary);
39
- --Button-background: var(--color-background-screen);
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
- --Button-background-hover: var(--color-background-screen-hover);
48
+ background-color: var(--color-background-screen-hover);
44
49
  }
45
50
  .np-icon-button-minimal-default:not(.disabled):not(:disabled):active {
46
- --Button-background-active: var(--color-background-screen-active);
51
+ background-color: var(--color-background-screen-active);
47
52
  }
48
53
  .np-icon-button-secondary-default {
49
- --Button-color: var(--color-interactive-primary);
50
- --Button-background: var(--color-interactive-neutral);
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
- --Button-background-hover: var(--color-interactive-neutral-hover);
58
+ background-color: var(--color-interactive-neutral-hover);
54
59
  }
55
60
  .np-icon-button-secondary-default:not(.disabled):not(:disabled):active {
56
- --Button-background-active: var(--color-interactive-neutral-active);
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
- --Button-color: var(--color-sentiment-negative-primary);
64
- --Button-background: var(--color-sentiment-negative-secondary);
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
- --Button-background-hover: var(--color-sentiment-negative-secondary-hover);
72
+ background-color: var(--color-sentiment-negative-secondary-hover);
68
73
  }
69
74
  .np-icon-button-secondary-negative:not(.disabled):not(:disabled):active {
70
- --Button-background-active: var(--color-sentiment-negative-secondary-active);
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
- --Button-color: var(@icon-color);
46
- --Button-background: var(@bg-color);
45
+ color: var(@icon-color);
46
+ background-color: var(@bg-color);
47
47
 
48
48
  &:not(.disabled, :disabled):hover {
49
- --Button-background-hover:~"var(@{bg-color}-hover)";
49
+ background-color:~"var(@{bg-color}-hover)";
50
50
  }
51
51
  &:not(.disabled, :disabled):active {
52
- --Button-background-active:~"var(@{bg-color}-active)";
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 = PrimitiveAnchorProps & { type?: LinkLarge | LinkDefault };
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 classNames = clsx(
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
- <PrimitiveAnchor
32
+ <a
42
33
  href={href}
43
34
  target={target}
44
- className={classNames}
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
- </PrimitiveAnchor>
42
+ </a>
52
43
  );
53
44
  };
54
45