@transferwise/components 46.100.1 → 46.100.2
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/avatarLayout/AvatarLayout.js +1 -1
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +1 -1
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- 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/main.css +4 -94
- package/build/styles/accordion/Accordion.css +27 -16
- package/build/styles/avatar/Avatar.css +95 -50
- 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 -94
- 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/story-config.d.ts +2 -3
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/package.json +20 -28
- 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.spec.tsx +1 -1
- package/src/avatar/Avatar.story.tsx +3 -2
- package/src/avatarLayout/AvatarLayout.story.tsx +1 -1
- package/src/avatarLayout/AvatarLayout.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/locale/index.spec.ts +28 -16
- 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.spec.tsx +5 -5
- 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.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.spec.tsx +8 -8
- 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/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 -94
- 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.spec.tsx +8 -5
- package/src/moneyInput/MoneyInput.story.tsx +2 -2
- package/src/moneyInput/currencyFormatting.spec.ts +1 -1
- 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/phoneNumberInput/utils/setDefaultPrefix/setDefaultPrefix.spec.ts +6 -3
- 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.spec.tsx +2 -2
- package/src/provider/Provider.story.tsx +1 -1
- package/src/provider/direction/DirectionProvider.spec.tsx +1 -1
- package/src/provider/language/LanguageProvider.spec.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.spec.tsx +8 -5
- 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.story.tsx +2 -2
- package/src/upload/Upload.tests.story.tsx +2 -2
- package/src/upload/utils/isTypeValid/isTypeValid.spec.ts +3 -1
- package/src/uploadInput/UploadInput.story.tsx +1 -1
- package/src/uploadInput/UploadInput.tests.story.tsx +3 -3
- 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,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';
|
|
@@ -353,7 +353,10 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
|
|
|
353
353
|
|
|
354
354
|
export const DateLookupWithoutInputAttributes = DateLookup;
|
|
355
355
|
|
|
356
|
-
|
|
356
|
+
const WrappedDateLookup = withInputAttributes(
|
|
357
357
|
DateLookup as React.ComponentType<DateLookupPropsWithInputAttributes>,
|
|
358
358
|
{ nonLabelable: true },
|
|
359
359
|
);
|
|
360
|
+
WrappedDateLookup.displayName = 'DateLookup';
|
|
361
|
+
|
|
362
|
+
export default WrappedDateLookup;
|
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { boolean, select } from '@storybook/addon-knobs';
|
|
3
1
|
import { Illustration } from '@wise/art';
|
|
4
|
-
|
|
2
|
+
import { fn } from 'storybook/test';
|
|
5
3
|
import { Size } from '../common';
|
|
6
|
-
|
|
7
|
-
import Decision, { DecisionPresentation, DecisionType } from '.';
|
|
8
4
|
import AvatarView from '../avatarView';
|
|
5
|
+
import Decision, { DecisionPresentation, DecisionType } from '.';
|
|
9
6
|
|
|
10
7
|
export default {
|
|
11
8
|
component: Decision,
|
|
12
9
|
title: 'Layouts/Decision',
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
source: { type: 'auto' },
|
|
13
|
+
},
|
|
14
|
+
},
|
|
13
15
|
};
|
|
14
16
|
|
|
15
|
-
export const Basic = ()
|
|
16
|
-
const presentation = select(
|
|
17
|
-
'presentation',
|
|
18
|
-
DecisionPresentation,
|
|
19
|
-
DecisionPresentation.LIST_BLOCK,
|
|
20
|
-
);
|
|
21
|
-
const disabled = boolean('disabled', false);
|
|
22
|
-
const showMediaCircleInList = boolean('showMediaCircleInList', true);
|
|
23
|
-
const isContainerAligned = boolean('isContainerAligned', false);
|
|
24
|
-
const size = select('size', [Size.MEDIUM, Size.SMALL], Size.MEDIUM);
|
|
25
|
-
|
|
17
|
+
export const Basic = function Render() {
|
|
26
18
|
return (
|
|
27
19
|
<Decision
|
|
28
20
|
options={[
|
|
29
21
|
{
|
|
30
22
|
description: 'Short text test.',
|
|
31
|
-
onClick:
|
|
23
|
+
onClick: fn(),
|
|
32
24
|
href: '#href1',
|
|
33
|
-
disabled,
|
|
34
25
|
media: {
|
|
35
26
|
block: <Illustration name="globe" alt="" disablePadding />,
|
|
36
27
|
list: <AvatarView profileName="Henry Mike" />,
|
|
@@ -41,8 +32,7 @@ export const Basic = () => {
|
|
|
41
32
|
{
|
|
42
33
|
description:
|
|
43
34
|
"Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
|
|
44
|
-
onClick:
|
|
45
|
-
disabled,
|
|
35
|
+
onClick: fn(),
|
|
46
36
|
href: '#href2',
|
|
47
37
|
media: {
|
|
48
38
|
block: <Illustration name="confetti" alt="" disablePadding />,
|
|
@@ -68,32 +58,23 @@ export const Basic = () => {
|
|
|
68
58
|
title: 'Hank Miller',
|
|
69
59
|
},
|
|
70
60
|
]}
|
|
71
|
-
presentation={
|
|
61
|
+
presentation={DecisionPresentation.LIST_BLOCK}
|
|
72
62
|
type={DecisionType.NAVIGATION}
|
|
73
|
-
showMediaCircleInList
|
|
74
|
-
isContainerAligned={
|
|
75
|
-
size={
|
|
63
|
+
showMediaCircleInList
|
|
64
|
+
isContainerAligned={false}
|
|
65
|
+
size={Size.MEDIUM}
|
|
76
66
|
/>
|
|
77
67
|
);
|
|
78
68
|
};
|
|
79
69
|
|
|
80
|
-
export const
|
|
81
|
-
const presentation = select(
|
|
82
|
-
'presentation',
|
|
83
|
-
DecisionPresentation,
|
|
84
|
-
DecisionPresentation.LIST_BLOCK_GRID,
|
|
85
|
-
);
|
|
86
|
-
const disabled = boolean('disabled', false);
|
|
87
|
-
const size = select('size', [Size.MEDIUM, Size.SMALL], Size.MEDIUM);
|
|
88
|
-
|
|
70
|
+
export const Grid = function Render() {
|
|
89
71
|
return (
|
|
90
72
|
<Decision
|
|
91
73
|
options={[
|
|
92
74
|
{
|
|
93
75
|
description: 'Short text test.',
|
|
94
|
-
onClick:
|
|
76
|
+
onClick: fn(),
|
|
95
77
|
href: '#href1',
|
|
96
|
-
disabled,
|
|
97
78
|
media: {
|
|
98
79
|
block: (
|
|
99
80
|
<img
|
|
@@ -109,8 +90,7 @@ export const grid = () => {
|
|
|
109
90
|
{
|
|
110
91
|
description:
|
|
111
92
|
"Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
|
|
112
|
-
onClick:
|
|
113
|
-
disabled,
|
|
93
|
+
onClick: fn(),
|
|
114
94
|
href: '#href2',
|
|
115
95
|
media: {
|
|
116
96
|
block: (
|
|
@@ -127,7 +107,7 @@ export const grid = () => {
|
|
|
127
107
|
{
|
|
128
108
|
description:
|
|
129
109
|
"Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
|
|
130
|
-
onClick:
|
|
110
|
+
onClick: fn(),
|
|
131
111
|
href: '#href3',
|
|
132
112
|
media: {
|
|
133
113
|
block: (
|
|
@@ -139,15 +119,13 @@ export const grid = () => {
|
|
|
139
119
|
list: <AvatarView profileName="Henry Mike" />,
|
|
140
120
|
},
|
|
141
121
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
142
|
-
disabled,
|
|
143
122
|
title: 'Hank Miller',
|
|
144
123
|
},
|
|
145
124
|
{
|
|
146
125
|
description:
|
|
147
126
|
"Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
|
|
148
|
-
onClick:
|
|
127
|
+
onClick: fn(),
|
|
149
128
|
href: '#href1',
|
|
150
|
-
disabled,
|
|
151
129
|
media: {
|
|
152
130
|
block: (
|
|
153
131
|
<img
|
|
@@ -163,9 +141,8 @@ export const grid = () => {
|
|
|
163
141
|
{
|
|
164
142
|
description:
|
|
165
143
|
"Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
|
|
166
|
-
onClick:
|
|
144
|
+
onClick: fn(),
|
|
167
145
|
href: '#href1',
|
|
168
|
-
disabled,
|
|
169
146
|
media: {
|
|
170
147
|
block: (
|
|
171
148
|
<img
|
|
@@ -181,9 +158,8 @@ export const grid = () => {
|
|
|
181
158
|
{
|
|
182
159
|
description:
|
|
183
160
|
"Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
|
|
184
|
-
onClick:
|
|
161
|
+
onClick: fn(),
|
|
185
162
|
href: '#href1',
|
|
186
|
-
disabled,
|
|
187
163
|
media: {
|
|
188
164
|
block: (
|
|
189
165
|
<img
|
|
@@ -199,9 +175,8 @@ export const grid = () => {
|
|
|
199
175
|
{
|
|
200
176
|
description:
|
|
201
177
|
"Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
|
|
202
|
-
onClick:
|
|
178
|
+
onClick: fn(),
|
|
203
179
|
href: '#href1',
|
|
204
|
-
disabled,
|
|
205
180
|
media: {
|
|
206
181
|
block: (
|
|
207
182
|
<img
|
|
@@ -215,9 +190,9 @@ export const grid = () => {
|
|
|
215
190
|
title: 'Hank Miller',
|
|
216
191
|
},
|
|
217
192
|
]}
|
|
218
|
-
presentation={
|
|
193
|
+
presentation={DecisionPresentation.LIST_BLOCK_GRID}
|
|
219
194
|
type={DecisionType.NAVIGATION}
|
|
220
|
-
size={
|
|
195
|
+
size={Size.MEDIUM}
|
|
221
196
|
/>
|
|
222
197
|
);
|
|
223
198
|
};
|
|
@@ -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 { Button, Dimmer } from '..';
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { select } from '@storybook/addon-knobs';
|
|
2
1
|
import { useState } from 'react';
|
|
3
|
-
|
|
4
|
-
import { Section, Button, Input, Modal } from '..';
|
|
5
2
|
import { Position, Priority } from '../common';
|
|
6
|
-
|
|
3
|
+
import { Section, Button, Input, Modal, type DrawerProps } from '..';
|
|
7
4
|
import Drawer from './Drawer';
|
|
8
5
|
|
|
9
6
|
export default {
|
|
10
7
|
component: Drawer,
|
|
11
8
|
title: 'Dialogs/Drawer',
|
|
9
|
+
argTypes: {
|
|
10
|
+
position: {
|
|
11
|
+
control: 'select',
|
|
12
|
+
options: [Position.LEFT, Position.RIGHT],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
12
15
|
};
|
|
13
16
|
|
|
14
|
-
export const Basic = () => {
|
|
17
|
+
export const Basic = (args: DrawerProps) => {
|
|
15
18
|
const [openDrawer, setOpenDrawer] = useState(false);
|
|
16
19
|
const [openModal, setOpenModal] = useState(false);
|
|
17
|
-
const position = select('position', [Position.LEFT, Position.RIGHT], Position.RIGHT);
|
|
18
20
|
|
|
19
21
|
return (
|
|
20
22
|
<>
|
|
@@ -23,7 +25,7 @@ export const Basic = () => {
|
|
|
23
25
|
</Button>
|
|
24
26
|
<Drawer
|
|
25
27
|
open={openDrawer}
|
|
26
|
-
position={position}
|
|
28
|
+
position={args.position}
|
|
27
29
|
headerTitle="This is the title of the drawer"
|
|
28
30
|
footerContent={
|
|
29
31
|
<>
|
|
@@ -115,3 +117,7 @@ export const Basic = () => {
|
|
|
115
117
|
</>
|
|
116
118
|
);
|
|
117
119
|
};
|
|
120
|
+
|
|
121
|
+
Basic.args = {
|
|
122
|
+
position: Position.RIGHT,
|
|
123
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { render } from '../test-utils';
|
|
2
|
-
|
|
3
2
|
import Emphasis from './Emphasis';
|
|
4
3
|
|
|
5
4
|
describe('Emphasis', () => {
|
|
@@ -10,13 +9,14 @@ describe('Emphasis', () => {
|
|
|
10
9
|
${'<positive>positive</positive>'} | ${'em.emphasis.emphasis--positive'}
|
|
11
10
|
${'<negative>negative</negative>'} | ${'em.emphasis.emphasis--negative'}
|
|
12
11
|
${'<warning>warning</warning>'} | ${'em.emphasis.emphasis--warning'}
|
|
13
|
-
`(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
`(
|
|
13
|
+
'$text renders as expected with selectoe $selector',
|
|
14
|
+
({ text, selector }: Record<string, string>) => {
|
|
15
|
+
const { container } = render(<Emphasis text={text} />);
|
|
16
|
+
expect(container.querySelector(selector)).toBeInTheDocument();
|
|
17
|
+
expect(container?.firstElementChild?.tagName).toBe('SPAN');
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
it('escapes malicious tags', () => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
+
import { action } from 'storybook/actions';
|
|
2
3
|
|
|
3
4
|
import { Input } from '../inputs/Input';
|
|
4
5
|
import { Field, FieldProps } from './Field';
|
|
5
6
|
import { Sentiment } from '../common';
|
|
6
7
|
import DateInput from '../dateInput';
|
|
7
|
-
import { fn } from '@storybook/test';
|
|
8
8
|
import { lorem10, lorem40 } from '../test-utils';
|
|
9
9
|
import { TextArea } from '../inputs/TextArea';
|
|
10
10
|
import { SearchInput } from '../inputs/SearchInput';
|
|
@@ -51,11 +51,11 @@ export const Basic = (args: FieldProps) => {
|
|
|
51
51
|
</Field>
|
|
52
52
|
|
|
53
53
|
<Field label="Date Of Birth" required={false}>
|
|
54
|
-
<DateInput onChange={
|
|
54
|
+
<DateInput value={undefined} onChange={action('date-input-changed')} />
|
|
55
55
|
</Field>
|
|
56
56
|
|
|
57
57
|
<Field label="Date Of Birth with Description" required={false} description={lorem10}>
|
|
58
|
-
<DateInput onChange={
|
|
58
|
+
<DateInput value={undefined} onChange={action('date-input-changed')} />
|
|
59
59
|
</Field>
|
|
60
60
|
|
|
61
61
|
<Field label="Search business" required={false}>
|