@transferwise/components 46.97.5 → 46.98.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/alert/Alert.js +8 -0
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +8 -0
- package/build/alert/Alert.mjs.map +1 -1
- package/build/common/closeButton/CloseButton.js +3 -1
- package/build/common/closeButton/CloseButton.js.map +1 -1
- package/build/common/closeButton/CloseButton.mjs +3 -1
- package/build/common/closeButton/CloseButton.mjs.map +1 -1
- package/build/dateInput/DateInput.js +4 -4
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +4 -4
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +4 -4
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +4 -4
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.js +3 -3
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.js.map +1 -1
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs +3 -3
- package/build/dateLookup/dayCalendar/table/DayCalendarTable.mjs.map +1 -1
- package/build/i18n/cs.json +3 -2
- package/build/i18n/cs.json.js +3 -2
- package/build/i18n/cs.json.js.map +1 -1
- package/build/i18n/cs.json.mjs +3 -2
- package/build/i18n/cs.json.mjs.map +1 -1
- package/build/i18n/de.json +3 -2
- package/build/i18n/de.json.js +3 -2
- package/build/i18n/de.json.js.map +1 -1
- package/build/i18n/de.json.mjs +3 -2
- package/build/i18n/de.json.mjs.map +1 -1
- package/build/i18n/en.json +3 -2
- package/build/i18n/en.json.js +3 -2
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +3 -2
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/i18n/es.json +3 -2
- package/build/i18n/es.json.js +3 -2
- package/build/i18n/es.json.js.map +1 -1
- package/build/i18n/es.json.mjs +3 -2
- package/build/i18n/es.json.mjs.map +1 -1
- package/build/i18n/fr.json +3 -2
- package/build/i18n/fr.json.js +3 -2
- package/build/i18n/fr.json.js.map +1 -1
- package/build/i18n/fr.json.mjs +3 -2
- package/build/i18n/fr.json.mjs.map +1 -1
- package/build/i18n/hu.json +3 -2
- package/build/i18n/hu.json.js +3 -2
- package/build/i18n/hu.json.js.map +1 -1
- package/build/i18n/hu.json.mjs +3 -2
- package/build/i18n/hu.json.mjs.map +1 -1
- package/build/i18n/id.json +3 -2
- package/build/i18n/id.json.js +3 -2
- package/build/i18n/id.json.js.map +1 -1
- package/build/i18n/id.json.mjs +3 -2
- package/build/i18n/id.json.mjs.map +1 -1
- package/build/i18n/it.json +3 -2
- package/build/i18n/it.json.js +3 -2
- package/build/i18n/it.json.js.map +1 -1
- package/build/i18n/it.json.mjs +3 -2
- package/build/i18n/it.json.mjs.map +1 -1
- package/build/i18n/ja.json +3 -2
- package/build/i18n/ja.json.js +3 -2
- package/build/i18n/ja.json.js.map +1 -1
- package/build/i18n/ja.json.mjs +3 -2
- package/build/i18n/ja.json.mjs.map +1 -1
- package/build/i18n/nl.json +6 -5
- package/build/i18n/pl.json +3 -2
- package/build/i18n/pl.json.js +3 -2
- package/build/i18n/pl.json.js.map +1 -1
- package/build/i18n/pl.json.mjs +3 -2
- package/build/i18n/pl.json.mjs.map +1 -1
- package/build/i18n/pt.json +3 -2
- package/build/i18n/pt.json.js +3 -2
- package/build/i18n/pt.json.js.map +1 -1
- package/build/i18n/pt.json.mjs +3 -2
- package/build/i18n/pt.json.mjs.map +1 -1
- package/build/i18n/ro.json +3 -2
- package/build/i18n/ro.json.js +3 -2
- package/build/i18n/ro.json.js.map +1 -1
- package/build/i18n/ro.json.mjs +3 -2
- package/build/i18n/ro.json.mjs.map +1 -1
- package/build/i18n/ru.json +3 -2
- package/build/i18n/ru.json.js +3 -2
- package/build/i18n/ru.json.js.map +1 -1
- package/build/i18n/ru.json.mjs +3 -2
- package/build/i18n/ru.json.mjs.map +1 -1
- package/build/i18n/th.json +3 -2
- package/build/i18n/th.json.js +3 -2
- package/build/i18n/th.json.js.map +1 -1
- package/build/i18n/th.json.mjs +3 -2
- package/build/i18n/th.json.mjs.map +1 -1
- package/build/i18n/tr.json +3 -2
- package/build/i18n/tr.json.js +3 -2
- package/build/i18n/tr.json.js.map +1 -1
- package/build/i18n/tr.json.mjs +3 -2
- package/build/i18n/tr.json.mjs.map +1 -1
- package/build/i18n/zh-CN.json +3 -2
- package/build/i18n/zh-CN.json.js +3 -2
- package/build/i18n/zh-CN.json.js.map +1 -1
- package/build/i18n/zh-CN.json.mjs +3 -2
- package/build/i18n/zh-CN.json.mjs.map +1 -1
- package/build/i18n/zh-HK.json +3 -2
- package/build/i18n/zh-HK.json.js +3 -2
- package/build/i18n/zh-HK.json.js.map +1 -1
- package/build/i18n/zh-HK.json.mjs +3 -2
- package/build/i18n/zh-HK.json.mjs.map +1 -1
- package/build/image/Image.js +9 -10
- package/build/image/Image.js.map +1 -1
- package/build/image/Image.mjs +11 -11
- package/build/image/Image.mjs.map +1 -1
- package/build/index.js +0 -2
- package/build/index.js.map +1 -1
- package/build/index.mjs +0 -1
- package/build/index.mjs.map +1 -1
- package/build/main.css +16 -45
- package/build/moneyInput/MoneyInput.js +4 -8
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.messages.js +3 -0
- package/build/moneyInput/MoneyInput.messages.js.map +1 -1
- package/build/moneyInput/MoneyInput.messages.mjs +3 -0
- package/build/moneyInput/MoneyInput.messages.mjs.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +4 -8
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +36 -2
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.messages.js +6 -0
- package/build/phoneNumberInput/PhoneNumberInput.messages.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.messages.mjs +6 -0
- package/build/phoneNumberInput/PhoneNumberInput.messages.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +36 -2
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/snackbar/Snackbar.js +1 -1
- package/build/snackbar/Snackbar.js.map +1 -1
- package/build/snackbar/Snackbar.mjs +1 -1
- package/build/snackbar/Snackbar.mjs.map +1 -1
- package/build/styles/circularButton/CircularButton.css +1 -0
- package/build/styles/dateInput/DateInput.css +13 -0
- package/build/styles/main.css +16 -45
- package/build/styles/uploadInput/uploadItem/UploadItem.css +2 -1
- package/build/tabs/Tabs.js +3 -3
- package/build/tabs/Tabs.js.map +1 -1
- package/build/tabs/Tabs.mjs +3 -3
- package/build/tabs/Tabs.mjs.map +1 -1
- package/build/test-utils/assets/apple-pay-logo.svg +84 -0
- package/build/typeahead/Typeahead.js +2 -2
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +2 -2
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.js +2 -2
- package/build/typeahead/typeaheadInput/TypeaheadInput.js.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs +2 -2
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs.map +1 -1
- package/build/types/alert/Alert.d.ts.map +1 -1
- package/build/types/common/closeButton/CloseButton.d.ts +2 -0
- package/build/types/common/closeButton/CloseButton.d.ts.map +1 -1
- package/build/types/image/Image.d.ts +0 -1
- package/build/types/image/Image.d.ts.map +1 -1
- package/build/types/index.d.ts +0 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.messages.d.ts +5 -0
- package/build/types/moneyInput/MoneyInput.messages.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
- package/build/types/phoneNumberInput/PhoneNumberInput.messages.d.ts +8 -0
- package/build/types/phoneNumberInput/PhoneNumberInput.messages.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/test-utils/index.d.ts +6 -4
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts +1 -2
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/upload/steps/processingStep/processingStep.d.ts +1 -3
- package/build/types/upload/steps/processingStep/processingStep.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts.map +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts +1 -1
- package/build/types/uploadInput/uploadItem/UploadItem.d.ts.map +1 -1
- package/build/types/withDisplayFormat/WithDisplayFormat.d.ts.map +1 -1
- package/build/upload/Upload.js +29 -45
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.mjs +29 -45
- package/build/upload/Upload.mjs.map +1 -1
- package/build/upload/steps/processingStep/processingStep.js +1 -3
- package/build/upload/steps/processingStep/processingStep.js.map +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +1 -3
- package/build/upload/steps/processingStep/processingStep.mjs.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js +54 -6
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +54 -6
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +12 -6
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +12 -6
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.js +3 -2
- package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.mjs +3 -2
- package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
- package/package.json +14 -17
- package/src/alert/Alert.spec.tsx +11 -0
- package/src/alert/Alert.story.tsx +23 -9
- package/src/alert/Alert.tsx +14 -1
- package/src/circularButton/CircularButton.css +1 -0
- package/src/circularButton/CircularButton.less +1 -0
- package/src/circularButton/CircularButton.tests.story.tsx +23 -0
- package/src/common/closeButton/CloseButton.spec.tsx +13 -1
- package/src/common/closeButton/CloseButton.tsx +3 -0
- package/src/dateInput/DateInput.css +13 -0
- package/src/dateInput/DateInput.less +20 -0
- package/src/dateInput/DateInput.tests.story.tsx +14 -3
- package/src/dateInput/DateInput.tsx +4 -4
- package/src/i18n/cs.json +3 -2
- package/src/i18n/de.json +3 -2
- package/src/i18n/en.json +3 -2
- package/src/i18n/es.json +3 -2
- package/src/i18n/fr.json +3 -2
- package/src/i18n/hu.json +3 -2
- package/src/i18n/id.json +3 -2
- package/src/i18n/it.json +3 -2
- package/src/i18n/ja.json +3 -2
- package/src/i18n/nl.json +6 -5
- package/src/i18n/pl.json +3 -2
- package/src/i18n/pt.json +3 -2
- package/src/i18n/ro.json +3 -2
- package/src/i18n/ru.json +3 -2
- package/src/i18n/th.json +3 -2
- package/src/i18n/tr.json +3 -2
- package/src/i18n/zh-CN.json +3 -2
- package/src/i18n/zh-HK.json +3 -2
- package/src/image/Image.spec.tsx +3 -3
- package/src/image/Image.tsx +10 -12
- package/src/index.ts +0 -2
- package/src/legacylistItem/LegacyListItem.story.tsx +5 -5
- package/src/legacylistItem/LegacyListItem.tests.story.tsx +6 -6
- package/src/main.css +16 -45
- package/src/main.less +0 -1
- package/src/moneyInput/MoneyInput.messages.ts +5 -0
- package/src/moneyInput/MoneyInput.spec.tsx +42 -5
- package/src/moneyInput/MoneyInput.story.tsx +11 -2
- package/src/moneyInput/MoneyInput.tsx +5 -7
- package/src/phoneNumberInput/PhoneNumberInput.messages.ts +8 -0
- package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +77 -43
- package/src/phoneNumberInput/PhoneNumberInput.tsx +34 -2
- package/src/promoCard/__snapshots__/PromoCard.spec.tsx.snap +1 -0
- package/src/promoCard/__snapshots__/PromoCardGroup.spec.tsx.snap +2 -0
- package/src/ssr.spec.tsx +0 -1
- package/src/test-utils/assets/apple-pay-logo.svg +84 -0
- package/src/test-utils/fake-data.ts +5 -0
- package/src/test-utils/jest.setup.ts +0 -4
- package/src/typeahead/Typeahead.spec.tsx +182 -0
- package/src/typeahead/typeaheadInput/TypeaheadInput.spec.tsx +103 -0
- package/src/typeahead/util/highlight.spec.tsx +43 -0
- package/src/upload/Upload.spec.tsx +63 -0
- package/src/upload/Upload.story.tsx +0 -51
- package/src/upload/Upload.tests.story.tsx +93 -0
- package/src/upload/Upload.tsx +28 -49
- package/src/upload/steps/processingStep/processingStep.tsx +2 -7
- package/src/uploadInput/UploadInput.tsx +74 -10
- package/src/uploadInput/uploadItem/UploadItem.css +2 -1
- package/src/uploadInput/uploadItem/UploadItem.less +1 -1
- package/src/uploadInput/uploadItem/UploadItem.tsx +11 -6
- package/src/withDisplayFormat/WithDisplayFormat.spec.js +11 -15
- package/src/withDisplayFormat/WithDisplayFormat.tsx +3 -2
- package/build/selectOption/SelectOption.js +0 -131
- package/build/selectOption/SelectOption.js.map +0 -1
- package/build/selectOption/SelectOption.messages.js +0 -17
- package/build/selectOption/SelectOption.messages.js.map +0 -1
- package/build/selectOption/SelectOption.messages.mjs +0 -13
- package/build/selectOption/SelectOption.messages.mjs.map +0 -1
- package/build/selectOption/SelectOption.mjs +0 -127
- package/build/selectOption/SelectOption.mjs.map +0 -1
- package/build/styles/selectOption/SelectOption.css +0 -44
- package/build/types/selectOption/SelectOption.d.ts +0 -21
- package/build/types/selectOption/SelectOption.d.ts.map +0 -1
- package/build/types/selectOption/SelectOption.messages.d.ts +0 -12
- package/build/types/selectOption/SelectOption.messages.d.ts.map +0 -1
- package/build/types/selectOption/index.d.ts +0 -3
- package/build/types/selectOption/index.d.ts.map +0 -1
- package/src/selectOption/SelectOption.css +0 -44
- package/src/selectOption/SelectOption.less +0 -40
- package/src/selectOption/SelectOption.messages.ts +0 -12
- package/src/selectOption/SelectOption.spec.tsx +0 -83
- package/src/selectOption/SelectOption.story.tsx +0 -277
- package/src/selectOption/SelectOption.tsx +0 -151
- package/src/selectOption/index.ts +0 -2
- package/src/typeahead/Typeahead.rtl.spec.tsx +0 -54
- package/src/typeahead/Typeahead.spec.js +0 -404
- package/src/typeahead/typeaheadInput/TypeaheadInput.spec.js +0 -74
- package/src/typeahead/typeaheadOption/TypeaheadOption.spec.js +0 -75
- package/src/typeahead/util/highlight.spec.js +0 -34
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
.np-select-option {
|
|
2
|
-
border-radius: 10px;
|
|
3
|
-
border-radius: var(--radius-small);
|
|
4
|
-
padding: 16px;
|
|
5
|
-
padding: var(--size-16);
|
|
6
|
-
}
|
|
7
|
-
.np-select-option-placeholder {
|
|
8
|
-
background-color: rgba(134,167,189,0.10196);
|
|
9
|
-
background-color: var(--color-background-neutral);
|
|
10
|
-
}
|
|
11
|
-
.np-select-option-placeholder:not(.disabled):hover {
|
|
12
|
-
background-color: var(--color-background-neutral-hover);
|
|
13
|
-
}
|
|
14
|
-
.np-select-option-placeholder:not(.disabled):focus,
|
|
15
|
-
.np-select-option-placeholder:not(.disabled):active {
|
|
16
|
-
background-color: var(--color-background-neutral-active);
|
|
17
|
-
}
|
|
18
|
-
.np-select-option-selected {
|
|
19
|
-
border: 1px solid #c9cbce;
|
|
20
|
-
border: 1px solid var(--color-interactive-secondary);
|
|
21
|
-
}
|
|
22
|
-
.np-select-option-list {
|
|
23
|
-
max-height: 350px;
|
|
24
|
-
overflow-y: auto;
|
|
25
|
-
}
|
|
26
|
-
.np-select-option-list > .np-section {
|
|
27
|
-
margin-top: 0;
|
|
28
|
-
}
|
|
29
|
-
.has-error * .np-select-option {
|
|
30
|
-
--ring-outline-color: var(--color-sentiment-negative);
|
|
31
|
-
--ring-outline-width: 3px;
|
|
32
|
-
--ring-outline-offset: calc(-1 * var(--ring-outline-width));
|
|
33
|
-
outline: var(--ring-outline-color) solid 3px;
|
|
34
|
-
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
35
|
-
outline-offset: calc(-1 * 3px);
|
|
36
|
-
outline-offset: var(--ring-outline-offset);
|
|
37
|
-
}
|
|
38
|
-
.has-error * .np-select-option:focus {
|
|
39
|
-
outline: none;
|
|
40
|
-
}
|
|
41
|
-
.has-error * .np-select-option:focus-visible {
|
|
42
|
-
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
43
|
-
outline-offset: var(--ring-outline-offset);
|
|
44
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ActionButtonProps } from '../actionButton';
|
|
2
|
-
import type { OptionProps } from '../common/Option/Option';
|
|
3
|
-
import { HeaderProps } from '../header/Header';
|
|
4
|
-
export type SelectOptiopsSection<T = unknown> = {
|
|
5
|
-
title?: HeaderProps['title'];
|
|
6
|
-
options: SelectOptionValue<T>[];
|
|
7
|
-
};
|
|
8
|
-
export type SelectOptionValue<T = unknown> = Pick<OptionProps, 'media' | 'title' | 'content' | 'disabled'> & {
|
|
9
|
-
value?: T;
|
|
10
|
-
};
|
|
11
|
-
export type SelectOptionPlaceholder = Pick<OptionProps, 'media' | 'title' | 'content'> & {
|
|
12
|
-
actionLabel?: ActionButtonProps['children'];
|
|
13
|
-
};
|
|
14
|
-
export type SelectOptionProps<T = unknown> = {
|
|
15
|
-
onChange: (selected: SelectOptionValue<T>) => void;
|
|
16
|
-
selected?: SelectOptionValue<T>;
|
|
17
|
-
options: SelectOptiopsSection<T>[];
|
|
18
|
-
placeholder: SelectOptionPlaceholder;
|
|
19
|
-
} & Omit<OptionProps, 'as' | 'title' | 'media' | 'content' | 'onClick' | 'onChange' | 'showMediaAtAllSizes' | 'decision'>;
|
|
20
|
-
export default function SelectOption<T>({ selected, options, onChange, placeholder, disabled, ...props }: SelectOptionProps<T>): import("react").JSX.Element;
|
|
21
|
-
//# sourceMappingURL=SelectOption.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectOption.d.ts","sourceRoot":"","sources":["../../../src/selectOption/SelectOption.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAU/C,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,OAAO,IAAI;IAC9C,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,OAAO,IAAI,IAAI,CAC/C,WAAW,EACX,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAC3C,GAAG;IACF,KAAK,CAAC,EAAE,CAAC,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC,GAAG;IACvF,WAAW,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,OAAO,IAAI;IAC3C,QAAQ,EAAE,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACnD,QAAQ,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAChC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,WAAW,EAAE,uBAAuB,CAAC;CACtC,GAAG,IAAI,CACN,WAAW,EACX,IAAI,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,qBAAqB,GAAG,UAAU,CACnG,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,EAAE,EACtC,QAAoB,EACpB,OAAO,EACP,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,CAAC,CAAC,+BAmGtB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectOption.messages.d.ts","sourceRoot":"","sources":["../../../src/selectOption/SelectOption.messages.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,wBASG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/selectOption/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
.np-select-option {
|
|
2
|
-
border-radius: 10px;
|
|
3
|
-
border-radius: var(--radius-small);
|
|
4
|
-
padding: 16px;
|
|
5
|
-
padding: var(--size-16);
|
|
6
|
-
}
|
|
7
|
-
.np-select-option-placeholder {
|
|
8
|
-
background-color: rgba(134,167,189,0.10196);
|
|
9
|
-
background-color: var(--color-background-neutral);
|
|
10
|
-
}
|
|
11
|
-
.np-select-option-placeholder:not(.disabled):hover {
|
|
12
|
-
background-color: var(--color-background-neutral-hover);
|
|
13
|
-
}
|
|
14
|
-
.np-select-option-placeholder:not(.disabled):focus,
|
|
15
|
-
.np-select-option-placeholder:not(.disabled):active {
|
|
16
|
-
background-color: var(--color-background-neutral-active);
|
|
17
|
-
}
|
|
18
|
-
.np-select-option-selected {
|
|
19
|
-
border: 1px solid #c9cbce;
|
|
20
|
-
border: 1px solid var(--color-interactive-secondary);
|
|
21
|
-
}
|
|
22
|
-
.np-select-option-list {
|
|
23
|
-
max-height: 350px;
|
|
24
|
-
overflow-y: auto;
|
|
25
|
-
}
|
|
26
|
-
.np-select-option-list > .np-section {
|
|
27
|
-
margin-top: 0;
|
|
28
|
-
}
|
|
29
|
-
.has-error * .np-select-option {
|
|
30
|
-
--ring-outline-color: var(--color-sentiment-negative);
|
|
31
|
-
--ring-outline-width: 3px;
|
|
32
|
-
--ring-outline-offset: calc(-1 * var(--ring-outline-width));
|
|
33
|
-
outline: var(--ring-outline-color) solid 3px;
|
|
34
|
-
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
35
|
-
outline-offset: calc(-1 * 3px);
|
|
36
|
-
outline-offset: var(--ring-outline-offset);
|
|
37
|
-
}
|
|
38
|
-
.has-error * .np-select-option:focus {
|
|
39
|
-
outline: none;
|
|
40
|
-
}
|
|
41
|
-
.has-error * .np-select-option:focus-visible {
|
|
42
|
-
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
43
|
-
outline-offset: var(--ring-outline-offset);
|
|
44
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
@import (reference) "../../node_modules/@transferwise/neptune-css/src/less/ring.less";
|
|
2
|
-
|
|
3
|
-
.np-select-option {
|
|
4
|
-
border-radius: var(--radius-small);
|
|
5
|
-
padding: var(--size-16);
|
|
6
|
-
|
|
7
|
-
&-placeholder {
|
|
8
|
-
background-color: var(--color-background-neutral);
|
|
9
|
-
|
|
10
|
-
&:not(.disabled):hover {
|
|
11
|
-
background-color: var(--color-background-neutral-hover);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&:not(.disabled):focus,
|
|
15
|
-
&:not(.disabled):active {
|
|
16
|
-
background-color: var(--color-background-neutral-active);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&-selected {
|
|
21
|
-
border: 1px solid var(--color-interactive-secondary);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&-list {
|
|
25
|
-
max-height: 350px;
|
|
26
|
-
overflow-y: auto;
|
|
27
|
-
|
|
28
|
-
& > .np-section {
|
|
29
|
-
// remove large margin in Section & Header
|
|
30
|
-
margin-top: 0;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.has-error * & {
|
|
35
|
-
.ring-negative();
|
|
36
|
-
.ring-inset();
|
|
37
|
-
.ring();
|
|
38
|
-
.focus-ring();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl';
|
|
2
|
-
|
|
3
|
-
export default defineMessages({
|
|
4
|
-
actionLabel: {
|
|
5
|
-
id: 'neptune.SelectOption.action.label',
|
|
6
|
-
defaultMessage: 'Choose',
|
|
7
|
-
},
|
|
8
|
-
selectedActionLabel: {
|
|
9
|
-
id: 'neptune.SelectOption.selected.action.label',
|
|
10
|
-
defaultMessage: 'Change chosen option',
|
|
11
|
-
},
|
|
12
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { render, userEvent, screen, within, mockMatchMedia } from '../test-utils';
|
|
2
|
-
import { composeStories } from '@storybook/react';
|
|
3
|
-
import * as stories from './SelectOption.story';
|
|
4
|
-
import { Breakpoint } from '../common';
|
|
5
|
-
import { wait } from '../test-utils/wait';
|
|
6
|
-
|
|
7
|
-
const { Basic: SelectOptionExample } = composeStories(stories);
|
|
8
|
-
|
|
9
|
-
mockMatchMedia();
|
|
10
|
-
|
|
11
|
-
describe('Select Option', () => {
|
|
12
|
-
it('opens dropdown on desktop view', async () => {
|
|
13
|
-
render(<SelectOptionExample />);
|
|
14
|
-
|
|
15
|
-
let dialog = screen.queryByRole('dialog');
|
|
16
|
-
expect(dialog).not.toBeInTheDocument();
|
|
17
|
-
|
|
18
|
-
const button = screen.getByRole('button');
|
|
19
|
-
|
|
20
|
-
await userEvent.click(button);
|
|
21
|
-
|
|
22
|
-
dialog = screen.queryByRole('dialog');
|
|
23
|
-
expect(dialog).toBeInTheDocument();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('opens bottom sheet on mobile view', async () => {
|
|
27
|
-
// mock mobile view
|
|
28
|
-
window.innerWidth = Breakpoint.EXTRA_SMALL;
|
|
29
|
-
|
|
30
|
-
render(<SelectOptionExample />);
|
|
31
|
-
|
|
32
|
-
let dialog = screen.queryByRole('dialog');
|
|
33
|
-
expect(dialog).not.toBeInTheDocument();
|
|
34
|
-
|
|
35
|
-
const button = screen.getByRole('button');
|
|
36
|
-
|
|
37
|
-
await userEvent.click(button);
|
|
38
|
-
|
|
39
|
-
dialog = screen.queryByRole('dialog');
|
|
40
|
-
expect(dialog).toBeInTheDocument();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('shows options', async () => {
|
|
44
|
-
render(<SelectOptionExample />);
|
|
45
|
-
|
|
46
|
-
const button = screen.getByRole('button');
|
|
47
|
-
|
|
48
|
-
await userEvent.click(button);
|
|
49
|
-
|
|
50
|
-
const dialog = screen.getByRole('dialog');
|
|
51
|
-
const sectionHeaders = within(dialog).getAllByRole('heading', { name: /balances|jars/i });
|
|
52
|
-
expect(sectionHeaders).toHaveLength(2);
|
|
53
|
-
|
|
54
|
-
const options = within(dialog).getAllByRole('heading', { level: 4 });
|
|
55
|
-
expect(options).toHaveLength(5);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('choose option', async () => {
|
|
59
|
-
// mock mobile view
|
|
60
|
-
window.innerWidth = Breakpoint.EXTRA_SMALL;
|
|
61
|
-
|
|
62
|
-
render(
|
|
63
|
-
<SelectOptionExample placeholder={{ title: 'Please choose balance', actionLabel: 'Pick' }} />,
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const button = screen.getByRole('button');
|
|
67
|
-
|
|
68
|
-
expect(button).toHaveTextContent('Pick');
|
|
69
|
-
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
70
|
-
await userEvent.click(button);
|
|
71
|
-
expect(screen.getByRole('dialog')).toBeInTheDocument();
|
|
72
|
-
|
|
73
|
-
const pickedOption = within(screen.getByRole('dialog')).getByText('Trip to Mars');
|
|
74
|
-
|
|
75
|
-
await userEvent.click(pickedOption);
|
|
76
|
-
|
|
77
|
-
// wait for dialog to close
|
|
78
|
-
await wait(500);
|
|
79
|
-
expect(screen.getByText('Trip to Mars')).toBeInTheDocument();
|
|
80
|
-
expect(screen.queryAllByTestId('chevron-down-icon')).toHaveLength(1);
|
|
81
|
-
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
82
|
-
});
|
|
83
|
-
});
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
import { Flag } from '@wise/art';
|
|
3
|
-
import SelectOption, {
|
|
4
|
-
SelectOptionProps,
|
|
5
|
-
SelectOptionValue,
|
|
6
|
-
SelectOptiopsSection,
|
|
7
|
-
} from './SelectOption';
|
|
8
|
-
import { Bank, BankTransfer, Beach, Briefcase, Card, Plane } from '@transferwise/icons';
|
|
9
|
-
import { Field } from '../field/Field';
|
|
10
|
-
import { lorem10 } from '../test-utils';
|
|
11
|
-
import Badge from '../badge';
|
|
12
|
-
import Avatar from '../avatar';
|
|
13
|
-
import { Sentiment } from '../common';
|
|
14
|
-
import { useState } from 'react';
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
title: 'Option/SelectOption',
|
|
18
|
-
tags: ['autodocs'],
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
type Story = StoryObj<typeof SelectOption>;
|
|
22
|
-
|
|
23
|
-
type CustomData = { data?: string };
|
|
24
|
-
|
|
25
|
-
function cardPaymentMethod(index?: number): SelectOptionValue<CustomData> {
|
|
26
|
-
return {
|
|
27
|
-
media: <Card />,
|
|
28
|
-
title: `Credit card ${index}`,
|
|
29
|
-
content: (
|
|
30
|
-
<>
|
|
31
|
-
<div>Transfer the money to Wise using your bank account.</div>
|
|
32
|
-
<div>0.32 GBP in fees, should arrive in seconds</div>
|
|
33
|
-
</>
|
|
34
|
-
),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const recentPaymentMethods: SelectOptionValue<CustomData>[] = [
|
|
39
|
-
cardPaymentMethod(1),
|
|
40
|
-
cardPaymentMethod(2),
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
const allOtherPaymentMethods: SelectOptionValue<CustomData>[] = [
|
|
44
|
-
{
|
|
45
|
-
media: <Flag code="gbp" />,
|
|
46
|
-
title: 'Wise GBP balance',
|
|
47
|
-
content: (
|
|
48
|
-
<>
|
|
49
|
-
<span>300 GBP available</span>
|
|
50
|
-
<span>0 GBP in fees, should arrive in seconds</span>
|
|
51
|
-
</>
|
|
52
|
-
),
|
|
53
|
-
disabled: true,
|
|
54
|
-
value: { data: lorem10 },
|
|
55
|
-
},
|
|
56
|
-
cardPaymentMethod(1),
|
|
57
|
-
{
|
|
58
|
-
media: <Card />,
|
|
59
|
-
title: 'Debit card',
|
|
60
|
-
content: (
|
|
61
|
-
<>
|
|
62
|
-
<span>Send from your Visa or Mastercard.</span>
|
|
63
|
-
<span>0.74 GBP in fees, should arrive in seconds</span>
|
|
64
|
-
</>
|
|
65
|
-
),
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
media: <Bank />,
|
|
69
|
-
title: 'Swift Transfer',
|
|
70
|
-
content: (
|
|
71
|
-
<>
|
|
72
|
-
<span>Send money internationally. Your bank will charge you extra fees.</span>
|
|
73
|
-
<span>0.32 GBP in fees, should arrive by Thursday</span>
|
|
74
|
-
</>
|
|
75
|
-
),
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
media: <BankTransfer />,
|
|
79
|
-
title: 'Bank Transfer',
|
|
80
|
-
content: (
|
|
81
|
-
<>
|
|
82
|
-
<span>Transfer the money to Wise using your bank account.</span>
|
|
83
|
-
<span>0.32 GBP in fees, should arrive in seconds</span>
|
|
84
|
-
</>
|
|
85
|
-
),
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
media: <BankTransfer />,
|
|
89
|
-
title: 'Withdraw from your U.S. bank account (ACH)',
|
|
90
|
-
content: (
|
|
91
|
-
<>
|
|
92
|
-
<span>1.63 USD in total fees.</span>
|
|
93
|
-
<span>
|
|
94
|
-
Pay with ACH using the bank account you’ve connected to Wise. Should arrive in seconds.
|
|
95
|
-
</span>
|
|
96
|
-
</>
|
|
97
|
-
),
|
|
98
|
-
},
|
|
99
|
-
cardPaymentMethod(1),
|
|
100
|
-
cardPaymentMethod(2),
|
|
101
|
-
cardPaymentMethod(3),
|
|
102
|
-
cardPaymentMethod(4),
|
|
103
|
-
cardPaymentMethod(5),
|
|
104
|
-
cardPaymentMethod(6),
|
|
105
|
-
];
|
|
106
|
-
|
|
107
|
-
const paymentMethods: SelectOptiopsSection<CustomData>[] = [
|
|
108
|
-
{
|
|
109
|
-
title: 'Recently used',
|
|
110
|
-
options: recentPaymentMethods,
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
title: 'Payment methods',
|
|
114
|
-
options: allOtherPaymentMethods,
|
|
115
|
-
},
|
|
116
|
-
];
|
|
117
|
-
|
|
118
|
-
const balances: SelectOptiopsSection[] = [
|
|
119
|
-
{
|
|
120
|
-
title: 'Balances',
|
|
121
|
-
options: [
|
|
122
|
-
{
|
|
123
|
-
media: <Flag code="gbp" />,
|
|
124
|
-
title: 'Wise GBP balance',
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
media: <Flag code="eur" />,
|
|
128
|
-
title: 'Wise EUR balance',
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
title: 'Jars',
|
|
134
|
-
options: [
|
|
135
|
-
{
|
|
136
|
-
media: (
|
|
137
|
-
<Badge badge={<Flag code="usd" />} size="md">
|
|
138
|
-
<Avatar type="icon" size="md" backgroundColor="var(--color-bright-pink)">
|
|
139
|
-
<Beach size="24" />
|
|
140
|
-
</Avatar>
|
|
141
|
-
</Badge>
|
|
142
|
-
),
|
|
143
|
-
title: 'Hawaii Holiday',
|
|
144
|
-
content: 'Wise USD jar',
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
media: (
|
|
148
|
-
<Badge badge={<Flag code="aed" />} size="md">
|
|
149
|
-
<Avatar type="icon" size="md" backgroundColor="var(--color-bright-yellow)">
|
|
150
|
-
<Briefcase size="24" />
|
|
151
|
-
</Avatar>
|
|
152
|
-
</Badge>
|
|
153
|
-
),
|
|
154
|
-
title: 'Emirates Business Trip',
|
|
155
|
-
content: 'Wise AED jar',
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
media: (
|
|
159
|
-
<Badge badge={<Flag code="jpy" />} size="md">
|
|
160
|
-
<Avatar type="icon" size="md" backgroundColor="var(--color-bright-blue)">
|
|
161
|
-
<Plane size="24" />
|
|
162
|
-
</Avatar>
|
|
163
|
-
</Badge>
|
|
164
|
-
),
|
|
165
|
-
title: 'Trip to Mars',
|
|
166
|
-
content: 'Wise Jpy jar',
|
|
167
|
-
},
|
|
168
|
-
],
|
|
169
|
-
},
|
|
170
|
-
];
|
|
171
|
-
|
|
172
|
-
export const Basic: Story = {
|
|
173
|
-
args: {
|
|
174
|
-
placeholder: { title: 'No balance selected' },
|
|
175
|
-
options: balances,
|
|
176
|
-
},
|
|
177
|
-
render: (args: SelectOptionProps) => {
|
|
178
|
-
const [selected, setSelected] = useState<SelectOptionValue | undefined>(undefined);
|
|
179
|
-
|
|
180
|
-
function onChange(value: SelectOptionValue): void {
|
|
181
|
-
setSelected(value);
|
|
182
|
-
}
|
|
183
|
-
return (
|
|
184
|
-
<div className="row">
|
|
185
|
-
<div className="col-md-8 col-md-offset-2">
|
|
186
|
-
<Field label="Balances">
|
|
187
|
-
<SelectOption {...args} {...{ selected, onChange }} />
|
|
188
|
-
</Field>
|
|
189
|
-
</div>
|
|
190
|
-
</div>
|
|
191
|
-
);
|
|
192
|
-
},
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
export const Variants: Story = {
|
|
196
|
-
render: () => {
|
|
197
|
-
const [selected, setSelected] = useState<SelectOptionValue<CustomData>>({
|
|
198
|
-
...paymentMethods[1].options[1],
|
|
199
|
-
content: null,
|
|
200
|
-
});
|
|
201
|
-
function onChange(value: SelectOptionValue<CustomData>): void {
|
|
202
|
-
setSelected({ ...value, content: null });
|
|
203
|
-
}
|
|
204
|
-
return (
|
|
205
|
-
<div className="row">
|
|
206
|
-
<div className="col-md-8 col-md-offset-2">
|
|
207
|
-
<SelectOption<CustomData>
|
|
208
|
-
className="d-block"
|
|
209
|
-
aria-label="Choose one of payment methods"
|
|
210
|
-
placeholder={{ title: 'No method selected', actionLabel: 'Select' }}
|
|
211
|
-
selected={selected}
|
|
212
|
-
options={paymentMethods}
|
|
213
|
-
onChange={onChange}
|
|
214
|
-
/>
|
|
215
|
-
</div>
|
|
216
|
-
|
|
217
|
-
<div className="col-md-8 col-md-offset-2">
|
|
218
|
-
<Field label={<>Payment method</>}>
|
|
219
|
-
<SelectOption<CustomData>
|
|
220
|
-
aria-label="Choose one of payment methods"
|
|
221
|
-
placeholder={{ title: 'No method selected', actionLabel: 'Select' }}
|
|
222
|
-
selected={selected}
|
|
223
|
-
options={paymentMethods}
|
|
224
|
-
onChange={onChange}
|
|
225
|
-
/>
|
|
226
|
-
</Field>
|
|
227
|
-
</div>
|
|
228
|
-
|
|
229
|
-
<div className="col-md-8 col-md-offset-2">
|
|
230
|
-
<Field
|
|
231
|
-
label={<>Payment method</>}
|
|
232
|
-
sentiment={Sentiment.NEGATIVE}
|
|
233
|
-
message="Just an example of validation message"
|
|
234
|
-
>
|
|
235
|
-
<SelectOption<CustomData>
|
|
236
|
-
aria-label="Choose one of payment methods"
|
|
237
|
-
placeholder={{ title: 'No method selected', actionLabel: 'Select' }}
|
|
238
|
-
selected={selected}
|
|
239
|
-
options={paymentMethods}
|
|
240
|
-
onChange={onChange}
|
|
241
|
-
/>
|
|
242
|
-
</Field>
|
|
243
|
-
</div>
|
|
244
|
-
|
|
245
|
-
<div className="col-md-8 col-md-offset-2">
|
|
246
|
-
<Field
|
|
247
|
-
label={<>Payment method</>}
|
|
248
|
-
sentiment={Sentiment.NEGATIVE}
|
|
249
|
-
message="Just an example of validation message"
|
|
250
|
-
>
|
|
251
|
-
<SelectOption<CustomData>
|
|
252
|
-
aria-label="Choose one of payment methods"
|
|
253
|
-
placeholder={{ title: 'No method selected', actionLabel: 'Select' }}
|
|
254
|
-
options={paymentMethods}
|
|
255
|
-
onChange={onChange}
|
|
256
|
-
/>
|
|
257
|
-
</Field>
|
|
258
|
-
</div>
|
|
259
|
-
|
|
260
|
-
<div className="col-md-8 col-md-offset-2">
|
|
261
|
-
<Field
|
|
262
|
-
label={<>Payment method</>}
|
|
263
|
-
sentiment={Sentiment.NEGATIVE}
|
|
264
|
-
message="Example of disabled select option"
|
|
265
|
-
>
|
|
266
|
-
<SelectOption<CustomData>
|
|
267
|
-
disabled
|
|
268
|
-
placeholder={{ title: 'No method selected' }}
|
|
269
|
-
options={paymentMethods}
|
|
270
|
-
onChange={onChange}
|
|
271
|
-
/>
|
|
272
|
-
</Field>
|
|
273
|
-
</div>
|
|
274
|
-
</div>
|
|
275
|
-
);
|
|
276
|
-
},
|
|
277
|
-
};
|