@transferwise/components 46.160.8 → 46.161.1

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 (56) hide show
  1. package/build/Tag/Tag.js +45 -0
  2. package/build/Tag/Tag.js.map +1 -0
  3. package/build/Tag/Tag.mjs +41 -0
  4. package/build/Tag/Tag.mjs.map +1 -0
  5. package/build/index.js +2 -0
  6. package/build/index.js.map +1 -1
  7. package/build/index.mjs +1 -0
  8. package/build/index.mjs.map +1 -1
  9. package/build/main.css +31 -32
  10. package/build/styles/Tag/Tag.css +30 -0
  11. package/build/styles/css/neptune-core.css +1 -32
  12. package/build/styles/css/neptune.css +1 -32
  13. package/build/styles/main.css +31 -32
  14. package/build/styles/styles/less/neptune-core.css +1 -32
  15. package/build/styles/styles/less/neptune.css +1 -32
  16. package/build/types/Tag/Tag.d.ts +24 -0
  17. package/build/types/Tag/Tag.d.ts.map +1 -0
  18. package/build/types/Tag/Tag.types.d.ts +39 -0
  19. package/build/types/Tag/Tag.types.d.ts.map +1 -0
  20. package/build/types/Tag/index.d.ts +3 -0
  21. package/build/types/Tag/index.d.ts.map +1 -0
  22. package/build/types/index.d.ts +2 -0
  23. package/build/types/index.d.ts.map +1 -1
  24. package/package.json +3 -3
  25. package/src/Tag/Tag.css +30 -0
  26. package/src/Tag/Tag.less +31 -0
  27. package/src/Tag/Tag.test.tsx +70 -0
  28. package/src/Tag/Tag.tsx +71 -0
  29. package/src/Tag/Tag.types.ts +46 -0
  30. package/src/Tag/_stories/Tag.story.tsx +245 -0
  31. package/src/Tag/_stories/Tag.test.story.tsx +121 -0
  32. package/src/Tag/index.ts +2 -0
  33. package/src/index.ts +2 -0
  34. package/src/main.css +31 -32
  35. package/src/main.less +1 -0
  36. package/src/styles/less/core/_fonts.less +9 -29
  37. package/src/styles/less/core/_scaffolding.less +1 -12
  38. package/src/styles/less/neptune-core.css +1 -32
  39. package/src/styles/less/neptune.css +1 -32
  40. package/src/test-utils/assets/card-payment-bakery.webp +0 -0
  41. package/build/styles/fonts/TW-Averta-Bold.woff +0 -0
  42. package/build/styles/fonts/TW-Averta-Bold.woff2 +0 -0
  43. package/build/styles/fonts/TW-Averta-Regular.woff +0 -0
  44. package/build/styles/fonts/TW-Averta-Regular.woff2 +0 -0
  45. package/build/styles/fonts/TW-Averta-Semibold.woff +0 -0
  46. package/build/styles/fonts/TW-Averta-Semibold.woff2 +0 -0
  47. package/build/styles/fonts/TransferWise-IconFont.svg +0 -81
  48. package/build/styles/fonts/TransferWise-IconFont.woff +0 -0
  49. package/src/styles/fonts/TW-Averta-Bold.woff +0 -0
  50. package/src/styles/fonts/TW-Averta-Bold.woff2 +0 -0
  51. package/src/styles/fonts/TW-Averta-Regular.woff +0 -0
  52. package/src/styles/fonts/TW-Averta-Regular.woff2 +0 -0
  53. package/src/styles/fonts/TW-Averta-Semibold.woff +0 -0
  54. package/src/styles/fonts/TW-Averta-Semibold.woff2 +0 -0
  55. package/src/styles/fonts/TransferWise-IconFont.svg +0 -81
  56. package/src/styles/fonts/TransferWise-IconFont.woff +0 -0
