@transferwise/components 0.0.0-experimental-5cd0315 → 0.0.0-experimental-e49ee76
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/inputs/SelectInput.js +3 -22
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +3 -22
- package/build/inputs/SelectInput.mjs.map +1 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/actionButton/ActionButton.story.tsx +2 -9
- package/src/avatar/Avatar.story.tsx +2 -8
- package/src/button/_stories/Button.test.story.tsx +5 -10
- package/src/checkbox/Checkbox.story.tsx +3 -16
- package/src/circularButton/CircularButton.story.tsx +2 -7
- package/src/common/bottomSheet/BottomSheet.story.tsx +6 -32
- package/src/common/circle/Circle.story.tsx +3 -14
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +3 -16
- package/src/dateInput/DateInput.test.story.tsx +3 -13
- package/src/dateLookup/DateLookup.story.tsx +9 -7
- package/src/header/Header.test.story.tsx +5 -10
- package/src/info/Info.story.tsx +4 -20
- package/src/inputs/SelectInput.tsx +5 -24
- package/src/listItem/_stories/variants/ListItem.brightGreen.test.story.tsx +2 -7
- package/src/listItem/_stories/variants/ListItem.dark.test.story.tsx +2 -7
- package/src/listItem/_stories/variants/ListItem.forestGreen.test.story.tsx +2 -7
- package/src/listItem/_stories/variants/ListItem.rtl.test.story.tsx +2 -7
- package/src/modal/Modal.story.tsx +6 -31
- package/src/prompt/ActionPrompt/ActionPrompt.story.tsx +18 -23
- package/src/snackbar/Snackbar.test.story.tsx +6 -32
- package/src/statusIcon/StatusIcon.story.tsx +5 -9
- package/src/tooltip/Tooltip.story.tsx +2 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
|
|
3
3
|
import CriticalCommsBanner from '.';
|
|
4
|
-
import {
|
|
4
|
+
import { withVariantConfig } from '../../.storybook/helpers';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
component: CriticalCommsBanner,
|
|
@@ -24,13 +24,7 @@ export const Variants: Story = {
|
|
|
24
24
|
subtitle: 'Add money within the next 30 days',
|
|
25
25
|
action: { label: 'Take action', href: 'https://wise.com' },
|
|
26
26
|
},
|
|
27
|
-
|
|
28
|
-
variants: ['default', 'dark', 'rtl'],
|
|
29
|
-
chromatic: {
|
|
30
|
-
dark: allModes.dark,
|
|
31
|
-
rtl: allModes.rtl,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
27
|
+
...withVariantConfig(['default', 'dark', 'rtl']),
|
|
34
28
|
};
|
|
35
29
|
|
|
36
30
|
export const Mobile: Story = {
|
|
@@ -40,12 +34,5 @@ export const Mobile: Story = {
|
|
|
40
34
|
subtitle: 'Add money within the next 30 days',
|
|
41
35
|
action: { label: 'Take action', href: 'https://wise.com' },
|
|
42
36
|
},
|
|
43
|
-
|
|
44
|
-
variants: ['default', 'dark', 'rtl', 'mobile'],
|
|
45
|
-
chromatic: {
|
|
46
|
-
dark: allModes.dark,
|
|
47
|
-
rtl: allModes.rtl,
|
|
48
|
-
mobile: allModes.largeMobile,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
37
|
+
...withVariantConfig(['default', 'dark', 'rtl', 'mobile']),
|
|
51
38
|
};
|
|
@@ -6,7 +6,7 @@ import { lorem10 } from '../test-utils';
|
|
|
6
6
|
|
|
7
7
|
import Provider from '../provider/Provider';
|
|
8
8
|
import translations from '../i18n';
|
|
9
|
-
import {
|
|
9
|
+
import { withVariantConfig } from '../../.storybook/helpers';
|
|
10
10
|
|
|
11
11
|
const meta: Meta<typeof DateInput> = {
|
|
12
12
|
component: DateInput,
|
|
@@ -223,20 +223,10 @@ export const NoNonDigitsAllowed: Story = {
|
|
|
223
223
|
|
|
224
224
|
export const BasicMobile: Story = {
|
|
225
225
|
...Basic,
|
|
226
|
-
|
|
227
|
-
variants: ['mobile'],
|
|
228
|
-
chromatic: {
|
|
229
|
-
mobile: allModes.largeMobile,
|
|
230
|
-
},
|
|
231
|
-
},
|
|
226
|
+
...withVariantConfig(['mobile'], Basic),
|
|
232
227
|
};
|
|
233
228
|
|
|
234
229
|
export const InputErrorMobile: Story = {
|
|
235
230
|
...InputError,
|
|
236
|
-
|
|
237
|
-
variants: ['mobile'],
|
|
238
|
-
chromatic: {
|
|
239
|
-
mobile: allModes.largeMobile,
|
|
240
|
-
},
|
|
241
|
-
},
|
|
231
|
+
...withVariantConfig(['mobile'], InputError),
|
|
242
232
|
};
|
|
@@ -4,7 +4,7 @@ import { StoryObj } from '@storybook/react-webpack5';
|
|
|
4
4
|
import { Field } from '..';
|
|
5
5
|
import { Size } from '../common';
|
|
6
6
|
import DateLookup, { type DateLookupProps } from './DateLookup';
|
|
7
|
-
import {
|
|
7
|
+
import { withVariantConfig } from '../../.storybook/helpers';
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
component: DateLookup,
|
|
@@ -61,13 +61,15 @@ export const Basic: Story = {
|
|
|
61
61
|
};
|
|
62
62
|
export const Basic400Zoom: Story = {
|
|
63
63
|
...Basic,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
|
|
65
|
+
...withVariantConfig(['400%'], {
|
|
66
|
+
...Basic,
|
|
67
|
+
parameters: {
|
|
68
|
+
chromatic: {
|
|
69
|
+
delay: 2000,
|
|
70
|
+
},
|
|
68
71
|
},
|
|
69
|
-
|
|
70
|
-
},
|
|
72
|
+
}),
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
export const WithField: Story = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import Header, { type HeaderProps } from './Header';
|
|
3
|
-
import {
|
|
3
|
+
import { withVariantConfig } from '../../.storybook/helpers';
|
|
4
4
|
|
|
5
5
|
const meta: Meta<typeof Header> = {
|
|
6
6
|
component: Header,
|
|
@@ -85,16 +85,11 @@ export const SectionTrailingSpaceWithAction: Story = {
|
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
export const AllVariants: Story = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
chromatic: {
|
|
92
|
-
dark: allModes.dark,
|
|
93
|
-
brightGreen: allModes.brightGreen,
|
|
94
|
-
forestGreen: allModes.forestGreen,
|
|
95
|
-
rtl: allModes.rtl,
|
|
88
|
+
...withVariantConfig(['default', 'dark', 'bright-green', 'forest-green', 'rtl'], {
|
|
89
|
+
parameters: {
|
|
90
|
+
padding: '0',
|
|
96
91
|
},
|
|
97
|
-
},
|
|
92
|
+
}),
|
|
98
93
|
render: () => (
|
|
99
94
|
<div
|
|
100
95
|
className="header-variants"
|
package/src/info/Info.story.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { userEvent, within } from 'storybook/test';
|
|
|
4
4
|
import { lorem10 } from '../test-utils';
|
|
5
5
|
|
|
6
6
|
import Info, { InfoPresentation } from '.';
|
|
7
|
-
import {
|
|
7
|
+
import { withVariantConfig } from '../../.storybook/helpers';
|
|
8
8
|
|
|
9
9
|
const meta = {
|
|
10
10
|
component: Info,
|
|
@@ -27,13 +27,7 @@ export default meta;
|
|
|
27
27
|
type Story = StoryObj<typeof meta>;
|
|
28
28
|
|
|
29
29
|
export const Basic: Story = {
|
|
30
|
-
|
|
31
|
-
variants: ['default', 'dark', 'rtl'],
|
|
32
|
-
chromatic: {
|
|
33
|
-
dark: allModes.dark,
|
|
34
|
-
rtl: allModes.rtl,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
30
|
+
...withVariantConfig(['default', 'dark', 'rtl']),
|
|
37
31
|
};
|
|
38
32
|
|
|
39
33
|
export const OpenedPopover = {
|
|
@@ -50,12 +44,7 @@ export const OpenedPopover = {
|
|
|
50
44
|
|
|
51
45
|
export const OpenedPopoverMobile: Story = {
|
|
52
46
|
...OpenedPopover,
|
|
53
|
-
|
|
54
|
-
variants: ['mobile'],
|
|
55
|
-
chromatic: {
|
|
56
|
-
mobile: allModes.largeMobile,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
47
|
+
...withVariantConfig(['mobile'], OpenedPopover),
|
|
59
48
|
};
|
|
60
49
|
|
|
61
50
|
export const OpenedModal = {
|
|
@@ -67,10 +56,5 @@ export const OpenedModal = {
|
|
|
67
56
|
|
|
68
57
|
export const OpenedModalMobile: Story = {
|
|
69
58
|
...OpenedModal,
|
|
70
|
-
|
|
71
|
-
variants: ['mobile'],
|
|
72
|
-
chromatic: {
|
|
73
|
-
mobile: allModes.largeMobile,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
59
|
+
...withVariantConfig(['mobile'], OpenedModal),
|
|
76
60
|
};
|
|
@@ -741,35 +741,15 @@ function SelectInputOptions<T = string>({
|
|
|
741
741
|
return items;
|
|
742
742
|
}
|
|
743
743
|
|
|
744
|
-
const
|
|
744
|
+
const filtered = filterSelectInputItems(dedupeSelectInputItems(items, compareValues), (item) =>
|
|
745
|
+
selectInputOptionItemIncludesNeedle(item, needle),
|
|
746
|
+
);
|
|
745
747
|
|
|
746
748
|
if (sortFilteredOptions) {
|
|
747
|
-
// When sorting, filter out non-matching items completely to avoid ghost items
|
|
748
|
-
const filtered = dedupedItems.map((item) => {
|
|
749
|
-
if (item.type === 'option') {
|
|
750
|
-
return selectInputOptionItemIncludesNeedle(item, needle)
|
|
751
|
-
? item
|
|
752
|
-
: { ...item, value: undefined };
|
|
753
|
-
}
|
|
754
|
-
if (item.type === 'group') {
|
|
755
|
-
return {
|
|
756
|
-
...item,
|
|
757
|
-
options: item.options.map((option) =>
|
|
758
|
-
selectInputOptionItemIncludesNeedle(option, needle)
|
|
759
|
-
? option
|
|
760
|
-
: { ...option, value: undefined },
|
|
761
|
-
),
|
|
762
|
-
};
|
|
763
|
-
}
|
|
764
|
-
return item;
|
|
765
|
-
});
|
|
766
|
-
|
|
767
749
|
return sortSelectInputItems(filtered, sortFilteredOptions, filterQuery);
|
|
768
750
|
}
|
|
769
751
|
|
|
770
|
-
return
|
|
771
|
-
selectInputOptionItemIncludesNeedle(item, needle),
|
|
772
|
-
);
|
|
752
|
+
return filtered;
|
|
773
753
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
774
754
|
}, [needle, items, compareValues]);
|
|
775
755
|
const resultsEmpty = needle != null && filteredItems.length === 0;
|
|
@@ -947,6 +927,7 @@ function SelectInputOptions<T = string>({
|
|
|
947
927
|
) : (
|
|
948
928
|
<Virtualizer
|
|
949
929
|
ref={virtualiserHandlerRef}
|
|
930
|
+
key={needle}
|
|
950
931
|
data={filteredItems}
|
|
951
932
|
keepMounted={mountedIndexes}
|
|
952
933
|
scrollRef={listboxRef} // `VList` doesn't expose this
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react-webpack5';
|
|
2
2
|
import { ListItem, type ListItemProps } from '../../ListItem';
|
|
3
3
|
import { VariantStory } from './helpers';
|
|
4
|
-
import {
|
|
4
|
+
import { withVariantConfig } from '../../../../.storybook/helpers';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
component: ListItem,
|
|
@@ -16,12 +16,7 @@ export default {
|
|
|
16
16
|
|
|
17
17
|
const Default = {
|
|
18
18
|
...VariantStory,
|
|
19
|
-
|
|
20
|
-
variants: ['bright-green'],
|
|
21
|
-
chromatic: {
|
|
22
|
-
'bright-green': allModes.brightGreen,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
19
|
+
...withVariantConfig(['bright-green'], VariantStory),
|
|
25
20
|
args: { variant: 'bright-green' },
|
|
26
21
|
};
|
|
27
22
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react-webpack5';
|
|
2
2
|
import { ListItem, type ListItemProps } from '../../ListItem';
|
|
3
3
|
import { VariantStory } from './helpers';
|
|
4
|
-
import {
|
|
4
|
+
import { withVariantConfig } from '../../../../.storybook/helpers';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
component: ListItem,
|
|
@@ -16,12 +16,7 @@ export default {
|
|
|
16
16
|
|
|
17
17
|
const Default = {
|
|
18
18
|
...VariantStory,
|
|
19
|
-
|
|
20
|
-
variants: ['dark'],
|
|
21
|
-
chromatic: {
|
|
22
|
-
dark: allModes.dark,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
19
|
+
...withVariantConfig(['dark'], VariantStory),
|
|
25
20
|
args: { variant: 'dark' },
|
|
26
21
|
};
|
|
27
22
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react-webpack5';
|
|
2
2
|
import { ListItem, type ListItemProps } from '../../ListItem';
|
|
3
3
|
import { VariantStory } from './helpers';
|
|
4
|
-
import {
|
|
4
|
+
import { withVariantConfig } from '../../../../.storybook/helpers';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
component: ListItem,
|
|
@@ -16,12 +16,7 @@ export default {
|
|
|
16
16
|
|
|
17
17
|
const Default = {
|
|
18
18
|
...VariantStory,
|
|
19
|
-
|
|
20
|
-
variants: ['forest-green'],
|
|
21
|
-
chromatic: {
|
|
22
|
-
forestGreen: allModes.forestGreen,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
19
|
+
...withVariantConfig(['forest-green'], VariantStory),
|
|
25
20
|
args: { variant: 'forest-green' },
|
|
26
21
|
};
|
|
27
22
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta } from '@storybook/react-webpack5';
|
|
2
2
|
import { ListItem, type ListItemProps } from '../../ListItem';
|
|
3
3
|
import { VariantStory } from './helpers';
|
|
4
|
-
import {
|
|
4
|
+
import { withVariantConfig } from '../../../../.storybook/helpers';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
component: ListItem,
|
|
@@ -16,12 +16,7 @@ export default {
|
|
|
16
16
|
|
|
17
17
|
const Default = {
|
|
18
18
|
...VariantStory,
|
|
19
|
-
|
|
20
|
-
variants: ['rtl'],
|
|
21
|
-
chromatic: {
|
|
22
|
-
rtl: allModes.rtl,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
19
|
+
...withVariantConfig(['rtl'], VariantStory),
|
|
25
20
|
args: { variant: 'rtl' },
|
|
26
21
|
};
|
|
27
22
|
|
|
@@ -6,7 +6,7 @@ import { useState } from 'react';
|
|
|
6
6
|
import { Button, Modal, ModalProps } from '..';
|
|
7
7
|
import { CommonProps, Scroll } from '../common';
|
|
8
8
|
import { lorem10, lorem100, lorem1000 } from '../test-utils';
|
|
9
|
-
import {
|
|
9
|
+
import { withVariantConfig } from '../../.storybook/helpers';
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
component: Modal,
|
|
@@ -78,12 +78,7 @@ export const Basic: Story = {
|
|
|
78
78
|
|
|
79
79
|
export const BasicMobile: Story = {
|
|
80
80
|
...Basic,
|
|
81
|
-
|
|
82
|
-
variants: ['mobile'],
|
|
83
|
-
chromatic: {
|
|
84
|
-
mobile: allModes.largeMobile,
|
|
85
|
-
},
|
|
86
|
-
},
|
|
81
|
+
...withVariantConfig(['mobile'], Basic),
|
|
87
82
|
};
|
|
88
83
|
|
|
89
84
|
export const ContentScroll: Story = {
|
|
@@ -97,12 +92,7 @@ export const ContentScroll: Story = {
|
|
|
97
92
|
|
|
98
93
|
export const ContentScrollMobile: Story = {
|
|
99
94
|
...ContentScroll,
|
|
100
|
-
|
|
101
|
-
variants: ['mobile'],
|
|
102
|
-
chromatic: {
|
|
103
|
-
mobile: allModes.largeMobile,
|
|
104
|
-
},
|
|
105
|
-
},
|
|
95
|
+
...withVariantConfig(['mobile'], ContentScroll),
|
|
106
96
|
};
|
|
107
97
|
|
|
108
98
|
export const ViewportScroll: Story = {
|
|
@@ -116,12 +106,7 @@ export const ViewportScroll: Story = {
|
|
|
116
106
|
|
|
117
107
|
export const ViewportScrollMobile: Story = {
|
|
118
108
|
...ViewportScroll,
|
|
119
|
-
|
|
120
|
-
variants: ['mobile'],
|
|
121
|
-
chromatic: {
|
|
122
|
-
mobile: allModes.largeMobile,
|
|
123
|
-
},
|
|
124
|
-
},
|
|
109
|
+
...withVariantConfig(['mobile'], ViewportScroll),
|
|
125
110
|
};
|
|
126
111
|
|
|
127
112
|
export const WithoutTitle: Story = {
|
|
@@ -134,12 +119,7 @@ export const WithoutTitle: Story = {
|
|
|
134
119
|
|
|
135
120
|
export const WithoutTitleMobile: Story = {
|
|
136
121
|
...WithoutTitle,
|
|
137
|
-
|
|
138
|
-
variants: ['mobile'],
|
|
139
|
-
chromatic: {
|
|
140
|
-
mobile: allModes.largeMobile,
|
|
141
|
-
},
|
|
142
|
-
},
|
|
122
|
+
...withVariantConfig(['mobile'], WithoutTitle),
|
|
143
123
|
};
|
|
144
124
|
|
|
145
125
|
export const WithThemeProviderInContent: Story = {
|
|
@@ -161,10 +141,5 @@ export const WithThemeProviderInContent: Story = {
|
|
|
161
141
|
|
|
162
142
|
export const WithThemeProviderInContentMobile: Story = {
|
|
163
143
|
...WithThemeProviderInContent,
|
|
164
|
-
|
|
165
|
-
variants: ['mobile'],
|
|
166
|
-
chromatic: {
|
|
167
|
-
mobile: allModes.largeMobile,
|
|
168
|
-
},
|
|
169
|
-
},
|
|
144
|
+
...withVariantConfig(['mobile'], WithThemeProviderInContent),
|
|
170
145
|
};
|
|
@@ -4,7 +4,7 @@ import { fn } from 'storybook/test';
|
|
|
4
4
|
import { Bank } from '@transferwise/icons';
|
|
5
5
|
import { ActionPrompt } from './ActionPrompt';
|
|
6
6
|
import { lorem10 } from '../../test-utils';
|
|
7
|
-
import {
|
|
7
|
+
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
8
8
|
|
|
9
9
|
const meta: Meta<typeof ActionPrompt> = {
|
|
10
10
|
title: 'Prompts/ActionPrompt',
|
|
@@ -17,22 +17,22 @@ type Story = StoryObj<typeof ActionPrompt>;
|
|
|
17
17
|
|
|
18
18
|
const withComponentGrid =
|
|
19
19
|
({ maxWidth = 'auto', gap = '1rem' } = {}) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
(Story: () => ReactElement) => (
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
width: '100%',
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
justifyContent: 'flex-start',
|
|
27
|
+
alignItems: 'flex-start',
|
|
28
|
+
alignContent: 'flex-start',
|
|
29
|
+
gap,
|
|
30
|
+
maxWidth,
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<Story />
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
36
|
|
|
37
37
|
export const AllSentiments: Story = {
|
|
38
38
|
render: () => {
|
|
@@ -60,12 +60,7 @@ export const AllSentiments: Story = {
|
|
|
60
60
|
|
|
61
61
|
export const Mobile: Story = {
|
|
62
62
|
...AllSentiments,
|
|
63
|
-
|
|
64
|
-
variants: ['mobile'],
|
|
65
|
-
chromatic: {
|
|
66
|
-
mobile: allModes.largeMobile,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
63
|
+
...withVariantConfig(['mobile'], AllSentiments),
|
|
69
64
|
};
|
|
70
65
|
|
|
71
66
|
export const PrimaryActionOnly: Story = {
|
|
@@ -7,7 +7,7 @@ import SnackbarProvider from './SnackbarProvider';
|
|
|
7
7
|
import Button from '../button';
|
|
8
8
|
import CheckboxOption from '../checkboxOption';
|
|
9
9
|
import { wait } from '../test-utils/wait';
|
|
10
|
-
import {
|
|
10
|
+
import { withVariantConfig } from '../../.storybook/helpers';
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
13
|
title: 'Dialogs/Snackbar/Tests',
|
|
@@ -115,12 +115,7 @@ export const Mobile = {
|
|
|
115
115
|
</div>
|
|
116
116
|
) as React.ReactNode,
|
|
117
117
|
},
|
|
118
|
-
|
|
119
|
-
variants: ['mobile'],
|
|
120
|
-
chromatic: {
|
|
121
|
-
mobile: allModes.largeMobile,
|
|
122
|
-
},
|
|
123
|
-
},
|
|
118
|
+
...withVariantConfig(['mobile'], Default),
|
|
124
119
|
};
|
|
125
120
|
|
|
126
121
|
const switchToDarkMode = async (context: { canvasElement: HTMLElement }) => {
|
|
@@ -152,12 +147,7 @@ export const DarkMode = {
|
|
|
152
147
|
) as React.ReactNode,
|
|
153
148
|
},
|
|
154
149
|
play: switchToDarkMode,
|
|
155
|
-
|
|
156
|
-
variants: ['dark'],
|
|
157
|
-
chromatic: {
|
|
158
|
-
dark: allModes.dark,
|
|
159
|
-
},
|
|
160
|
-
},
|
|
150
|
+
...withVariantConfig(['dark'], Default),
|
|
161
151
|
};
|
|
162
152
|
|
|
163
153
|
const switchToRTL = async (context: { canvasElement: HTMLElement }) => {
|
|
@@ -209,12 +199,7 @@ export const RTL = {
|
|
|
209
199
|
) as React.ReactNode,
|
|
210
200
|
},
|
|
211
201
|
play: switchToRTL,
|
|
212
|
-
|
|
213
|
-
variants: ['rtl'],
|
|
214
|
-
chromatic: {
|
|
215
|
-
rtl: allModes.rtl,
|
|
216
|
-
},
|
|
217
|
-
},
|
|
202
|
+
...withVariantConfig(['rtl'], Default),
|
|
218
203
|
};
|
|
219
204
|
|
|
220
205
|
export const RTLMobile = {
|
|
@@ -223,13 +208,7 @@ export const RTLMobile = {
|
|
|
223
208
|
...RTL.args,
|
|
224
209
|
},
|
|
225
210
|
play: switchToRTL,
|
|
226
|
-
|
|
227
|
-
variants: ['rtl', 'mobile'],
|
|
228
|
-
chromatic: {
|
|
229
|
-
rtl: allModes.rtl,
|
|
230
|
-
mobile: allModes.largeMobile,
|
|
231
|
-
},
|
|
232
|
-
},
|
|
211
|
+
...withVariantConfig(['rtl', 'mobile'], Default),
|
|
233
212
|
};
|
|
234
213
|
|
|
235
214
|
export const Zoom400 = {
|
|
@@ -254,12 +233,7 @@ export const Zoom400 = {
|
|
|
254
233
|
</div>
|
|
255
234
|
),
|
|
256
235
|
},
|
|
257
|
-
|
|
258
|
-
variants: ['400%'],
|
|
259
|
-
chromatic: {
|
|
260
|
-
zoom400: allModes.zoom400,
|
|
261
|
-
},
|
|
262
|
-
},
|
|
236
|
+
...withVariantConfig(['400%'], Default),
|
|
263
237
|
};
|
|
264
238
|
|
|
265
239
|
export const MultipleClicks = {
|
|
@@ -3,7 +3,7 @@ import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
|
3
3
|
import { Sentiment, Size, Status } from '../common';
|
|
4
4
|
|
|
5
5
|
import StatusIcon, { StatusIconSentiment } from './StatusIcon';
|
|
6
|
-
import {
|
|
6
|
+
import { withVariantConfig } from '../../.storybook/helpers';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
component: StatusIcon,
|
|
@@ -30,15 +30,11 @@ export const Presentational: Story = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export const Variants: Story = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
chromatic: {
|
|
37
|
-
dark: allModes.dark,
|
|
38
|
-
brightGreen: allModes.brightGreen,
|
|
39
|
-
forestGreen: allModes.forestGreen,
|
|
33
|
+
...withVariantConfig(['default', 'dark', 'bright-green', 'forest-green'], {
|
|
34
|
+
parameters: {
|
|
35
|
+
padding: '0',
|
|
40
36
|
},
|
|
41
|
-
},
|
|
37
|
+
}),
|
|
42
38
|
render: () => (
|
|
43
39
|
<span style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '400px' }}>
|
|
44
40
|
{[
|
|
@@ -4,7 +4,7 @@ import { userEvent, within } from 'storybook/test';
|
|
|
4
4
|
import Button from '../button';
|
|
5
5
|
|
|
6
6
|
import Tooltip from './Tooltip';
|
|
7
|
-
import {
|
|
7
|
+
import { withVariantConfig } from '../../.storybook/helpers';
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
component: Tooltip,
|
|
@@ -40,10 +40,5 @@ export const OpenedTooltip: Story = {
|
|
|
40
40
|
|
|
41
41
|
export const OpenedTooltipDark: Story = {
|
|
42
42
|
...OpenedTooltip,
|
|
43
|
-
|
|
44
|
-
variants: ['dark'],
|
|
45
|
-
chromatic: {
|
|
46
|
-
dark: allModes.dark,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
43
|
+
...withVariantConfig(['dark'], OpenedTooltip),
|
|
49
44
|
};
|