@transferwise/components 0.0.0-experimental-c0ebd4f → 0.0.0-experimental-45bc861
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/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/common/propsValues/sentiment.js +0 -1
- package/build/common/propsValues/sentiment.js.map +1 -1
- package/build/common/propsValues/sentiment.mjs +0 -1
- package/build/common/propsValues/sentiment.mjs.map +1 -1
- package/build/i18n/cs.json +9 -9
- package/build/i18n/cs.json.js +9 -9
- package/build/i18n/cs.json.mjs +9 -9
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/index.mjs +1 -1
- package/build/main.css +72 -60
- 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/inputs/Input.css +2 -28
- package/build/styles/inputs/TextArea.css +2 -28
- package/build/styles/item/Item.css +68 -0
- package/build/styles/main.css +72 -60
- package/build/styles/popover/Popover.css +2 -28
- package/build/test-utils/assets/apple-pay-logo.svg +84 -0
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs.map +1 -1
- package/build/types/alert/Alert.d.ts +2 -2
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/avatarWrapper/AvatarWrapper.d.ts +2 -2
- package/build/types/avatarWrapper/AvatarWrapper.d.ts.map +1 -1
- package/build/types/common/propsValues/sentiment.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/item/Item.d.ts +41 -0
- package/build/types/item/Item.d.ts.map +1 -0
- package/build/types/item/ItemAdditionalInfo.d.ts +9 -0
- package/build/types/item/ItemAdditionalInfo.d.ts.map +1 -0
- package/build/types/item/ItemCheckbox.d.ts +4 -0
- package/build/types/item/ItemCheckbox.d.ts.map +1 -0
- package/build/types/item/ItemIconButton.d.ts +4 -0
- package/build/types/item/ItemIconButton.d.ts.map +1 -0
- package/build/types/item/ItemMedia.d.ts +19 -0
- package/build/types/item/ItemMedia.d.ts.map +1 -0
- package/build/types/item/ItemNavigation.d.ts +4 -0
- package/build/types/item/ItemNavigation.d.ts.map +1 -0
- package/build/types/item/index.d.ts +6 -0
- package/build/types/item/index.d.ts.map +1 -0
- package/build/types/statusIcon/StatusIcon.d.ts +2 -3
- package/build/types/statusIcon/StatusIcon.d.ts.map +1 -1
- package/build/types/test-utils/fake-data.d.ts +2 -0
- package/build/types/test-utils/fake-data.d.ts.map +1 -1
- package/build/types/title/Title.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/alert/Alert.story.tsx +3 -5
- package/src/alert/Alert.tsx +2 -11
- package/src/avatarWrapper/AvatarWrapper.story.tsx +2 -2
- package/src/avatarWrapper/AvatarWrapper.tsx +2 -3
- package/src/common/propsValues/sentiment.ts +0 -1
- package/src/i18n/cs.json +9 -9
- package/src/index.ts +2 -0
- package/src/inputs/Input.css +2 -28
- package/src/inputs/TextArea.css +2 -28
- package/src/item/Item.css +68 -0
- package/src/item/Item.less +69 -0
- package/src/item/Item.story.tsx +111 -0
- package/src/item/Item.tsx +165 -0
- package/src/item/ItemAdditionalInfo.tsx +31 -0
- package/src/item/ItemCheckbox.tsx +16 -0
- package/src/item/ItemIconButton.tsx +15 -0
- package/src/item/ItemMedia.tsx +44 -0
- package/src/item/ItemNavigation.tsx +16 -0
- package/src/item/index.ts +6 -0
- package/src/main.css +72 -60
- package/src/main.less +1 -0
- package/src/popover/Popover.css +2 -28
- package/src/statusIcon/StatusIcon.docs.mdx +1 -1
- package/src/statusIcon/StatusIcon.spec.tsx +4 -10
- package/src/statusIcon/StatusIcon.story.tsx +5 -10
- package/src/statusIcon/StatusIcon.tsx +4 -6
- package/src/test-utils/assets/apple-pay-logo.svg +84 -0
- package/src/test-utils/fake-data.ts +5 -0
- package/src/title/Title.test.story.tsx +12 -19
- package/src/title/Title.tsx +0 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
.np-item {
|
|
2
|
+
padding: var(--size-16);
|
|
3
|
+
border-radius: var(--radius-large);
|
|
4
|
+
background-color: var(--color-background-screen);
|
|
5
|
+
display: flex;
|
|
6
|
+
gap: var(--size-16);
|
|
7
|
+
align-items: center;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
|
|
11
|
+
&:hover {
|
|
12
|
+
background-color: var(--color-background-screen-hover);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&:active {
|
|
16
|
+
background-color: var(--color-background-screen-active);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-media {
|
|
20
|
+
flex: 0 0 auto;
|
|
21
|
+
align-items: flex-start;
|
|
22
|
+
|
|
23
|
+
&-image {
|
|
24
|
+
width: var(--item-media-image-size);
|
|
25
|
+
height: var(--item-media-image-size);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&-title {
|
|
30
|
+
color: var(--color-content-primary);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&-additional-info {
|
|
34
|
+
color: var(--color-content-tertiary);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&-value {
|
|
38
|
+
flex: 0 0 auto;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&-control {
|
|
42
|
+
flex: 0 0 auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&-spotlight {
|
|
46
|
+
&-active {
|
|
47
|
+
background-color: var(--color-background-neutral);
|
|
48
|
+
|
|
49
|
+
&:hover {
|
|
50
|
+
background-color: var(--color-background-neutral-hover);
|
|
51
|
+
}
|
|
52
|
+
&:active {
|
|
53
|
+
background-color: var(--color-background-neutral-active);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&-inactive {
|
|
58
|
+
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
59
|
+
border: 1px dashed var(--color-border-neutral);
|
|
60
|
+
|
|
61
|
+
&:hover {
|
|
62
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
63
|
+
}
|
|
64
|
+
&:active {
|
|
65
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import Item, { Props as ItemProps } from './Item';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { lorem10, lorem20, lorem40, lorem5 } from '../test-utils';
|
|
4
|
+
import { Flag } from '@wise/art';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: Item,
|
|
8
|
+
title: 'Content/Item',
|
|
9
|
+
} satisfies Meta<ItemProps>;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<ItemProps>;
|
|
12
|
+
|
|
13
|
+
// TODO: delete this story later when we have more peace of the List Item puzzle
|
|
14
|
+
export const TempPlayground: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<div>
|
|
17
|
+
<Item
|
|
18
|
+
media={
|
|
19
|
+
<Item.AvatarView badge={{ type: 'action' }}>
|
|
20
|
+
<Flag code="BBD" />
|
|
21
|
+
</Item.AvatarView>
|
|
22
|
+
}
|
|
23
|
+
title="Test title"
|
|
24
|
+
subtitle="Test subtitle"
|
|
25
|
+
additionalInfo={<Item.AdditionalInfo>{lorem10}</Item.AdditionalInfo>}
|
|
26
|
+
/>
|
|
27
|
+
<Item
|
|
28
|
+
media={
|
|
29
|
+
<Item.AvatarLayout
|
|
30
|
+
avatars={[{ asset: <Flag code="BBD" /> }, { asset: <Flag code="MXN" /> }]}
|
|
31
|
+
/>
|
|
32
|
+
}
|
|
33
|
+
title="Test title"
|
|
34
|
+
subtitle={lorem10}
|
|
35
|
+
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
36
|
+
/>
|
|
37
|
+
<Item
|
|
38
|
+
media={
|
|
39
|
+
<Item.AvatarLayout
|
|
40
|
+
size={72}
|
|
41
|
+
orientation="diagonal"
|
|
42
|
+
avatars={[{ asset: <Flag code="BBD" /> }, { asset: <Flag code="MXN" /> }]}
|
|
43
|
+
/>
|
|
44
|
+
}
|
|
45
|
+
title="Test title"
|
|
46
|
+
subtitle={lorem10}
|
|
47
|
+
valueTitle="100 GBP"
|
|
48
|
+
valueSubtitle="100 USD"
|
|
49
|
+
additionalInfo={<Item.AdditionalInfo>{lorem20}</Item.AdditionalInfo>}
|
|
50
|
+
/>
|
|
51
|
+
<Item
|
|
52
|
+
media={<Item.AvatarView profileType="BUSINESS" notification />}
|
|
53
|
+
title="Test title"
|
|
54
|
+
subtitle="Test subtitle"
|
|
55
|
+
additionalInfo={
|
|
56
|
+
<Item.AdditionalInfo
|
|
57
|
+
action={{ label: 'Learn more', href: 'https://wise.com', target: '_blank' }}
|
|
58
|
+
>
|
|
59
|
+
{lorem10}
|
|
60
|
+
</Item.AdditionalInfo>
|
|
61
|
+
}
|
|
62
|
+
/>
|
|
63
|
+
<Item
|
|
64
|
+
media={<Item.AvatarView imgSrc="../avatar-square-dude.webp" selected />}
|
|
65
|
+
title="Test title"
|
|
66
|
+
additionalInfo={<Item.AdditionalInfo>{lorem10}</Item.AdditionalInfo>}
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
<Item
|
|
70
|
+
media={<Item.Image src="../apple-pay-logo.svg" />}
|
|
71
|
+
title="Accepting Apple Pay"
|
|
72
|
+
subtitle={lorem10}
|
|
73
|
+
/>
|
|
74
|
+
|
|
75
|
+
<Item
|
|
76
|
+
media={<Item.Image src="../wise-card.svg" />}
|
|
77
|
+
title="Wise Business Card"
|
|
78
|
+
subtitle={lorem5}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
),
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const ItemRadio: Story = {
|
|
85
|
+
render: () => (
|
|
86
|
+
<div>
|
|
87
|
+
{/* Basic */}
|
|
88
|
+
{/* with additional info */}
|
|
89
|
+
{/* with prompt */}
|
|
90
|
+
{/* Disabled */}
|
|
91
|
+
{/* Spotlight */}
|
|
92
|
+
{/* Active */}
|
|
93
|
+
</div>
|
|
94
|
+
),
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const ItemButton: Story = {
|
|
98
|
+
render: () => (
|
|
99
|
+
<div>
|
|
100
|
+
{/* Basic */}
|
|
101
|
+
{/* with additional info */}
|
|
102
|
+
{/* with prompt */}
|
|
103
|
+
{/* partially interactive */}
|
|
104
|
+
{/* Disabled */}
|
|
105
|
+
{/* Spotlight */}
|
|
106
|
+
{/* Active */}
|
|
107
|
+
</div>
|
|
108
|
+
),
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// add intaces with dark mode
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { createContext, ReactNode, useId, useMemo, useState } from 'react';
|
|
2
|
+
import { Typography } from '../common';
|
|
3
|
+
import Body from '../body';
|
|
4
|
+
import { AdditionalInfo } from './ItemAdditionalInfo';
|
|
5
|
+
import { IconButton } from './ItemIconButton';
|
|
6
|
+
import { Checkbox } from './ItemCheckbox';
|
|
7
|
+
import { Navigation } from './ItemNavigation';
|
|
8
|
+
import { clsx } from 'clsx';
|
|
9
|
+
import { AvatarLayout, AvatarView, Image } from './ItemMedia';
|
|
10
|
+
|
|
11
|
+
export type ItemTypes =
|
|
12
|
+
| 'none'
|
|
13
|
+
| 'navigation'
|
|
14
|
+
| 'radio'
|
|
15
|
+
| 'checkbox'
|
|
16
|
+
| 'switch'
|
|
17
|
+
| 'button'
|
|
18
|
+
| 'icon-button';
|
|
19
|
+
|
|
20
|
+
export type Props = {
|
|
21
|
+
as?: 'li' | 'div' | 'span';
|
|
22
|
+
inverted?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
partialInteractivity?: boolean;
|
|
25
|
+
spotlight?: 'active' | 'inactive';
|
|
26
|
+
title: ReactNode;
|
|
27
|
+
subtitle?: ReactNode;
|
|
28
|
+
additionalInfo?: ReactNode;
|
|
29
|
+
valueTitle?: ReactNode;
|
|
30
|
+
valueSubtitle?: ReactNode;
|
|
31
|
+
media?: ReactNode;
|
|
32
|
+
control?: ReactNode;
|
|
33
|
+
prompt?: ReactNode;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type ItemContextData = {
|
|
37
|
+
setControlType: (type: ItemTypes) => void;
|
|
38
|
+
ids: {
|
|
39
|
+
label: string;
|
|
40
|
+
additionalInfo: string;
|
|
41
|
+
value: string;
|
|
42
|
+
control: string;
|
|
43
|
+
prompt: string;
|
|
44
|
+
};
|
|
45
|
+
props: Pick<Props, 'as' | 'disabled' | 'inverted'>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// @ts-expect-error for now let's mock it with `null` value
|
|
49
|
+
// but actually by default we should specify `setControlType('none')`
|
|
50
|
+
export const ItemContext = createContext<ItemContextData>(null);
|
|
51
|
+
|
|
52
|
+
export const Item = ({
|
|
53
|
+
as: View = 'li',
|
|
54
|
+
title,
|
|
55
|
+
subtitle,
|
|
56
|
+
additionalInfo,
|
|
57
|
+
prompt,
|
|
58
|
+
inverted,
|
|
59
|
+
media,
|
|
60
|
+
spotlight = undefined,
|
|
61
|
+
valueTitle,
|
|
62
|
+
valueSubtitle,
|
|
63
|
+
control,
|
|
64
|
+
disabled,
|
|
65
|
+
}: Props) => {
|
|
66
|
+
/*
|
|
67
|
+
const returnType = (): ReactNode => {
|
|
68
|
+
switch (type) {
|
|
69
|
+
case 'Navigation':
|
|
70
|
+
return <Chevron orientation={Position.RIGHT} disabled />;
|
|
71
|
+
case 'Radio':
|
|
72
|
+
return <RadioButton name="Hello" checked />;
|
|
73
|
+
case 'Checkbox':
|
|
74
|
+
return <CheckboxButton name="Hello" checked />;
|
|
75
|
+
case 'Switch':
|
|
76
|
+
return <Switch onClick={() => console.log('clicked')} />;
|
|
77
|
+
case 'Button':
|
|
78
|
+
return <Button v2>Hello</Button>;
|
|
79
|
+
case 'IconButton':
|
|
80
|
+
return (
|
|
81
|
+
<IconButton size={40} priority="minimal">
|
|
82
|
+
<InfoCircle />
|
|
83
|
+
</IconButton>
|
|
84
|
+
);
|
|
85
|
+
case 'NonInteractive':
|
|
86
|
+
default:
|
|
87
|
+
return <></>;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
*/
|
|
91
|
+
const idPrefix = useId();
|
|
92
|
+
|
|
93
|
+
const [controlType, setControlType] = useState<ItemTypes>();
|
|
94
|
+
const ids = {
|
|
95
|
+
label: `${idPrefix}_label`,
|
|
96
|
+
value: `${idPrefix}_value`,
|
|
97
|
+
control: `${idPrefix}_control`,
|
|
98
|
+
prompt: `${idPrefix}_prompt`,
|
|
99
|
+
additionalInfo: `${idPrefix}_additional-info`,
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const itemCtx = useMemo(
|
|
103
|
+
() => ({ setControlType, ids, props: { as: View, disabled, inverted } }),
|
|
104
|
+
[],
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<ItemContext.Provider value={itemCtx}>
|
|
109
|
+
<View
|
|
110
|
+
className={clsx('np-item', `np-item-${controlType}`, {
|
|
111
|
+
[`np-item-spotlight-${spotlight}`]: !!spotlight,
|
|
112
|
+
})}
|
|
113
|
+
aria-describedby={[ids.additionalInfo].join(' ')}
|
|
114
|
+
>
|
|
115
|
+
{media && <div className="np-item-media">{media}</div>}
|
|
116
|
+
|
|
117
|
+
{/* Title + Subtitle + Values + Additional Info - Group */}
|
|
118
|
+
<div>
|
|
119
|
+
{/* Title + Subtitle + Values - Group */}
|
|
120
|
+
<div className="d-flex justify-content-between">
|
|
121
|
+
<span>
|
|
122
|
+
{/* @ts-expect-error div can have role and aria-lavel props */}
|
|
123
|
+
<Body
|
|
124
|
+
type={Typography.BODY_LARGE_BOLD}
|
|
125
|
+
className="np-item-title"
|
|
126
|
+
// for a11y this needs to be a header but for SEO it shouldn't be `h*` tag
|
|
127
|
+
// so we enable header semantics via `role` and `aria-level` attrs
|
|
128
|
+
role="heading"
|
|
129
|
+
aria-level="4"
|
|
130
|
+
>
|
|
131
|
+
{title}
|
|
132
|
+
</Body>
|
|
133
|
+
<Body className="np-item-subtitle">{subtitle}</Body>
|
|
134
|
+
</span>
|
|
135
|
+
{(valueTitle || valueSubtitle) && (
|
|
136
|
+
<span id={ids.value} className="np-item-value">
|
|
137
|
+
<Body type={Typography.BODY_LARGE_BOLD} className="np-item-title-value">
|
|
138
|
+
{valueTitle}
|
|
139
|
+
</Body>
|
|
140
|
+
<Body className="np-item-subtitle-value">{valueSubtitle}</Body>
|
|
141
|
+
</span>
|
|
142
|
+
)}
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
{/* Additional Info and Prompt here */}
|
|
146
|
+
{Boolean(subtitle) && additionalInfo}
|
|
147
|
+
</div>
|
|
148
|
+
<Body className="np-item-control">{control}</Body>
|
|
149
|
+
{prompt}
|
|
150
|
+
</View>
|
|
151
|
+
</ItemContext.Provider>
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/* eslint-disable functional/immutable-data */
|
|
156
|
+
Item.Image = Image;
|
|
157
|
+
Item.AvatarView = AvatarView;
|
|
158
|
+
Item.AvatarLayout = AvatarLayout;
|
|
159
|
+
Item.AdditionalInfo = AdditionalInfo;
|
|
160
|
+
Item.Checkbox = Checkbox;
|
|
161
|
+
Item.IconButton = IconButton;
|
|
162
|
+
Item.Navigation = Navigation;
|
|
163
|
+
/* eslint-enable functional/immutable-data */
|
|
164
|
+
|
|
165
|
+
export default Item;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PropsWithChildren, useContext } from 'react';
|
|
2
|
+
import { ItemContext, ItemContextData } from './Item';
|
|
3
|
+
import Body from '../body';
|
|
4
|
+
import Link, { LinkProps } from '../link';
|
|
5
|
+
import { Typography } from '../common';
|
|
6
|
+
|
|
7
|
+
export type ItemAdditionalInfoProps = PropsWithChildren<{
|
|
8
|
+
action?: Pick<LinkProps, 'href' | 'onClick' | 'target'> & { label?: string };
|
|
9
|
+
}>;
|
|
10
|
+
|
|
11
|
+
export const AdditionalInfo = function ({ children, action }: ItemAdditionalInfoProps) {
|
|
12
|
+
const { ids } = useContext<ItemContextData>(ItemContext);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Body
|
|
16
|
+
type={Typography.BODY_DEFAULT}
|
|
17
|
+
id={ids.additionalInfo}
|
|
18
|
+
className="np-item-additional-info"
|
|
19
|
+
>
|
|
20
|
+
{children}
|
|
21
|
+
{action ? (
|
|
22
|
+
<>
|
|
23
|
+
{' '}
|
|
24
|
+
<Link href={action.href} target={action.target} onClick={action.onClick}>
|
|
25
|
+
{action.label}
|
|
26
|
+
</Link>
|
|
27
|
+
</>
|
|
28
|
+
) : null}
|
|
29
|
+
</Body>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import CheckboxButton from '../checkboxButton';
|
|
3
|
+
import { CheckboxButtonProps } from '../checkboxButton/CheckboxButton';
|
|
4
|
+
import { ItemContext, ItemContextData } from './Item';
|
|
5
|
+
|
|
6
|
+
export type ItemCheckboxProps = Pick<CheckboxButtonProps, 'checked' | 'indeterminate' | 'onChange'>;
|
|
7
|
+
|
|
8
|
+
export const Checkbox = function (props: ItemCheckboxProps) {
|
|
9
|
+
const { setControlType, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setControlType('checkbox');
|
|
13
|
+
}, []);
|
|
14
|
+
|
|
15
|
+
return <CheckboxButton disabled={baseItemProps.disabled} {...props} />;
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import { default as IconButtonComp, IconButtonProps } from '../iconButton';
|
|
3
|
+
import { ItemContext, ItemContextData } from './Item';
|
|
4
|
+
|
|
5
|
+
export type ItemIconButtonProps = Pick<IconButtonProps, 'onClick' | 'href' | 'target'>;
|
|
6
|
+
|
|
7
|
+
export const IconButton = function (props: ItemIconButtonProps) {
|
|
8
|
+
const { setControlType } = useContext<ItemContextData>(ItemContext);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setControlType('icon-button');
|
|
12
|
+
}, []);
|
|
13
|
+
|
|
14
|
+
return <IconButtonComp {...props} size={32} />;
|
|
15
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { default as AvatarViewComp, AvatarViewProps } from '../avatarView';
|
|
2
|
+
import { default as AvatarLayoutComp, AvatarLayoutProps } from '../avatarLayout';
|
|
3
|
+
import { default as ImageComp, ImageProps } from '../image/Image';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
|
|
6
|
+
type SizeProp = { size?: 32 | 40 | 48 | 56 | 72 };
|
|
7
|
+
|
|
8
|
+
export type ItemAvatarViewProps = Omit<AvatarViewProps, 'size' | 'interactive'> & SizeProp;
|
|
9
|
+
|
|
10
|
+
export const AvatarView = ({ className, size = 48, ...props }: ItemAvatarViewProps) => {
|
|
11
|
+
return (
|
|
12
|
+
<AvatarViewComp {...props} size={size} className={clsx('np-item-avatar-view', className)} />
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type ItemAvatarLayoutProps = Omit<AvatarLayoutProps, 'size' | 'interactive'> & SizeProp;
|
|
17
|
+
|
|
18
|
+
export const AvatarLayout = ({ className, size = 48, ...props }: ItemAvatarLayoutProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<AvatarLayoutComp {...props} size={size} className={clsx('np-item-avatar-layout', className)} />
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type ItemImageProps = Omit<ImageProps, 'stretch' | 'shrink' | 'id' | 'alt'> &
|
|
25
|
+
SizeProp & {
|
|
26
|
+
alt?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* TODO: mention that image is for rare cases not for DS illustrations, they discouraged
|
|
31
|
+
*/
|
|
32
|
+
export const Image = ({ alt = '', size = 48, ...props }: ItemImageProps) => {
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
className={clsx('np-item-media-image')}
|
|
36
|
+
style={{
|
|
37
|
+
// @ts-expect-error CSS custom props allowed
|
|
38
|
+
'--item-media-image-size': `${size}px`,
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
41
|
+
<ImageComp {...props} alt={alt} />
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChevronRight, BillSplit as Disabled } from '@transferwise/icons';
|
|
2
|
+
import { ButtonProps } from '../button/Button.types';
|
|
3
|
+
import Item, { ItemContext, ItemContextData } from './Item';
|
|
4
|
+
import { useContext, useEffect } from 'react';
|
|
5
|
+
|
|
6
|
+
export type ItemNavigationProps = Pick<ButtonProps, 'onClick' | 'href'>;
|
|
7
|
+
|
|
8
|
+
export const Navigation = function Navigation({ onClick }: ItemNavigationProps) {
|
|
9
|
+
const { setControlType, props: baseItemProps } = useContext<ItemContextData>(ItemContext);
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
setControlType('navigation');
|
|
13
|
+
}, []);
|
|
14
|
+
|
|
15
|
+
return baseItemProps?.disabled ? <Disabled size={24} /> : <ChevronRight size={24} />;
|
|
16
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { Props as ItemProps } from './Item';
|
|
2
|
+
export type { ItemAdditionalInfoProps } from './ItemAdditionalInfo';
|
|
3
|
+
export type { ItemCheckboxProps } from './ItemCheckbox';
|
|
4
|
+
export type { ItemImageProps, ItemAvatarViewProps, ItemAvatarLayoutProps } from './ItemMedia';
|
|
5
|
+
|
|
6
|
+
export { default } from './Item';
|
package/src/main.css
CHANGED
|
@@ -2585,6 +2585,8 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2585
2585
|
line-height: 1.2;
|
|
2586
2586
|
line-height: var(--line-height-title);
|
|
2587
2587
|
letter-spacing: 0;
|
|
2588
|
+
-webkit-hyphens: auto;
|
|
2589
|
+
hyphens: auto;
|
|
2588
2590
|
margin-bottom: 0;
|
|
2589
2591
|
margin-bottom: initial;
|
|
2590
2592
|
font-size: 1.375rem;
|
|
@@ -2596,36 +2598,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2596
2598
|
height: 72px !important;
|
|
2597
2599
|
height: var(--size-72) !important;
|
|
2598
2600
|
}
|
|
2599
|
-
@supports (hyphenate-limit-chars: 1) {
|
|
2600
|
-
.np-form-control--size-lg {
|
|
2601
|
-
-webkit-hyphens: auto;
|
|
2602
|
-
hyphens: auto;
|
|
2603
|
-
hyphenate-limit-chars: 7 3;
|
|
2604
|
-
}
|
|
2605
|
-
@media (min-width: 768px) {
|
|
2606
|
-
.np-form-control--size-lg {
|
|
2607
|
-
hyphenate-limit-chars: 8 3;
|
|
2608
|
-
}
|
|
2609
|
-
}
|
|
2610
|
-
@media (min-width: 992px) {
|
|
2611
|
-
.np-form-control--size-lg {
|
|
2612
|
-
hyphenate-limit-chars: 10 4 3;
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
@supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
|
|
2617
|
-
.np-form-control--size-lg {
|
|
2618
|
-
-webkit-hyphens: auto;
|
|
2619
|
-
hyphens: auto;
|
|
2620
|
-
-webkit-hyphenate-limit-before: 3;
|
|
2621
|
-
-webkit-hyphenate-limit-after: 3;
|
|
2622
|
-
}
|
|
2623
|
-
@media (min-width: 992px) {
|
|
2624
|
-
.np-form-control--size-lg {
|
|
2625
|
-
-webkit-hyphenate-limit-before: 4;
|
|
2626
|
-
}
|
|
2627
|
-
}
|
|
2628
|
-
}
|
|
2629
2601
|
.np-form-control--size-lg + p,
|
|
2630
2602
|
.np-form-control--size-lg + ul:not(.list-unstyled),
|
|
2631
2603
|
.np-form-control--size-lg + ol:not(.list-unstyled) {
|
|
@@ -2648,6 +2620,74 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2648
2620
|
border-radius: 9999px !important;
|
|
2649
2621
|
border-radius: var(--radius-full) !important;
|
|
2650
2622
|
}
|
|
2623
|
+
.np-item {
|
|
2624
|
+
padding: 16px;
|
|
2625
|
+
padding: var(--size-16);
|
|
2626
|
+
border-radius: 24px;
|
|
2627
|
+
border-radius: var(--radius-large);
|
|
2628
|
+
background-color: #ffffff;
|
|
2629
|
+
background-color: var(--color-background-screen);
|
|
2630
|
+
display: flex;
|
|
2631
|
+
gap: 16px;
|
|
2632
|
+
gap: var(--size-16);
|
|
2633
|
+
align-items: center;
|
|
2634
|
+
flex-direction: row;
|
|
2635
|
+
cursor: pointer;
|
|
2636
|
+
}
|
|
2637
|
+
.np-item:hover {
|
|
2638
|
+
background-color: var(--color-background-screen-hover);
|
|
2639
|
+
}
|
|
2640
|
+
.np-item:active {
|
|
2641
|
+
background-color: var(--color-background-screen-active);
|
|
2642
|
+
}
|
|
2643
|
+
.np-item-media {
|
|
2644
|
+
flex: 0 0 auto;
|
|
2645
|
+
align-items: flex-start;
|
|
2646
|
+
}
|
|
2647
|
+
.np-item-media-image {
|
|
2648
|
+
width: var(--item-media-image-size);
|
|
2649
|
+
height: var(--item-media-image-size);
|
|
2650
|
+
}
|
|
2651
|
+
.np-item-title {
|
|
2652
|
+
color: #37517e;
|
|
2653
|
+
color: var(--color-content-primary);
|
|
2654
|
+
}
|
|
2655
|
+
.np-item-additional-info {
|
|
2656
|
+
color: #768e9c;
|
|
2657
|
+
color: var(--color-content-tertiary);
|
|
2658
|
+
}
|
|
2659
|
+
.np-item-value {
|
|
2660
|
+
flex: 0 0 auto;
|
|
2661
|
+
}
|
|
2662
|
+
.np-item-control {
|
|
2663
|
+
flex: 0 0 auto;
|
|
2664
|
+
}
|
|
2665
|
+
.np-item-spotlight-active {
|
|
2666
|
+
background-color: rgba(134,167,189,0.10196);
|
|
2667
|
+
background-color: var(--color-background-neutral);
|
|
2668
|
+
}
|
|
2669
|
+
.np-item-spotlight-active:hover {
|
|
2670
|
+
background-color: var(--color-background-neutral-hover);
|
|
2671
|
+
}
|
|
2672
|
+
.np-item-spotlight-active:active {
|
|
2673
|
+
background-color: var(--color-background-neutral-active);
|
|
2674
|
+
}
|
|
2675
|
+
.np-item-spotlight-inactive {
|
|
2676
|
+
background-color: rgba(134, 167, 189, 0.025);
|
|
2677
|
+
border: 1px dashed rgba(0,0,0,0.10196);
|
|
2678
|
+
border: 1px dashed var(--color-border-neutral);
|
|
2679
|
+
}
|
|
2680
|
+
@supports (color: color-mix(in lch, red, blue)) {
|
|
2681
|
+
.np-item-spotlight-inactive {
|
|
2682
|
+
background-color: color-mix(in srgb, var(--color-background-neutral) 25%, transparent);
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
.np-item-spotlight-inactive:hover {
|
|
2686
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-hover) 25%, transparent);
|
|
2687
|
+
}
|
|
2688
|
+
.np-item-spotlight-inactive:active {
|
|
2689
|
+
background-color: color-mix(in srgb, var(--color-background-neutral-active) 25%, transparent);
|
|
2690
|
+
}
|
|
2651
2691
|
.np-field-control {
|
|
2652
2692
|
margin-top: 4px;
|
|
2653
2693
|
margin-top: var(--size-4);
|
|
@@ -4051,6 +4091,8 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4051
4091
|
line-height: 1.2;
|
|
4052
4092
|
line-height: var(--line-height-title);
|
|
4053
4093
|
letter-spacing: 0;
|
|
4094
|
+
-webkit-hyphens: auto;
|
|
4095
|
+
hyphens: auto;
|
|
4054
4096
|
margin-bottom: 0;
|
|
4055
4097
|
margin-bottom: initial;
|
|
4056
4098
|
font-weight: 600;
|
|
@@ -4060,36 +4102,6 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4060
4102
|
letter-spacing: -0.02em;
|
|
4061
4103
|
line-height: 122%;
|
|
4062
4104
|
}
|
|
4063
|
-
@supports (hyphenate-limit-chars: 1) {
|
|
4064
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
4065
|
-
-webkit-hyphens: auto;
|
|
4066
|
-
hyphens: auto;
|
|
4067
|
-
hyphenate-limit-chars: 7 3;
|
|
4068
|
-
}
|
|
4069
|
-
@media (min-width: 768px) {
|
|
4070
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
4071
|
-
hyphenate-limit-chars: 8 3;
|
|
4072
|
-
}
|
|
4073
|
-
}
|
|
4074
|
-
@media (min-width: 992px) {
|
|
4075
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
4076
|
-
hyphenate-limit-chars: 10 4 3;
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
|
-
}
|
|
4080
|
-
@supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
|
|
4081
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
4082
|
-
-webkit-hyphens: auto;
|
|
4083
|
-
hyphens: auto;
|
|
4084
|
-
-webkit-hyphenate-limit-before: 3;
|
|
4085
|
-
-webkit-hyphenate-limit-after: 3;
|
|
4086
|
-
}
|
|
4087
|
-
@media (min-width: 992px) {
|
|
4088
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
4089
|
-
-webkit-hyphenate-limit-before: 4;
|
|
4090
|
-
}
|
|
4091
|
-
}
|
|
4092
|
-
}
|
|
4093
4105
|
.np-popover__container.np-bottom-sheet .np-popover__title + p,
|
|
4094
4106
|
.np-popover__container.np-bottom-sheet .np-popover__title + ul:not(.list-unstyled),
|
|
4095
4107
|
.np-popover__container.np-bottom-sheet .np-popover__title + ol:not(.list-unstyled) {
|
package/src/main.less
CHANGED
package/src/popover/Popover.css
CHANGED
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
line-height: 1.2;
|
|
25
25
|
line-height: var(--line-height-title);
|
|
26
26
|
letter-spacing: 0;
|
|
27
|
+
-webkit-hyphens: auto;
|
|
28
|
+
hyphens: auto;
|
|
27
29
|
margin-bottom: 0;
|
|
28
30
|
margin-bottom: initial;
|
|
29
31
|
font-weight: 600;
|
|
@@ -32,34 +34,6 @@
|
|
|
32
34
|
font-size: var(--font-size-26);
|
|
33
35
|
letter-spacing: -0.02em;
|
|
34
36
|
line-height: 122%;
|
|
35
|
-
}@supports (hyphenate-limit-chars: 1) {
|
|
36
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
37
|
-
-webkit-hyphens: auto;
|
|
38
|
-
hyphens: auto;
|
|
39
|
-
hyphenate-limit-chars: 7 3;
|
|
40
|
-
}
|
|
41
|
-
@media (min-width: 768px) {
|
|
42
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
43
|
-
hyphenate-limit-chars: 8 3;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
@media (min-width: 992px) {
|
|
47
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
48
|
-
hyphenate-limit-chars: 10 4 3;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}@supports (not (hyphenate-limit-chars: 1)) and (-webkit-hyphenate-limit-before: 1) {
|
|
52
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
53
|
-
-webkit-hyphens: auto;
|
|
54
|
-
hyphens: auto;
|
|
55
|
-
-webkit-hyphenate-limit-before: 3;
|
|
56
|
-
-webkit-hyphenate-limit-after: 3;
|
|
57
|
-
}
|
|
58
|
-
@media (min-width: 992px) {
|
|
59
|
-
.np-popover__container.np-bottom-sheet .np-popover__title {
|
|
60
|
-
-webkit-hyphenate-limit-before: 4;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
37
|
}.np-popover__container.np-bottom-sheet .np-popover__title + p,
|
|
64
38
|
.np-popover__container.np-bottom-sheet .np-popover__title + ul:not(.list-unstyled),
|
|
65
39
|
.np-popover__container.np-bottom-sheet .np-popover__title + ol:not(.list-unstyled) {
|