@@ -0,0 +1,121 @@
1
+ import type { ReactElement } from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
3
+
4
+ import { withRTLDiff } from '../../../.storybook/decorators/RtlDiffDecorator';
5
+ import { allModes } from '../../../.storybook/modes';
6
+ import Tag from '..';
7
+ import type { TagProps } from '..';
8
+
9
+ const SENTIMENTS = ['neutral', 'negative', 'warning', 'success', 'proposition'] as const;
10
+
11
+ const withMatrixGrid = (Story: () => ReactElement) => (
12
+ <div
13
+ style={{
14
+ alignItems: 'center',
15
+ display: 'grid',
16
+ gap: '0.5rem',
17
+ gridTemplateColumns: 'repeat(5, max-content)',
18
+ justifyItems: 'start',
19
+ }}
20
+ >
21
+ <Story />
22
+ </div>
23
+ );
24
+
25
+ const meta = {
26
+ title: 'Prompts/Tag/Tests',
27
+ component: Tag,
28
+ tags: ['!autodocs', '!manifest'],
29
+ args: {
30
+ label: 'Tag copy',
31
+ },
32
+ } satisfies Meta<TagProps>;
33
+
34
+ export default meta;
35
+
36
+ type Story = StoryObj<TagProps>;
37
+
38
+ /**
39
+ * Every combination of size, emphasis and sentiment, across all themes.
40
+ */
41
+ export const AllThemesAndSentiments: Story = {
42
+ render: () => (
43
+ <>
44
+ {(['small', 'large'] as const).map((size) =>
45
+ (['base', 'elevated'] as const).map((emphasis) =>
46
+ SENTIMENTS.map((sentiment) => (
47
+ <Tag
48
+ key={`${size}-${emphasis}-${sentiment}`}
49
+ label={`${size} ${sentiment}`}
50
+ size={size}
51
+ sentiment={sentiment}
52
+ emphasis={emphasis}
53
+ />
54
+ )),
55
+ ),
56
+ )}
57
+ </>
58
+ ),
59
+ decorators: [withMatrixGrid],
60
+ parameters: {
61
+ padding: '16px',
62
+ variants: ['default', 'dark', 'bright-green', 'forest-green'],
63
+ chromatic: {
64
+ dark: allModes.dark,
65
+ brightGreen: allModes.brightGreen,
66
+ forestGreen: allModes.forestGreen,
67
+ },
68
+ },
69
+ };
70
+
71
+ /**
72
+ * The tag's horizontal padding is asymmetric and long copy truncates, so both need to mirror.
73
+ */
74
+ export const RTLDiff: Story = {
75
+ render: () => (
76
+ <div
77
+ style={{
78
+ alignItems: 'flex-start',
79
+ display: 'flex',
80
+ flexDirection: 'column',
81
+ gap: '0.5rem',
82
+ }}
83
+ >
84
+ <Tag label="Tag copy" />
85
+ <Tag label="Tag copy" size="large" sentiment="success" emphasis="elevated" />
86
+ <Tag label="A tag with copy far too long to fit within its maximum width" />
87
+ </div>
88
+ ),
89
+ ...withRTLDiff(),
90
+ };
91
+
92
+ /**
93
+ * `overMedia` tags keep their dark screen mode colours in every theme.
94
+ */
95
+ export const OverMediaAcrossThemes: Story = {
96
+ render: () => (
97
+ <>
98
+ {(['small', 'large'] as const).map((size) =>
99
+ SENTIMENTS.map((sentiment) => (
100
+ <Tag
101
+ key={`${size}-${sentiment}`}
102
+ label={`${size} ${sentiment}`}
103
+ size={size}
104
+ sentiment={sentiment}
105
+ overMedia
106
+ />
107
+ )),
108
+ )}
109
+ </>
110
+ ),
111
+ decorators: [withMatrixGrid],
112
+ parameters: {
113
+ padding: '16px',
114
+ variants: ['default', 'dark', 'bright-green', 'forest-green'],
115
+ chromatic: {
116
+ dark: allModes.dark,
117
+ brightGreen: allModes.brightGreen,
118
+ forestGreen: allModes.forestGreen,
119
+ },
120
+ },
121
+ };
@@ -0,0 +1,2 @@
1
+ export { default } from './Tag';
2
+ export type { TagProps, TagSize } from './Tag.types';
package/src/index.ts CHANGED
@@ -148,6 +148,7 @@ export type {
148
148
  export type { SwitchProps } from './Switch';
149
149
  export type { SwitchOptionProps } from './_deprecated/SwitchOption';
150
150
  export type { TabItem, TabsProps, TabProps, TabListProps, TabPanelProps } from './Tabs';
151
+ export type { TagProps, TagSize } from './Tag';
151
152
  export type { TextareaWithDisplayFormatProps } from './TextareaWithDisplayFormat';
152
153
  export type { TileProps } from './Tile';
153
154
  export type { TitleProps } from './Title';
@@ -291,6 +292,7 @@ export { default as Summary } from './_deprecated/Summary';
291
292
  export { default as Switch } from './Switch';
292
293
  export { default as SwitchOption } from './_deprecated/SwitchOption';
293
294
  export { default as Tabs } from './Tabs';
295
+ export { default as Tag } from './Tag';
294
296
  export { default as TextareaWithDisplayFormat } from './TextareaWithDisplayFormat';
295
297
  export { default as Title } from './Title';
296
298
  export { default as Tile } from './Tile';
package/src/main.css CHANGED
@@ -2627,26 +2627,6 @@
2627
2627
  src: url("styles/fonts/inter-vietnamese-variable-wghtOnly-normal.woff2") format("woff2");
2628
2628
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
2629
2629
  }
