@transferwise/components 0.0.0-experimental-14ff413 → 0.0.0-experimental-b79d3f4

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 (32) hide show
  1. package/build/main.css +4 -42
  2. package/build/moneyInput/MoneyInput.js +28 -12
  3. package/build/moneyInput/MoneyInput.js.map +1 -1
  4. package/build/moneyInput/MoneyInput.mjs +30 -14
  5. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  6. package/build/moneyInput/currencyFormatting.js +8 -2
  7. package/build/moneyInput/currencyFormatting.js.map +1 -1
  8. package/build/moneyInput/currencyFormatting.mjs +5 -4
  9. package/build/moneyInput/currencyFormatting.mjs.map +1 -1
  10. package/build/statusIcon/StatusIcon.js +12 -1
  11. package/build/statusIcon/StatusIcon.js.map +1 -1
  12. package/build/statusIcon/StatusIcon.mjs +12 -1
  13. package/build/statusIcon/StatusIcon.mjs.map +1 -1
  14. package/build/styles/main.css +4 -42
  15. package/build/styles/statusIcon/StatusIcon.css +4 -35
  16. package/build/types/moneyInput/MoneyInput.d.ts +6 -0
  17. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  18. package/build/types/moneyInput/currencyFormatting.d.ts +4 -3
  19. package/build/types/moneyInput/currencyFormatting.d.ts.map +1 -1
  20. package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
  21. package/package.json +1 -1
  22. package/src/main.css +4 -42
  23. package/src/moneyInput/MoneyInput.story.tsx +18 -1
  24. package/src/moneyInput/MoneyInput.test.tsx +45 -0
  25. package/src/moneyInput/MoneyInput.tsx +27 -3
  26. package/src/moneyInput/currencyFormatting.ts +11 -5
  27. package/src/statusIcon/StatusIcon.css +4 -35
  28. package/src/statusIcon/StatusIcon.less +4 -35
  29. package/src/statusIcon/StatusIcon.story.tsx +79 -119
  30. package/src/statusIcon/StatusIcon.test.tsx +23 -16
  31. package/src/statusIcon/StatusIcon.tsx +16 -2
  32. package/src/statusIcon/StatusIcon.test.story.tsx +0 -125
@@ -1,125 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react-webpack5';
2
-
3
- import { Sentiment, Size } from '../common';
4
- import SentimentSurface from '../sentimentSurface';
5
- import { withVariantConfig } from '../../.storybook/helpers';
6
- import { allModes } from '../../.storybook/modes';
7
-
8
- import StatusIcon, { StatusIconSentiment } from './StatusIcon';
9
-
10
- export default {
11
- title: 'Other/StatusIcon/Tests',
12
- component: StatusIcon,
13
- tags: ['!autodocs', '!manifest'],
14
- } satisfies Meta<typeof StatusIcon>;
15
-
16
- type Story = StoryObj<typeof StatusIcon>;
17
-
18
- const sizes = [16, 24, 32, 40, 48, 56, 72] as const;
19
-
20
- const surfaceSentiments = ['success', 'warning', 'negative', 'neutral'] as const;
21
-
22
- // Cycle through different sentiments per size so each row shows varied icons
23
- const iconSentiments: StatusIconSentiment[] = [
24
- Sentiment.POSITIVE,
25
- Sentiment.NEGATIVE,
26
- Sentiment.WARNING,
27
- Sentiment.NEUTRAL,
28
- Sentiment.PENDING,
29
- Sentiment.POSITIVE,
30
- Sentiment.NEGATIVE,
31
- ];
32
-
33
- const rowStyle = {
34
- display: 'flex',
35
- alignItems: 'center',
36
- padding: '8px',
37
- gap: '8px',
38
- } as const;
39
-
40
- const labelStyle = {
41
- width: '120px',
42
- fontSize: '11px',
43
- fontWeight: 'bold',
44
- paddingLeft: '8px',
45
- flexShrink: 0,
46
- } as const;
47
-
48
- /**
49
- * All sentiments, emphasis levels, and sizes across all themes for visual regression testing.
50
- */
51
- export const Variants: Story = {
52
- render: () => (
53
- <div style={{ display: 'flex', flexDirection: 'column' }}>
54
- {surfaceSentiments.flatMap((sentiment) => [
55
- <SentimentSurface
56
- key={`${sentiment}-base`}
57
- sentiment={sentiment}
58
- emphasis="base"
59
- style={rowStyle}
60
- >
61
- <div style={labelStyle}>{sentiment} (base)</div>
62
- {sizes.map((size, i) => (
63
- <StatusIcon key={size} sentiment={iconSentiments[i]} size={size} />
64
- ))}
65
- </SentimentSurface>,
66
- <SentimentSurface
67
- key={`${sentiment}-elevated`}
68
- sentiment={sentiment}
69
- emphasis="elevated"
70
- style={rowStyle}
71
- >
72
- <div style={labelStyle}>{sentiment} (elevated)</div>
73
- {sizes.map((size, i) => (
74
- <StatusIcon key={size} sentiment={iconSentiments[i]} size={size} />
75
- ))}
76
- </SentimentSurface>,
77
- ])}
78
-
79
- {/* Row without a SentimentSurface wrapper — standalone fallback colours */}
80
- <div style={rowStyle}>
81
- <div style={labelStyle}>none</div>
82
- {sizes.map((size, i) => (
83
- <StatusIcon key={size} sentiment={iconSentiments[i]} size={size} />
84
- ))}
85
- </div>
86
- </div>
87
- ),
88
- parameters: {
89
- padding: '16px',
90
- variants: ['default', 'dark', 'bright-green', 'forest-green'],
91
- },
92
- };
93
-
94
- export const RTL: Story = {
95
- render: Variants.render,
96
- ...withVariantConfig(['rtl']),
97
- };
98
-
99
- /**
100
- * @deprecated Legacy `Size.SMALL | Size.MEDIUM | Size.LARGE` values still work but
101
- * consumers should migrate to numeric sizes.
102
- */
103
- export const LegacySizes: Story = {
104
- render: () => {
105
- const legacySizes = [
106
- { value: Size.SMALL, label: 'Size.SMALL' },
107
- { value: Size.MEDIUM, label: 'Size.MEDIUM' },
108
- { value: Size.LARGE, label: 'Size.LARGE' },
109
- ] as const;
110
-
111
- return (
112
- <div style={{ display: 'flex', gap: '16px', alignItems: 'center' }}>
113
- {legacySizes.map(({ value, label }) => (
114
- <div
115
- key={label}
116
- style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '4px' }}
117
- >
118
- <StatusIcon size={value} />
119
- <span style={{ fontSize: '11px' }}>{label}</span>
120
- </div>
121
- ))}
122
- </div>
123
- );
124
- },
125
- };