@transferwise/components 0.0.0-experimental-b80ad21 → 0.0.0-experimental-3821d5a

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/main.css CHANGED
@@ -1308,7 +1308,7 @@
1308
1308
  --Button-color-active: var(--Button-secondary-neutral-color);
1309
1309
  }
1310
1310
  .wds-Button--secondary-neutral .wds-Button-icon--end {
1311
- color: var(--color-interactive-primary);
1311
+ color: var(--Button-secondary-color);
1312
1312
  }
1313
1313
  .wds-Button--tertiary {
1314
1314
  --Button-background: var(--Button-tertiary-background);
@@ -113,7 +113,7 @@
113
113
  --Button-color-active: var(--Button-secondary-neutral-color);
114
114
  }
115
115
  .wds-Button--secondary-neutral .wds-Button-icon--end {
116
- color: var(--color-interactive-primary);
116
+ color: var(--Button-secondary-color);
117
117
  }
118
118
  .wds-Button--tertiary {
119
119
  --Button-background: var(--Button-tertiary-background);
@@ -1308,7 +1308,7 @@
1308
1308
  --Button-color-active: var(--Button-secondary-neutral-color);
1309
1309
  }
1310
1310
  .wds-Button--secondary-neutral .wds-Button-icon--end {
1311
- color: var(--color-interactive-primary);
1311
+ color: var(--Button-secondary-color);
1312
1312
  }
1313
1313
  .wds-Button--tertiary {
1314
1314
  --Button-background: var(--Button-tertiary-background);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "0.0.0-experimental-b80ad21",
3
+ "version": "0.0.0-experimental-3821d5a",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -84,13 +84,13 @@
84
84
  "storybook-addon-tag-badges": "^2.0.2",
85
85
  "storybook-addon-test-codegen": "^2.0.1",
86
86
  "@transferwise/less-config": "3.1.2",
87
- "@transferwise/neptune-css": "0.0.0-experimental-b80ad21",
87
+ "@transferwise/neptune-css": "0.0.0-experimental-3821d5a",
88
88
  "@wise/components-theming": "1.9.1",
89
89
  "@wise/wds-configs": "0.0.0"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@transferwise/icons": "^3 || ^4",
93
- "@transferwise/neptune-css": "0.0.0-experimental-b80ad21",
93
+ "@transferwise/neptune-css": "0.0.0-experimental-3821d5a",
94
94
  "@wise/art": "^2.24.4",
95
95
  "@wise/components-theming": "^1.6.2",
96
96
  "react": ">=18",
@@ -113,7 +113,7 @@
113
113
  --Button-color-active: var(--Button-secondary-neutral-color);
114
114
  }
115
115
  .wds-Button--secondary-neutral .wds-Button-icon--end {
116
- color: var(--color-interactive-primary);
116
+ color: var(--Button-secondary-color);
117
117
  }
118
118
  .wds-Button--tertiary {
119
119
  --Button-background: var(--Button-tertiary-background);
@@ -74,7 +74,7 @@
74
74
  --Button-color-active: var(--Button-secondary-neutral-color);
75
75
 
76
76
  .wds-Button-icon--end {
77
- color: var(--color-interactive-primary);
77
+ color: var(--Button-secondary-color);
78
78
  }
79
79
  }
80
80
 
@@ -696,116 +696,6 @@ export const WithAvatars: StoryObj<PreviewStoryArgs> = {
696
696
  decorators: [withComponentGrid()],
697
697
  };
698
698
 
