@transferwise/components 45.16.0 → 45.17.1
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/i18n/en.json +1 -0
- package/build/index.esm.js +52 -57
- package/build/index.esm.js.map +1 -1
- package/build/index.js +52 -57
- package/build/index.js.map +1 -1
- package/build/main.css +1 -1
- package/build/styles/common/Option/Option.css +1 -1
- package/build/styles/inputs/SelectInput.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/button/Button.messages.d.ts +9 -0
- package/build/types/button/Button.messages.d.ts.map +1 -0
- package/build/types/common/index.d.ts +1 -0
- package/build/types/common/randomId.d.ts +13 -0
- package/build/types/common/randomId.d.ts.map +1 -0
- package/build/types/promoCard/PromoCard.d.ts.map +1 -1
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/select/searchBox/SearchBox.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/accordion/AccordionItem/AccordionItem.spec.js +1 -0
- package/src/accordion/AccordionItem/AccordionItem.tsx +19 -11
- package/src/accordion/AccordionItem/__snapshots__/AccordionItem.spec.js.snap +18 -4
- package/src/button/Button.messages.js +9 -0
- package/src/button/Button.spec.js +1 -2
- package/src/button/Button.tsx +11 -1
- package/src/button/__snapshots__/Button.spec.js.snap +22 -15
- package/src/common/Option/Option.css +1 -1
- package/src/common/Option/Option.less +0 -5
- package/src/common/index.js +1 -0
- package/src/common/randomId.ts +14 -0
- package/src/dateInput/DateInput.story.tsx +0 -3
- package/src/i18n/en.json +1 -0
- package/src/inputs/SelectInput.css +1 -1
- package/src/inputs/SelectInput.less +3 -0
- package/src/main.css +1 -1
- package/src/main.less +0 -3
- package/src/moneyInput/MoneyInput.story.tsx +0 -3
- package/src/phoneNumberInput/PhoneNumberInput.story.js +0 -3
- package/src/promoCard/PromoCard.tsx +1 -16
- package/src/select/Select.js +2 -0
- package/src/select/Select.story.js +0 -6
- package/src/select/searchBox/SearchBox.spec.js +3 -7
- package/src/select/searchBox/SearchBox.tsx +2 -0
- package/src/upload/Upload.spec.js +2 -0
- package/src/select/searchBox/__snapshots__/SearchBox.spec.js.snap +0 -46
package/src/main.less
CHANGED
|
@@ -30,9 +30,6 @@
|
|
|
30
30
|
@import "./header/Header.less";
|
|
31
31
|
@import "./image/Image.less";
|
|
32
32
|
@import "./info/Info.less";
|
|
33
|
-
@import "./inputs/_BottomSheet.less";
|
|
34
|
-
@import "./inputs/_ButtonInput.less";
|
|
35
|
-
@import "./inputs/_Popover.less";
|
|
36
33
|
@import "./inputs/Input.less";
|
|
37
34
|
@import "./inputs/InputGroup.less";
|
|
38
35
|
@import "./inputs/SelectInput.less";
|
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import React, { forwardRef, FunctionComponent, ReactElement, useEffect, useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import Body from '../body';
|
|
6
|
-
import { Typography } from '../common';
|
|
6
|
+
import { Typography, generateRandomId } from '../common';
|
|
7
7
|
import Card, { CardProps } from '../common/card';
|
|
8
8
|
import Display from '../display';
|
|
9
9
|
import Image from '../image/Image';
|
|
@@ -142,21 +142,6 @@ export type PolymorphicPromoCard = (
|
|
|
142
142
|
props: PromoCardLinkProps | PromoCardCheckedProps,
|
|
143
143
|
) => JSX.Element;
|
|
144
144
|
|
|
145
|
-
/**
|
|
146
|
-
* generateRandomId() function
|
|
147
|
-
*
|
|
148
|
-
* This function generates a random string of characters that can be used as
|
|
149
|
-
* an ID.
|
|
150
|
-
*
|
|
151
|
-
* @returns {string} A random string of characters.
|
|
152
|
-
* @example
|
|
153
|
-
* const id = generateRandomId();
|
|
154
|
-
* // id will be a random string of characters, such as "id-4711".
|
|
155
|
-
*/
|
|
156
|
-
const generateRandomId = (): string => {
|
|
157
|
-
return `id-${Math.random().toString(36).slice(7)}`;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
145
|
/**
|
|
161
146
|
* PromoCard component.
|
|
162
147
|
*
|
package/src/select/Select.js
CHANGED
|
@@ -333,6 +333,8 @@ export default function Select({
|
|
|
333
333
|
ref={optionsListReference}
|
|
334
334
|
id={listboxId}
|
|
335
335
|
role="listbox"
|
|
336
|
+
aria-orientation="vertical"
|
|
337
|
+
aria-activedescendant={getUniqueIdForOption(id, selected)}
|
|
336
338
|
tabIndex="-1"
|
|
337
339
|
className={dropdownClass}
|
|
338
340
|
{...dropdownProps}
|
|
@@ -41,12 +41,6 @@ export const Basic = () => {
|
|
|
41
41
|
return (
|
|
42
42
|
<Select
|
|
43
43
|
id={id}
|
|
44
|
-
buttonProps={{
|
|
45
|
-
'aria-label': 'Basic button',
|
|
46
|
-
}}
|
|
47
|
-
dropdownProps={{
|
|
48
|
-
'aria-label': 'Options for basic button',
|
|
49
|
-
}}
|
|
50
44
|
size={size}
|
|
51
45
|
classNames={`${hasError ? 'has-error' : ''}`}
|
|
52
46
|
placeholder={placeholder}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import '
|
|
2
|
-
|
|
3
|
-
import { render } from '../../test-utils';
|
|
1
|
+
import { render, screen } from '../../test-utils';
|
|
4
2
|
|
|
5
3
|
import SearchBox from '.';
|
|
6
4
|
|
|
7
|
-
jest.mock('react-transition-group/Transition', () => jest.fn('placeholder'));
|
|
8
|
-
|
|
9
5
|
describe('SearchBox', () => {
|
|
10
6
|
const props = {
|
|
11
7
|
classNames: {},
|
|
@@ -17,8 +13,8 @@ describe('SearchBox', () => {
|
|
|
17
13
|
};
|
|
18
14
|
|
|
19
15
|
it('renders', () => {
|
|
20
|
-
|
|
16
|
+
render(<SearchBox {...props} />);
|
|
21
17
|
|
|
22
|
-
expect(
|
|
18
|
+
expect(screen.getByRole('searchbox')).toBeInTheDocument();
|
|
23
19
|
});
|
|
24
20
|
});
|
|
@@ -15,6 +15,7 @@ jest.mock('./utils/asyncFileRead');
|
|
|
15
15
|
const { asyncFileRead } = require('./utils/asyncFileRead');
|
|
16
16
|
|
|
17
17
|
const defaultLocale = 'en-GB';
|
|
18
|
+
const formatMessage = (id) => `${id}`;
|
|
18
19
|
jest.mock('react-intl', () => ({
|
|
19
20
|
injectIntl: (Component) =>
|
|
20
21
|
function (props) {
|
|
@@ -22,6 +23,7 @@ jest.mock('react-intl', () => ({
|
|
|
22
23
|
<Component {...props} intl={{ locale: defaultLocale, formatMessage: (id) => `${id}` }} />
|
|
23
24
|
);
|
|
24
25
|
},
|
|
26
|
+
useIntl: () => ({ formatMessage }),
|
|
25
27
|
defineMessages: (translations) => translations,
|
|
26
28
|
}));
|
|
27
29
|
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`SearchBox renders 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<li
|
|
6
|
-
class="border-bottom"
|
|
7
|
-
>
|
|
8
|
-
<a
|
|
9
|
-
class="np-select-filter-link p-a-0"
|
|
10
|
-
>
|
|
11
|
-
<div
|
|
12
|
-
class="input-group"
|
|
13
|
-
>
|
|
14
|
-
<span
|
|
15
|
-
class="input-group-addon input-group-addon--search"
|
|
16
|
-
>
|
|
17
|
-
<span
|
|
18
|
-
aria-hidden="true"
|
|
19
|
-
class="tw-icon tw-icon-search tw-icon tw-icon-search"
|
|
20
|
-
data-testid="search-icon"
|
|
21
|
-
role="presentation"
|
|
22
|
-
>
|
|
23
|
-
<svg
|
|
24
|
-
fill="currentColor"
|
|
25
|
-
focusable="false"
|
|
26
|
-
height="24"
|
|
27
|
-
viewBox="0 0 24 24"
|
|
28
|
-
width="24"
|
|
29
|
-
>
|
|
30
|
-
<path
|
|
31
|
-
d="m20.786 19.543-4.029-4.029c1.072-1.328 1.672-3 1.672-4.8C18.429 6.471 14.957 3 10.714 3S3 6.471 3 10.714s3.471 7.715 7.714 7.715c1.8 0 3.472-.643 4.8-1.672l4.029 4.029 1.243-1.243Zm-10.029-2.829c-3.3 0-6-2.7-6-6s2.7-6 6-6 6 2.7 6 6-2.7 6-6 6Z"
|
|
32
|
-
/>
|
|
33
|
-
</svg>
|
|
34
|
-
</span>
|
|
35
|
-
</span>
|
|
36
|
-
<input
|
|
37
|
-
class="np-select-filter form-control np-form-control np-form-control--size-auto np-text-body-large np-input np-input--shape-rectangle"
|
|
38
|
-
placeholder="placeholder"
|
|
39
|
-
spellcheck="false"
|
|
40
|
-
value="value"
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
|
-
</a>
|
|
44
|
-
</li>
|
|
45
|
-
</div>
|
|
46
|
-
`;
|