@transferwise/components 0.0.0-experimental-8d0974a → 0.0.0-experimental-53b8447
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/avatar/Avatar.js +3 -0
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +3 -0
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatarView/AvatarView.js +187 -0
- package/build/avatarView/AvatarView.js.map +1 -0
- package/build/avatarView/AvatarView.mjs +185 -0
- package/build/avatarView/AvatarView.mjs.map +1 -0
- package/build/avatarView/NotificationDot.js +56 -0
- package/build/avatarView/NotificationDot.js.map +1 -0
- package/build/avatarView/NotificationDot.mjs +54 -0
- package/build/avatarView/NotificationDot.mjs.map +1 -0
- package/build/avatarWrapper/AvatarWrapper.js +6 -1
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +6 -1
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +8 -1
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +8 -1
- package/build/badge/Badge.mjs.map +1 -1
- package/build/badge/BadgeAssets.js +63 -0
- package/build/badge/BadgeAssets.js.map +1 -0
- package/build/badge/BadgeAssets.mjs +61 -0
- package/build/badge/BadgeAssets.mjs.map +1 -0
- package/build/common/circle/Circle.js +29 -3
- package/build/common/circle/Circle.js.map +1 -1
- package/build/common/circle/Circle.mjs +29 -3
- package/build/common/circle/Circle.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +6 -6
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +6 -6
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.js +1 -4
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.js.map +1 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs +1 -4
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs.map +1 -1
- package/build/i18n/de.json +5 -0
- package/build/i18n/de.json.js +5 -0
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +5 -0
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/es.json +5 -0
- package/build/i18n/es.json.js +5 -0
- package/build/i18n/es.json.js.map +1 -1
- package/build/i18n/es.json.mjs +5 -0
- package/build/i18n/es.json.mjs.map +1 -1
- package/build/i18n/fr.json +5 -0
- package/build/i18n/fr.json.js +5 -0
- package/build/i18n/fr.json.js.map +1 -1
- package/build/i18n/fr.json.mjs +5 -0
- package/build/i18n/fr.json.mjs.map +1 -1
- package/build/i18n/hu.json +5 -0
- package/build/i18n/hu.json.js +5 -0
- package/build/i18n/hu.json.js.map +1 -1
- package/build/i18n/hu.json.mjs +5 -0
- package/build/i18n/hu.json.mjs.map +1 -1
- package/build/i18n/id.json +5 -0
- package/build/i18n/id.json.js +5 -0
- package/build/i18n/id.json.js.map +1 -1
- package/build/i18n/id.json.mjs +5 -0
- package/build/i18n/id.json.mjs.map +1 -1
- package/build/i18n/it.json +5 -0
- package/build/i18n/it.json.js +5 -0
- package/build/i18n/it.json.js.map +1 -1
- package/build/i18n/it.json.mjs +5 -0
- package/build/i18n/it.json.mjs.map +1 -1
- package/build/i18n/ja.json +5 -0
- package/build/i18n/ja.json.js +5 -0
- package/build/i18n/ja.json.js.map +1 -1
- package/build/i18n/ja.json.mjs +5 -0
- package/build/i18n/ja.json.mjs.map +1 -1
- package/build/i18n/pl.json +5 -0
- package/build/i18n/pl.json.js +5 -0
- package/build/i18n/pl.json.js.map +1 -1
- package/build/i18n/pl.json.mjs +5 -0
- package/build/i18n/pl.json.mjs.map +1 -1
- package/build/i18n/pt.json +5 -0
- package/build/i18n/pt.json.js +5 -0
- package/build/i18n/pt.json.js.map +1 -1
- package/build/i18n/pt.json.mjs +5 -0
- package/build/i18n/pt.json.mjs.map +1 -1
- package/build/i18n/ro.json +5 -0
- package/build/i18n/ro.json.js +5 -0
- package/build/i18n/ro.json.js.map +1 -1
- package/build/i18n/ro.json.mjs +5 -0
- package/build/i18n/ro.json.mjs.map +1 -1
- package/build/i18n/ru.json +5 -0
- package/build/i18n/ru.json.js +5 -0
- package/build/i18n/ru.json.js.map +1 -1
- package/build/i18n/ru.json.mjs +5 -0
- package/build/i18n/ru.json.mjs.map +1 -1
- package/build/i18n/tr.json +5 -0
- package/build/i18n/tr.json.js +5 -0
- package/build/i18n/tr.json.js.map +1 -1
- package/build/i18n/tr.json.mjs +5 -0
- package/build/i18n/tr.json.mjs.map +1 -1
- package/build/index.js +15 -4
- package/build/index.js.map +1 -1
- package/build/index.mjs +10 -2
- package/build/index.mjs.map +1 -1
- package/build/main.css +98 -25
- package/build/statusIcon/StatusIcon.js +2 -2
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +2 -2
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/styles/avatarGroup/AvatarGroup.css +28 -0
- package/build/styles/avatarView/AvatarView.css +28 -0
- package/build/styles/avatarView/NotificationDot.css +20 -0
- package/build/styles/badge/Badge.css +6 -5
- package/build/styles/common/circle/Circle.css +36 -0
- package/build/styles/main.css +98 -25
- package/build/styles/statusIcon/StatusIcon.css +0 -20
- package/build/types/avatar/Avatar.d.ts +3 -0
- package/build/types/avatar/Avatar.d.ts.map +1 -1
- package/build/types/avatarGroup/AvatarGroup.d.ts +18 -0
- package/build/types/avatarGroup/AvatarGroup.d.ts.map +1 -0
- package/build/types/avatarGroup/index.d.ts +3 -0
- package/build/types/avatarGroup/index.d.ts.map +1 -0
- package/build/types/avatarView/AvatarView.d.ts +25 -0
- package/build/types/avatarView/AvatarView.d.ts.map +1 -0
- package/build/types/avatarView/NotificationDot.d.ts +8 -0
- package/build/types/avatarView/NotificationDot.d.ts.map +1 -0
- package/build/types/avatarView/index.d.ts +3 -0
- package/build/types/avatarView/index.d.ts.map +1 -0
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +3 -0
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/badge/Badge.d.ts +5 -1
- package/build/types/badge/Badge.d.ts.map +1 -1
- package/build/types/badge/BadgeAssets.d.ts +15 -0
- package/build/types/badge/BadgeAssets.d.ts.map +1 -0
- package/build/types/badge/index.d.ts +2 -0
- package/build/types/badge/index.d.ts.map +1 -1
- package/build/types/common/circle/Circle.d.ts +3 -1
- package/build/types/common/circle/Circle.d.ts.map +1 -1
- package/build/types/common/dateUtils/index.d.ts +0 -1
- package/build/types/common/dateUtils/index.d.ts.map +1 -1
- package/build/types/dateLookup/DateLookup.d.ts +1 -1
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts +1 -1
- package/build/types/dateLookup/dayCalendar/table/DayCalendarTable.d.ts.map +1 -1
- package/build/types/index.d.ts +3 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/statusIcon/StatusIcon.d.ts +6 -2
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatar/Avatar.tsx +3 -0
- package/src/avatarGroup/AvatarGroup.css +28 -0
- package/src/avatarGroup/AvatarGroup.less +32 -0
- package/src/avatarGroup/AvatarGroup.story.tsx +195 -0
- package/src/avatarGroup/AvatarGroup.tsx +80 -0
- package/src/avatarGroup/index.ts +2 -0
- package/src/avatarView/AvatarView.css +28 -0
- package/src/avatarView/AvatarView.less +16 -0
- package/src/avatarView/AvatarView.story.tsx +573 -0
- package/src/avatarView/AvatarView.tsx +184 -0
- package/src/avatarView/NotificationDot.css +20 -0
- package/src/avatarView/NotificationDot.less +24 -0
- package/src/avatarView/NotificationDot.tsx +32 -0
- package/src/avatarView/index.ts +2 -0
- package/src/avatarWrapper/AvatarWrapper.story.tsx +6 -0
- package/src/avatarWrapper/AvatarWrapper.tsx +3 -0
- package/src/badge/Badge.css +6 -5
- package/src/badge/Badge.less +4 -3
- package/src/badge/Badge.tsx +8 -1
- package/src/badge/BadgeAssets.tsx +65 -0
- package/src/badge/index.ts +3 -0
- package/src/common/circle/Circle.css +36 -0
- package/src/common/circle/Circle.less +42 -1
- package/src/common/circle/Circle.tsx +41 -3
- package/src/common/dateUtils/index.ts +0 -1
- package/src/dateLookup/DateLookup.tests.story.tsx +5 -40
- package/src/dateLookup/DateLookup.tsx +11 -9
- package/src/dateLookup/dayCalendar/table/DayCalendarTable.tsx +2 -5
- package/src/decision/Decision.story.tsx +10 -46
- package/src/flowNavigation/FlowNavigation.story.js +10 -39
- package/src/i18n/de.json +5 -0
- package/src/i18n/es.json +5 -0
- package/src/i18n/fr.json +5 -0
- package/src/i18n/hu.json +5 -0
- package/src/i18n/id.json +5 -0
- package/src/i18n/it.json +5 -0
- package/src/i18n/ja.json +5 -0
- package/src/i18n/pl.json +5 -0
- package/src/i18n/pt.json +5 -0
- package/src/i18n/ro.json +5 -0
- package/src/i18n/ru.json +5 -0
- package/src/i18n/tr.json +5 -0
- package/src/index.ts +4 -0
- package/src/listItem/ListItem.story.tsx +6 -43
- package/src/main.css +98 -25
- package/src/main.less +2 -0
- package/src/navigationOption/NavigationOption.story.js +14 -65
- package/src/overlayHeader/OverlayHeader.story.tsx +5 -10
- package/src/radio/Radio.story.tsx +5 -5
- package/src/radioGroup/RadioGroup.story.tsx +3 -3
- package/src/selectOption/SelectOption.story.tsx +31 -30
- package/src/statusIcon/StatusIcon.css +0 -20
- package/src/statusIcon/StatusIcon.less +0 -17
- package/src/statusIcon/StatusIcon.tsx +14 -4
- package/src/tile/Tile.story.tsx +2 -6
- package/build/common/dateUtils/getDateView/getDateView.js +0 -10
- package/build/common/dateUtils/getDateView/getDateView.js.map +0 -1
- package/build/common/dateUtils/getDateView/getDateView.mjs +0 -8
- package/build/common/dateUtils/getDateView/getDateView.mjs.map +0 -1
- package/build/types/common/dateUtils/getDateView/getDateView.d.ts +0 -2
- package/build/types/common/dateUtils/getDateView/getDateView.d.ts.map +0 -1
- package/src/common/dateUtils/getDateView/getDateView.ts +0 -5
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
import { StoryFn } from '@storybook/react';
|
|
2
2
|
import { expect, userEvent, within } from '@storybook/test';
|
|
3
|
-
import { action } from '@storybook/addon-actions';
|
|
4
3
|
import { useState } from 'react';
|
|
5
4
|
|
|
6
|
-
import DateLookup
|
|
5
|
+
import DateLookup from './DateLookup';
|
|
7
6
|
|
|
8
7
|
export default {
|
|
9
8
|
component: DateLookup,
|
|
10
9
|
title: 'Forms/DateLookup/Tests',
|
|
11
10
|
};
|
|
12
11
|
|
|
13
|
-
const props: DateLookupProps = {
|
|
14
|
-
value: new Date(1987, 0, 10, 12, 0, 0),
|
|
15
|
-
onChange: (value: Date | null) => {
|
|
16
|
-
action(value?.toString() || 'null');
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
12
|
type Story = StoryFn<typeof DateLookup>;
|
|
20
13
|
|
|
21
|
-
const Template: Story = (
|
|
22
|
-
const
|
|
23
|
-
const [value, setValue] = useState<Date | null>(initialValue);
|
|
14
|
+
const Template: Story = () => {
|
|
15
|
+
const [value, setValue] = useState<Date | null>(new Date(1987, 0, 10, 12, 0, 0));
|
|
24
16
|
|
|
25
17
|
return (
|
|
26
18
|
<DateLookup
|
|
27
|
-
{...args}
|
|
28
19
|
value={value}
|
|
29
20
|
clearable
|
|
30
21
|
placeholder="placeholder"
|
|
@@ -36,7 +27,7 @@ const Template: Story = (args: DateLookupProps) => {
|
|
|
36
27
|
};
|
|
37
28
|
|
|
38
29
|
export const ClearSpace = Template.bind({});
|
|
39
|
-
|
|
30
|
+
|
|
40
31
|
ClearSpace.play = async ({ canvasElement, step }) => {
|
|
41
32
|
const canvas = within(canvasElement);
|
|
42
33
|
|
|
@@ -55,7 +46,7 @@ ClearSpace.play = async ({ canvasElement, step }) => {
|
|
|
55
46
|
};
|
|
56
47
|
|
|
57
48
|
export const ClearEnter = Template.bind({});
|
|
58
|
-
|
|
49
|
+
|
|
59
50
|
ClearEnter.play = async ({ canvasElement, step }) => {
|
|
60
51
|
const canvas = within(canvasElement);
|
|
61
52
|
|
|
@@ -72,29 +63,3 @@ ClearEnter.play = async ({ canvasElement, step }) => {
|
|
|
72
63
|
await expect(placeholder).toBeInTheDocument();
|
|
73
64
|
});
|
|
74
65
|
};
|
|
75
|
-
|
|
76
|
-
export const FocusOnSelectedDay = Template.bind({});
|
|
77
|
-
FocusOnSelectedDay.args = { ...props };
|
|
78
|
-
FocusOnSelectedDay.play = async () => {
|
|
79
|
-
await userEvent.tab();
|
|
80
|
-
await userEvent.keyboard(' ');
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const FocusOnToday = Template.bind({});
|
|
84
|
-
FocusOnToday.args = { ...props, value: null };
|
|
85
|
-
FocusOnToday.play = async () => {
|
|
86
|
-
await userEvent.tab();
|
|
87
|
-
await userEvent.keyboard(' ');
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export const FocusOnFirstNonDisabledDate = Template.bind({});
|
|
91
|
-
FocusOnFirstNonDisabledDate.args = {
|
|
92
|
-
...props,
|
|
93
|
-
value: null,
|
|
94
|
-
min: new Date(1987, 0, 10, 12, 0, 0),
|
|
95
|
-
max: new Date(1987, 0, 12, 12, 0, 0),
|
|
96
|
-
};
|
|
97
|
-
FocusOnFirstNonDisabledDate.play = async () => {
|
|
98
|
-
await userEvent.tab();
|
|
99
|
-
await userEvent.keyboard(' ');
|
|
100
|
-
};
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
MonthFormat,
|
|
7
7
|
Position,
|
|
8
8
|
Breakpoint,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
SizeSmall,
|
|
10
|
+
SizeMedium,
|
|
11
|
+
SizeLarge,
|
|
12
12
|
} from '../common';
|
|
13
|
-
import { isWithinRange, moveToWithinRange
|
|
13
|
+
import { isWithinRange, moveToWithinRange } from '../common/dateUtils';
|
|
14
14
|
import ResponsivePanel from '../common/responsivePanel';
|
|
15
15
|
import { WithInputAttributesProps, withInputAttributes } from '../inputs/contexts';
|
|
16
16
|
import { OverlayIdContext, OverlayIdProvider } from '../provider/overlay/OverlayIdProvider';
|
|
@@ -72,14 +72,13 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
|
|
|
72
72
|
|
|
73
73
|
constructor(props: DateLookup['props']) {
|
|
74
74
|
super(props);
|
|
75
|
-
const dateView = returnDateView(props.value, props.min, props.max);
|
|
76
75
|
this.state = {
|
|
77
76
|
selectedDate: getStartOfDay(props.value),
|
|
78
77
|
originalDate: null,
|
|
79
78
|
min: getStartOfDay(props.min),
|
|
80
79
|
max: getStartOfDay(props.max),
|
|
81
|
-
viewMonth:
|
|
82
|
-
viewYear:
|
|
80
|
+
viewMonth: (props.value || new Date()).getMonth(),
|
|
81
|
+
viewYear: (props.value || new Date()).getFullYear(),
|
|
83
82
|
open: false,
|
|
84
83
|
mode: 'day',
|
|
85
84
|
isMobile: false,
|
|
@@ -101,7 +100,8 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
|
|
|
101
100
|
props.onChange(moveToWithinRange(selectedDate, min, max));
|
|
102
101
|
return null;
|
|
103
102
|
}
|
|
104
|
-
const viewDateThatIsWithinRange: Date =
|
|
103
|
+
const viewDateThatIsWithinRange: Date =
|
|
104
|
+
selectedDate || ((min || max) && moveToWithinRange(new Date(), min, max)) || new Date();
|
|
105
105
|
const viewMonth = viewDateThatIsWithinRange.getMonth();
|
|
106
106
|
const viewYear = viewDateThatIsWithinRange.getFullYear();
|
|
107
107
|
return { selectedDate, min, max, viewMonth, viewYear };
|
|
@@ -209,7 +209,9 @@ class DateLookup extends PureComponent<DateLookupPropsWithInputAttributes, DateL
|
|
|
209
209
|
} else {
|
|
210
210
|
date = getStartOfDay(new Date());
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
if (date) {
|
|
213
|
+
date = moveToWithinRange(date, min, max);
|
|
214
|
+
}
|
|
213
215
|
if (date?.getTime() !== selectedDate?.getTime()) {
|
|
214
216
|
this.props.onChange(date);
|
|
215
217
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formatDate } from '@transferwise/formatting';
|
|
2
2
|
import { PureComponent } from 'react';
|
|
3
|
-
import { injectIntl,
|
|
3
|
+
import { injectIntl, WrappedComponentProps } from 'react-intl';
|
|
4
4
|
|
|
5
5
|
import { getDayNames, isWithinRange } from '../../../common/dateUtils';
|
|
6
6
|
import { getFocusableTime } from '../../getFocusableTime/getFocusableTime';
|
|
@@ -64,9 +64,6 @@ class DayCalendarTable extends PureComponent<DayCalendarTableProps> {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
isDisabled = (day: number) => {
|
|
67
|
-
if (day < 0) {
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
67
|
const { min, max, viewMonth, viewYear } = this.props;
|
|
71
68
|
const date = new Date(viewYear, viewMonth, day);
|
|
72
69
|
|
|
@@ -75,7 +72,7 @@ class DayCalendarTable extends PureComponent<DayCalendarTableProps> {
|
|
|
75
72
|
|
|
76
73
|
isActive = (day: number) => {
|
|
77
74
|
const { selectedDate, viewMonth, viewYear } = this.props;
|
|
78
|
-
return !!(selectedDate &&
|
|
75
|
+
return !!(selectedDate && +new Date(viewYear, viewMonth, day) === +selectedDate);
|
|
79
76
|
};
|
|
80
77
|
|
|
81
78
|
isToday = (day: number) => {
|
|
@@ -2,7 +2,7 @@ import { action } from '@storybook/addon-actions';
|
|
|
2
2
|
import { boolean, select } from '@storybook/addon-knobs';
|
|
3
3
|
import { Illustration } from '@wise/art';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import AvatarView from '../avatarView';
|
|
6
6
|
import { Size } from '../common';
|
|
7
7
|
|
|
8
8
|
import Decision, { DecisionPresentation, DecisionType } from '.';
|
|
@@ -33,11 +33,7 @@ export const Basic = () => {
|
|
|
33
33
|
disabled,
|
|
34
34
|
media: {
|
|
35
35
|
block: <Illustration name="globe" alt="" disablePadding />,
|
|
36
|
-
list:
|
|
37
|
-
<Avatar size="md" type="initials">
|
|
38
|
-
HM
|
|
39
|
-
</Avatar>
|
|
40
|
-
),
|
|
36
|
+
list: <AvatarView>HM</AvatarView>,
|
|
41
37
|
},
|
|
42
38
|
'aria-label': 'Click to see something',
|
|
43
39
|
title: 'Hank Miller',
|
|
@@ -50,11 +46,7 @@ export const Basic = () => {
|
|
|
50
46
|
href: '#href2',
|
|
51
47
|
media: {
|
|
52
48
|
block: <Illustration name="confetti" alt="" disablePadding />,
|
|
53
|
-
list:
|
|
54
|
-
<Avatar size="md" type="initials">
|
|
55
|
-
HM
|
|
56
|
-
</Avatar>
|
|
57
|
-
),
|
|
49
|
+
list: <AvatarView>HM</AvatarView>,
|
|
58
50
|
},
|
|
59
51
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
60
52
|
title: 'Hank Miller',
|
|
@@ -109,11 +101,7 @@ export const grid = () => {
|
|
|
109
101
|
alt=""
|
|
110
102
|
/>
|
|
111
103
|
),
|
|
112
|
-
list:
|
|
113
|
-
<Avatar size="md" type="initials">
|
|
114
|
-
HM
|
|
115
|
-
</Avatar>
|
|
116
|
-
),
|
|
104
|
+
list: <AvatarView>HM</AvatarView>,
|
|
117
105
|
},
|
|
118
106
|
'aria-label': 'Click to see something',
|
|
119
107
|
title: 'Hank Miller',
|
|
@@ -131,11 +119,7 @@ export const grid = () => {
|
|
|
131
119
|
alt=""
|
|
132
120
|
/>
|
|
133
121
|
),
|
|
134
|
-
list:
|
|
135
|
-
<Avatar size="md" type="initials">
|
|
136
|
-
HM
|
|
137
|
-
</Avatar>
|
|
138
|
-
),
|
|
122
|
+
list: <AvatarView>HM</AvatarView>,
|
|
139
123
|
},
|
|
140
124
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
141
125
|
title: 'Hank Miller',
|
|
@@ -152,11 +136,7 @@ export const grid = () => {
|
|
|
152
136
|
alt=""
|
|
153
137
|
/>
|
|
154
138
|
),
|
|
155
|
-
list:
|
|
156
|
-
<Avatar size="md" type="initials">
|
|
157
|
-
HM
|
|
158
|
-
</Avatar>
|
|
159
|
-
),
|
|
139
|
+
list: <AvatarView>HM</AvatarView>,
|
|
160
140
|
},
|
|
161
141
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
162
142
|
disabled,
|
|
@@ -175,11 +155,7 @@ export const grid = () => {
|
|
|
175
155
|
alt=""
|
|
176
156
|
/>
|
|
177
157
|
),
|
|
178
|
-
list:
|
|
179
|
-
<Avatar size="md" type="initials">
|
|
180
|
-
HM
|
|
181
|
-
</Avatar>
|
|
182
|
-
),
|
|
158
|
+
list: <AvatarView>HM</AvatarView>,
|
|
183
159
|
},
|
|
184
160
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
185
161
|
title: 'Hank Miller',
|
|
@@ -197,11 +173,7 @@ export const grid = () => {
|
|
|
197
173
|
alt=""
|
|
198
174
|
/>
|
|
199
175
|
),
|
|
200
|
-
list:
|
|
201
|
-
<Avatar size="md" type="initials">
|
|
202
|
-
HM
|
|
203
|
-
</Avatar>
|
|
204
|
-
),
|
|
176
|
+
list: <AvatarView>HM</AvatarView>,
|
|
205
177
|
},
|
|
206
178
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
207
179
|
title: 'Hank Miller',
|
|
@@ -219,11 +191,7 @@ export const grid = () => {
|
|
|
219
191
|
alt=""
|
|
220
192
|
/>
|
|
221
193
|
),
|
|
222
|
-
list:
|
|
223
|
-
<Avatar size="md" type="initials">
|
|
224
|
-
HM
|
|
225
|
-
</Avatar>
|
|
226
|
-
),
|
|
194
|
+
list: <AvatarView>HM</AvatarView>,
|
|
227
195
|
},
|
|
228
196
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
229
197
|
title: 'Hank Miller',
|
|
@@ -241,11 +209,7 @@ export const grid = () => {
|
|
|
241
209
|
alt=""
|
|
242
210
|
/>
|
|
243
211
|
),
|
|
244
|
-
list:
|
|
245
|
-
<Avatar size="md" type="initials">
|
|
246
|
-
HM
|
|
247
|
-
</Avatar>
|
|
248
|
-
),
|
|
212
|
+
list: <AvatarView>HM</AvatarView>,
|
|
249
213
|
},
|
|
250
214
|
'aria-label': 'Click here to send money to Hank Miller.',
|
|
251
215
|
title: 'Hank Miller',
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { boolean, select, text } from '@storybook/addon-knobs';
|
|
2
|
-
import { Person as ProfileIcon, Briefcase as BriefcaseIcon } from '@transferwise/icons';
|
|
3
2
|
import { useState } from 'react';
|
|
4
3
|
|
|
5
|
-
import
|
|
6
|
-
import AvatarWrapper from '../avatarWrapper';
|
|
4
|
+
import AvatarView from '../avatarView';
|
|
7
5
|
import Body from '../body';
|
|
8
6
|
import Button from '../button';
|
|
9
|
-
import { ProfileType,
|
|
7
|
+
import { ProfileType, Typography } from '../common';
|
|
10
8
|
import Logo from '../logo';
|
|
11
9
|
import OverlayHeader from '../overlayHeader';
|
|
12
10
|
|
|
@@ -19,16 +17,11 @@ export default {
|
|
|
19
17
|
component: FlowNavigation,
|
|
20
18
|
title: 'Navigation/FlowNavigation',
|
|
21
19
|
};
|
|
22
|
-
const avatarProfiles = {
|
|
23
|
-
'': null,
|
|
24
|
-
Business: <BriefcaseIcon />,
|
|
25
|
-
Profile: <ProfileIcon />,
|
|
26
|
-
};
|
|
27
20
|
|
|
28
21
|
export const Variants = () => {
|
|
29
22
|
const [activeStep, setActiveStep] = useState(2);
|
|
30
23
|
const [closed, setClosed] = useState(false);
|
|
31
|
-
const showAvatar = select('avatar',
|
|
24
|
+
const showAvatar = select('avatar', ['', ProfileType.PERSONAL, ProfileType.BUSINESS], 'Profile');
|
|
32
25
|
const showCloseButton = boolean('show closeButton', true);
|
|
33
26
|
const showMobileBackButton = boolean('show mobile backButton', true);
|
|
34
27
|
const done = boolean('done', false);
|
|
@@ -41,13 +34,7 @@ export const Variants = () => {
|
|
|
41
34
|
return !closed ? (
|
|
42
35
|
<>
|
|
43
36
|
<FlowNavigation
|
|
44
|
-
avatar={
|
|
45
|
-
!showAvatar ? null : (
|
|
46
|
-
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
47
|
-
{avatarProfiles[showAvatar]}
|
|
48
|
-
</Avatar>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
37
|
+
avatar={!showAvatar ? null : <AvatarView type={showAvatar.toLowerCase()} />}
|
|
51
38
|
logo={<Logo />}
|
|
52
39
|
activeStep={activeStep}
|
|
53
40
|
done={done}
|
|
@@ -120,7 +107,7 @@ export const Variants = () => {
|
|
|
120
107
|
|
|
121
108
|
<FlowNavigation
|
|
122
109
|
done={done}
|
|
123
|
-
avatar={<
|
|
110
|
+
avatar={<AvatarView imgSrc={avatarURL} type={profileType} />}
|
|
124
111
|
activeStep={activeStep}
|
|
125
112
|
steps={[
|
|
126
113
|
{
|
|
@@ -164,7 +151,7 @@ export const Variants = () => {
|
|
|
164
151
|
{/* Instance of always `done` FlowNav for visual testing */}
|
|
165
152
|
<FlowNavigation
|
|
166
153
|
done
|
|
167
|
-
avatar={<
|
|
154
|
+
avatar={<AvatarView imgSrc={avatarURL} type={profileType} />}
|
|
168
155
|
activeStep={activeStep}
|
|
169
156
|
steps={[
|
|
170
157
|
{ label: 'Recipient', hoverLabel: 'Daniele Tomboro', onClick: () => setActiveStep(0) },
|
|
@@ -224,11 +211,7 @@ export const SendFlow = () => {
|
|
|
224
211
|
return (
|
|
225
212
|
<>
|
|
226
213
|
<FlowNavigation
|
|
227
|
-
avatar={
|
|
228
|
-
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
229
|
-
<ProfileIcon />
|
|
230
|
-
</Avatar>
|
|
231
|
-
}
|
|
214
|
+
avatar={<AvatarView />}
|
|
232
215
|
logo={<Logo />}
|
|
233
216
|
activeStep={activeStep}
|
|
234
217
|
steps={steps}
|
|
@@ -256,7 +239,7 @@ export const SendFlow = () => {
|
|
|
256
239
|
export const WithOverlayHeaderComparison = () => {
|
|
257
240
|
const [activeStep, setActiveStep] = useState(4);
|
|
258
241
|
const [closed, setClosed] = useState(false);
|
|
259
|
-
const showAvatar = select('avatar',
|
|
242
|
+
const showAvatar = select('avatar', ['', ProfileType.PERSONAL, ProfileType.BUSINESS], 'Profile');
|
|
260
243
|
const showCloseButton = boolean('show closeButton', true);
|
|
261
244
|
const showMobileBackButton = boolean('show mobile backButton', true);
|
|
262
245
|
const done = boolean('done', false);
|
|
@@ -265,13 +248,7 @@ export const WithOverlayHeaderComparison = () => {
|
|
|
265
248
|
<>
|
|
266
249
|
<div style={{ border: '1px solid #e8e8e8' }}>
|
|
267
250
|
<FlowNavigation
|
|
268
|
-
avatar={
|
|
269
|
-
showAvatar ? (
|
|
270
|
-
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
271
|
-
{avatarProfiles[showAvatar]}
|
|
272
|
-
</Avatar>
|
|
273
|
-
) : null
|
|
274
|
-
}
|
|
251
|
+
avatar={showAvatar ? <AvatarView type={showAvatar.toLocaleLowerCase()} /> : null}
|
|
275
252
|
activeStep={activeStep}
|
|
276
253
|
done={done}
|
|
277
254
|
steps={[]}
|
|
@@ -283,13 +260,7 @@ export const WithOverlayHeaderComparison = () => {
|
|
|
283
260
|
</div>
|
|
284
261
|
<div style={{ border: '1px solid #e8e8e8' }}>
|
|
285
262
|
<OverlayHeader
|
|
286
|
-
avatar={
|
|
287
|
-
showAvatar ? (
|
|
288
|
-
<Avatar type={AvatarType.ICON} size={Size.MEDIUM}>
|
|
289
|
-
{avatarProfiles[showAvatar]}
|
|
290
|
-
</Avatar>
|
|
291
|
-
) : null
|
|
292
|
-
}
|
|
263
|
+
avatar={showAvatar ? <AvatarView type={showAvatar.toLowerCase()} /> : null}
|
|
293
264
|
onClose={showCloseButton && (() => setClosed(true))}
|
|
294
265
|
/>
|
|
295
266
|
</div>
|
package/src/i18n/de.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "Keine Ergebnisse gefunden",
|
|
28
28
|
"neptune.SelectOption.action.label": "Auswählen",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Ausgewählte Option ändern",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "Fehler:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "Auskünfte:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "Ausstehend:",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "Erfolgreich:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "Warnung:",
|
|
30
35
|
"neptune.Summary.statusDone": "Schritt erledigt",
|
|
31
36
|
"neptune.Summary.statusNotDone": "Schritt noch zu erledigen",
|
|
32
37
|
"neptune.Summary.statusPending": "Schritt ausstehend",
|
package/src/i18n/es.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "No se han encontrado resultados",
|
|
28
28
|
"neptune.SelectOption.action.label": "Elegir",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Cambiar opción elegida",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "Error:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "Información:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "Pendiente:",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "Éxito:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "Advertencia:",
|
|
30
35
|
"neptune.Summary.statusDone": "Apartado listo",
|
|
31
36
|
"neptune.Summary.statusNotDone": "Apartado a completar",
|
|
32
37
|
"neptune.Summary.statusPending": "Apartado pendiente",
|
package/src/i18n/fr.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "Aucun résultat trouvé",
|
|
28
28
|
"neptune.SelectOption.action.label": "Sélectionner",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Modifier l'option choisie",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "Erreur:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "Informations:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "En attente :",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "Terminé:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "Attention:",
|
|
30
35
|
"neptune.Summary.statusDone": "Validé",
|
|
31
36
|
"neptune.Summary.statusNotDone": "À compléter",
|
|
32
37
|
"neptune.Summary.statusPending": "En attente",
|
package/src/i18n/hu.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "Nincs találat",
|
|
28
28
|
"neptune.SelectOption.action.label": "Kiválasztás",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Kiválasztott opció módosítása",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "Hiba:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "Információ:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "Függőben:",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "Siker:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "Figyelmeztetés:",
|
|
30
35
|
"neptune.Summary.statusDone": "Kész",
|
|
31
36
|
"neptune.Summary.statusNotDone": "Hátravan",
|
|
32
37
|
"neptune.Summary.statusPending": "Függőben",
|
package/src/i18n/id.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "Hasil tidak ditemukan",
|
|
28
28
|
"neptune.SelectOption.action.label": "Pilih",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Ubah opsi yang dipilih",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "Kesalahan:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "Informasi:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "Tertunda:",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "Berhasil:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "Peringatan:",
|
|
30
35
|
"neptune.Summary.statusDone": "Item selesai",
|
|
31
36
|
"neptune.Summary.statusNotDone": "Item yang harus dilakukan",
|
|
32
37
|
"neptune.Summary.statusPending": "Item tertunda",
|
package/src/i18n/it.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "Nessun risultato trovato",
|
|
28
28
|
"neptune.SelectOption.action.label": "Scegli",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Modifica l'opzione scelta",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "Errore:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "Informazioni:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "In attesa:",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "Fatto:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "Attenzione:",
|
|
30
35
|
"neptune.Summary.statusDone": "Completato",
|
|
31
36
|
"neptune.Summary.statusNotDone": "Da completare",
|
|
32
37
|
"neptune.Summary.statusPending": "In corso",
|
package/src/i18n/ja.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "結果が見つかりませんでした",
|
|
28
28
|
"neptune.SelectOption.action.label": "選択してください",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "選択したオプションを変更する",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "エラー:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "情報:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "保留中:",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "完了:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "警告:",
|
|
30
35
|
"neptune.Summary.statusDone": "完了",
|
|
31
36
|
"neptune.Summary.statusNotDone": "未完了",
|
|
32
37
|
"neptune.Summary.statusPending": "保留中",
|
package/src/i18n/pl.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "Nie znaleziono wyników",
|
|
28
28
|
"neptune.SelectOption.action.label": "Wybierz",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Zmień wybraną opcję",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "Błąd:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "Informacje:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "W toku:",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "Gotowe:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "Ostrzeżenie:",
|
|
30
35
|
"neptune.Summary.statusDone": "Czynność wykonana",
|
|
31
36
|
"neptune.Summary.statusNotDone": "Czynność do wykonania",
|
|
32
37
|
"neptune.Summary.statusPending": "Czynność oczekująca",
|
package/src/i18n/pt.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "Nenhum resultado encontrado",
|
|
28
28
|
"neptune.SelectOption.action.label": "Selecionar",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Altere a opção escolhida",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "Erro:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "Informação:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "Pendente:",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "Concluído:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "Aviso:",
|
|
30
35
|
"neptune.Summary.statusDone": "Pronto",
|
|
31
36
|
"neptune.Summary.statusNotDone": "Não iniciado",
|
|
32
37
|
"neptune.Summary.statusPending": "Pendente",
|
package/src/i18n/ro.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "Nu s-a găsit niciun rezultat",
|
|
28
28
|
"neptune.SelectOption.action.label": "Alege",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Schimbă opțiunea aleasă",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "Eroare:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "Informații:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "În așteptare:",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "Gata:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "Avertisment:",
|
|
30
35
|
"neptune.Summary.statusDone": "Finalizat",
|
|
31
36
|
"neptune.Summary.statusNotDone": "De făcut",
|
|
32
37
|
"neptune.Summary.statusPending": "În așteptare",
|
package/src/i18n/ru.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "Ничего не найдено",
|
|
28
28
|
"neptune.SelectOption.action.label": "Выбрать",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Изменить выбранный вариант",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "Ошибка:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "Информация:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "В ожидании:",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "Готово:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "Внимание:",
|
|
30
35
|
"neptune.Summary.statusDone": "Этап завершен",
|
|
31
36
|
"neptune.Summary.statusNotDone": "Этап к выполнению",
|
|
32
37
|
"neptune.Summary.statusPending": "Этап в процессе",
|
package/src/i18n/tr.json
CHANGED
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"neptune.SelectInput.noResultsFound": "Sonuç bulunamadı",
|
|
28
28
|
"neptune.SelectOption.action.label": "Seç",
|
|
29
29
|
"neptune.SelectOption.selected.action.label": "Seçilen opsiyonu değiştir",
|
|
30
|
+
"neptune.StatusIcon.iconLabel.error": "Hata:",
|
|
31
|
+
"neptune.StatusIcon.iconLabel.information": "Bilgi:",
|
|
32
|
+
"neptune.StatusIcon.iconLabel.pending": "Bekliyor:",
|
|
33
|
+
"neptune.StatusIcon.iconLabel.success": "Başarılı:",
|
|
34
|
+
"neptune.StatusIcon.iconLabel.warning": "Uyarı:",
|
|
30
35
|
"neptune.Summary.statusDone": "Tamamlanan aşama",
|
|
31
36
|
"neptune.Summary.statusNotDone": "Yapılacak",
|
|
32
37
|
"neptune.Summary.statusPending": "Bekliyor",
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type { ActionOptionProps } from './actionOption';
|
|
|
8
8
|
export type { SelectOptionProps, SelectOptionValue, SelectOptiopsSection } from './selectOption';
|
|
9
9
|
export type { AlertAction, AlertProps, AlertType } from './alert';
|
|
10
10
|
export type { AvatarProps } from './avatar';
|
|
11
|
+
export type { AvatarViewProps } from './avatarView';
|
|
11
12
|
export type { BadgeProps } from './badge';
|
|
12
13
|
export type { CardProps } from './card';
|
|
13
14
|
export type { CarouselProps } from './carousel';
|
|
@@ -102,6 +103,7 @@ export { default as ActionOption } from './actionOption';
|
|
|
102
103
|
export { default as SelectOption } from './selectOption';
|
|
103
104
|
export { default as Alert } from './alert';
|
|
104
105
|
export { default as Avatar } from './avatar';
|
|
106
|
+
export { default as AvatarView } from './avatarView';
|
|
105
107
|
export { default as AvatarWrapper } from './avatarWrapper';
|
|
106
108
|
export { default as Badge } from './badge';
|
|
107
109
|
export { default as Body } from './body';
|
|
@@ -243,6 +245,8 @@ export {
|
|
|
243
245
|
getLangFromLocale,
|
|
244
246
|
isBrowser,
|
|
245
247
|
isServerSide,
|
|
248
|
+
getInitials,
|
|
249
|
+
getBrandColorFromSeed,
|
|
246
250
|
} from './common';
|
|
247
251
|
|
|
248
252
|
/**
|