699
- const buttonPriorities = ['primary', 'secondary', 'secondary-neutral', 'tertiary'] as const;
700
- const buttonSizes = ['sm', 'md', 'lg'] as const;
701
-
702
- export const AllVariants = storyConfig(
703
- {
704
- tags: ['!autodocs'],
705
- parameters: {
706
- padding: '0',
707
- },
708
- render: () => (
709
- <div
710
- className="button-variants"
711
- style={{ display: 'flex', flexWrap: 'wrap', gap: '16px', maxWidth: '1200px' }}
712
- >
713
- {buttonPriorities.map((priority) =>
714
- buttonSizes.map((size) => (
715
- <div
716
- key={`${priority}-default-${size}`}
717
- style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
718
- >
719
- <Button
720
- v2
721
- priority={priority as ButtonPriority}
722
- size={size}
723
- addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
724
- addonEnd={{ type: 'icon', value: <ArrowRight /> }}
725
- block
726
- >
727
- {`${priority} default ${size}`}
728
- </Button>
729
- <Button
730
- className="m-t-1 m-b-1"
731
- v2
732
- priority={priority as ButtonPriority}
733
- size={size}
734
- addonStart={{
735
- type: 'avatar',
736
- value: [{ asset: <Freeze /> }, { asset: <Freeze /> }],
737
- }}
738
- addonEnd={{ type: 'icon', value: <ArrowRight /> }}
739
- block
740
- disabled
741
- >
742
- {`${priority} default ${size} Disabled`}
743
- </Button>
744
- <Button
745
- v2
746
- priority={priority as ButtonPriority}
747
- size={size}
748
- addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
749
- addonEnd={{ type: 'icon', value: <ArrowRight /> }}
750
- block
751
- loading
752
- >
753
- {`${priority} default ${size} Loading`}
754
- </Button>
755
- </div>
756
- )),
757
- )}
758
- {['primary', 'secondary'].map((priority) =>
759
- buttonSizes.map((size) => (
760
- <div
761
- key={`${priority}-negative-${size}`}
762
- style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
763
- >
764
- <Button
765
- v2
766
- sentiment="negative"
767
- priority={priority as ButtonPriority}
768
- size={size}
769
- addonEnd={{ type: 'icon', value: <ChevronRight /> }}
770
- addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
771
- block
772
- >
773
- {`${priority} negative ${size}`}
774
- </Button>
775
- <Button
776
- className="m-t-1 m-b-1"
777
- v2
778
- sentiment="negative"
779
- priority={priority as ButtonPriority}
780
- size={size}
781
- addonEnd={{ type: 'icon', value: <ChevronRight /> }}
782
- addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
783
- block
784
- disabled
785
- >
786
- {`${priority} negative ${size} Disabled`}
787
- </Button>
788
- <Button
789
- v2
790
- sentiment="negative"
791
- priority={priority as ButtonPriority}
792
- size={size}
793
- addonEnd={{ type: 'icon', value: <ChevronRight /> }}
794
- addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
795
- block
796
- loading
797
- >
798
- {`${priority} negative ${size} Loading`}
799
- </Button>
800
- </div>
801
- )),
802
- )}
803
- </div>
804
- ),
805
- },
806
- { variants: ['default', 'dark', 'bright-green', 'forest-green', 'rtl'] },
807
- );
808
-
809
699
  /**
810
700
  * **NB:** The button doesn't know how long its label is, how many words it consists of and
811
701
  * how zoomed in it is. That is likely to lead to scenarios in which the text will overflow
@@ -926,14 +816,39 @@ export const SentimentAwareness: Story = {
926
816
  className="p-a-1 d-flex align-items-center"
927
817
  style={{ gap: 'var(--size-8)' }}
928
818
  >
929
- <Button v2>Primary</Button>
930
- <Button v2 priority="secondary">
819
+ <Button
820
+ v2
821
+ size="md"
822
+ addonEnd={{ type: 'icon', value: <ChevronRight /> }}
823
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
824
+ >
825
+ Primary
826
+ </Button>
827
+ <Button
828
+ v2
829
+ size="md"
830
+ priority="secondary"
831
+ addonEnd={{ type: 'icon', value: <ChevronRight /> }}
832
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
833
+ >
931
834
  Secondary
932
835
  </Button>
933
- <Button v2 priority="secondary-neutral">
836
+ <Button
837
+ v2
838
+ size="md"
839
+ priority="secondary-neutral"
840
+ addonEnd={{ type: 'icon', value: <ChevronRight /> }}
841
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
842
+ >
934
843
  Secondary Neutral
935
844
  </Button>
936
- <Button v2 disabled>
845
+ <Button
846
+ v2
847
+ size="md"
848
+ disabled
849
+ addonEnd={{ type: 'icon', value: <ChevronRight /> }}
850
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
851
+ >
937
852
  Disabled
938
853
  </Button>
939
854
  </SentimentSurface>
@@ -2,6 +2,10 @@ import { Meta } from '@storybook/react-webpack5';
2
2
  import Button from './Button.resolver';
3
3
  import { expect, userEvent, within } from 'storybook/test';
4
4
  import { storyConfig } from '../test-utils';
5
+ import { ButtonPriority } from './Button.types';
6
+ import { ArrowRight, ChevronRight, Freeze } from '@transferwise/icons';
7
+ import SentimentSurface from '../sentimentSurface';
8
+ import { Flag } from '@wise/art';
5
9
 
6
10
  const meta: Meta<typeof Button> = {
7
11
  component: Button,
@@ -25,3 +29,188 @@ FocusTertiary.play = async ({ canvasElement }) => {
25
29
  const buttonElement: HTMLButtonElement = canvas.getByRole('button');
26
30
  await expect(buttonElement).toHaveFocus();
27
31
  };
32
+
33
+ const buttonPriorities = ['primary', 'secondary', 'secondary-neutral', 'tertiary'] as const;
34
+ const buttonSizes = ['sm', 'md', 'lg'] as const;
35
+ export const AllVariants = storyConfig(
36
+ {
37
+ tags: ['!autodocs'],
38
+ parameters: {
39
+ padding: '0',
40
+ },
41
+ render: () => (
42
+ <div
43
+ className="button-variants"
44
+ style={{ display: 'flex', flexWrap: 'wrap', gap: '16px', maxWidth: '1200px' }}
45
+ >
46
+ {buttonPriorities.map((priority) =>
47
+ buttonSizes.map((size) => (
48
+ <div
49
+ key={`${priority}-default-${size}`}
50
+ style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
51
+ >
52
+ <Button
53
+ v2
54
+ priority={priority as ButtonPriority}
55
+ size={size}
56
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
57
+ addonEnd={{ type: 'icon', value: <ArrowRight /> }}
58
+ block
59
+ >
60
+ {`${priority} default ${size}`}
61
+ </Button>
62
+ <Button
63
+ className="m-t-1 m-b-1"
64
+ v2
65
+ priority={priority as ButtonPriority}
66
+ size={size}
67
+ addonStart={{
68
+ type: 'avatar',
69
+ value: [{ asset: <Freeze /> }, { asset: <Freeze /> }],
70
+ }}
71
+ addonEnd={{ type: 'icon', value: <ArrowRight /> }}
72
+ block
73
+ disabled
74
+ >
75
+ {`${priority} default ${size} Disabled`}
76
+ </Button>
77
+ <Button
78
+ v2
79
+ priority={priority as ButtonPriority}
80
+ size={size}
81
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
82
+ addonEnd={{ type: 'icon', value: <ArrowRight /> }}
83
+ block
84
+ loading
85
+ >
86
+ {`${priority} default ${size} Loading`}
87
+ </Button>
88
+ </div>
89
+ )),
90
+ )}
91
+ {['primary', 'secondary'].map((priority) =>
92
+ buttonSizes.map((size) => (
93
+ <div
94
+ key={`${priority}-negative-${size}`}
95
+ style={{ flex: '1 0 30%', marginBottom: '16px', justifyContent: 'space-between' }}
96
+ >
97
+ <Button
98
+ v2
99
+ sentiment="negative"
100
+ priority={priority as ButtonPriority}
101
+ size={size}
102
+ addonEnd={{ type: 'icon', value: <ChevronRight /> }}
103
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
104
+ block
105
+ >
106
+ {`${priority} negative ${size}`}
107
+ </Button>
108
+ <Button
109
+ className="m-t-1 m-b-1"
110
+ v2
111
+ sentiment="negative"
112
+ priority={priority as ButtonPriority}
113
+ size={size}
114
+ addonEnd={{ type: 'icon', value: <ChevronRight /> }}
115
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
116
+ block
117
+ disabled
118
+ >
119
+ {`${priority} negative ${size} Disabled`}
120
+ </Button>
121
+ <Button
122
+ v2
123
+ sentiment="negative"
124
+ priority={priority as ButtonPriority}
125
+ size={size}
126
+ addonEnd={{ type: 'icon', value: <ChevronRight /> }}
127
+ addonStart={{ type: 'avatar', value: [{ asset: <Freeze /> }] }}
128
+ block
129
+ loading
130
+ >
131
+ {`${priority} negative ${size} Loading`}
132
+ </Button>
133
+ </div>
134
+ )),
135
+ )}
136
+ </div>
137
+ ),
138
+ },
139
+ { variants: ['default', 'dark', 'bright-green', 'forest-green', 'rtl'] },
140
+ );
141
+
142
+ export const SentimentAwareness = storyConfig(
143
+ {
144
+ render: () => {
145
+ const PERMUTATIONS = {
146
+ emphasis: ['base', 'elevated'] as const,
147
+ sentiment: ['success', 'warning', 'negative', 'neutral', 'proposition'] as const,
148
+ disabled: [false, true] as const,
149
+ others: [
150
+ {
151
+ addonStart: { type: 'avatar' as const, value: [{ asset: <Freeze /> }] },
152
+ addonEnd: { type: 'icon' as const, value: <ChevronRight /> },
153
+ },
154
+ {
155
+ addonStart: { type: 'avatar' as const, value: [{ profileName: 'John Doe' }] },
156
+ },
157
+ {
158
+ addonStart: {
159
+ type: 'avatar' as const,
160
+ value: [
161
+ {
162
+ asset: <Flag code="gb" />,
163
+ },
164
+ { asset: <Freeze /> },
165
+ ],
166
+ },
167
+ },
168
+ {
169
+ loading: true,
170
+ },
171
+ ],
172
+ priority: ['primary', 'secondary', 'secondary-neutral'] as const,
173
+ };
174
+
175
+ return (
176
+ <>
177
+ {PERMUTATIONS.emphasis.map((emphasis) =>
178
+ PERMUTATIONS.sentiment.map((sentiment) => (
179
+ <SentimentSurface
180
+ key={`${emphasis}-${sentiment}`}
181
+ sentiment={sentiment}
182
+ emphasis={emphasis}
183
+ style={{
184
+ padding: 'var(--size-8)',
185
+ display: 'grid',
186
+ gridTemplateColumns: 'repeat(3, min-content)',
187
+ gap: 'var(--size-8)',
188
+ }}
189
+ >
190
+ {PERMUTATIONS.disabled.map((disabled) =>
191
+ PERMUTATIONS.others.map((media, mediaVariant) =>
192
+ PERMUTATIONS.priority.map((priority) => (
193
+ <div key={`${emphasis}-${sentiment}-${disabled}-${priority}-${mediaVariant}`}>
194
+ <Button v2 size="md" disabled={disabled} priority={priority} {...media}>
195
+ {priority}
196
+ </Button>
197
+ </div>
198
+ )),
199
+ ),
200
+ )}
201
+ </SentimentSurface>
202
+ )),
203
+ )}
204
+ </>
205
+ );
206
+ },
207
+ decorators: [
208
+ (Story: React.ComponentType) => (
209
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
210
+ <Story />
211
+ </div>
212
+ ),
213
+ ],
214
+ },
215
+ {},
216
+ );
package/src/main.css CHANGED
@@ -1308,7 +1308,7 @@
1308
1308
  --Button-color-active: var(--Button-secondary-neutral-color);
1309
1309
  }
1310
1310
  .wds-Button--secondary-neutral .wds-Button-icon--end {
1311
- color: var(--color-interactive-primary);
1311
+ color: var(--Button-secondary-color);
1312
1312
  }
1313
1313
  .wds-Button--tertiary {
1314
1314
  --Button-background: var(--Button-tertiary-background);