@transferwise/components 46.85.0 → 46.86.0
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 +1 -0
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +1 -0
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +18 -21
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +19 -22
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/definitionList/DefinitionList.js.map +1 -1
- package/build/definitionList/DefinitionList.mjs.map +1 -1
- package/build/i18n/de.json +1 -0
- package/build/i18n/de.json.js +1 -0
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +1 -0
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/es.json +1 -0
- package/build/i18n/es.json.js +1 -0
- package/build/i18n/es.json.js.map +1 -1
- package/build/i18n/es.json.mjs +1 -0
- package/build/i18n/es.json.mjs.map +1 -1
- package/build/i18n/fr.json +6 -5
- package/build/i18n/fr.json.js +6 -5
- package/build/i18n/fr.json.js.map +1 -1
- package/build/i18n/fr.json.mjs +6 -5
- package/build/i18n/fr.json.mjs.map +1 -1
- package/build/i18n/hu.json +1 -0
- package/build/i18n/hu.json.js +1 -0
- package/build/i18n/hu.json.js.map +1 -1
- package/build/i18n/hu.json.mjs +1 -0
- package/build/i18n/hu.json.mjs.map +1 -1
- package/build/i18n/id.json +1 -0
- package/build/i18n/id.json.js +1 -0
- package/build/i18n/id.json.js.map +1 -1
- package/build/i18n/id.json.mjs +1 -0
- package/build/i18n/id.json.mjs.map +1 -1
- package/build/i18n/it.json +1 -0
- package/build/i18n/it.json.js +1 -0
- package/build/i18n/it.json.js.map +1 -1
- package/build/i18n/it.json.mjs +1 -0
- package/build/i18n/it.json.mjs.map +1 -1
- package/build/i18n/pl.json +1 -0
- package/build/i18n/pl.json.js +1 -0
- package/build/i18n/pl.json.js.map +1 -1
- package/build/i18n/pl.json.mjs +1 -0
- package/build/i18n/pl.json.mjs.map +1 -1
- package/build/i18n/ro.json +1 -0
- package/build/i18n/ro.json.js +1 -0
- package/build/i18n/ro.json.js.map +1 -1
- package/build/i18n/ro.json.mjs +1 -0
- package/build/i18n/ro.json.mjs.map +1 -1
- package/build/i18n/th.json +1 -0
- package/build/i18n/th.json.js +1 -0
- package/build/i18n/th.json.js.map +1 -1
- package/build/i18n/th.json.mjs +1 -0
- package/build/i18n/th.json.mjs.map +1 -1
- package/build/i18n/tr.json +1 -0
- package/build/i18n/tr.json.js +1 -0
- package/build/i18n/tr.json.js.map +1 -1
- package/build/i18n/tr.json.mjs +1 -0
- package/build/i18n/tr.json.mjs.map +1 -1
- package/build/i18n/zh-CN.json +1 -0
- package/build/i18n/zh-CN.json.js +1 -0
- package/build/i18n/zh-CN.json.js.map +1 -1
- package/build/i18n/zh-CN.json.mjs +1 -0
- package/build/i18n/zh-CN.json.mjs.map +1 -1
- package/build/main.css +17 -158
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/styles/circularButton/CircularButton.css +17 -158
- package/build/styles/main.css +17 -158
- package/build/types/avatarLayout/AvatarLayout.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts +11 -4
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/definitionList/DefinitionList.d.ts +1 -2
- package/build/types/definitionList/DefinitionList.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatar/Avatar.story.tsx +4 -1
- package/src/avatarLayout/AvatarLayout.story.tsx +2 -0
- package/src/avatarLayout/AvatarLayout.tsx +3 -1
- package/src/avatarWrapper/AvatarWrapper.story.tsx +4 -0
- package/src/badge/Badge.story.tsx +4 -0
- package/src/circularButton/CircularButton.css +17 -158
- package/src/circularButton/CircularButton.less +22 -91
- package/src/circularButton/CircularButton.story.tsx +45 -24
- package/src/circularButton/CircularButton.tsx +38 -25
- package/src/definitionList/DefinitionList.story.tsx +57 -57
- package/src/definitionList/DefinitionList.tsx +1 -1
- package/src/i18n/de.json +1 -0
- package/src/i18n/es.json +1 -0
- package/src/i18n/fr.json +6 -5
- package/src/i18n/hu.json +1 -0
- package/src/i18n/id.json +1 -0
- package/src/i18n/it.json +1 -0
- package/src/i18n/pl.json +1 -0
- package/src/i18n/ro.json +1 -0
- package/src/i18n/th.json +1 -0
- package/src/i18n/tr.json +1 -0
- package/src/i18n/zh-CN.json +1 -0
- package/src/iconButton/IconButton.story.tsx +6 -6
- package/src/main.css +17 -158
- package/src/moneyInput/MoneyInput.spec.tsx +468 -0
- package/src/moneyInput/MoneyInput.tsx +2 -1
- package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +283 -0
- package/src/slidingPanel/SlidingPanel.spec.tsx +69 -0
- package/src/circularButton/_button-label-states.less +0 -34
- package/src/definitionList/DefinitionList.spec.js +0 -91
- package/src/moneyInput/MoneyInput.rtl.spec.tsx +0 -149
- package/src/moneyInput/MoneyInput.spec.js +0 -820
- package/src/phoneNumberInput/PhoneNumberInput.rtl.spec.tsx +0 -32
- package/src/phoneNumberInput/PhoneNumberInput.spec.js +0 -356
- package/src/slidingPanel/SlidingPanel.spec.js +0 -56
|
@@ -7,6 +7,9 @@ import { storyConfig } from '../test-utils';
|
|
|
7
7
|
|
|
8
8
|
import Avatar, { AvatarType } from '.';
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use **`AvatarView`** components instead
|
|
12
|
+
*/
|
|
10
13
|
export default {
|
|
11
14
|
component: Avatar,
|
|
12
15
|
title: 'Content/Avatar',
|
|
@@ -45,7 +48,7 @@ export const Table: Story = storyConfig(
|
|
|
45
48
|
const backgroundColor = '#d6f5e3';
|
|
46
49
|
const emoji = '✈️';
|
|
47
50
|
const initials = 'GN';
|
|
48
|
-
const Icon = wiseIcons
|
|
51
|
+
const Icon = wiseIcons.Check;
|
|
49
52
|
|
|
50
53
|
return (
|
|
51
54
|
<div>
|
|
@@ -197,8 +197,10 @@ export const EdgeInstances: Story = {
|
|
|
197
197
|
<AvatarLayout orientation="diagonal" avatars={[{}]} />
|
|
198
198
|
|
|
199
199
|
<AvatarLayout orientation="diagonal" avatars={[{ profileName: 'Jay Jay' }]} />
|
|
200
|
+
<AvatarLayout orientation="diagonal" size={16} avatars={[{ profileName: 'Jay Jay' }]} />
|
|
200
201
|
|
|
201
202
|
<AvatarLayout orientation="diagonal" avatars={[{ asset: <Flag code="gb" /> }]} />
|
|
203
|
+
<AvatarLayout orientation="diagonal" size={24} avatars={[{ asset: <Flag code="gb" /> }]} />
|
|
202
204
|
|
|
203
205
|
<AvatarLayout
|
|
204
206
|
orientation="diagonal"
|
|
@@ -27,7 +27,9 @@ export default function AvatarLayout({
|
|
|
27
27
|
const isDiagonal = orientation === 'diagonal';
|
|
28
28
|
const avatarSize = isDiagonal ? DIAGONAL_LAYOUT_STYLE_CONFIG[size]?.avatarSize : size;
|
|
29
29
|
return avatars.length < 1 ? null : avatars.length === 1 ? (
|
|
30
|
-
<AvatarView {...avatars[0]}
|
|
30
|
+
<AvatarView {...avatars[0]} size={size}>
|
|
31
|
+
{avatars[0].asset}
|
|
32
|
+
</AvatarView>
|
|
31
33
|
) : (
|
|
32
34
|
<div
|
|
33
35
|
className={clsx('np-avatar-layout', `np-avatar-layout-${orientation}`, className)}
|
|
@@ -4,7 +4,11 @@ import { ProfileType, Sentiment } from '../common';
|
|
|
4
4
|
|
|
5
5
|
import AvatarWrapper from './AvatarWrapper';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated use **`AvatarView`** components instead
|
|
9
|
+
*/
|
|
7
10
|
export default {
|
|
11
|
+
tags: ['autodocs'],
|
|
8
12
|
component: AvatarWrapper,
|
|
9
13
|
title: 'Content/AvatarWrapper',
|
|
10
14
|
} satisfies Meta<typeof AvatarWrapper>;
|
|
@@ -5,7 +5,11 @@ import { Size, Theme } from '../common';
|
|
|
5
5
|
|
|
6
6
|
import Badge from './Badge';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated use **`<AvatarView badge={..} />`** components instead
|
|
10
|
+
*/
|
|
8
11
|
export default {
|
|
12
|
+
tags: ['autodocs'],
|
|
9
13
|
component: Badge,
|
|
10
14
|
title: 'Content/Badge',
|
|
11
15
|
excludeStories: ['ExampleBadgeCss'],
|
|
@@ -2,173 +2,32 @@
|
|
|
2
2
|
display: inline-flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: center;
|
|
5
|
-
text-align: center;
|
|
6
5
|
cursor: pointer;
|
|
7
|
-
position: relative;
|
|
8
6
|
}
|
|
9
|
-
.np-circular-btn .
|
|
10
|
-
|
|
11
|
-
top: 16px;
|
|
12
|
-
top: var(--size-16);
|
|
13
|
-
pointer-events: none;
|
|
14
|
-
color: white;
|
|
15
|
-
transition: color 0.15s ease-in-out;
|
|
16
|
-
width: 100%;
|
|
17
|
-
left: 0;
|
|
18
|
-
}
|
|
19
|
-
[dir="rtl"] .np-circular-btn .tw-icon {
|
|
20
|
-
right: 0;
|
|
21
|
-
left: auto;
|
|
22
|
-
left: initial;
|
|
23
|
-
}
|
|
24
|
-
@media (max-width: 320px) {
|
|
25
|
-
.np-circular-btn .tw-icon {
|
|
26
|
-
top: 12px;
|
|
27
|
-
top: var(--size-12);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
.np-circular-btn .tw-icon > svg {
|
|
31
|
-
margin: 0 auto;
|
|
32
|
-
}
|
|
33
|
-
.np-theme-personal .np-circular-btn {
|
|
34
|
-
/* stylelint-disable-next-line no-duplicate-selectors */
|
|
35
|
-
}
|
|
36
|
-
.np-theme-personal .np-circular-btn .tw-icon,
|
|
37
|
-
.np-theme-personal .np-circular-btn .tw-icon:hover,
|
|
38
|
-
.np-theme-personal .np-circular-btn .tw-icon:active {
|
|
39
|
-
color: var(--color-interactive-control);
|
|
40
|
-
}
|
|
41
|
-
.np-theme-personal .np-circular-btn.negative .tw-icon,
|
|
42
|
-
.np-theme-personal .np-circular-btn.negative.secondary:not(.disabled):not(:disabled):hover .tw-icon,
|
|
43
|
-
.np-theme-personal .np-circular-btn.negative.secondary:not(.disabled):not(:disabled):active .tw-icon {
|
|
44
|
-
color: var(--color-contrast) !important;
|
|
45
|
-
}
|
|
46
|
-
.np-theme-personal .np-circular-btn.negative.secondary:not(.disabled):not(:disabled) .tw-icon {
|
|
47
|
-
color: var(--color-sentiment-negative) !important;
|
|
48
|
-
}
|
|
49
|
-
.np-circular-btn.accent .np-circular-btn__label {
|
|
50
|
-
color: #00a2dd;
|
|
51
|
-
color: var(--color-interactive-accent);
|
|
52
|
-
}
|
|
53
|
-
.np-circular-btn.accent:not(.disabled):not(:disabled):hover .np-circular-btn__label {
|
|
54
|
-
color: #008fc9;
|
|
55
|
-
color: var(--color-interactive-accent-hover);
|
|
56
|
-
}
|
|
57
|
-
.np-circular-btn.accent:active .np-circular-btn__label,
|
|
58
|
-
.np-circular-btn.accent input[type="button"]:active ~ .np-circular-btn__label {
|
|
59
|
-
color: #0081ba;
|
|
60
|
-
color: var(--color-interactive-accent-active);
|
|
61
|
-
}
|
|
62
|
-
.np-circular-btn.accent.secondary .tw-icon {
|
|
63
|
-
color: #00a2dd;
|
|
64
|
-
color: var(--color-interactive-accent);
|
|
65
|
-
}
|
|
66
|
-
.np-circular-btn.accent.secondary:not(.disabled):not(:disabled):hover .tw-icon,
|
|
67
|
-
.np-circular-btn.accent.secondary input[type="button"]:active + .tw-icon {
|
|
68
|
-
color: white;
|
|
69
|
-
}
|
|
70
|
-
.np-circular-btn.positive .np-circular-btn__label {
|
|
71
|
-
color: #2ead4b;
|
|
72
|
-
color: var(--color-interactive-positive);
|
|
73
|
-
}
|
|
74
|
-
.np-circular-btn.positive:not(.disabled):not(:disabled):hover .np-circular-btn__label {
|
|
75
|
-
color: #069939;
|
|
76
|
-
color: var(--color-interactive-positive-hover);
|
|
77
|
-
}
|
|
78
|
-
.np-circular-btn.positive:active .np-circular-btn__label,
|
|
79
|
-
.np-circular-btn.positive input[type="button"]:active ~ .np-circular-btn__label {
|
|
80
|
-
color: #008b2b;
|
|
81
|
-
color: var(--color-interactive-positive-active);
|
|
82
|
-
}
|
|
83
|
-
.np-circular-btn.positive.secondary .tw-icon {
|
|
84
|
-
color: #2ead4b;
|
|
85
|
-
color: var(--color-interactive-positive);
|
|
86
|
-
}
|
|
87
|
-
.np-circular-btn.positive.secondary:not(.disabled):not(:disabled):hover .tw-icon,
|
|
88
|
-
.np-circular-btn.positive.secondary input[type="button"]:active + .tw-icon {
|
|
89
|
-
color: white;
|
|
90
|
-
}
|
|
91
|
-
.np-circular-btn.negative .np-circular-btn__label {
|
|
92
|
-
color: #e74848;
|
|
93
|
-
color: var(--color-interactive-negative);
|
|
94
|
-
}
|
|
95
|
-
.np-circular-btn.negative:not(.disabled):not(:disabled):hover .np-circular-btn__label {
|
|
96
|
-
color: #d03238;
|
|
97
|
-
color: var(--color-interactive-negative-hover);
|
|
98
|
-
}
|
|
99
|
-
.np-circular-btn.negative:active .np-circular-btn__label,
|
|
100
|
-
.np-circular-btn.negative input[type="button"]:active ~ .np-circular-btn__label {
|
|
101
|
-
color: #bf1e2c;
|
|
102
|
-
color: var(--color-interactive-negative-active);
|
|
103
|
-
}
|
|
104
|
-
.np-circular-btn.negative.secondary .tw-icon {
|
|
105
|
-
color: #e74848;
|
|
106
|
-
color: var(--color-interactive-negative);
|
|
107
|
-
}
|
|
108
|
-
.np-circular-btn.negative.secondary:not(.disabled):not(:disabled):hover .tw-icon,
|
|
109
|
-
.np-circular-btn.negative.secondary input[type="button"]:active + .tw-icon {
|
|
110
|
-
color: white;
|
|
111
|
-
}
|
|
112
|
-
.np-theme-personal .np-circular-btn.accent .np-circular-btn__label {
|
|
7
|
+
.np-circular-btn-primary-default .np-circular-btn-label,
|
|
8
|
+
.np-circular-btn-secondary-default .np-circular-btn-label {
|
|
113
9
|
color: var(--color-interactive-primary);
|
|
114
10
|
}
|
|
115
|
-
.np-
|
|
11
|
+
.np-circular-btn-primary-default .np-circular-btn-label:not(.disabled):not(:disabled):hover,
|
|
12
|
+
.np-circular-btn-secondary-default .np-circular-btn-label:not(.disabled):not(:disabled):hover {
|
|
116
13
|
color: var(--color-interactive-primary-hover);
|
|
117
14
|
}
|
|
118
|
-
.np-
|
|
119
|
-
.np-
|
|
15
|
+
.np-circular-btn-primary-default .np-circular-btn-label:not(.disabled):not(:disabled):active,
|
|
16
|
+
.np-circular-btn-secondary-default .np-circular-btn-label:not(.disabled):not(:disabled):active {
|
|
120
17
|
color: var(--color-interactive-primary-active);
|
|
121
18
|
}
|
|
122
|
-
.np-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
.np-theme-personal .np-circular-btn.accent.secondary:not(.disabled):not(:disabled):hover .tw-icon,
|
|
126
|
-
.np-theme-personal .np-circular-btn.accent.secondary input[type="button"]:active + .tw-icon {
|
|
127
|
-
color: white;
|
|
128
|
-
color: var(--color-interactive-control);
|
|
129
|
-
}
|
|
130
|
-
.np-theme-personal .np-circular-btn.accent.secondary:active input[type="button"] + .tw-icon {
|
|
131
|
-
color: var(--color-interactive-control);
|
|
132
|
-
}
|
|
133
|
-
.np-theme-personal .np-circular-btn.positive .np-circular-btn__label {
|
|
134
|
-
color: var(--color-interactive-primary);
|
|
135
|
-
}
|
|
136
|
-
.np-theme-personal .np-circular-btn.positive:not(.disabled):not(:disabled):hover .np-circular-btn__label {
|
|
137
|
-
color: var(--color-interactive-primary-hover);
|
|
138
|
-
}
|
|
139
|
-
.np-theme-personal .np-circular-btn.positive:active .np-circular-btn__label,
|
|
140
|
-
.np-theme-personal .np-circular-btn.positive input[type="button"]:active ~ .np-circular-btn__label {
|
|
141
|
-
color: var(--color-interactive-primary-active);
|
|
142
|
-
}
|
|
143
|
-
.np-theme-personal .np-circular-btn.positive.secondary .tw-icon {
|
|
144
|
-
color: var(--color-interactive-primary);
|
|
145
|
-
}
|
|
146
|
-
.np-theme-personal .np-circular-btn.positive.secondary:not(.disabled):not(:disabled):hover .tw-icon,
|
|
147
|
-
.np-theme-personal .np-circular-btn.positive.secondary input[type="button"]:active + .tw-icon {
|
|
148
|
-
color: white;
|
|
149
|
-
color: var(--color-interactive-control);
|
|
150
|
-
}
|
|
151
|
-
.np-theme-personal .np-circular-btn.positive.secondary:active input[type="button"] + .tw-icon {
|
|
152
|
-
color: var(--color-interactive-control);
|
|
153
|
-
}
|
|
154
|
-
.np-theme-personal .np-circular-btn.negative .np-circular-btn__label {
|
|
155
|
-
color: var(--color-sentiment-negative);
|
|
156
|
-
}
|
|
157
|
-
.np-theme-personal .np-circular-btn.negative:not(.disabled):not(:disabled):hover .np-circular-btn__label {
|
|
158
|
-
color: var(--color-sentiment-negative-hover);
|
|
159
|
-
}
|
|
160
|
-
.np-theme-personal .np-circular-btn.negative:active .np-circular-btn__label,
|
|
161
|
-
.np-theme-personal .np-circular-btn.negative input[type="button"]:active ~ .np-circular-btn__label {
|
|
162
|
-
color: var(--color-sentiment-negative-active);
|
|
19
|
+
.np-circular-btn-primary-negative .np-circular-btn-label,
|
|
20
|
+
.np-circular-btn-secondary-negative .np-circular-btn-label {
|
|
21
|
+
color: var(--color-sentiment-negative-primary);
|
|
163
22
|
}
|
|
164
|
-
.np-
|
|
165
|
-
|
|
23
|
+
.np-circular-btn-primary-negative .np-circular-btn-label:not(.disabled):not(:disabled):hover,
|
|
24
|
+
.np-circular-btn-secondary-negative .np-circular-btn-label:not(.disabled):not(:disabled):hover {
|
|
25
|
+
color: var(--color-sentiment-negative-primary-hover);
|
|
166
26
|
}
|
|
167
|
-
.np-
|
|
168
|
-
.np-
|
|
169
|
-
color:
|
|
170
|
-
color: var(--color-interactive-control);
|
|
27
|
+
.np-circular-btn-primary-negative .np-circular-btn-label:not(.disabled):not(:disabled):active,
|
|
28
|
+
.np-circular-btn-secondary-negative .np-circular-btn-label:not(.disabled):not(:disabled):active {
|
|
29
|
+
color: var(--color-sentiment-negative-primary-active);
|
|
171
30
|
}
|
|
172
|
-
.np-
|
|
173
|
-
|
|
31
|
+
.np-circular-btn-disabled {
|
|
32
|
+
cursor: not-allowed;
|
|
174
33
|
}
|
|
@@ -1,105 +1,36 @@
|
|
|
1
|
-
@import (reference) "../../node_modules/@transferwise/neptune-css/src/less/mixins/_logical-properties.less";
|
|
2
|
-
@import "./_button-label-states.less";
|
|
3
|
-
|
|
4
1
|
.np-circular-btn {
|
|
5
2
|
display: inline-flex;
|
|
6
3
|
flex-direction: column;
|
|
7
4
|
align-items: center;
|
|
8
|
-
text-align: center;
|
|
9
5
|
cursor: pointer;
|
|
10
|
-
position: relative;
|
|
11
|
-
|
|
12
|
-
.tw-icon {
|
|
13
|
-
position: absolute;
|
|
14
|
-
top: var(--size-16);
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
color: white;
|
|
17
|
-
transition: color 0.15s ease-in-out;
|
|
18
|
-
width: 100%;
|
|
19
|
-
.left(0);
|
|
20
6
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
&-primary-default,
|
|
8
|
+
&-secondary-default {
|
|
9
|
+
.np-circular-btn-label {
|
|
10
|
+
color: var(--color-interactive-primary);
|
|
11
|
+
&:not(.disabled, :disabled):hover {
|
|
12
|
+
color: var(--color-interactive-primary-hover);
|
|
13
|
+
}
|
|
14
|
+
&:not(.disabled, :disabled):active {
|
|
15
|
+
color: var(--color-interactive-primary-active);
|
|
16
|
+
}
|
|
27
17
|
}
|
|
28
18
|
}
|
|
29
19
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
&:hover
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
&-primary-negative,
|
|
21
|
+
&-secondary-negative {
|
|
22
|
+
.np-circular-btn-label {
|
|
23
|
+
color: var(--color-sentiment-negative-primary);
|
|
24
|
+
&:not(.disabled, :disabled):hover {
|
|
25
|
+
color: var(--color-sentiment-negative-primary-hover);
|
|
26
|
+
}
|
|
27
|
+
&:not(.disabled, :disabled):active {
|
|
28
|
+
color: var(--color-sentiment-negative-primary-active);
|
|
37
29
|
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&.negative .tw-icon,
|
|
41
|
-
&.negative.secondary:not(.disabled, :disabled):hover .tw-icon,
|
|
42
|
-
&.negative.secondary:not(.disabled, :disabled):active .tw-icon {
|
|
43
|
-
// TODO, this will need to be removed when we update our CSS architecture
|
|
44
|
-
color: var(--color-contrast) !important;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&.negative.secondary:not(.disabled, :disabled) .tw-icon {
|
|
48
|
-
// TODO, this will need to be removed when we update our CSS architecture
|
|
49
|
-
color: var(--color-sentiment-negative) !important;
|
|
50
30
|
}
|
|
51
31
|
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.button-label-states(
|
|
55
|
-
np-circular-btn,
|
|
56
|
-
accent,
|
|
57
|
-
var(--color-interactive-accent),
|
|
58
|
-
var(--color-interactive-accent-hover),
|
|
59
|
-
var(--color-interactive-accent-active)
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
.button-label-states(
|
|
63
|
-
np-circular-btn,
|
|
64
|
-
positive,
|
|
65
|
-
var(--color-interactive-positive),
|
|
66
|
-
var(--color-interactive-positive-hover),
|
|
67
|
-
var(--color-interactive-positive-active)
|
|
68
|
-
);
|
|
69
32
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var(--color-interactive-negative),
|
|
74
|
-
var(--color-interactive-negative-hover),
|
|
75
|
-
var(--color-interactive-negative-active)
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
.np-theme-personal {
|
|
79
|
-
.button-label-states(
|
|
80
|
-
np-circular-btn,
|
|
81
|
-
accent,
|
|
82
|
-
var(--color-interactive-primary),
|
|
83
|
-
var(--color-interactive-primary-hover),
|
|
84
|
-
var(--color-interactive-primary-active),
|
|
85
|
-
true
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
.button-label-states(
|
|
89
|
-
np-circular-btn,
|
|
90
|
-
positive,
|
|
91
|
-
var(--color-interactive-primary),
|
|
92
|
-
var(--color-interactive-primary-hover),
|
|
93
|
-
var(--color-interactive-primary-active),
|
|
94
|
-
true
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
.button-label-states(
|
|
98
|
-
np-circular-btn,
|
|
99
|
-
negative,
|
|
100
|
-
var(--color-sentiment-negative),
|
|
101
|
-
var(--color-sentiment-negative-hover),
|
|
102
|
-
var(--color-sentiment-negative-active),
|
|
103
|
-
true
|
|
104
|
-
);
|
|
33
|
+
&-disabled {
|
|
34
|
+
cursor: not-allowed;
|
|
35
|
+
}
|
|
105
36
|
}
|
|
@@ -5,14 +5,16 @@ import { ControlType, Priority } from '../common';
|
|
|
5
5
|
import { Meta, StoryObj } from '@storybook/react';
|
|
6
6
|
import CircularButton from './CircularButton';
|
|
7
7
|
import { storyConfig } from '../test-utils';
|
|
8
|
+
import Title from '../title';
|
|
9
|
+
import Body from '../body';
|
|
8
10
|
|
|
9
11
|
export default {
|
|
10
12
|
component: CircularButton,
|
|
11
13
|
title: 'Actions/CircularButton',
|
|
14
|
+
tags: ['autodocs'],
|
|
12
15
|
args: {
|
|
13
16
|
children: 'Button text',
|
|
14
|
-
|
|
15
|
-
icon: 'Freeze' as unknown as React.ReactElement,
|
|
17
|
+
icon: <Icons.Freeze />,
|
|
16
18
|
},
|
|
17
19
|
argTypes: {
|
|
18
20
|
icon: {
|
|
@@ -28,8 +30,8 @@ type Story = StoryObj<typeof CircularButton>;
|
|
|
28
30
|
|
|
29
31
|
export const Basic: Story = {
|
|
30
32
|
args: {
|
|
31
|
-
priority:
|
|
32
|
-
type:
|
|
33
|
+
priority: 'primary',
|
|
34
|
+
type: 'default',
|
|
33
35
|
disabled: false,
|
|
34
36
|
},
|
|
35
37
|
};
|
|
@@ -41,26 +43,45 @@ export const All: Story = {
|
|
|
41
43
|
render: (props) => {
|
|
42
44
|
return (
|
|
43
45
|
<>
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<
|
|
51
|
-
<CircularButton {...props} priority=
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
<CircularButton {...props} disabled />
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
<Title type="title-subsection" className="m-y-2">
|
|
47
|
+
Default (Primary and secondary)
|
|
48
|
+
</Title>
|
|
49
|
+
<Body>
|
|
50
|
+
<CircularButton {...props} priority="primary" type="default" />
|
|
51
|
+
<CircularButton {...props} priority="secondary" type="default" />
|
|
52
|
+
<CircularButton {...props} priority="primary" type="default" disabled />
|
|
53
|
+
<CircularButton {...props} priority="secondary" type="default" disabled />
|
|
54
|
+
</Body>
|
|
55
|
+
|
|
56
|
+
<Title type="title-subsection" className="m-y-2">
|
|
57
|
+
Negative (Primary and secondary)
|
|
58
|
+
</Title>
|
|
59
|
+
<Body>
|
|
60
|
+
<CircularButton {...props} priority="primary" type="negative" />
|
|
61
|
+
<CircularButton {...props} priority="secondary" type="negative" />
|
|
62
|
+
<CircularButton {...props} priority="primary" type="negative" disabled />
|
|
63
|
+
<CircularButton {...props} priority="secondary" type="negative" disabled />
|
|
64
|
+
</Body>
|
|
65
|
+
|
|
66
|
+
<Title type="title-body" className="m-y-2">
|
|
67
|
+
Accent (Deprecated)
|
|
68
|
+
</Title>
|
|
69
|
+
<Body>
|
|
70
|
+
<CircularButton {...props} priority="primary" type="accent" />
|
|
71
|
+
<CircularButton {...props} priority="secondary" type="accent" />
|
|
72
|
+
<CircularButton {...props} priority="primary" type="accent" disabled />
|
|
73
|
+
<CircularButton {...props} priority="secondary" type="accent" disabled />
|
|
74
|
+
</Body>
|
|
75
|
+
|
|
76
|
+
<Title type="title-body" className="m-y-2">
|
|
77
|
+
Positive (Deprecated)
|
|
78
|
+
</Title>
|
|
79
|
+
<Body>
|
|
80
|
+
<CircularButton {...props} priority="primary" type="positive" />
|
|
81
|
+
<CircularButton {...props} priority="secondary" type="positive" />
|
|
82
|
+
<CircularButton {...props} priority="primary" type="positive" disabled />
|
|
83
|
+
<CircularButton {...props} priority="secondary" type="positive" disabled />
|
|
84
|
+
</Body>
|
|
64
85
|
</>
|
|
65
86
|
);
|
|
66
87
|
},
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
|
-
import { cloneElement } from 'react';
|
|
3
2
|
|
|
4
3
|
import Body from '../body/Body';
|
|
5
|
-
import { typeClassMap, priorityClassMap } from '../button/classMap';
|
|
6
4
|
import { Breakpoint, ControlType, Priority, Typography } from '../common';
|
|
7
|
-
import
|
|
5
|
+
import IconButton, { IconButtonProps } from '../iconButton';
|
|
8
6
|
import { useMedia } from '../common/hooks/useMedia';
|
|
9
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated use `'default'` instead
|
|
10
|
+
*/
|
|
11
|
+
type DeprecatedTypes = `${ControlType.ACCENT | ControlType.POSITIVE}`;
|
|
12
|
+
|
|
10
13
|
export interface CircularButtonProps {
|
|
11
14
|
className?: string;
|
|
12
15
|
children: string;
|
|
13
16
|
disabled?: boolean;
|
|
14
|
-
icon: React.ReactElement<{ size?: unknown }
|
|
15
|
-
onClick?: React.MouseEventHandler<HTMLInputElement
|
|
17
|
+
icon: React.ReactElement<{ size?: unknown }> | React.ReactNode;
|
|
18
|
+
onClick?: React.MouseEventHandler<HTMLInputElement> &
|
|
19
|
+
React.MouseEventHandler<HTMLButtonElement> &
|
|
20
|
+
React.MouseEventHandler<HTMLAnchorElement>;
|
|
16
21
|
priority?: `${Priority.PRIMARY | Priority.SECONDARY}`;
|
|
17
|
-
|
|
22
|
+
/**
|
|
23
|
+
* `"accent"` and `"positive"` values are **deprecated**, please use `"default"` instead
|
|
24
|
+
*/
|
|
25
|
+
type?: DeprecatedTypes | 'default' | `${ControlType.NEGATIVE}`;
|
|
18
26
|
}
|
|
19
27
|
|
|
20
28
|
const CircularButton = ({
|
|
@@ -22,30 +30,35 @@ const CircularButton = ({
|
|
|
22
30
|
children,
|
|
23
31
|
disabled,
|
|
24
32
|
icon,
|
|
33
|
+
onClick,
|
|
25
34
|
priority = Priority.PRIMARY,
|
|
26
|
-
type =
|
|
27
|
-
...rest
|
|
35
|
+
type = 'default',
|
|
28
36
|
}: CircularButtonProps) => {
|
|
29
|
-
const classes = clsx('btn np-btn', 'm-b-1', typeClassMap[type], priorityClassMap[priority]);
|
|
30
|
-
|
|
31
|
-
const iconElement = Number(icon.props.size) !== 24 ? cloneElement(icon, { size: 24 }) : icon;
|
|
32
|
-
|
|
33
37
|
const isTinyViewport = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);
|
|
34
|
-
|
|
35
38
|
return (
|
|
36
|
-
<label
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
<label
|
|
40
|
+
className={clsx(
|
|
41
|
+
'np-circular-btn',
|
|
42
|
+
`np-circular-btn-${priority}-${type}`,
|
|
43
|
+
{ 'np-circular-btn-disabled': disabled },
|
|
44
|
+
className,
|
|
45
|
+
)}
|
|
46
|
+
>
|
|
47
|
+
<IconButton
|
|
48
|
+
size={isTinyViewport ? 32 : 56}
|
|
49
|
+
priority={priority}
|
|
50
|
+
type={['accent', 'positive'].includes(type) ? 'default' : (type as IconButtonProps['type'])}
|
|
51
|
+
className={clsx('m-b-1')}
|
|
44
52
|
disabled={disabled}
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
onClick={onClick}
|
|
54
|
+
>
|
|
55
|
+
{icon}
|
|
56
|
+
</IconButton>
|
|
57
|
+
<Body
|
|
58
|
+
as="span"
|
|
59
|
+
className={clsx('np-circular-btn-label', { disabled })}
|
|
60
|
+
type={Typography.BODY_DEFAULT_BOLD}
|
|
61
|
+
>
|
|
49
62
|
{children}
|
|
50
63
|
</Body>
|
|
51
64
|
</label>
|