@transferwise/components 0.0.0-experimental-cb7b730 → 0.0.0-experimental-9463364
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/dateLookup/DateLookup.js +3 -2
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +3 -2
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/i18n/en.json +1 -0
- package/build/i18n/en.json.js +1 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +1 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/main.css +4 -95
- package/build/styles/accordion/Accordion.css +27 -16
- package/build/styles/avatar/Avatar.css +95 -50
- package/build/styles/dimmer/Dimmer.css +0 -1
- package/build/styles/inputs/Input.css +37 -21
- package/build/styles/inputs/TextArea.css +35 -20
- package/build/styles/loader/Loader.css +4 -90
- package/build/styles/main.css +4 -95
- package/build/styles/popover/Popover.css +19 -12
- package/build/styles/select/Select.css +131 -68
- package/build/styles/switch/Switch.css +27 -16
- package/build/styles/tile/Tile.css +31 -18
- package/build/types/dateLookup/DateLookup.d.ts +2 -2
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +2 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +2 -3
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/upload/Upload.messages.d.ts +4 -0
- package/build/types/upload/Upload.messages.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/build/upload/Upload.js +13 -3
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.messages.js +3 -0
- package/build/upload/Upload.messages.js.map +1 -1
- package/build/upload/Upload.messages.mjs +3 -0
- package/build/upload/Upload.messages.mjs.map +1 -1
- package/build/upload/Upload.mjs +13 -3
- package/build/upload/Upload.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +3 -0
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +3 -0
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/package.json +8 -16
- package/src/accordion/Accordion.css +27 -16
- package/src/accordion/Accordion.story.tsx +1 -1
- package/src/actionButton/ActionButton.story.tsx +3 -2
- package/src/actionOption/ActionOption.story.tsx +2 -2
- package/src/alert/Alert.story.tsx +2 -2
- package/src/alert/Alert.tests.story.tsx +2 -2
- package/src/avatar/Avatar.css +95 -50
- package/src/avatar/Avatar.story.tsx +3 -2
- package/src/avatarLayout/AvatarLayout.story.tsx +1 -1
- package/src/avatarView/AvatarView.story.tsx +1 -1
- package/src/avatarWrapper/AvatarWrapper.story.tsx +3 -2
- package/src/badge/Badge.story.tsx +49 -28
- package/src/button/Button.accessibility.docs.mdx +1 -1
- package/src/button/Button.story.tsx +2 -2
- package/src/button/Button.tests.story.tsx +2 -2
- package/src/button/LegacyButton.story.tsx +3 -2
- package/src/card/Card.story.tsx +2 -2
- package/src/carousel/Carousel.story.tsx +1 -1
- package/src/checkbox/Checkbox.story.tsx +2 -2
- package/src/checkboxButton/CheckboxButton.story.tsx +2 -2
- package/src/checkboxOption/CheckboxOption.story.tsx +35 -29
- package/src/chevron/Chevron.story.tsx +1 -1
- package/src/chips/Chips.story.tsx +1 -1
- package/src/circularButton/CircularButton.story.tsx +1 -1
- package/src/circularButton/CircularButton.tests.story.tsx +1 -1
- package/src/common/bottomSheet/BottomSheet.story.tsx +2 -2
- package/src/common/card/Card.story.tsx +1 -1
- package/src/common/circle/Circle.story.tsx +2 -2
- package/src/common/responsivePanel/ResponsivePanel.spec.js +8 -29
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +1 -1
- package/src/dateInput/DateInput.story.tsx +2 -2
- package/src/dateInput/DateInput.tests.story.tsx +2 -2
- package/src/dateLookup/DateLookup.story.tsx +43 -71
- package/src/dateLookup/DateLookup.tests.story.tsx +3 -3
- package/src/dateLookup/DateLookup.tsx +4 -1
- package/src/decision/Decision.story.tsx +24 -49
- package/src/definitionList/DefinitionList.story.tsx +1 -1
- package/src/dimmer/Dimmer.css +0 -1
- package/src/dimmer/Dimmer.less +0 -1
- package/src/dimmer/Dimmer.story.tsx +2 -2
- package/src/divider/Divider.accessibility.docs.mdx +1 -1
- package/src/divider/Divider.story.tsx +1 -1
- package/src/drawer/Drawer.story.tsx +13 -7
- package/src/dropFade/DropFade.story.tsx +1 -1
- package/src/emphasis/Emphasis.story.tsx +1 -1
- package/src/field/Field.story.tsx +3 -3
- package/src/flowNavigation/FlowNavigation.story.tsx +305 -260
- package/src/i18n/en.json +1 -0
- package/src/iconButton/IconButton.story.tsx +2 -2
- package/src/image/Image.story.tsx +27 -54
- package/src/info/Info.story.tsx +2 -2
- package/src/inlineAlert/InlineAlert.story.tsx +1 -1
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +2 -2
- package/src/inputs/Input.css +37 -21
- package/src/inputs/InputGroup.story.tsx +1 -1
- package/src/inputs/SearchInput.story.tsx +1 -1
- package/src/inputs/SelectInput.docs.mdx +1 -1
- package/src/inputs/SelectInput.story.tsx +2 -2
- package/src/inputs/TextArea.css +35 -20
- package/src/instructionsList/InstructionsList.story.tsx +2 -2
- package/src/legacylistItem/LegacyListItem.story.tsx +1 -1
- package/src/loader/Loader.css +4 -90
- package/src/loader/Loader.story.tsx +1 -1
- package/src/logo/Logo.story.tsx +1 -1
- package/src/main.css +4 -95
- package/src/markdown/Markdown.story.tsx +1 -1
- package/src/modal/Modal.story.tsx +2 -2
- package/src/money/Money.story.tsx +1 -1
- package/src/moneyInput/MoneyInput.docs.mdx +1 -1
- package/src/moneyInput/MoneyInput.story.tsx +2 -2
- package/src/navigationOption/NavigationOption.story.tsx +265 -226
- package/src/nudge/Nudge.story.tsx +1 -1
- package/src/overlayHeader/OverlayHeader.story.tsx +32 -24
- package/src/phoneNumberInput/PhoneNumberInput.story.tsx +1 -1
- package/src/popover/Popover.css +19 -12
- package/src/popover/Popover.story.tsx +2 -2
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +2 -2
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.tests.story.tsx +2 -2
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +2 -2
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.tests.story.tsx +2 -2
- package/src/processIndicator/ProcessIndicator.story.tsx +1 -1
- package/src/progress/Progress.story.tsx +1 -1
- package/src/progressBar/ProgressBar.story.tsx +1 -1
- package/src/promoCard/PromoCard.story.tsx +1 -1
- package/src/promoCard/PromoCardGroup.story.tsx +1 -1
- package/src/provider/Provider.story.tsx +1 -1
- package/src/provider/theme/ThemeProvider.story.tsx +1 -1
- package/src/radio/Radio.story.tsx +59 -42
- package/src/radioGroup/RadioGroup.story.tsx +2 -2
- package/src/radioOption/RadioOption.story.tsx +73 -38
- package/src/segmentedControl/SegmentedControl.story.tsx +1 -1
- package/src/select/Select.css +131 -68
- package/src/select/Select.story.tsx +385 -397
- package/src/slidingPanel/SlidingPanel.story.tsx +30 -13
- package/src/snackbar/Snackbar.story.tsx +50 -36
- package/src/snackbar/Snackbar.tests.story.tsx +3 -2
- package/src/statusIcon/StatusIcon.docs.mdx +1 -1
- package/src/statusIcon/StatusIcon.story.tsx +1 -1
- package/src/stepper/Stepper.story.tsx +2 -2
- package/src/stepper/Stepper.tests.story.tsx +2 -2
- package/src/sticky/Sticky.story.tsx +1 -1
- package/src/summary/Summary.story.tsx +18 -17
- package/src/switch/Switch.css +27 -16
- package/src/switch/Switch.story.tsx +2 -2
- package/src/switchOption/SwitchOption.story.tsx +1 -1
- package/src/table/Table.story.tsx +1 -1
- package/src/test-utils/story-config.ts +9 -6
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +2 -2
- package/src/tile/Tile.css +31 -18
- package/src/tile/Tile.story.tsx +43 -43
- package/src/tooltip/Tooltip.story.tsx +2 -2
- package/src/typeahead/Typeahead.story.tsx +2 -2
- package/src/upload/Upload.messages.ts +4 -0
- package/src/upload/Upload.spec.tsx +6 -0
- package/src/upload/Upload.story.tsx +2 -2
- package/src/upload/Upload.tests.story.tsx +2 -2
- package/src/upload/Upload.tsx +17 -5
- package/src/uploadInput/UploadInput.story.tsx +1 -1
- package/src/uploadInput/UploadInput.tests.story.tsx +3 -3
- package/src/uploadInput/uploadButton/UploadButton.spec.tsx +6 -0
- package/src/uploadInput/uploadButton/UploadButton.tsx +4 -0
- package/src/withId/withId.docs.mdx +1 -1
- package/src/withId/withId.story.tsx +1 -1
- package/src/common/responsivePanel/__snapshots__/ResponsivePanel.spec.js.snap +0 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
|
|
3
3
|
import { ProfileType, Sentiment, Status } from '../common';
|
|
4
4
|
|
|
@@ -9,7 +9,8 @@ import AvatarWrapper from './AvatarWrapper';
|
|
|
9
9
|
*/
|
|
10
10
|
export default {
|
|
11
11
|
component: AvatarWrapper,
|
|
12
|
-
title: 'Content/AvatarWrapper
|
|
12
|
+
title: 'Content/AvatarWrapper',
|
|
13
|
+
tags: ['deprecated'],
|
|
13
14
|
} satisfies Meta<typeof AvatarWrapper>;
|
|
14
15
|
|
|
15
16
|
type Story = StoryObj<typeof AvatarWrapper>;
|
|
@@ -1,20 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Meta } from '@storybook/react-webpack5';
|
|
3
2
|
import { default as AvatarComponent, AvatarType } from '../avatar';
|
|
4
3
|
import { Size, Theme } from '../common';
|
|
5
|
-
|
|
6
|
-
import Badge from './Badge';
|
|
4
|
+
import Badge, { type BadgeProps } from './Badge';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* @deprecated use **`<AvatarView badge={..} />`** components instead
|
|
10
8
|
*/
|
|
11
|
-
|
|
9
|
+
const meta: Meta<typeof Badge> = {
|
|
12
10
|
component: Badge,
|
|
13
|
-
title: 'Content/Badge
|
|
14
|
-
|
|
11
|
+
title: 'Content/Badge',
|
|
12
|
+
tags: ['deprecated'],
|
|
15
13
|
};
|
|
16
14
|
|
|
17
|
-
export
|
|
15
|
+
export default meta;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Used for showing multiple components within a Canvas.
|
|
19
|
+
* @decorator
|
|
20
|
+
*/
|
|
21
|
+
const withComponentGrid =
|
|
22
|
+
(maxWidth = 'auto') =>
|
|
23
|
+
(Story: any) => (
|
|
24
|
+
<div
|
|
25
|
+
style={{
|
|
26
|
+
width: '100%',
|
|
27
|
+
placeItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexWrap: 'wrap',
|
|
31
|
+
gap: '2rem',
|
|
32
|
+
maxWidth,
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<Story />
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const ExampleBadgeStyle = {
|
|
18
40
|
background: 'var(--color-content-positive)',
|
|
19
41
|
width: '100%',
|
|
20
42
|
height: '100%',
|
|
@@ -25,47 +47,46 @@ export const ExampleBadgeCss = {
|
|
|
25
47
|
alignItems: 'center',
|
|
26
48
|
};
|
|
27
49
|
|
|
28
|
-
export const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
50
|
+
export const LegacyAvatarWithBadge = {
|
|
51
|
+
decorators: [withComponentGrid()],
|
|
52
|
+
parameters: {
|
|
53
|
+
docs: {
|
|
54
|
+
source: { type: 'dynamic' },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
render: () => {
|
|
58
|
+
return (
|
|
59
|
+
<>
|
|
35
60
|
<Badge
|
|
36
|
-
badge={<div style={
|
|
37
|
-
border={
|
|
61
|
+
badge={<div style={ExampleBadgeStyle}>B</div>}
|
|
62
|
+
border={Theme.LIGHT}
|
|
38
63
|
size={Size.LARGE}
|
|
39
64
|
>
|
|
40
65
|
<AvatarComponent type={AvatarType.INITIALS} size={Size.LARGE}>
|
|
41
66
|
AA
|
|
42
67
|
</AvatarComponent>
|
|
43
68
|
</Badge>
|
|
44
|
-
</div>
|
|
45
69
|
|
|
46
|
-
<div style={{ display: 'inline', margin: 8 }}>
|
|
47
70
|
<Badge
|
|
48
|
-
badge={<div style={
|
|
49
|
-
border={
|
|
71
|
+
badge={<div style={ExampleBadgeStyle}>B</div>}
|
|
72
|
+
border={Theme.LIGHT}
|
|
50
73
|
size={Size.MEDIUM}
|
|
51
74
|
>
|
|
52
75
|
<AvatarComponent type={AvatarType.INITIALS} size={Size.MEDIUM}>
|
|
53
76
|
AA
|
|
54
77
|
</AvatarComponent>
|
|
55
78
|
</Badge>
|
|
56
|
-
</div>
|
|
57
79
|
|
|
58
|
-
<div style={{ display: 'inline', margin: 8 }}>
|
|
59
80
|
<Badge
|
|
60
|
-
badge={<div style={
|
|
61
|
-
border={
|
|
81
|
+
badge={<div style={ExampleBadgeStyle}>B</div>}
|
|
82
|
+
border={Theme.LIGHT}
|
|
62
83
|
size={Size.SMALL}
|
|
63
84
|
>
|
|
64
85
|
<AvatarComponent type={AvatarType.INITIALS} size={Size.MEDIUM}>
|
|
65
86
|
AA
|
|
66
87
|
</AvatarComponent>
|
|
67
88
|
</Badge>
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
89
|
+
</>
|
|
90
|
+
);
|
|
91
|
+
},
|
|
71
92
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { fn } from '
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
3
|
import { Freeze, ArrowRight, ChevronRight } from '@transferwise/icons';
|
|
4
4
|
import { Flag } from '@wise/art';
|
|
5
5
|
import Button from './Button.resolver';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Meta } from '@storybook/react';
|
|
1
|
+
import { Meta } from '@storybook/react-webpack5';
|
|
2
2
|
import Button from './Button.resolver';
|
|
3
|
-
import { expect, userEvent, within } from '
|
|
3
|
+
import { expect, userEvent, within } from 'storybook/test';
|
|
4
4
|
import { storyConfig } from '../test-utils';
|
|
5
5
|
|
|
6
6
|
const meta: Meta<typeof Button> = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { userEvent, within, fn, expect } from '
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { userEvent, within, fn, expect } from 'storybook/test';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import Button from '.';
|
|
@@ -25,6 +25,7 @@ const withContainer = (Story: any) => (
|
|
|
25
25
|
const meta: Meta<typeof LegacyButton> = {
|
|
26
26
|
component: LegacyButton,
|
|
27
27
|
title: 'Actions/Button/Legacy Button',
|
|
28
|
+
tags: ['deprecated'],
|
|
28
29
|
args: {
|
|
29
30
|
size: undefined,
|
|
30
31
|
priority: undefined,
|
package/src/card/Card.story.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { FastFlag as FastFlagIcon } from '@transferwise/icons';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { fn } from '
|
|
4
|
+
import { fn } from 'storybook/test';
|
|
5
5
|
|
|
6
6
|
import Card from '.';
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { fn } from '
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
3
3
|
|
|
4
4
|
import { Field } from '../field/Field';
|
|
5
5
|
import { lorem10, storyConfig } from '../test-utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { action } from '
|
|
2
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { action } from 'storybook/actions';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import CheckboxButton from './CheckboxButton';
|
|
@@ -1,66 +1,72 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { boolean, text } from '@storybook/addon-knobs';
|
|
3
|
-
import { Meta } from '@storybook/react';
|
|
4
|
-
import { FastFlag as FastFlagIcon } from '@transferwise/icons';
|
|
5
1
|
import { useState } from 'react';
|
|
6
|
-
|
|
2
|
+
import { action } from 'storybook/actions';
|
|
3
|
+
import { Meta } from '@storybook/react-webpack5';
|
|
4
|
+
import { FastFlag } from '@transferwise/icons';
|
|
7
5
|
import { Nudge, Title, Typography } from '..';
|
|
8
|
-
|
|
9
|
-
import CheckboxOption from './CheckboxOption';
|
|
6
|
+
import CheckboxOption, { type CheckboxOptionProps } from './CheckboxOption';
|
|
10
7
|
|
|
11
8
|
const meta: Meta<typeof CheckboxOption> = {
|
|
12
9
|
component: CheckboxOption,
|
|
13
10
|
title: 'Option/CheckboxOption',
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
source: { type: 'dynamic' },
|
|
14
|
+
},
|
|
15
|
+
},
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
export default meta;
|
|
17
19
|
|
|
18
|
-
const
|
|
20
|
+
const commonArgs = {
|
|
21
|
+
disabled: false,
|
|
22
|
+
title: 'Checkbox option',
|
|
23
|
+
content: 'Normally, the button and icon are vertically centered.',
|
|
24
|
+
showMediaAtAllSizes: false,
|
|
25
|
+
isContainerAligned: false,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const renderTemplate = (args: Partial<CheckboxOptionProps> = commonArgs) => {
|
|
29
|
+
const mergedArgs = { ...commonArgs, ...args };
|
|
19
30
|
const [checked, setChecked] = useState(true);
|
|
20
|
-
const content = text('content', 'Normally, the button and icon are vertically centered.');
|
|
21
|
-
const title = text('title', 'Checkbox option');
|
|
22
|
-
const disabled = boolean('disabled', false);
|
|
23
|
-
const showMediaAtAllSizes = boolean('showMediaAtAllSizes', false);
|
|
24
|
-
const isContainerAligned = boolean('isContainerAligned', false);
|
|
25
31
|
|
|
26
32
|
return (
|
|
27
33
|
<CheckboxOption
|
|
28
34
|
id="checkbox-option"
|
|
29
35
|
name="checkbox-option"
|
|
30
36
|
checked={checked}
|
|
31
|
-
disabled={disabled}
|
|
32
|
-
title={title}
|
|
33
|
-
content={content}
|
|
34
|
-
media={<
|
|
35
|
-
showMediaAtAllSizes={showMediaAtAllSizes}
|
|
36
|
-
isContainerAligned={isContainerAligned}
|
|
37
|
+
disabled={mergedArgs.disabled}
|
|
38
|
+
title={mergedArgs.title}
|
|
39
|
+
content={mergedArgs.content}
|
|
40
|
+
media={<FastFlag />}
|
|
41
|
+
showMediaAtAllSizes={mergedArgs.showMediaAtAllSizes}
|
|
42
|
+
isContainerAligned={mergedArgs.isContainerAligned}
|
|
37
43
|
onChange={(newValue) => setChecked(newValue)}
|
|
38
44
|
/>
|
|
39
45
|
);
|
|
40
46
|
};
|
|
41
47
|
|
|
42
|
-
export const Basic = () => {
|
|
43
|
-
return
|
|
48
|
+
export const Basic = (args: CheckboxOptionProps) => {
|
|
49
|
+
return renderTemplate(args);
|
|
44
50
|
};
|
|
45
51
|
|
|
46
|
-
export const Multiple = () => {
|
|
52
|
+
export const Multiple = (args: CheckboxOptionProps) => {
|
|
47
53
|
return (
|
|
48
54
|
<>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
{renderTemplate(args)}
|
|
56
|
+
{renderTemplate(args)}
|
|
57
|
+
{renderTemplate(args)}
|
|
52
58
|
</>
|
|
53
59
|
);
|
|
54
60
|
};
|
|
55
61
|
|
|
56
|
-
export const WithContainerContent = () => (
|
|
62
|
+
export const WithContainerContent = (args: CheckboxOptionProps) => (
|
|
57
63
|
<>
|
|
58
64
|
<Title type={Typography.TITLE_SUBSECTION} className="m-b-1">
|
|
59
65
|
Choose how to pay
|
|
60
66
|
</Title>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
{renderTemplate(args)}
|
|
68
|
+
{renderTemplate(args)}
|
|
69
|
+
{renderTemplate(args)}
|
|
64
70
|
<div>
|
|
65
71
|
<Nudge
|
|
66
72
|
className="m-t-2"
|
|
@@ -2,7 +2,7 @@ import * as Icons from '@transferwise/icons';
|
|
|
2
2
|
|
|
3
3
|
import { ControlType, Priority } from '../common';
|
|
4
4
|
|
|
5
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
6
6
|
import CircularButton from './CircularButton';
|
|
7
7
|
import { storyConfig } from '../test-utils';
|
|
8
8
|
import Title from '../title';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { action } from '
|
|
2
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { action } from 'storybook/actions';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { FastFlag } from '@transferwise/icons';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { storyConfig } from '../../test-utils';
|
|
3
3
|
import Circle from './Circle';
|
|
4
4
|
import { Profile } from '@transferwise/icons';
|
|
5
|
-
import { action } from '
|
|
5
|
+
import { action } from 'storybook/actions';
|
|
6
6
|
import { CircleProps } from '.';
|
|
7
7
|
import Body from '../../body';
|
|
8
8
|
|
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
import { Breakpoint, Position } from '..';
|
|
2
|
-
import { mockMatchMedia, render } from '../../test-utils';
|
|
2
|
+
import { mockMatchMedia, render, screen } from '../../test-utils';
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
3
4
|
|
|
4
5
|
import ResponsivePanel from './ResponsivePanel';
|
|
5
6
|
|
|
6
7
|
mockMatchMedia();
|
|
7
8
|
|
|
8
|
-
jest.mock('../bottomSheet', () => {
|
|
9
|
-
const { forwardRef } = require('react');
|
|
10
|
-
return forwardRef(({ open, children }, reference) =>
|
|
11
|
-
open ? (
|
|
12
|
-
<div ref={reference} className="np-bottom-sheet">
|
|
13
|
-
{children}
|
|
14
|
-
</div>
|
|
15
|
-
) : null,
|
|
16
|
-
);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
jest.mock('../panel', () => {
|
|
20
|
-
const { forwardRef } = require('react');
|
|
21
|
-
return forwardRef(({ open, children }, reference) =>
|
|
22
|
-
open ? (
|
|
23
|
-
<div ref={reference} className="np-panel np-panel--open">
|
|
24
|
-
{children}
|
|
25
|
-
</div>
|
|
26
|
-
) : null,
|
|
27
|
-
);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
9
|
describe('ResponsivePanel', () => {
|
|
31
10
|
const props = {
|
|
32
11
|
arrow: true,
|
|
@@ -45,13 +24,13 @@ describe('ResponsivePanel', () => {
|
|
|
45
24
|
|
|
46
25
|
describe('on desktop', () => {
|
|
47
26
|
it('renders Panel', async () => {
|
|
48
|
-
|
|
27
|
+
render(
|
|
49
28
|
<ResponsivePanel {...props} intialOpen>
|
|
50
29
|
children
|
|
51
30
|
</ResponsivePanel>,
|
|
52
|
-
)
|
|
31
|
+
);
|
|
53
32
|
|
|
54
|
-
expect(
|
|
33
|
+
expect(screen.getByRole('dialog')).not.toHaveAttribute('aria-modal');
|
|
55
34
|
});
|
|
56
35
|
});
|
|
57
36
|
|
|
@@ -61,13 +40,13 @@ describe('ResponsivePanel', () => {
|
|
|
61
40
|
});
|
|
62
41
|
|
|
63
42
|
it('renders bottomSheet', async () => {
|
|
64
|
-
|
|
43
|
+
render(
|
|
65
44
|
<ResponsivePanel {...props} open>
|
|
66
45
|
children
|
|
67
46
|
</ResponsivePanel>,
|
|
68
|
-
)
|
|
47
|
+
);
|
|
69
48
|
|
|
70
|
-
expect(
|
|
49
|
+
expect(screen.getByRole('dialog')).toHaveAttribute('aria-modal');
|
|
71
50
|
});
|
|
72
51
|
});
|
|
73
52
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { userEvent, within, fn } from '
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { userEvent, within, fn } from 'storybook/test';
|
|
3
3
|
|
|
4
4
|
import { DateInput, Field } from '..';
|
|
5
5
|
import { lorem10, storyConfig } from '../test-utils';
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import { boolean, select, text, date } from '@storybook/addon-knobs';
|
|
2
|
-
import { userEvent } from '@storybook/test';
|
|
3
1
|
import { useState } from 'react';
|
|
4
|
-
|
|
2
|
+
import { userEvent } from 'storybook/test';
|
|
5
3
|
import { Field } from '..';
|
|
6
4
|
import { Size } from '../common';
|
|
7
5
|
import { storyConfig } from '../test-utils';
|
|
8
|
-
|
|
9
|
-
import DateLookup from './DateLookup';
|
|
6
|
+
import DateLookup, { type DateLookupProps } from './DateLookup';
|
|
10
7
|
|
|
11
8
|
export default {
|
|
12
9
|
component: DateLookup,
|
|
13
10
|
title: 'Forms/DateLookup',
|
|
11
|
+
argTypes: {
|
|
12
|
+
size: { control: 'select', options: [Size.SMALL, Size.MEDIUM, Size.LARGE] },
|
|
13
|
+
disabled: { control: 'boolean' },
|
|
14
|
+
label: { control: 'text' },
|
|
15
|
+
monthFormat: { control: 'select', options: ['long', 'short'] },
|
|
16
|
+
placeholder: { control: 'text' },
|
|
17
|
+
id: { control: 'text' },
|
|
18
|
+
clearable: { control: 'boolean' },
|
|
19
|
+
min: { control: 'date' },
|
|
20
|
+
max: { control: 'date' },
|
|
21
|
+
},
|
|
14
22
|
};
|
|
15
23
|
|
|
16
24
|
const epoch = new Date('2011-01-01');
|
|
@@ -18,92 +26,61 @@ const theFuture = new Date(epoch);
|
|
|
18
26
|
theFuture.setUTCDate(epoch.getUTCDate() + 10);
|
|
19
27
|
const thePast = new Date(epoch);
|
|
20
28
|
thePast.setUTCDate(epoch.getUTCDate() - 10);
|
|
21
|
-
const size = select('size', Object.values([Size.SMALL, Size.MEDIUM, Size.LARGE]), Size.MEDIUM);
|
|
22
29
|
|
|
23
|
-
export const Basic = () => {
|
|
30
|
+
export const Basic = (args: DateLookupProps) => {
|
|
24
31
|
const [value, setValue] = useState<Date | null>(epoch);
|
|
25
|
-
const disabled = boolean('disabled', false);
|
|
26
|
-
const label = text('label', 'label');
|
|
27
|
-
const monthFormat = select('monthFormat', ['long', 'short'], 'long');
|
|
28
|
-
const placeholder = text('placeholder', 'placeholder');
|
|
29
|
-
const id = text('id', 'date-lookup');
|
|
30
|
-
|
|
31
|
-
const clearable = boolean('clearable', true);
|
|
32
|
-
|
|
33
32
|
return (
|
|
34
33
|
<DateLookup
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
min={thePast}
|
|
39
|
-
max={theFuture}
|
|
40
|
-
monthFormat={monthFormat}
|
|
41
|
-
placeholder={placeholder}
|
|
42
|
-
size={size}
|
|
34
|
+
{...args}
|
|
35
|
+
min={args.min ? new Date(args.min) : thePast}
|
|
36
|
+
max={args.max ? new Date(args.max) : theFuture}
|
|
43
37
|
value={value}
|
|
44
|
-
|
|
45
|
-
onChange={(v) => {
|
|
46
|
-
console.log(v);
|
|
47
|
-
setValue(v);
|
|
48
|
-
}}
|
|
38
|
+
onChange={(v) => setValue(v)}
|
|
49
39
|
/>
|
|
50
40
|
);
|
|
51
41
|
};
|
|
52
|
-
|
|
42
|
+
Basic.args = {
|
|
43
|
+
size: Size.MEDIUM,
|
|
44
|
+
disabled: false,
|
|
45
|
+
label: 'label',
|
|
46
|
+
monthFormat: 'long',
|
|
47
|
+
placeholder: 'placeholder',
|
|
48
|
+
id: 'date-lookup',
|
|
49
|
+
clearable: true,
|
|
50
|
+
min: thePast,
|
|
51
|
+
max: theFuture,
|
|
52
|
+
};
|
|
53
53
|
Basic.play = async ({ canvasElement }: { canvasElement: HTMLElement }) => {
|
|
54
|
-
// testing focus state on keyboard nav
|
|
55
54
|
await userEvent.tab();
|
|
56
55
|
await userEvent.keyboard(' ');
|
|
57
56
|
};
|
|
58
57
|
|
|
59
58
|
export const Basic400Zoom = storyConfig(
|
|
60
|
-
{
|
|
59
|
+
{
|
|
60
|
+
render: Basic,
|
|
61
|
+
play: Basic.play,
|
|
62
|
+
parameters: { chromatic: { delay: 2000 } },
|
|
63
|
+
},
|
|
61
64
|
{ variants: ['400%'] },
|
|
62
65
|
);
|
|
63
66
|
|
|
64
|
-
export const WithField = () => {
|
|
67
|
+
export const WithField = (args: DateLookupProps) => {
|
|
65
68
|
const [value, setValue] = useState<Date | null>(epoch);
|
|
66
|
-
const disabled = boolean('disabled', false);
|
|
67
|
-
const label = text('label', 'label');
|
|
68
|
-
const monthFormat = select('monthFormat', ['long', 'short'], 'long');
|
|
69
|
-
const placeholder = text('placeholder', 'Select date');
|
|
70
|
-
const id = text('id', 'date-lookup');
|
|
71
|
-
|
|
72
|
-
const clearable = boolean('clearable', true);
|
|
73
|
-
|
|
74
69
|
return (
|
|
75
70
|
<Field label="Date lookup">
|
|
76
71
|
<DateLookup
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
min={thePast}
|
|
81
|
-
max={theFuture}
|
|
82
|
-
monthFormat={monthFormat}
|
|
83
|
-
placeholder={placeholder}
|
|
84
|
-
size={size}
|
|
72
|
+
{...args}
|
|
73
|
+
min={args.min ? new Date(args.min) : thePast}
|
|
74
|
+
max={args.max ? new Date(args.max) : theFuture}
|
|
85
75
|
value={value}
|
|
86
|
-
|
|
87
|
-
onChange={(v) => {
|
|
88
|
-
console.log(v);
|
|
89
|
-
setValue(v);
|
|
90
|
-
}}
|
|
76
|
+
onChange={(v) => setValue(v)}
|
|
91
77
|
/>
|
|
92
78
|
</Field>
|
|
93
79
|
);
|
|
94
80
|
};
|
|
95
81
|
|
|
96
|
-
export const RightAligned = () => {
|
|
82
|
+
export const RightAligned = (args: DateLookupProps) => {
|
|
97
83
|
const [value, setValue] = useState<Date | null>(epoch);
|
|
98
|
-
const disabled = boolean('disabled', false);
|
|
99
|
-
const label = text('label', 'label');
|
|
100
|
-
const monthFormat = select('monthFormat', ['long', 'short'], 'long');
|
|
101
|
-
const placeholder = text('placeholder', 'placeholder');
|
|
102
|
-
|
|
103
|
-
const minvalue = date('minvalue', thePast);
|
|
104
|
-
const maxvalue = date('maxvalue', theFuture);
|
|
105
|
-
const clearable = boolean('clearable', false);
|
|
106
|
-
|
|
107
84
|
return (
|
|
108
85
|
<div className="row">
|
|
109
86
|
<div className="col-xs-6">
|
|
@@ -115,16 +92,11 @@ export const RightAligned = () => {
|
|
|
115
92
|
</div>
|
|
116
93
|
<div className="col-xs-6">
|
|
117
94
|
<DateLookup
|
|
95
|
+
{...args}
|
|
118
96
|
id="right-aligned"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
min={new Date(minvalue)}
|
|
122
|
-
max={new Date(maxvalue)}
|
|
123
|
-
monthFormat={monthFormat}
|
|
124
|
-
placeholder={placeholder}
|
|
125
|
-
size={size}
|
|
97
|
+
min={args.min ? new Date(args.min) : thePast}
|
|
98
|
+
max={args.max ? new Date(args.max) : theFuture}
|
|
126
99
|
value={value}
|
|
127
|
-
clearable={clearable}
|
|
128
100
|
onChange={(v) => setValue(v)}
|
|
129
101
|
/>
|
|
130
102
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { StoryFn } from '@storybook/react';
|
|
2
|
-
import { expect, userEvent, within } from '
|
|
3
|
-
import { action } from '
|
|
1
|
+
import { StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { expect, userEvent, within } from 'storybook/test';
|
|
3
|
+
import { action } from 'storybook/actions';
|
|
4
4
|
import { useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import DateLookup, { type DateLookupProps } from './DateLookup';
|