@transferwise/components 46.100.1 → 46.101.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/avatarLayout/AvatarLayout.js +1 -1
- package/build/avatarLayout/AvatarLayout.js.map +1 -1
- package/build/avatarLayout/AvatarLayout.mjs +1 -1
- package/build/avatarLayout/AvatarLayout.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +3 -2
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +3 -2
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/i18n/en.json +2 -0
- package/build/i18n/en.json.js +2 -0
- package/build/i18n/en.json.js.map +1 -1
- package/build/i18n/en.json.mjs +2 -0
- package/build/i18n/en.json.mjs.map +1 -1
- package/build/main.css +4 -94
- package/build/styles/accordion/Accordion.css +27 -16
- package/build/styles/avatar/Avatar.css +95 -50
- package/build/styles/inputs/Input.css +37 -21
- package/build/styles/inputs/TextArea.css +35 -20
- package/build/styles/loader/Loader.css +4 -90
- package/build/styles/main.css +4 -94
- package/build/styles/popover/Popover.css +19 -12
- package/build/styles/select/Select.css +131 -68
- package/build/styles/switch/Switch.css +27 -16
- package/build/styles/tile/Tile.css +31 -18
- package/build/types/dateLookup/DateLookup.d.ts +2 -2
- package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
- package/build/types/test-utils/index.d.ts +4 -0
- package/build/types/test-utils/index.d.ts.map +1 -1
- package/build/types/test-utils/story-config.d.ts +2 -3
- package/build/types/test-utils/story-config.d.ts.map +1 -1
- package/build/types/upload/Upload.d.ts +6 -2
- package/build/types/upload/Upload.d.ts.map +1 -1
- package/build/types/upload/Upload.messages.d.ts +8 -0
- package/build/types/upload/Upload.messages.d.ts.map +1 -1
- package/build/types/uploadInput/UploadInput.d.ts +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts +4 -2
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/build/upload/Upload.js +16 -9
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.messages.js +6 -0
- package/build/upload/Upload.messages.js.map +1 -1
- package/build/upload/Upload.messages.mjs +6 -0
- package/build/upload/Upload.messages.mjs.map +1 -1
- package/build/upload/Upload.mjs +16 -9
- package/build/upload/Upload.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js +1 -1
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +1 -1
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +7 -4
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +7 -4
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/package.json +19 -27
- package/src/accordion/Accordion.css +27 -16
- package/src/accordion/Accordion.story.tsx +1 -1
- package/src/actionButton/ActionButton.story.tsx +3 -2
- package/src/actionOption/ActionOption.story.tsx +2 -2
- package/src/alert/Alert.story.tsx +2 -2
- package/src/alert/Alert.tests.story.tsx +2 -2
- package/src/avatar/Avatar.css +95 -50
- package/src/avatar/Avatar.spec.tsx +1 -1
- package/src/avatar/Avatar.story.tsx +3 -2
- package/src/avatarLayout/AvatarLayout.story.tsx +1 -1
- package/src/avatarLayout/AvatarLayout.tsx +1 -1
- package/src/avatarView/AvatarView.story.tsx +1 -1
- package/src/avatarWrapper/AvatarWrapper.story.tsx +3 -2
- package/src/badge/Badge.story.tsx +49 -28
- package/src/button/Button.accessibility.docs.mdx +1 -1
- package/src/button/Button.story.tsx +2 -2
- package/src/button/Button.tests.story.tsx +2 -2
- package/src/button/LegacyButton.story.tsx +3 -2
- package/src/card/Card.story.tsx +2 -2
- package/src/carousel/Carousel.story.tsx +1 -1
- package/src/checkbox/Checkbox.story.tsx +2 -2
- package/src/checkboxButton/CheckboxButton.story.tsx +2 -2
- package/src/checkboxOption/CheckboxOption.story.tsx +35 -29
- package/src/chevron/Chevron.story.tsx +1 -1
- package/src/chips/Chips.story.tsx +1 -1
- package/src/circularButton/CircularButton.story.tsx +1 -1
- package/src/circularButton/CircularButton.tests.story.tsx +1 -1
- package/src/common/bottomSheet/BottomSheet.story.tsx +2 -2
- package/src/common/card/Card.story.tsx +1 -1
- package/src/common/circle/Circle.story.tsx +2 -2
- package/src/common/locale/index.spec.ts +28 -16
- package/src/common/responsivePanel/ResponsivePanel.spec.js +8 -29
- package/src/criticalBanner/CriticalCommsBanner.story.tsx +1 -1
- package/src/dateInput/DateInput.story.tsx +2 -2
- package/src/dateInput/DateInput.tests.story.tsx +2 -2
- package/src/dateLookup/DateLookup.spec.tsx +5 -5
- package/src/dateLookup/DateLookup.story.tsx +43 -71
- package/src/dateLookup/DateLookup.tests.story.tsx +3 -3
- package/src/dateLookup/DateLookup.tsx +4 -1
- package/src/decision/Decision.story.tsx +24 -49
- package/src/definitionList/DefinitionList.story.tsx +1 -1
- package/src/dimmer/Dimmer.story.tsx +2 -2
- package/src/divider/Divider.accessibility.docs.mdx +1 -1
- package/src/divider/Divider.story.tsx +1 -1
- package/src/drawer/Drawer.story.tsx +13 -7
- package/src/dropFade/DropFade.story.tsx +1 -1
- package/src/emphasis/Emphasis.spec.tsx +8 -8
- package/src/emphasis/Emphasis.story.tsx +1 -1
- package/src/field/Field.story.tsx +3 -3
- package/src/flowNavigation/FlowNavigation.story.tsx +305 -260
- package/src/i18n/en.json +2 -0
- package/src/iconButton/IconButton.story.tsx +2 -2
- package/src/image/Image.story.tsx +27 -54
- package/src/info/Info.story.tsx +2 -2
- package/src/inlineAlert/InlineAlert.story.tsx +1 -1
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +2 -2
- package/src/inputs/Input.css +37 -21
- package/src/inputs/InputGroup.story.tsx +1 -1
- package/src/inputs/SearchInput.story.tsx +1 -1
- package/src/inputs/SelectInput.docs.mdx +1 -1
- package/src/inputs/SelectInput.story.tsx +2 -2
- package/src/inputs/TextArea.css +35 -20
- package/src/instructionsList/InstructionsList.story.tsx +2 -2
- package/src/legacylistItem/LegacyListItem.story.tsx +1 -1
- package/src/loader/Loader.css +4 -90
- package/src/loader/Loader.story.tsx +1 -1
- package/src/logo/Logo.story.tsx +1 -1
- package/src/main.css +4 -94
- package/src/markdown/Markdown.story.tsx +1 -1
- package/src/modal/Modal.story.tsx +2 -2
- package/src/money/Money.story.tsx +1 -1
- package/src/moneyInput/MoneyInput.docs.mdx +1 -1
- package/src/moneyInput/MoneyInput.spec.tsx +8 -5
- package/src/moneyInput/MoneyInput.story.tsx +2 -2
- package/src/moneyInput/currencyFormatting.spec.ts +1 -1
- package/src/navigationOption/NavigationOption.story.tsx +265 -226
- package/src/nudge/Nudge.story.tsx +1 -1
- package/src/overlayHeader/OverlayHeader.story.tsx +32 -24
- package/src/phoneNumberInput/PhoneNumberInput.story.tsx +1 -1
- package/src/phoneNumberInput/utils/setDefaultPrefix/setDefaultPrefix.spec.ts +6 -3
- package/src/popover/Popover.css +19 -12
- package/src/popover/Popover.story.tsx +2 -2
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.story.tsx +2 -2
- package/src/primitives/PrimitiveAnchor/stories/PrimitiveAnchor.tests.story.tsx +2 -2
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.story.tsx +2 -2
- package/src/primitives/PrimitiveButton/stories/PrimitiveButton.tests.story.tsx +2 -2
- package/src/processIndicator/ProcessIndicator.story.tsx +1 -1
- package/src/progress/Progress.story.tsx +1 -1
- package/src/progressBar/ProgressBar.story.tsx +1 -1
- package/src/promoCard/PromoCard.story.tsx +1 -1
- package/src/promoCard/PromoCardGroup.story.tsx +1 -1
- package/src/provider/Provider.spec.tsx +2 -2
- package/src/provider/Provider.story.tsx +1 -1
- package/src/provider/direction/DirectionProvider.spec.tsx +1 -1
- package/src/provider/language/LanguageProvider.spec.tsx +1 -1
- package/src/provider/theme/ThemeProvider.story.tsx +1 -1
- package/src/radio/Radio.story.tsx +59 -42
- package/src/radioGroup/RadioGroup.story.tsx +2 -2
- package/src/radioOption/RadioOption.story.tsx +73 -38
- package/src/segmentedControl/SegmentedControl.story.tsx +1 -1
- package/src/select/Select.css +131 -68
- package/src/select/Select.story.tsx +385 -397
- package/src/slidingPanel/SlidingPanel.story.tsx +30 -13
- package/src/snackbar/Snackbar.story.tsx +50 -36
- package/src/snackbar/Snackbar.tests.story.tsx +3 -2
- package/src/statusIcon/StatusIcon.docs.mdx +1 -1
- package/src/statusIcon/StatusIcon.spec.tsx +8 -5
- package/src/statusIcon/StatusIcon.story.tsx +1 -1
- package/src/stepper/Stepper.story.tsx +2 -2
- package/src/stepper/Stepper.tests.story.tsx +2 -2
- package/src/sticky/Sticky.story.tsx +1 -1
- package/src/summary/Summary.story.tsx +18 -17
- package/src/switch/Switch.css +27 -16
- package/src/switch/Switch.story.tsx +2 -2
- package/src/switchOption/SwitchOption.story.tsx +1 -1
- package/src/table/Table.story.tsx +1 -1
- package/src/test-utils/story-config.ts +9 -6
- package/src/textareaWithDisplayFormat/TextareaWithDisplayFormat.story.tsx +2 -2
- package/src/tile/Tile.css +31 -18
- package/src/tile/Tile.story.tsx +43 -43
- package/src/tooltip/Tooltip.story.tsx +2 -2
- package/src/typeahead/Typeahead.story.tsx +2 -2
- package/src/upload/Upload.messages.ts +8 -0
- package/src/upload/Upload.spec.tsx +6 -0
- package/src/upload/Upload.story.tsx +120 -5
- package/src/upload/Upload.tests.story.tsx +5 -3
- package/src/upload/Upload.tsx +24 -15
- package/src/upload/utils/isTypeValid/isTypeValid.spec.ts +3 -1
- package/src/uploadInput/UploadInput.story.tsx +1 -1
- package/src/uploadInput/UploadInput.tests.story.tsx +10 -3
- package/src/uploadInput/UploadInput.tsx +2 -2
- package/src/uploadInput/uploadButton/UploadButton.spec.tsx +6 -0
- package/src/uploadInput/uploadButton/UploadButton.tsx +12 -6
- package/src/withId/withId.docs.mdx +1 -1
- package/src/withId/withId.story.tsx +1 -1
- package/src/common/responsivePanel/__snapshots__/ResponsivePanel.spec.js.snap +0 -21
|
@@ -1,16 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
2
|
import { Person as ProfileIcon, Globe as GlobeIcon } from '@transferwise/icons';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
|
|
5
4
|
import Select, { SelectItem, SelectOptionItem } from './Select';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
|
-
* @deprecated Use **`SelectInput`** instead (https://neptune.wise.design/blog/2023-11-28-adopting-our-new-selectinput)
|
|
7
|
+
* @deprecated Use **`SelectInput`** instead <br/> [https://neptune.wise.design/blog/2023-11-28-adopting-our-new-selectinput](https://neptune.wise.design/blog/2023-11-28-adopting-our-new-selectinput)
|
|
9
8
|
*/
|
|
10
|
-
|
|
9
|
+
const meta: Meta<typeof Select> = {
|
|
11
10
|
component: Select,
|
|
12
|
-
title: 'Forms/Select
|
|
11
|
+
title: 'Forms/Select',
|
|
12
|
+
tags: ['deprecated'],
|
|
13
|
+
argTypes: {
|
|
14
|
+
id: { control: 'text' },
|
|
15
|
+
size: { control: 'radio', options: ['sm', 'md', 'lg'] },
|
|
16
|
+
dropdownRight: { control: 'radio', options: ['xs', 'sm', 'md', 'lg', 'xl'] },
|
|
17
|
+
dropdownWidth: { control: 'radio', options: [undefined, 'sm', 'md', 'lg'] },
|
|
18
|
+
placeholder: { control: 'text' },
|
|
19
|
+
inverse: { control: 'boolean' },
|
|
20
|
+
block: { control: 'boolean' },
|
|
21
|
+
required: { control: 'boolean' },
|
|
22
|
+
dropdownUp: { control: 'boolean' },
|
|
23
|
+
disabled: { control: 'boolean' },
|
|
24
|
+
search: { control: 'boolean' },
|
|
25
|
+
searchPlaceholder: { control: 'text' },
|
|
26
|
+
options: { control: false },
|
|
27
|
+
selected: { control: false },
|
|
28
|
+
onChange: { action: 'onChange' },
|
|
29
|
+
onSearchChange: { action: 'onSearchChange' },
|
|
30
|
+
searchValue: { control: false },
|
|
31
|
+
},
|
|
13
32
|
};
|
|
33
|
+
export default meta;
|
|
34
|
+
|
|
35
|
+
type Story = StoryObj<typeof Select>;
|
|
14
36
|
|
|
15
37
|
const ImageIcon = () => (
|
|
16
38
|
<img
|
|
@@ -20,410 +42,376 @@ const ImageIcon = () => (
|
|
|
20
42
|
/>
|
|
21
43
|
);
|
|
22
44
|
|
|
23
|
-
interface SelectItemWithCountries extends SelectItem {
|
|
24
|
-
countries?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
45
|
const isSelectOptionItem = (option: SelectItem | null): option is SelectOptionItem => {
|
|
28
46
|
return option !== null && typeof option.value !== 'undefined';
|
|
29
47
|
};
|
|
30
48
|
|
|
31
|
-
export const Basic =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
secondary:
|
|
117
|
-
'and with lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation secondary text',
|
|
118
|
-
},
|
|
119
|
-
]}
|
|
120
|
-
onChange={(option) => {
|
|
121
|
-
if (isSelectOptionItem(option)) {
|
|
122
|
-
setSelected(option);
|
|
123
|
-
}
|
|
124
|
-
}}
|
|
125
|
-
/>
|
|
126
|
-
);
|
|
49
|
+
export const Basic: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
id: 'basic-button',
|
|
52
|
+
size: 'md',
|
|
53
|
+
placeholder: 'Placeholder text',
|
|
54
|
+
dropdownRight: 'md',
|
|
55
|
+
dropdownWidth: 'md',
|
|
56
|
+
inverse: false,
|
|
57
|
+
block: true,
|
|
58
|
+
required: false,
|
|
59
|
+
dropdownUp: false,
|
|
60
|
+
disabled: false,
|
|
61
|
+
search: true,
|
|
62
|
+
searchPlaceholder: 'Search placeholder',
|
|
63
|
+
options: [
|
|
64
|
+
{ header: 'Basic' },
|
|
65
|
+
{ value: -1, label: 'A thing' },
|
|
66
|
+
{ value: 0, label: 'A thing', note: 'with a note' },
|
|
67
|
+
{ value: 1, label: 'Another thing', secondary: 'with secondary text this time' },
|
|
68
|
+
{
|
|
69
|
+
value: -2,
|
|
70
|
+
label: 'One more thing',
|
|
71
|
+
note: 'with a note',
|
|
72
|
+
secondary: 'and with secondary text',
|
|
73
|
+
},
|
|
74
|
+
{ value: 6, icon: <ImageIcon />, label: 'An <img>', note: 'with a note' },
|
|
75
|
+
{ value: 2, label: 'A disabled thing', disabled: true },
|
|
76
|
+
{ separator: true },
|
|
77
|
+
{ header: 'Icons' },
|
|
78
|
+
{ value: 3, label: 'Profile', icon: <ProfileIcon /> },
|
|
79
|
+
{
|
|
80
|
+
value: 4,
|
|
81
|
+
label: 'USD',
|
|
82
|
+
icon: <GlobeIcon />,
|
|
83
|
+
note: 'United States dollar - Outside of the US',
|
|
84
|
+
},
|
|
85
|
+
{ header: 'Currencies' },
|
|
86
|
+
{ value: 5, label: 'British pound', currency: 'gbp' },
|
|
87
|
+
{ value: 6, label: 'Euro', currency: 'eur' },
|
|
88
|
+
{ value: 7, label: 'USD', currency: 'usd', note: 'United States dollar' },
|
|
89
|
+
{ separator: true },
|
|
90
|
+
{ value: 8, label: 'Something else' },
|
|
91
|
+
{ header: 'Options with searchable alternatives' },
|
|
92
|
+
{
|
|
93
|
+
value: 9,
|
|
94
|
+
label: 'A thing with searchable alternatives',
|
|
95
|
+
searchStrings: ['abbreviation', 'acronym', 'nickname'],
|
|
96
|
+
},
|
|
97
|
+
{ separator: true },
|
|
98
|
+
{ header: 'Long content options' },
|
|
99
|
+
{
|
|
100
|
+
value: 10,
|
|
101
|
+
label:
|
|
102
|
+
'One more thing with lorem ipsum dolor sit amet, consectetur adipiscing elit consequat text',
|
|
103
|
+
note: 'with lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor note text',
|
|
104
|
+
secondary:
|
|
105
|
+
'and with lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation secondary text',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
value: 11,
|
|
109
|
+
icon: <GlobeIcon />,
|
|
110
|
+
label:
|
|
111
|
+
'One more thing with lorem ipsum dolor sit amet, consectetur adipiscing elit consequat text',
|
|
112
|
+
note: 'with lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor note text',
|
|
113
|
+
secondary:
|
|
114
|
+
'and with lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation secondary text',
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
selected: { value: 0, label: 'A thing', note: 'with a note' },
|
|
118
|
+
},
|
|
119
|
+
render: (args) => {
|
|
120
|
+
const initialSelected = args.selected ?? { value: 0, label: 'A thing', note: 'with a note' };
|
|
121
|
+
const [selected, setSelected] = useState<SelectOptionItem>(initialSelected);
|
|
122
|
+
return (
|
|
123
|
+
<Select
|
|
124
|
+
{...args}
|
|
125
|
+
selected={selected}
|
|
126
|
+
onChange={(option) => {
|
|
127
|
+
if (isSelectOptionItem(option)) {
|
|
128
|
+
setSelected(option);
|
|
129
|
+
}
|
|
130
|
+
}}
|
|
131
|
+
/>
|
|
132
|
+
);
|
|
133
|
+
},
|
|
127
134
|
};
|
|
128
135
|
|
|
129
|
-
export const CustomSearchFunction =
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
label: 'BRL',
|
|
280
|
-
note: 'Brazilian real',
|
|
281
|
-
searchStrings: ['Brazil'],
|
|
282
|
-
secondary: '',
|
|
283
|
-
icon: null,
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
currency: undefined,
|
|
287
|
-
value: 'USD',
|
|
288
|
-
label: 'USD',
|
|
289
|
-
note: 'United States dollar - Outside of the US',
|
|
290
|
-
searchStrings: ['United States'],
|
|
291
|
-
secondary: '',
|
|
292
|
-
icon: <GlobeIcon />,
|
|
293
|
-
},
|
|
294
|
-
]}
|
|
295
|
-
onChange={(option) => {
|
|
296
|
-
if (isSelectOptionItem(option)) {
|
|
297
|
-
setSelected(option);
|
|
298
|
-
}
|
|
299
|
-
}}
|
|
300
|
-
/>
|
|
301
|
-
);
|
|
136
|
+
export const CustomSearchFunction: Story = {
|
|
137
|
+
args: {
|
|
138
|
+
id: 'custom-search-button',
|
|
139
|
+
size: 'md',
|
|
140
|
+
placeholder: 'placeholder',
|
|
141
|
+
dropdownRight: 'md',
|
|
142
|
+
dropdownWidth: 'md',
|
|
143
|
+
inverse: false,
|
|
144
|
+
block: true,
|
|
145
|
+
required: false,
|
|
146
|
+
dropdownUp: false,
|
|
147
|
+
disabled: false,
|
|
148
|
+
search: true,
|
|
149
|
+
searchPlaceholder: 'Search placeholder',
|
|
150
|
+
options: [
|
|
151
|
+
{ header: 'Popular currencies' },
|
|
152
|
+
{
|
|
153
|
+
value: 1,
|
|
154
|
+
label: 'EUR',
|
|
155
|
+
currency: 'EUR',
|
|
156
|
+
searchStrings: [
|
|
157
|
+
'Austria',
|
|
158
|
+
'Belgium',
|
|
159
|
+
'Cyprus',
|
|
160
|
+
'Estonia',
|
|
161
|
+
'Finland',
|
|
162
|
+
'France',
|
|
163
|
+
'Germany',
|
|
164
|
+
'Greece',
|
|
165
|
+
'Ireland',
|
|
166
|
+
'Italy',
|
|
167
|
+
'Latvia',
|
|
168
|
+
'Lithuania',
|
|
169
|
+
'Luxembourg',
|
|
170
|
+
'Malta',
|
|
171
|
+
'Netherlands',
|
|
172
|
+
'Portugal',
|
|
173
|
+
'Slovakia',
|
|
174
|
+
'Slovenia',
|
|
175
|
+
'Spain',
|
|
176
|
+
'Andorra',
|
|
177
|
+
'Monaco',
|
|
178
|
+
'San Marino',
|
|
179
|
+
'Vatican City',
|
|
180
|
+
'Kosovo',
|
|
181
|
+
'Montenegro',
|
|
182
|
+
],
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
value: 2,
|
|
186
|
+
label: 'GBP',
|
|
187
|
+
currency: 'GBP',
|
|
188
|
+
searchStrings: ['Isle of Man', 'United Kingdom'],
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
value: 3,
|
|
192
|
+
label: 'INR',
|
|
193
|
+
currency: 'INR',
|
|
194
|
+
searchStrings: ['India'],
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
value: 4,
|
|
198
|
+
label: 'USD',
|
|
199
|
+
currency: 'USD',
|
|
200
|
+
searchStrings: [
|
|
201
|
+
'United States',
|
|
202
|
+
'Ecuador',
|
|
203
|
+
'El Salvador',
|
|
204
|
+
'Panama',
|
|
205
|
+
'East Timor',
|
|
206
|
+
'Zimbabwe',
|
|
207
|
+
'Micronesia',
|
|
208
|
+
'Marshall Islands',
|
|
209
|
+
'Palau',
|
|
210
|
+
'Turks and Caicos Islands',
|
|
211
|
+
'British Virgin Islands',
|
|
212
|
+
'Caribbean Netherlands',
|
|
213
|
+
'Bermuda',
|
|
214
|
+
'Bahamas',
|
|
215
|
+
'Puerto Rico',
|
|
216
|
+
'Guam',
|
|
217
|
+
'Northern Mariana Islands',
|
|
218
|
+
'American Samoa',
|
|
219
|
+
'U.S. Virgin Islands',
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
{ value: 5, label: 'DOP', currency: 'dop' },
|
|
223
|
+
{ value: 6, label: 'UZS', currency: 'uzs' },
|
|
224
|
+
{ value: 7, label: 'TTD', currency: 'ttd' },
|
|
225
|
+
{ header: 'All currencies' },
|
|
226
|
+
{
|
|
227
|
+
currency: 'aed',
|
|
228
|
+
value: 'AED',
|
|
229
|
+
label: 'AED',
|
|
230
|
+
searchStrings: ['United Arab Emirates'],
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
currency: 'aud',
|
|
234
|
+
value: 'AUD',
|
|
235
|
+
label: 'AUD',
|
|
236
|
+
note: 'Australian dollar',
|
|
237
|
+
searchStrings: ['Australia'],
|
|
238
|
+
secondary: '',
|
|
239
|
+
icon: null,
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
currency: 'bgn',
|
|
243
|
+
value: 'BGN',
|
|
244
|
+
label: 'BGN',
|
|
245
|
+
note: 'Bulgarian lev',
|
|
246
|
+
searchStrings: ['Bulgaria'],
|
|
247
|
+
secondary: '',
|
|
248
|
+
icon: null,
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
currency: 'brl',
|
|
252
|
+
value: 'BRL',
|
|
253
|
+
label: 'BRL',
|
|
254
|
+
note: 'Brazilian real',
|
|
255
|
+
searchStrings: ['Brazil'],
|
|
256
|
+
secondary: '',
|
|
257
|
+
icon: null,
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
currency: undefined,
|
|
261
|
+
value: 'USD',
|
|
262
|
+
label: 'USD',
|
|
263
|
+
note: 'United States dollar - Outside of the US',
|
|
264
|
+
searchStrings: ['United States'],
|
|
265
|
+
secondary: '',
|
|
266
|
+
icon: <GlobeIcon />,
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
selected: { value: 1, label: 'EUR', currency: 'EUR' },
|
|
270
|
+
},
|
|
271
|
+
render: (args) => {
|
|
272
|
+
const initialSelected = args.selected ?? { value: 1, label: 'EUR', currency: 'EUR' };
|
|
273
|
+
const [selected, setSelected] = useState<SelectOptionItem>(initialSelected);
|
|
274
|
+
return (
|
|
275
|
+
<Select
|
|
276
|
+
{...args}
|
|
277
|
+
selected={selected}
|
|
278
|
+
onChange={(option) => {
|
|
279
|
+
if (isSelectOptionItem(option)) {
|
|
280
|
+
setSelected(option);
|
|
281
|
+
}
|
|
282
|
+
}}
|
|
283
|
+
/>
|
|
284
|
+
);
|
|
285
|
+
},
|
|
302
286
|
};
|
|
303
287
|
|
|
304
|
-
export const AdvancedSearch =
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
{
|
|
354
|
-
{
|
|
355
|
-
{
|
|
356
|
-
{
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
searchStrings: ['abbreviation', 'acronym', 'nickname'],
|
|
365
|
-
},
|
|
366
|
-
].filter((option) => option.label?.toLowerCase().includes(searchValue))}
|
|
367
|
-
onChange={(option) => {
|
|
368
|
-
if (isSelectOptionItem(option)) {
|
|
369
|
-
setSelected(option);
|
|
288
|
+
export const AdvancedSearch: Story = {
|
|
289
|
+
args: {
|
|
290
|
+
id: 'advanced-search-button',
|
|
291
|
+
size: 'md',
|
|
292
|
+
placeholder: 'placeholder',
|
|
293
|
+
dropdownRight: 'md',
|
|
294
|
+
dropdownWidth: 'md',
|
|
295
|
+
inverse: false,
|
|
296
|
+
block: true,
|
|
297
|
+
required: false,
|
|
298
|
+
dropdownUp: false,
|
|
299
|
+
disabled: false,
|
|
300
|
+
searchPlaceholder: 'searchplaceholder',
|
|
301
|
+
options: [
|
|
302
|
+
{ header: 'Basic' },
|
|
303
|
+
{ value: -1, label: 'A thing' },
|
|
304
|
+
{ value: 0, label: 'A thing', note: 'with a note' },
|
|
305
|
+
{ value: 1, label: 'Another thing', secondary: 'with secondary text this time' },
|
|
306
|
+
{
|
|
307
|
+
value: -2,
|
|
308
|
+
label: 'One more thing',
|
|
309
|
+
note: 'with a note',
|
|
310
|
+
secondary: 'and with secondary text',
|
|
311
|
+
},
|
|
312
|
+
{ value: 2, label: 'A disabled thing', disabled: true },
|
|
313
|
+
{ separator: true },
|
|
314
|
+
{ header: 'Icons' },
|
|
315
|
+
{ value: 3, label: 'Profile', icon: <ProfileIcon /> },
|
|
316
|
+
{ value: 4, label: 'Globe', icon: <GlobeIcon /> },
|
|
317
|
+
{ header: 'Currencies' },
|
|
318
|
+
{ value: 5, label: 'British pound', currency: 'gbp' },
|
|
319
|
+
{ value: 6, label: 'Euro', currency: 'eur' },
|
|
320
|
+
{ separator: true },
|
|
321
|
+
{ value: 7, label: 'Something else' },
|
|
322
|
+
{ header: 'Options with searchable alternatives' },
|
|
323
|
+
{
|
|
324
|
+
value: 8,
|
|
325
|
+
label: 'A thing with searchable alternatives',
|
|
326
|
+
searchStrings: ['abbreviation', 'acronym', 'nickname'],
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
selected: { value: 0, label: 'A thing', note: 'with a note' },
|
|
330
|
+
},
|
|
331
|
+
render: (args) => {
|
|
332
|
+
const [searchValue, setSearchValue] = useState('');
|
|
333
|
+
const initialSelected = args.selected ?? { value: 0, label: 'A thing', note: 'with a note' };
|
|
334
|
+
const [selected, setSelected] = useState<SelectOptionItem>(initialSelected);
|
|
335
|
+
return (
|
|
336
|
+
<Select
|
|
337
|
+
{...args}
|
|
338
|
+
selected={selected}
|
|
339
|
+
searchValue={searchValue}
|
|
340
|
+
options={
|
|
341
|
+
Array.isArray(args.options)
|
|
342
|
+
? args.options.filter(
|
|
343
|
+
(option) =>
|
|
344
|
+
typeof option.label === 'string' &&
|
|
345
|
+
option.label.toLowerCase().includes(searchValue),
|
|
346
|
+
)
|
|
347
|
+
: []
|
|
370
348
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
349
|
+
onChange={(option) => {
|
|
350
|
+
if (isSelectOptionItem(option)) {
|
|
351
|
+
setSelected(option);
|
|
352
|
+
}
|
|
353
|
+
}}
|
|
354
|
+
onSearchChange={(v) => setSearchValue(v)}
|
|
355
|
+
/>
|
|
356
|
+
);
|
|
357
|
+
},
|
|
375
358
|
};
|
|
376
359
|
|
|
377
|
-
export const SearchingLargeLists =
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
360
|
+
export const SearchingLargeLists: Story = {
|
|
361
|
+
parameters: {
|
|
362
|
+
docs: {
|
|
363
|
+
canvas: {
|
|
364
|
+
sourceState: 'hidden',
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
args: {
|
|
369
|
+
id: 'large-list-button',
|
|
370
|
+
size: 'md',
|
|
371
|
+
placeholder: 'Placeholder text',
|
|
372
|
+
dropdownRight: 'md',
|
|
373
|
+
dropdownWidth: 'md',
|
|
374
|
+
inverse: false,
|
|
375
|
+
block: true,
|
|
376
|
+
required: false,
|
|
377
|
+
dropdownUp: false,
|
|
378
|
+
disabled: false,
|
|
379
|
+
search: true,
|
|
380
|
+
searchPlaceholder: 'Search placeholder',
|
|
381
|
+
options: new Array(1500).fill(null).map((x, index) => ({
|
|
382
|
+
value: `option${index + 1}`,
|
|
383
|
+
label: `Option ${index + 1}`,
|
|
384
|
+
secondary: `Here we have a description describing option ${index + 1}`,
|
|
385
|
+
})),
|
|
386
|
+
selected: {
|
|
387
|
+
value: 'option1',
|
|
388
|
+
label: 'Option 1',
|
|
389
|
+
secondary: 'Here we have a description describing option 1',
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
render: (args) => {
|
|
393
|
+
const initialSelected = args.selected ?? {
|
|
394
|
+
value: 'option1',
|
|
395
|
+
label: 'Option 1',
|
|
396
|
+
secondary: 'Here we have a description describing option 1',
|
|
397
|
+
};
|
|
398
|
+
const [selected, setSelected] = useState<SelectOptionItem>(initialSelected);
|
|
399
|
+
return (
|
|
400
|
+
<Select
|
|
401
|
+
{...args}
|
|
402
|
+
selected={selected}
|
|
403
|
+
onChange={(option) => {
|
|
404
|
+
if (isSelectOptionItem(option)) {
|
|
405
|
+
setSelected(option);
|
|
406
|
+
}
|
|
407
|
+
}}
|
|
408
|
+
/>
|
|
409
|
+
);
|
|
410
|
+
},
|
|
423
411
|
};
|
|
424
412
|
|
|
425
|
-
export const CustomDropdownBalances =
|
|
426
|
-
|
|
413
|
+
export const CustomDropdownBalances: Story = {
|
|
414
|
+
render: () => (
|
|
427
415
|
<>
|
|
428
416
|
Bye
|
|
429
417
|
<div className="open">
|
|
@@ -451,5 +439,5 @@ export const CustomDropdownBalances = () => {
|
|
|
451
439
|
</ul>
|
|
452
440
|
</div>
|
|
453
441
|
</>
|
|
454
|
-
)
|
|
442
|
+
),
|
|
455
443
|
};
|