@transferwise/components 46.132.1 → 46.133.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/inputs/InputGroup.js +10 -1
- package/build/inputs/InputGroup.js.map +1 -1
- package/build/inputs/InputGroup.mjs +10 -1
- package/build/inputs/InputGroup.mjs.map +1 -1
- package/build/main.css +18 -2
- package/build/phoneNumberInput/PhoneNumberInput.js +6 -1
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +6 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/styles/inputs/InputGroup.css +10 -2
- package/build/styles/main.css +18 -2
- package/build/styles/phoneNumberInput/PhoneNumberInput.css +5 -0
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/button/_stories/Button.accessibility.docs.mdx +10 -6
- package/src/button/_stories/Button.story.tsx +0 -2
- package/src/common/bottomSheet/BottomSheet.story.tsx +11 -9
- package/src/common/bottomSheet/BottomSheet.test.story.tsx +28 -15
- package/src/divider/Divider.accessibility.docs.mdx +1 -10
- package/src/divider/Divider.story.tsx +0 -1
- package/src/expressiveMoneyInput/ExpressiveMoneyInput.story.tsx +1 -2
- package/src/header/Header.accessibility.docs.mdx +9 -5
- package/src/inputs/InputGroup.css +10 -2
- package/src/inputs/InputGroup.less +12 -2
- package/src/inputs/InputGroup.story.tsx +27 -0
- package/src/inputs/InputGroup.tsx +10 -0
- package/src/inputs/SelectInput/_stories/SelectInput.story.tsx +0 -1
- package/src/legacylistItem/LegacyListItem.test.story.tsx +1 -1
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +0 -1
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +0 -1
- package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +0 -1
- package/src/listItem/Button/ListItemButton.story.tsx +0 -1
- package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +0 -1
- package/src/listItem/IconButton/ListItemIconButton.story.tsx +0 -1
- package/src/listItem/Navigation/ListItemNavigation.story.tsx +0 -1
- package/src/listItem/Prompt/ListItemPrompt.story.tsx +0 -1
- package/src/listItem/Radio/ListItemRadio.story.tsx +0 -1
- package/src/listItem/Switch/ListItemSwitch.story.tsx +0 -1
- package/src/listItem/_stories/ListItem.story.tsx +1 -0
- package/src/main.css +18 -2
- package/src/phoneNumberInput/PhoneNumberInput.css +5 -0
- package/src/phoneNumberInput/PhoneNumberInput.less +7 -0
- package/src/phoneNumberInput/PhoneNumberInput.tsx +10 -1
- package/src/prompt/InlinePrompt/InlinePrompt.story.tsx +0 -1
- package/src/section/Section.story.tsx +12 -7
- package/src/sentimentSurface/SentimentSurface.story.tsx +1 -1
- package/src/snackbar/Snackbar.test.story.tsx +16 -104
- package/src/summary/Summary.test.story.tsx +1 -1
- package/src/switchOption/SwitchOption.story.tsx +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.
|
|
3
|
+
"version": "46.133.0",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"@babel/preset-env": "^7.29.0",
|
|
44
44
|
"@babel/preset-react": "^7.28.5",
|
|
45
45
|
"@babel/preset-typescript": "^7.28.5",
|
|
46
|
-
"@formatjs/cli": "^6.
|
|
46
|
+
"@formatjs/cli": "^6.13.1",
|
|
47
47
|
"@rollup/plugin-babel": "^6.1.0",
|
|
48
48
|
"@rollup/plugin-json": "^6.1.0",
|
|
49
49
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
50
50
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
51
51
|
"@rollup/plugin-url": "^8.0.2",
|
|
52
|
-
"@storybook/addon-a11y": "^10.3.
|
|
53
|
-
"@storybook/addon-docs": "^10.3.
|
|
54
|
-
"@storybook/addon-mcp": "^0.
|
|
52
|
+
"@storybook/addon-a11y": "^10.3.2",
|
|
53
|
+
"@storybook/addon-docs": "^10.3.2",
|
|
54
|
+
"@storybook/addon-mcp": "^0.4.1",
|
|
55
55
|
"@storybook/addon-webpack5-compiler-babel": "^4.0.0",
|
|
56
|
-
"@storybook/react-webpack5": "^10.3.
|
|
56
|
+
"@storybook/react-webpack5": "^10.3.2",
|
|
57
57
|
"@testing-library/dom": "^10.4.1",
|
|
58
58
|
"@testing-library/jest-dom": "^6.9.1",
|
|
59
59
|
"@testing-library/react": "^16.3.2",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@types/babel__core": "^7.20.5",
|
|
64
64
|
"@types/commonmark": "^0.27.10",
|
|
65
65
|
"@types/jest": "^30.0.0",
|
|
66
|
-
"@types/lodash": "4.17.
|
|
66
|
+
"@types/lodash": "4.17.24",
|
|
67
67
|
"@types/lodash.clamp": "^4.0.9",
|
|
68
68
|
"@types/lodash.debounce": "^4.0.9",
|
|
69
69
|
"@types/react": "^18.3.28",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"@wise/art": "^2.26.0",
|
|
73
73
|
"@wise/eslint-config": "^13.3.0",
|
|
74
74
|
"babel-plugin-formatjs": "^10.5.41",
|
|
75
|
-
"eslint": "^9.39.
|
|
76
|
-
"eslint-plugin-storybook": "^10.3.
|
|
75
|
+
"eslint": "^9.39.4",
|
|
76
|
+
"eslint-plugin-storybook": "^10.3.2",
|
|
77
77
|
"gulp": "^5.0.1",
|
|
78
|
-
"jest": "^30.
|
|
78
|
+
"jest": "^30.3.0",
|
|
79
79
|
"jest-environment-jsdom": "^29.7.0",
|
|
80
80
|
"jest-fetch-mock": "^3.0.3",
|
|
81
81
|
"jsdom-testing-mocks": "^1.16.0",
|
|
@@ -83,13 +83,13 @@
|
|
|
83
83
|
"react-intl": "^7.1.14",
|
|
84
84
|
"rollup": "^4.57.1",
|
|
85
85
|
"rollup-preserve-directives": "^1.1.3",
|
|
86
|
-
"storybook": "^10.3.
|
|
87
|
-
"storybook-addon-tag-badges": "^3.0
|
|
86
|
+
"storybook": "^10.3.2",
|
|
87
|
+
"storybook-addon-tag-badges": "^3.1.0",
|
|
88
88
|
"storybook-addon-test-codegen": "^3.0.1",
|
|
89
89
|
"@transferwise/less-config": "3.1.2",
|
|
90
|
-
"@
|
|
90
|
+
"@wise/wds-configs": "0.0.0",
|
|
91
91
|
"@wise/components-theming": "1.10.1",
|
|
92
|
-
"@
|
|
92
|
+
"@transferwise/neptune-css": "14.27.1"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
95
|
"@transferwise/icons": "^3 || ^4",
|
|
@@ -102,24 +102,24 @@
|
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@babel/runtime": "^7.28.6",
|
|
105
|
-
"@floating-ui/react": "^0.27.
|
|
105
|
+
"@floating-ui/react": "^0.27.19",
|
|
106
106
|
"@headlessui/react": "^2.2.9",
|
|
107
107
|
"@popperjs/core": "^2.11.8",
|
|
108
|
-
"@react-aria/focus": "^3.21.
|
|
109
|
-
"@react-aria/overlays": "^3.31.
|
|
110
|
-
"@transferwise/formatting": "^2.13.
|
|
108
|
+
"@react-aria/focus": "^3.21.5",
|
|
109
|
+
"@react-aria/overlays": "^3.31.2",
|
|
110
|
+
"@transferwise/formatting": "^2.13.7",
|
|
111
111
|
"@transferwise/neptune-validation": "^3.3.3",
|
|
112
112
|
"clsx": "^2.1.1",
|
|
113
113
|
"commonmark": "^0.31.2",
|
|
114
114
|
"core-js": "^3.48.0",
|
|
115
|
-
"framer-motion": "^12.
|
|
115
|
+
"framer-motion": "^12.36.0",
|
|
116
116
|
"lodash.clamp": "^4.0.3",
|
|
117
117
|
"lodash.debounce": "^4.0.8",
|
|
118
118
|
"merge-props": "^6.0.0",
|
|
119
119
|
"react-popper": "^2.3.0",
|
|
120
120
|
"react-transition-group": "^4.4.5",
|
|
121
|
-
"virtua": "^0.48.
|
|
122
|
-
"@transferwise/neptune-tokens": "^8.
|
|
121
|
+
"virtua": "^0.48.8",
|
|
122
|
+
"@transferwise/neptune-tokens": "^8.20.3"
|
|
123
123
|
},
|
|
124
124
|
"publishConfig": {
|
|
125
125
|
"access": "public",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, Canvas, Source } from '@storybook/addon-docs/blocks';
|
|
2
2
|
import { Bulb } from '@transferwise/icons';
|
|
3
|
-
import
|
|
4
|
-
import * as stories from './Button.story';
|
|
3
|
+
import ListItem from '../../listItem';
|
|
4
|
+
import * as stories from './Button.test.story';
|
|
5
5
|
|
|
6
6
|
<Meta title="Actions/Button/Accessibility" />
|
|
7
7
|
|
|
@@ -9,11 +9,15 @@ import * as stories from './Button.story';
|
|
|
9
9
|
|
|
10
10
|
Given the `Button` is a widely used and highly sensitive component, there are some instances where care is required to ensure inclusive and accessible experience.
|
|
11
11
|
|
|
12
|
-
<
|
|
13
|
-
media={<Bulb size={24} />}
|
|
12
|
+
<ListItem
|
|
14
13
|
title="Design guidance"
|
|
15
|
-
|
|
16
|
-
href="https://wise.design/components/button#accessibility"
|
|
14
|
+
subtitle="Before you start, familiarise yourself with the dedicated accessibility documentation."
|
|
15
|
+
control={<ListItem.Navigation href="https://wise.design/components/button#accessibility" />}
|
|
16
|
+
media={
|
|
17
|
+
<ListItem.AvatarView>
|
|
18
|
+
<Bulb />
|
|
19
|
+
</ListItem.AvatarView>
|
|
20
|
+
}
|
|
17
21
|
/>
|
|
18
22
|
|
|
19
23
|
<br />
|
|
@@ -153,7 +153,6 @@ const getPropsForPreview = (args: PreviewStoryArgs) => {
|
|
|
153
153
|
const meta: Meta<typeof Button> = {
|
|
154
154
|
component: Button,
|
|
155
155
|
title: 'Actions/Button',
|
|
156
|
-
tags: ['new'],
|
|
157
156
|
argTypes: {
|
|
158
157
|
v2: {
|
|
159
158
|
table: {
|
|
@@ -306,7 +305,6 @@ export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
|
306
305
|
onMouseLeave: { table: { disable: true } },
|
|
307
306
|
...previewArgTypes,
|
|
308
307
|
},
|
|
309
|
-
tags: ['!autodocs'],
|
|
310
308
|
};
|
|
311
309
|
|
|
312
310
|
/**
|
|
@@ -2,15 +2,13 @@ import { action } from 'storybook/actions';
|
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
3
3
|
import { FastFlag } from '@transferwise/icons';
|
|
4
4
|
import { useState } from 'react';
|
|
5
|
-
|
|
6
|
-
import Body from '../../body/Body';
|
|
7
5
|
import Button from '../../button';
|
|
8
|
-
import
|
|
9
|
-
import { lorem10, lorem500 } from '../../test-utils';
|
|
6
|
+
import { lorem10 } from '../../test-utils';
|
|
10
7
|
import Title from '../../title/Title';
|
|
11
8
|
import { Typography } from '../propsValues/typography';
|
|
12
9
|
|
|
13
10
|
import BottomSheet from './BottomSheet';
|
|
11
|
+
import ListItem from '../../listItem';
|
|
14
12
|
|
|
15
13
|
export default {
|
|
16
14
|
component: BottomSheet,
|
|
@@ -48,11 +46,15 @@ export const Basic: Story = {
|
|
|
48
46
|
{lorem10}
|
|
49
47
|
<br />
|
|
50
48
|
<br />
|
|
51
|
-
<
|
|
52
|
-
title="
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
<ListItem
|
|
50
|
+
title="List item"
|
|
51
|
+
subtitle="Button and icon are vertically centered."
|
|
52
|
+
control={<ListItem.Navigation href="#" />}
|
|
53
|
+
media={
|
|
54
|
+
<ListItem.AvatarView>
|
|
55
|
+
<FastFlag />
|
|
56
|
+
</ListItem.AvatarView>
|
|
57
|
+
}
|
|
56
58
|
/>
|
|
57
59
|
</>
|
|
58
60
|
),
|
|
@@ -8,8 +8,8 @@ import { Typography } from '../propsValues/typography';
|
|
|
8
8
|
import Alert from '../../alert';
|
|
9
9
|
import Body from '../../body';
|
|
10
10
|
import Button from '../../button';
|
|
11
|
-
import NavigationOption from '../../navigationOption';
|
|
12
11
|
import Title from '../../title';
|
|
12
|
+
import ListItem from '../../listItem';
|
|
13
13
|
import BottomSheet from './BottomSheet';
|
|
14
14
|
import { withVariantConfig } from '../../../.storybook/helpers';
|
|
15
15
|
|
|
@@ -109,11 +109,15 @@ const Basic: Story = {
|
|
|
109
109
|
{lorem10}
|
|
110
110
|
<br />
|
|
111
111
|
<br />
|
|
112
|
-
<
|
|
113
|
-
title="
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
<ListItem
|
|
113
|
+
title="List item"
|
|
114
|
+
subtitle="Button and icon are vertically centered."
|
|
115
|
+
control={<ListItem.Navigation href="#" />}
|
|
116
|
+
media={
|
|
117
|
+
<ListItem.AvatarView>
|
|
118
|
+
<FastFlag />
|
|
119
|
+
</ListItem.AvatarView>
|
|
120
|
+
}
|
|
117
121
|
/>
|
|
118
122
|
</>
|
|
119
123
|
),
|
|
@@ -153,16 +157,25 @@ const WithOverflowContent: Story = {
|
|
|
153
157
|
<>
|
|
154
158
|
<Title type={Typography.TITLE_SECTION}>Money without borders</Title>
|
|
155
159
|
{lorem10}
|
|
156
|
-
<
|
|
157
|
-
title="
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
<ListItem
|
|
161
|
+
title="List item"
|
|
162
|
+
subtitle="Button and icon are vertically centered."
|
|
163
|
+
control={<ListItem.Navigation href="#" />}
|
|
164
|
+
media={
|
|
165
|
+
<ListItem.AvatarView>
|
|
166
|
+
<FastFlag />
|
|
167
|
+
</ListItem.AvatarView>
|
|
168
|
+
}
|
|
160
169
|
/>
|
|
161
|
-
<
|
|
162
|
-
title="
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
170
|
+
<ListItem
|
|
171
|
+
title="List item"
|
|
172
|
+
subtitle="Button and icon are vertically centered."
|
|
173
|
+
control={<ListItem.Navigation href="#" />}
|
|
174
|
+
media={
|
|
175
|
+
<ListItem.AvatarView>
|
|
176
|
+
<FastFlag />
|
|
177
|
+
</ListItem.AvatarView>
|
|
178
|
+
}
|
|
166
179
|
/>
|
|
167
180
|
{lorem500}
|
|
168
181
|
<Body type={Typography.BODY_DEFAULT_BOLD}>{lorem10}</Body>
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { Meta,
|
|
2
|
-
import { NavigationOption } from '..';
|
|
3
|
-
import { Bulb } from '@transferwise/icons';
|
|
1
|
+
import { Meta, Source } from '@storybook/addon-docs/blocks';
|
|
4
2
|
|
|
5
3
|
<Meta title="Layouts/Divider/Accessibility" />
|
|
6
4
|
|
|
@@ -8,13 +6,6 @@ import { Bulb } from '@transferwise/icons';
|
|
|
8
6
|
|
|
9
7
|
A Divider is used to separate sections of content. While it doesn't directly announce anything to screen readers, there are a few considerations:
|
|
10
8
|
|
|
11
|
-
<NavigationOption
|
|
12
|
-
media={<Bulb size={24} />}
|
|
13
|
-
title="Design guidance"
|
|
14
|
-
content="Before you start, please review the documentation on how separators should be used, announced or hidden from assistive tech."
|
|
15
|
-
href="https://wise.design/components/divider"
|
|
16
|
-
/>
|
|
17
|
-
|
|
18
9
|
<br />
|
|
19
10
|
<br />
|
|
20
11
|
|
|
@@ -52,7 +52,7 @@ const withScrollbarProtector: Decorator = (Story) => (
|
|
|
52
52
|
export default {
|
|
53
53
|
title: 'Forms/ExpressiveMoneyInput',
|
|
54
54
|
component: ExpressiveMoneyInput,
|
|
55
|
-
tags: ['contribution'],
|
|
55
|
+
tags: ['early-access', 'contribution'],
|
|
56
56
|
parameters: {
|
|
57
57
|
docs: {
|
|
58
58
|
canvas: {
|
|
@@ -78,7 +78,6 @@ export default {
|
|
|
78
78
|
type Story = StoryObj<ExpressiveMoneyInputProps>;
|
|
79
79
|
|
|
80
80
|
export const Playground: Story = {
|
|
81
|
-
tags: ['!autodocs'],
|
|
82
81
|
render: (args: ExpressiveMoneyInputProps) => <ExpressiveMoneyInput {...args} />,
|
|
83
82
|
};
|
|
84
83
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, Canvas, Source } from '@storybook/addon-docs/blocks';
|
|
2
|
-
import { NavigationOption } from '..';
|
|
3
2
|
import { Bulb } from '@transferwise/icons';
|
|
3
|
+
import ListItem from '../listItem';
|
|
4
4
|
import * as stories from './Header.story';
|
|
5
5
|
|
|
6
6
|
<Meta title="Typography/Header/Accessibility" />
|
|
@@ -9,11 +9,15 @@ import * as stories from './Header.story';
|
|
|
9
9
|
|
|
10
10
|
Given the `Header` is a key component for structuring content and conveying hierarchy, ensuring its accessibility is crucial for an inclusive experience.
|
|
11
11
|
|
|
12
|
-
<
|
|
13
|
-
media={<Bulb size={24} />}
|
|
12
|
+
<ListItem
|
|
14
13
|
title="Design guidance"
|
|
15
|
-
|
|
16
|
-
href="https://wise.design/components/section-header
|
|
14
|
+
subtitle="Before you start, familiarise yourself with the provided guidance."
|
|
15
|
+
control={<ListItem.Navigation href="https://wise.design/components/section-header" />}
|
|
16
|
+
media={
|
|
17
|
+
<ListItem.AvatarView>
|
|
18
|
+
<Bulb />
|
|
19
|
+
</ListItem.AvatarView>
|
|
20
|
+
}
|
|
17
21
|
/>
|
|
18
22
|
|
|
19
23
|
<br />
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
grid-column-start: 1;
|
|
11
11
|
grid-row-start: 1;
|
|
12
12
|
}
|
|
13
|
+
.np-input-group .np-input-addon--avatar + fieldset .form-control.np-form-control.np-form-control--size-md.np-button-input {
|
|
14
|
+
padding-left: 48px;
|
|
15
|
+
padding-left: var(--size-48);
|
|
16
|
+
}
|
|
13
17
|
.np-input-addon {
|
|
14
18
|
pointer-events: none;
|
|
15
19
|
z-index: 10;
|
|
@@ -21,14 +25,18 @@
|
|
|
21
25
|
transition-timing-function: ease-out;
|
|
22
26
|
transition-duration: 150ms;
|
|
23
27
|
}
|
|
28
|
+
.np-input-addon.np-input-addon--avatar > .np-avatar-view {
|
|
29
|
+
margin-right: 8px;
|
|
30
|
+
margin-right: var(--size-8);
|
|
31
|
+
}
|
|
24
32
|
.np-input-group:disabled .np-input-addon:not(.np-input-addon--interactive) {
|
|
25
33
|
opacity: 0.45;
|
|
26
34
|
mix-blend-mode: luminosity;
|
|
27
35
|
}
|
|
28
|
-
.np-input-group:has( > :is(input,button,select):focus-visible) .np-input-addon {
|
|
36
|
+
.np-input-group:has( > :is(input, button, select):focus-visible) .np-input-addon {
|
|
29
37
|
color: var(--color-interactive-primary);
|
|
30
38
|
}
|
|
31
|
-
.np-input-group:has( > :is(input,button,select):hover) .np-input-addon {
|
|
39
|
+
.np-input-group:has( > :is(input, button, select):hover) .np-input-addon {
|
|
32
40
|
color: #b5b7ba;
|
|
33
41
|
color: var(--color-interactive-secondary-hover);
|
|
34
42
|
}
|
|
@@ -10,9 +10,19 @@
|
|
|
10
10
|
|
|
11
11
|
/* Prevent unwanted `group-hover/input` triggers */
|
|
12
12
|
border-radius: var(--radius-full);
|
|
13
|
+
|
|
14
|
+
.np-input-addon--avatar
|
|
15
|
+
+ fieldset
|
|
16
|
+
.form-control.np-form-control.np-form-control--size-md.np-button-input {
|
|
17
|
+
padding-left: 48px;
|
|
18
|
+
padding-left: var(--size-48);
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
.np-input-addon {
|
|
23
|
+
&.np-input-addon--avatar > .np-avatar-view {
|
|
24
|
+
margin-right: var(--size-8);
|
|
25
|
+
}
|
|
16
26
|
pointer-events: none;
|
|
17
27
|
z-index: 10;
|
|
18
28
|
display: inline-flex;
|
|
@@ -27,11 +37,11 @@
|
|
|
27
37
|
mix-blend-mode: luminosity;
|
|
28
38
|
}
|
|
29
39
|
|
|
30
|
-
.np-input-group:has(
|
|
40
|
+
.np-input-group:has(> :is(input, button, select):focus-visible) & {
|
|
31
41
|
color: var(--color-interactive-primary);
|
|
32
42
|
}
|
|
33
43
|
|
|
34
|
-
.np-input-group:has(
|
|
44
|
+
.np-input-group:has(> :is(input, button, select):hover) & {
|
|
35
45
|
color: var(--color-interactive-secondary-hover);
|
|
36
46
|
}
|
|
37
47
|
|
|
@@ -6,7 +6,10 @@ import { Button } from '..';
|
|
|
6
6
|
import { Field } from '../field/Field';
|
|
7
7
|
|
|
8
8
|
import { Input } from './Input';
|
|
9
|
+
import { Flag } from '@wise/art';
|
|
9
10
|
import { InputGroup } from './InputGroup';
|
|
11
|
+
import AvatarView from '../avatarView';
|
|
12
|
+
import PhoneNumberInput from '../phoneNumberInput';
|
|
10
13
|
|
|
11
14
|
export default {
|
|
12
15
|
component: InputGroup,
|
|
@@ -81,3 +84,27 @@ function InputGroupWithSuffix(args: NonNullable<Story['args']>) {
|
|
|
81
84
|
</InputGroup>
|
|
82
85
|
);
|
|
83
86
|
}
|
|
87
|
+
|
|
88
|
+
export const PhoneNumberWithPrefix: Story = {
|
|
89
|
+
render: (args) => <PhoneNumberInputGroupWithPrefix {...args} />,
|
|
90
|
+
args: {
|
|
91
|
+
disabled: false,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
function PhoneNumberInputGroupWithPrefix(args: NonNullable<Story['args']>) {
|
|
96
|
+
return (
|
|
97
|
+
<InputGroup
|
|
98
|
+
{...args}
|
|
99
|
+
addonStart={{
|
|
100
|
+
content: (
|
|
101
|
+
<AvatarView size={24}>
|
|
102
|
+
<Flag code="gbp" />
|
|
103
|
+
</AvatarView>
|
|
104
|
+
),
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
<PhoneNumberInput onChange={() => {}} />
|
|
108
|
+
</InputGroup>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
@@ -126,6 +126,15 @@ function InputAddon({
|
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
+
const isAvatarView = (node: unknown): boolean => {
|
|
130
|
+
if (!node || typeof node !== 'object') return false;
|
|
131
|
+
const { type } = node as { type?: { displayName?: string; name?: string } };
|
|
132
|
+
if (!type || (typeof type !== 'function' && typeof type !== 'object')) return false;
|
|
133
|
+
return type.displayName === 'AvatarView' || type.name === 'AvatarView';
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const hasAvatarView = Array.isArray(content) ? content.some(isAvatarView) : isAvatarView(content);
|
|
137
|
+
|
|
129
138
|
return (
|
|
130
139
|
/* Prevent nested controls from being labeled redundantly */
|
|
131
140
|
<FieldLabelContextProvider value={undefined}>
|
|
@@ -145,6 +154,7 @@ function InputAddon({
|
|
|
145
154
|
'np-input-addon--padding-sm': padding === 'sm',
|
|
146
155
|
'np-input-addon--padding-md': padding === 'md',
|
|
147
156
|
},
|
|
157
|
+
hasAvatarView && 'np-input-addon--avatar',
|
|
148
158
|
)}
|
|
149
159
|
>
|
|
150
160
|
{content}
|
|
@@ -146,7 +146,6 @@ export default meta;
|
|
|
146
146
|
type Story = StoryObj<ListItemButtonProps>;
|
|
147
147
|
|
|
148
148
|
export const Playground: StoryObj<PreviewStoryArgs> = {
|
|
149
|
-
tags: ['!autodocs'],
|
|
150
149
|
render: (args: PreviewStoryArgs) => {
|
|
151
150
|
const [props, previewProps] = getPropsForPreview(args);
|
|
152
151
|
|
package/src/main.css
CHANGED
|
@@ -30167,6 +30167,11 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
30167
30167
|
grid-row-start: 1;
|
|
30168
30168
|
}
|
|
30169
30169
|
|
|
30170
|
+
.np-input-group .np-input-addon--avatar + fieldset .form-control.np-form-control.np-form-control--size-md.np-button-input {
|
|
30171
|
+
padding-left: 48px;
|
|
30172
|
+
padding-left: var(--size-48);
|
|
30173
|
+
}
|
|
30174
|
+
|
|
30170
30175
|
.np-input-addon {
|
|
30171
30176
|
pointer-events: none;
|
|
30172
30177
|
z-index: 10;
|
|
@@ -30179,16 +30184,21 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
30179
30184
|
transition-duration: 150ms;
|
|
30180
30185
|
}
|
|
30181
30186
|
|
|
30187
|
+
.np-input-addon.np-input-addon--avatar > .np-avatar-view {
|
|
30188
|
+
margin-right: 8px;
|
|
30189
|
+
margin-right: var(--size-8);
|
|
30190
|
+
}
|
|
30191
|
+
|
|
30182
30192
|
.np-input-group:disabled .np-input-addon:not(.np-input-addon--interactive) {
|
|
30183
30193
|
opacity: 0.45;
|
|
30184
30194
|
mix-blend-mode: luminosity;
|
|
30185
30195
|
}
|
|
30186
30196
|
|
|
30187
|
-
.np-input-group:has( > :is(input,button,select):focus-visible) .np-input-addon {
|
|
30197
|
+
.np-input-group:has( > :is(input, button, select):focus-visible) .np-input-addon {
|
|
30188
30198
|
color: var(--color-interactive-primary);
|
|
30189
30199
|
}
|
|
30190
30200
|
|
|
30191
|
-
.np-input-group:has( > :is(input,button,select):hover) .np-input-addon {
|
|
30201
|
+
.np-input-group:has( > :is(input, button, select):hover) .np-input-addon {
|
|
30192
30202
|
color: #b5b7ba;
|
|
30193
30203
|
color: var(--color-interactive-secondary-hover);
|
|
30194
30204
|
}
|
|
@@ -31687,6 +31697,12 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
31687
31697
|
width: 100%;
|
|
31688
31698
|
}
|
|
31689
31699
|
|
|
31700
|
+
.tw-telephone__country-select--with-input-group-addon-start .np-button-input {
|
|
31701
|
+
padding-inline-start: 48px;
|
|
31702
|
+
padding-inline-start: var(--size-48);
|
|
31703
|
+
padding-inline-end: 26px !important;
|
|
31704
|
+
}
|
|
31705
|
+
|
|
31690
31706
|
.tw-telephone__number-input {
|
|
31691
31707
|
flex: auto 1 1;
|
|
31692
31708
|
}
|
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
.tw-telephone__country-select .np-input-group {
|
|
19
19
|
width: 100%;
|
|
20
20
|
}
|
|
21
|
+
.tw-telephone__country-select--with-input-group-addon-start .np-button-input {
|
|
22
|
+
padding-inline-start: 48px;
|
|
23
|
+
padding-inline-start: var(--size-48);
|
|
24
|
+
padding-inline-end: 26px !important;
|
|
25
|
+
}
|
|
21
26
|
.tw-telephone__number-input {
|
|
22
27
|
flex: auto 1 1;
|
|
23
28
|
}
|
|
@@ -19,6 +19,13 @@
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
.tw-telephone__country-select--with-input-group-addon-start {
|
|
23
|
+
.np-button-input {
|
|
24
|
+
padding-inline-start: var(--size-48);
|
|
25
|
+
padding-inline-end: 26px !important;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
.tw-telephone__number-input {
|
|
23
30
|
flex: auto 1 1;
|
|
24
31
|
}
|