2630
- @font-face {
2631
- font-weight: 400;
2632
- font-weight: var(--font-weight-regular);
2633
- font-family: Averta;
2634
- src: url("styles/fonts/TW-Averta-Regular.woff2") format("woff2"), url("styles/fonts/TW-Averta-Regular.woff") format("woff");
2635
- font-display: swap;
2636
- }
2637
- @font-face {
2638
- font-weight: 600;
2639
- font-weight: var(--font-weight-semi-bold);
2640
- font-family: Averta;
2641
- src: url("styles/fonts/TW-Averta-Semibold.woff2") format("woff2"), url("styles/fonts/TW-Averta-Semibold.woff") format("woff");
2642
- font-display: swap;
2643
- }
2644
- @font-face {
2645
- font-weight: 700;
2646
- font-weight: var(--font-weight-bold);
2647
- font-family: Averta;
2648
- src: url("styles/fonts/TW-Averta-Bold.woff2") format("woff2"), url("styles/fonts/TW-Averta-Bold.woff") format("woff");
2649
- }
2650
2630
  @font-face {
2651
2631
  font-family: "Wise Sans";
2652
2632
  font-style: normal;
@@ -2831,7 +2811,6 @@ summary {
2831
2811
  }
2832
2812
  :root {
2833
2813
  --base-font-size: 16px;
2834
- --font-family-regular: "Inter", Helvetica, Arial, sans-serif;
2835
2814
  --input-group-addon-padding: 12px 16px calc(12px - 2px);
2836
2815
  --btn-padding: 12px 24px calc(12px - 2px);
2837
2816
  --btn-xs-padding: 2px 8px calc(2px - 2px);
@@ -2847,18 +2826,8 @@ summary {
2847
2826
  --btn-sm-radius-base: 2px;
2848
2827
  --btn-lg-radius-base: 3px;
2849
2828
  }
2850
- .np-theme-light,
2851
- .np-theme-dark,
2852
- .np-theme-navy {
2853
- --font-family-regular: averta, avenir w02, avenir, helvetica, arial, sans-serif !important;
2854
- font-family: averta, avenir w02, avenir, helvetica, arial, sans-serif;
2855
- font-family: var(--font-family-regular);
2856
- line-height: 1.5;
2857
- line-height: var(--line-height-body);
2858
- }
2859
2829
  .np-theme-personal {
2860
- --font-family-regular: "Inter", Helvetica, Arial, sans-serif !important;
2861
- font-family: "Inter", Helvetica, Arial, sans-serif;
2830
+ font-family: 'Inter', Helvetica, Arial, sans-serif;
2862
2831
  font-family: var(--font-family-regular);
2863
2832
  font-feature-settings: "calt";
2864
2833
  --input-group-addon-padding: 12px 16px;
@@ -27387,6 +27356,36 @@ button.np-link {
27387
27356
  margin-inline-end: 12px;
27388
27357
  margin-inline-end: var(--size-12);
27389
27358
  }
27359
+ .wds-tag {
27360
+ display: inline-block;
27361
+ max-inline-size: 240px;
27362
+ min-inline-size: 0;
27363
+ overflow: hidden;
27364
+ text-overflow: ellipsis;
27365
+ vertical-align: middle;
27366
+ white-space: nowrap;
27367
+ inline-size: -moz-fit-content;
27368
+ inline-size: fit-content;
27369
+ }
27370
+ .wds-tag--small {
27371
+ border-radius: 6px;
27372
+ font-size: 0.75rem;
27373
+ font-size: var(--font-size-12);
27374
+ padding-block: 1px;
27375
+ padding-inline: 4px;
27376
+ padding-inline: var(--size-4);
27377
+ }
27378
+ .wds-tag--large {
27379
+ border-radius: 8px;
27380
+ padding-block: 1px;
27381
+ padding-inline: 6px;
27382
+ }
27383
+ .wds-tag.wds-tag--proposition {
27384
+ color: var(--color-sentiment-interactive-primary);
27385
+ }
27386
+ .wds-tag-theme {
27387
+ display: contents;
27388
+ }
27390
27389
  .np-tile {
27391
27390
  min-inline-size: 120px;
27392
27391
  border-radius: 10px;
package/src/main.less CHANGED
@@ -86,6 +86,7 @@
86
86
  @import "./_deprecated/SwitchOption/SwitchOption.less";
87
87
  @import "./Tabs/Tabs.less";
88
88
  @import "./Table/Table.less";
89
+ @import "./Tag/Tag.less";
89
90
  @import "./Tile/Tile.less";
90
91
  @import "./Tooltip/Tooltip.less";
91
92
  @import "./Typeahead/Typeahead.less";
@@ -42,7 +42,9 @@
42
42
  font-display: swap;
43
43
  font-weight: 100 900;
44
44
  src: url("./styles/fonts/inter-latin-variable-wghtOnly-normal.woff2") format("woff2");
45
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
45
+ unicode-range:
46
+ U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074,
47
+ U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
46
48
  }
47
49
 
48
50
  @font-face {
@@ -51,7 +53,9 @@
51
53
  font-display: swap;
52
54
  font-weight: 100 900;
53
55
  src: url("./styles/fonts/inter-latin-ext-variable-wghtOnly-normal.woff2") format("woff2");
54
- unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
56
+ unicode-range:
57
+ U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F,
58
+ U+A720-A7FF;
55
59
  }
56
60
 
57
61
  @font-face {
@@ -60,33 +64,9 @@
60
64
  font-display: swap;
61
65
  font-weight: 100 900;
62
66
  src: url("./styles/fonts/inter-vietnamese-variable-wghtOnly-normal.woff2") format("woff2");
63
- unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
64
- }
65
-
66
- @font-face {
67
- font-weight: var(--font-weight-regular);
68
- font-family: Averta;
69
- src:
70
- url("./styles/fonts/TW-Averta-Regular.woff2") format("woff2"),
71
- url("./styles/fonts/TW-Averta-Regular.woff") format("woff");
72
- font-display: swap;
73
- }
74
-
75
- @font-face {
76
- font-weight: var(--font-weight-semi-bold);
77
- font-family: Averta;
78
- src:
79
- url("./styles/fonts/TW-Averta-Semibold.woff2") format("woff2"),
80
- url("./styles/fonts/TW-Averta-Semibold.woff") format("woff");
81
- font-display: swap;
82
- }
83
-
84
- @font-face {
85
- font-weight: var(--font-weight-bold);
86
- font-family: Averta;
87
- src:
88
- url("./styles/fonts/TW-Averta-Bold.woff2") format("woff2"),
89
- url("./styles/fonts/TW-Averta-Bold.woff") format("woff");
67
+ unicode-range:
68
+ U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9,
69
+ U+20AB;
90
70
  }
91
71
 
92
72
  @font-face {
@@ -9,8 +9,8 @@
9
9
 
10
10
  :root {
11
11
  // page default font size should be set in absolute units (pixels)
12
+ // TODO: move this token to rest of foundation tokens (neptune-tokens)
12
13
  --base-font-size: 16px;
13
- --font-family-regular: "Inter", Helvetica, Arial, sans-serif;
14
14
  --input-group-addon-padding: @padding-large-vertical @padding-base-horizontal
15
15
  calc(@padding-large-vertical - 2px);
16
16
  --btn-padding: @btn-padding-vertical @btn-padding-horizontal calc(@btn-padding-vertical - 2px);
@@ -36,18 +36,7 @@
36
36
  --btn-lg-radius-base: @border-radius-large;
37
37
  }
38
38
 
39
- .np-theme-light,
40
- .np-theme-dark,
41
- .np-theme-navy {
42
- --font-family-regular: averta, avenir w02, avenir, helvetica, arial, sans-serif !important;
43
-
44
- font-family: var(--font-family-regular);
45
- line-height: var(--line-height-body);
46
- }
47
-
48
39
  .np-theme-personal {
49
- --font-family-regular: "Inter", Helvetica, Arial, sans-serif !important;
50
-
51
40
  font-family: var(--font-family-regular);
52
41
  font-feature-settings: "calt";
53
42
 
@@ -55,26 +55,6 @@
55
55
  src: url("styles/fonts/inter-vietnamese-variable-wghtOnly-normal.woff2") format("woff2");
56
56
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
57
57
  }
58
- @font-face {
59
- font-weight: 400;
60
- font-weight: var(--font-weight-regular);
61
- font-family: Averta;
62
- src: url("styles/fonts/TW-Averta-Regular.woff2") format("woff2"), url("styles/fonts/TW-Averta-Regular.woff") format("woff");
63
- font-display: swap;
64
- }
65
- @font-face {
66
- font-weight: 600;
67
- font-weight: var(--font-weight-semi-bold);
68
- font-family: Averta;
69
- src: url("styles/fonts/TW-Averta-Semibold.woff2") format("woff2"), url("styles/fonts/TW-Averta-Semibold.woff") format("woff");
70
- font-display: swap;
71
- }
72
- @font-face {
73
- font-weight: 700;
74
- font-weight: var(--font-weight-bold);
75
- font-family: Averta;
76
- src: url("styles/fonts/TW-Averta-Bold.woff2") format("woff2"), url("styles/fonts/TW-Averta-Bold.woff") format("woff");
77
- }
78
58
  @font-face {
79
59
  font-family: "Wise Sans";
80
60
  font-style: normal;
@@ -259,7 +239,6 @@ summary {
259
239
  }
260
240
  :root {
261
241
  --base-font-size: 16px;
262
- --font-family-regular: "Inter", Helvetica, Arial, sans-serif;
263
242
  --input-group-addon-padding: 12px 16px calc(12px - 2px);
264
243
  --btn-padding: 12px 24px calc(12px - 2px);
265
244
  --btn-xs-padding: 2px 8px calc(2px - 2px);
@@ -275,18 +254,8 @@ summary {
275
254
  --btn-sm-radius-base: 2px;
276
255
  --btn-lg-radius-base: 3px;
277
256
  }
278
- .np-theme-light,
279
- .np-theme-dark,
280
- .np-theme-navy {
281
- --font-family-regular: averta, avenir w02, avenir, helvetica, arial, sans-serif !important;
282
- font-family: averta, avenir w02, avenir, helvetica, arial, sans-serif;
283
- font-family: var(--font-family-regular);
284
- line-height: 1.5;
285
- line-height: var(--line-height-body);
286
- }
287
257
  .np-theme-personal {
288
- --font-family-regular: "Inter", Helvetica, Arial, sans-serif !important;
289
- font-family: "Inter", Helvetica, Arial, sans-serif;
258
+ font-family: 'Inter', Helvetica, Arial, sans-serif;
290
259
  font-family: var(--font-family-regular);
291
260
  font-feature-settings: "calt";
292
261
  --input-group-addon-padding: 12px 16px;
@@ -2032,26 +2032,6 @@
2032
2032
  src: url("styles/fonts/inter-vietnamese-variable-wghtOnly-normal.woff2") format("woff2");
2033
2033
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
2034
2034
  }
2035
- @font-face {
2036
- font-weight: 400;
2037
- font-weight: var(--font-weight-regular);
2038
- font-family: Averta;
2039
- src: url("styles/fonts/TW-Averta-Regular.woff2") format("woff2"), url("styles/fonts/TW-Averta-Regular.woff") format("woff");
2040
- font-display: swap;
2041
- }
2042
- @font-face {
2043
- font-weight: 600;
2044
- font-weight: var(--font-weight-semi-bold);
2045
- font-family: Averta;
2046
- src: url("styles/fonts/TW-Averta-Semibold.woff2") format("woff2"), url("styles/fonts/TW-Averta-Semibold.woff") format("woff");
2047
- font-display: swap;
2048
- }
2049
- @font-face {
2050
- font-weight: 700;
2051
- font-weight: var(--font-weight-bold);
2052
- font-family: Averta;
2053
- src: url("styles/fonts/TW-Averta-Bold.woff2") format("woff2"), url("styles/fonts/TW-Averta-Bold.woff") format("woff");
2054
- }
2055
2035
  @font-face {
2056
2036
  font-family: "Wise Sans";
2057
2037
  font-style: normal;
@@ -2236,7 +2216,6 @@ summary {
2236
2216
  }
2237
2217
  :root {
2238
2218
  --base-font-size: 16px;
2239
- --font-family-regular: "Inter", Helvetica, Arial, sans-serif;
2240
2219
  --input-group-addon-padding: 12px 16px calc(12px - 2px);
2241
2220
  --btn-padding: 12px 24px calc(12px - 2px);
2242
2221
  --btn-xs-padding: 2px 8px calc(2px - 2px);
@@ -2252,18 +2231,8 @@ summary {
2252
2231
  --btn-sm-radius-base: 2px;
2253
2232
  --btn-lg-radius-base: 3px;
2254
2233
  }
2255
- .np-theme-light,
2256
- .np-theme-dark,
2257
- .np-theme-navy {
2258
- --font-family-regular: averta, avenir w02, avenir, helvetica, arial, sans-serif !important;
2259
- font-family: averta, avenir w02, avenir, helvetica, arial, sans-serif;
2260
- font-family: var(--font-family-regular);
2261
- line-height: 1.5;
2262
- line-height: var(--line-height-body);
2263
- }
2264
2234
  .np-theme-personal {
2265
- --font-family-regular: "Inter", Helvetica, Arial, sans-serif !important;
2266
- font-family: "Inter", Helvetica, Arial, sans-serif;
2235
+ font-family: 'Inter', Helvetica, Arial, sans-serif;
2267
2236
  font-family: var(--font-family-regular);
2268
2237
  font-feature-settings: "calt";
2269
2238
  --input-group-addon-padding: 12px 16px;