@transferwise/components 45.17.0 → 45.18.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/i18n/en.json +1 -0
- package/build/index.esm.js +391 -350
- package/build/index.esm.js.map +1 -1
- package/build/index.js +391 -349
- 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/instructionsList/InstructionsList.css +1 -1
- package/build/styles/main.css +1 -1
- package/build/styles/stepper/Stepper.css +1 -1
- package/build/styles/tooltip/Tooltip.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/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts +13 -0
- package/build/types/common/polymorphicWithOverrides/PolymorphicWithOverrides.d.ts.map +1 -0
- package/build/types/common/randomId.d.ts +13 -0
- package/build/types/common/randomId.d.ts.map +1 -0
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +16 -6
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/instructionsList/InstructionsList.d.ts +10 -3
- package/build/types/instructionsList/InstructionsList.d.ts.map +1 -1
- package/build/types/processIndicator/ProcessIndicator.d.ts +1 -1
- 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/build/types/tooltip/Tooltip.d.ts +2 -1
- package/build/types/tooltip/Tooltip.d.ts.map +1 -1
- package/package.json +4 -3
- 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.story.tsx +6 -0
- package/src/button/Button.tsx +17 -2
- 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/polymorphicWithOverrides/PolymorphicWithOverrides.tsx +19 -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/index.ts +3 -0
- package/src/inputs/SelectInput.css +1 -1
- package/src/inputs/SelectInput.less +8 -2
- package/src/inputs/SelectInput.story.tsx +52 -5
- package/src/inputs/SelectInput.tsx +165 -104
- package/src/inputs/_Popover.less +1 -1
- package/src/instructionsList/InstructionList.story.tsx +39 -0
- package/src/instructionsList/InstructionsList.css +1 -1
- package/src/instructionsList/InstructionsList.less +3 -15
- package/src/instructionsList/InstructionsList.spec.tsx +35 -0
- package/src/instructionsList/InstructionsList.tsx +40 -25
- package/src/main.css +1 -1
- package/src/moneyInput/MoneyInput.story.tsx +0 -3
- package/src/phoneNumberInput/PhoneNumberInput.story.js +0 -3
- package/src/processIndicator/ProcessIndicator.js +2 -2
- 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/stepper/Stepper.css +1 -1
- package/src/stepper/Stepper.less +1 -1
- package/src/tooltip/Tooltip.css +1 -1
- package/src/tooltip/Tooltip.less +13 -0
- package/src/tooltip/Tooltip.spec.tsx +97 -29
- package/src/tooltip/Tooltip.tsx +24 -31
- package/src/tooltip/__snapshots__/Tooltip.spec.tsx.snap +31 -0
- package/src/upload/Upload.spec.js +2 -0
- package/src/instructionsList/InstructionList.story.js +0 -27
- package/src/instructionsList/InstructionsList.spec.js +0 -29
- package/src/select/searchBox/__snapshots__/SearchBox.spec.js.snap +0 -46
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
exports[`Button alternative states renders as block if block is true 1`] = `
|
|
4
4
|
<div>
|
|
5
5
|
<button
|
|
6
|
+
aria-live="off"
|
|
6
7
|
class="btn btn-md np-btn np-btn-md btn-block np-btn-block btn-accent btn-priority-1"
|
|
7
8
|
type="button"
|
|
8
9
|
>
|
|
@@ -11,24 +12,10 @@ exports[`Button alternative states renders as block if block is true 1`] = `
|
|
|
11
12
|
</div>
|
|
12
13
|
`;
|
|
13
14
|
|
|
14
|
-
exports[`Button alternative states renders as loading if loading is true 1`] = `
|
|
15
|
-
<div>
|
|
16
|
-
<button
|
|
17
|
-
class="btn btn-md np-btn np-btn-md btn-loading disabled btn-accent btn-priority-1"
|
|
18
|
-
disabled=""
|
|
19
|
-
type="button"
|
|
20
|
-
>
|
|
21
|
-
Send money
|
|
22
|
-
<span
|
|
23
|
-
class="btn-loader m-l-2"
|
|
24
|
-
/>
|
|
25
|
-
</button>
|
|
26
|
-
</div>
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
15
|
exports[`Button by default renders a medium button of type accent and priority primary 1`] = `
|
|
30
16
|
<div>
|
|
31
17
|
<button
|
|
18
|
+
aria-live="off"
|
|
32
19
|
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
33
20
|
type="button"
|
|
34
21
|
>
|
|
@@ -40,6 +27,7 @@ exports[`Button by default renders a medium button of type accent and priority p
|
|
|
40
27
|
exports[`Button by default renders an anchor tag with button styles of type accent and priority primary 1`] = `
|
|
41
28
|
<div>
|
|
42
29
|
<a
|
|
30
|
+
aria-live="off"
|
|
43
31
|
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
44
32
|
href="#"
|
|
45
33
|
>
|
|
@@ -51,6 +39,7 @@ exports[`Button by default renders an anchor tag with button styles of type acce
|
|
|
51
39
|
exports[`Button deprecated types renders danger as negative buttons with priority secondary and logs a warning 1`] = `
|
|
52
40
|
<div>
|
|
53
41
|
<button
|
|
42
|
+
aria-live="off"
|
|
54
43
|
class="btn btn-md np-btn np-btn-md btn-negative btn-priority-2"
|
|
55
44
|
type="button"
|
|
56
45
|
>
|
|
@@ -62,6 +51,7 @@ exports[`Button deprecated types renders danger as negative buttons with priorit
|
|
|
62
51
|
exports[`Button deprecated types renders link as accent buttons with priority tertiary and logs a warning 1`] = `
|
|
63
52
|
<div>
|
|
64
53
|
<button
|
|
54
|
+
aria-live="off"
|
|
65
55
|
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-3"
|
|
66
56
|
type="button"
|
|
67
57
|
>
|
|
@@ -73,6 +63,7 @@ exports[`Button deprecated types renders link as accent buttons with priority te
|
|
|
73
63
|
exports[`Button deprecated types renders pay as positive buttons and logs a warning 1`] = `
|
|
74
64
|
<div>
|
|
75
65
|
<button
|
|
66
|
+
aria-live="off"
|
|
76
67
|
class="btn btn-md np-btn np-btn-md btn-positive btn-priority-1"
|
|
77
68
|
type="button"
|
|
78
69
|
>
|
|
@@ -84,6 +75,7 @@ exports[`Button deprecated types renders pay as positive buttons and logs a warn
|
|
|
84
75
|
exports[`Button deprecated types renders primary as accent buttons and logs a warning 1`] = `
|
|
85
76
|
<div>
|
|
86
77
|
<button
|
|
78
|
+
aria-live="off"
|
|
87
79
|
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
88
80
|
type="button"
|
|
89
81
|
>
|
|
@@ -95,6 +87,7 @@ exports[`Button deprecated types renders primary as accent buttons and logs a wa
|
|
|
95
87
|
exports[`Button priorities defaults tertiary buttons to secondary for positive buttons 1`] = `
|
|
96
88
|
<div>
|
|
97
89
|
<button
|
|
90
|
+
aria-live="off"
|
|
98
91
|
class="btn btn-md np-btn np-btn-md btn-positive btn-priority-2"
|
|
99
92
|
type="button"
|
|
100
93
|
>
|
|
@@ -106,6 +99,7 @@ exports[`Button priorities defaults tertiary buttons to secondary for positive b
|
|
|
106
99
|
exports[`Button priorities defaults tertiary buttons to secondary for positive buttons 2`] = `
|
|
107
100
|
<div>
|
|
108
101
|
<button
|
|
102
|
+
aria-live="off"
|
|
109
103
|
class="btn btn-md np-btn np-btn-md btn-negative btn-priority-2"
|
|
110
104
|
type="button"
|
|
111
105
|
>
|
|
@@ -117,6 +111,7 @@ exports[`Button priorities defaults tertiary buttons to secondary for positive b
|
|
|
117
111
|
exports[`Button priorities renders primary buttons 1`] = `
|
|
118
112
|
<div>
|
|
119
113
|
<button
|
|
114
|
+
aria-live="off"
|
|
120
115
|
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
121
116
|
type="button"
|
|
122
117
|
>
|
|
@@ -128,6 +123,7 @@ exports[`Button priorities renders primary buttons 1`] = `
|
|
|
128
123
|
exports[`Button priorities renders primary buttons 2`] = `
|
|
129
124
|
<div>
|
|
130
125
|
<button
|
|
126
|
+
aria-live="off"
|
|
131
127
|
class="btn btn-md np-btn np-btn-md btn-positive btn-priority-1"
|
|
132
128
|
type="button"
|
|
133
129
|
>
|
|
@@ -139,6 +135,7 @@ exports[`Button priorities renders primary buttons 2`] = `
|
|
|
139
135
|
exports[`Button priorities renders primary buttons 3`] = `
|
|
140
136
|
<div>
|
|
141
137
|
<button
|
|
138
|
+
aria-live="off"
|
|
142
139
|
class="btn btn-md np-btn np-btn-md btn-negative btn-priority-1"
|
|
143
140
|
type="button"
|
|
144
141
|
>
|
|
@@ -150,6 +147,7 @@ exports[`Button priorities renders primary buttons 3`] = `
|
|
|
150
147
|
exports[`Button priorities renders secondary buttons 1`] = `
|
|
151
148
|
<div>
|
|
152
149
|
<button
|
|
150
|
+
aria-live="off"
|
|
153
151
|
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-2"
|
|
154
152
|
type="button"
|
|
155
153
|
>
|
|
@@ -161,6 +159,7 @@ exports[`Button priorities renders secondary buttons 1`] = `
|
|
|
161
159
|
exports[`Button priorities renders secondary buttons 2`] = `
|
|
162
160
|
<div>
|
|
163
161
|
<button
|
|
162
|
+
aria-live="off"
|
|
164
163
|
class="btn btn-md np-btn np-btn-md btn-positive btn-priority-2"
|
|
165
164
|
type="button"
|
|
166
165
|
>
|
|
@@ -172,6 +171,7 @@ exports[`Button priorities renders secondary buttons 2`] = `
|
|
|
172
171
|
exports[`Button priorities renders secondary buttons 3`] = `
|
|
173
172
|
<div>
|
|
174
173
|
<button
|
|
174
|
+
aria-live="off"
|
|
175
175
|
class="btn btn-md np-btn np-btn-md btn-negative btn-priority-2"
|
|
176
176
|
type="button"
|
|
177
177
|
>
|
|
@@ -183,6 +183,7 @@ exports[`Button priorities renders secondary buttons 3`] = `
|
|
|
183
183
|
exports[`Button priorities renders tertiary buttons 1`] = `
|
|
184
184
|
<div>
|
|
185
185
|
<button
|
|
186
|
+
aria-live="off"
|
|
186
187
|
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-3"
|
|
187
188
|
type="button"
|
|
188
189
|
>
|
|
@@ -194,6 +195,7 @@ exports[`Button priorities renders tertiary buttons 1`] = `
|
|
|
194
195
|
exports[`Button sizes renders large buttons 1`] = `
|
|
195
196
|
<div>
|
|
196
197
|
<button
|
|
198
|
+
aria-live="off"
|
|
197
199
|
class="btn btn-lg np-btn np-btn-lg btn-accent btn-priority-1"
|
|
198
200
|
type="button"
|
|
199
201
|
>
|
|
@@ -205,6 +207,7 @@ exports[`Button sizes renders large buttons 1`] = `
|
|
|
205
207
|
exports[`Button sizes renders medium buttons 1`] = `
|
|
206
208
|
<div>
|
|
207
209
|
<button
|
|
210
|
+
aria-live="off"
|
|
208
211
|
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
209
212
|
type="button"
|
|
210
213
|
>
|
|
@@ -216,6 +219,7 @@ exports[`Button sizes renders medium buttons 1`] = `
|
|
|
216
219
|
exports[`Button sizes renders small buttons 1`] = `
|
|
217
220
|
<div>
|
|
218
221
|
<button
|
|
222
|
+
aria-live="off"
|
|
219
223
|
class="btn btn-sm np-btn np-btn-sm btn-accent btn-priority-1"
|
|
220
224
|
type="button"
|
|
221
225
|
>
|
|
@@ -227,6 +231,7 @@ exports[`Button sizes renders small buttons 1`] = `
|
|
|
227
231
|
exports[`Button types renders accent buttons 1`] = `
|
|
228
232
|
<div>
|
|
229
233
|
<button
|
|
234
|
+
aria-live="off"
|
|
230
235
|
class="btn btn-md np-btn np-btn-md btn-accent btn-priority-1"
|
|
231
236
|
type="button"
|
|
232
237
|
>
|
|
@@ -238,6 +243,7 @@ exports[`Button types renders accent buttons 1`] = `
|
|
|
238
243
|
exports[`Button types renders negative buttons 1`] = `
|
|
239
244
|
<div>
|
|
240
245
|
<button
|
|
246
|
+
aria-live="off"
|
|
241
247
|
class="btn btn-md np-btn np-btn-md btn-negative btn-priority-1"
|
|
242
248
|
type="button"
|
|
243
249
|
>
|
|
@@ -249,6 +255,7 @@ exports[`Button types renders negative buttons 1`] = `
|
|
|
249
255
|
exports[`Button types renders positive buttons 1`] = `
|
|
250
256
|
<div>
|
|
251
257
|
<button
|
|
258
|
+
aria-live="off"
|
|
252
259
|
class="btn btn-md np-btn np-btn-md btn-positive btn-priority-1"
|
|
253
260
|
type="button"
|
|
254
261
|
>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.np-option:has(:focus-visible){--ring-outline-offset:0;outline:var(--ring-outline-color) solid var(--ring-outline-width);outline-offset:var(--ring-outline-offset)}.np-option:has(:focus-visible) :focus-visible{outline:none}.np-option .circle-sm{height:40px;height:var(--size-40);width:40px;width:var(--size-40)}.np-option__title{color:#37517e;color:var(--color-content-primary);
|
|
1
|
+
.np-option:has(:focus-visible){--ring-outline-offset:0;outline:var(--ring-outline-color) solid var(--ring-outline-width);outline-offset:var(--ring-outline-offset)}.np-option:has(:focus-visible) :focus-visible{outline:none}.np-option .circle-sm{height:40px;height:var(--size-40);width:40px;width:var(--size-40)}.np-option__title{color:#37517e;color:var(--color-content-primary);font-size:1rem;font-weight:600;font-weight:var(--font-weight-semi-bold);letter-spacing:0;line-height:1.5;line-height:var(--line-height-body);margin:0}.np-option__body{color:#5d7079;color:var(--color-content-secondary);font-size:.875rem;font-size:var(--font-size-14);font-weight:400;font-weight:var(--font-weight-regular);line-height:1.42857;margin-top:4px;margin-top:var(--size-4)}.np-option__sm-media.decision .media-left{display:block}.np-option__no-media-circle{display:flex;justify-content:center;max-width:64px;max-width:var(--size-64);min-width:48px;min-width:var(--size-48)}.np-option__no-media-circle>*{max-height:76px}button.np-option{background-color:transparent;text-align:left;width:100%}[dir=rtl] button.np-option{text-align:right}.np-theme-personal .np-option .circle{overflow:visible}.np-theme-personal .np-option .circle-sm{height:48px;height:var(--size-48);line-height:48px;line-height:var(--size-48);width:48px;width:var(--size-48)}.np-theme-personal .np-option__body{margin:4px 0 0;margin:var(--size-4) 0 0;text-decoration:none}.np-theme-personal .np-option__container-aligned{margin-left:-16px;margin-left:calc(var(--space-content-horizontal)*-1);margin-right:-16px;margin-right:calc(var(--space-content-horizontal)*-1);max-width:none;width:auto}@media (min-width:576px){.np-theme-personal .np-option{border-radius:10px;border-radius:var(--radius-small)}}
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
letter-spacing: 0;
|
|
24
24
|
line-height: var(--line-height-body);
|
|
25
25
|
margin: 0;
|
|
26
|
-
display: inline-block;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
&__body {
|
|
@@ -72,10 +71,6 @@ button.np-option {
|
|
|
72
71
|
line-height: var(--size-48);
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
&__title {
|
|
76
|
-
display: inline-block;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
74
|
&__body {
|
|
80
75
|
margin: var(--size-4) 0 0;
|
|
81
76
|
text-decoration: none;
|
package/src/common/index.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface PolymorphicWithOverridesProps {
|
|
4
|
+
__overrides: {
|
|
5
|
+
as: React.ElementType;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* For overcoming the limitations of third-party components with an `as` prop.
|
|
13
|
+
*/
|
|
14
|
+
export const PolymorphicWithOverrides = forwardRef(function PolymorphicWithOverrides(
|
|
15
|
+
{ __overrides: { as: Element, ...restOverrides }, ...restProps }: PolymorphicWithOverridesProps,
|
|
16
|
+
ref: React.ForwardedRef<Element>,
|
|
17
|
+
) {
|
|
18
|
+
return <Element ref={ref} {...restProps} {...restOverrides} />;
|
|
19
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* generateRandomId() function
|
|
3
|
+
*
|
|
4
|
+
* This function generates a random string of characters that can be used as
|
|
5
|
+
* an ID.
|
|
6
|
+
*
|
|
7
|
+
* @returns {string} A random string of characters.
|
|
8
|
+
* @example
|
|
9
|
+
* const id = generateRandomId();
|
|
10
|
+
* // id will be a random string of characters, such as "id-4711".
|
|
11
|
+
*/
|
|
12
|
+
export const generateRandomId = (): string => {
|
|
13
|
+
return `id-${Math.random().toString(36).slice(7)}`;
|
|
14
|
+
};
|
package/src/i18n/en.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -5,9 +5,12 @@ export type { InputProps } from './inputs/Input';
|
|
|
5
5
|
export type { InputGroupProps } from './inputs/InputGroup';
|
|
6
6
|
export type { SearchInputProps } from './inputs/SearchInput';
|
|
7
7
|
export type {
|
|
8
|
+
SelectInputGroupItem,
|
|
8
9
|
SelectInputItem,
|
|
9
10
|
SelectInputOptionContentProps,
|
|
11
|
+
SelectInputOptionItem,
|
|
10
12
|
SelectInputProps,
|
|
13
|
+
SelectInputSeparatorItem,
|
|
11
14
|
} from './inputs/SelectInput';
|
|
12
15
|
export type { TextAreaProps } from './inputs/TextArea';
|
|
13
16
|
export type { UploadedFile, UploadError, UploadResponse } from './uploadInput/types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.np-bottom-sheet-v2-container{position:relative;z-index:1060}.np-bottom-sheet-v2-backdrop-container--enter,.np-bottom-sheet-v2-backdrop-container--leave{transition-duration:.15s;transition-property:opacity;transition-timing-function:ease-out}.np-bottom-sheet-v2-backdrop-container--enter-from,.np-bottom-sheet-v2-backdrop-container--leave-to{opacity:0}.np-bottom-sheet-v2-backdrop{background-color:#37517e;background-color:var(--color-content-primary);inset:0;opacity:.4;position:fixed}.np-bottom-sheet-v2{display:flex;flex-direction:column;inset:0;justify-content:flex-end;padding-left:8px;padding-left:var(--size-8);padding-right:8px;padding-right:var(--size-8);padding-top:64px;padding-top:var(--size-64);position:fixed}.np-bottom-sheet-v2-content{max-height:100%}.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-duration:.3s;transition-property:transform;transition-timing-function:ease-out}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-property:opacity}}@media (prefers-reduced-motion:no-preference){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{transform:translateY(100%)}}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{opacity:0}}.np-bottom-sheet-v2-content-inner-container{background-color:#fff;background-color:var(--color-background-elevated);border-top-left-radius:32px;border-top-right-radius:32px;box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;height:100%}.np-bottom-sheet-v2-content-inner-container:focus{outline:none}.np-bottom-sheet-v2-header{align-self:flex-end;padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-content-inner{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;padding-top:0;row-gap:8px;row-gap:var(--size-8)}.np-bottom-sheet-v2-content-inner--has-title{grid-template-rows:auto 1fr}.np-bottom-sheet-v2-content-inner--padding-md{padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-title{color:#37517e;color:var(--color-content-primary)}.np-bottom-sheet-v2-body{color:#5d7079;color:var(--color-content-secondary)}.np-button-input{align-content:center;border-radius:10px;border-radius:var(--size-10);display:inline-grid;grid-auto-columns:minmax(0,1fr);text-align:start}.np-popover-v2-container{background-color:#fff;background-color:var(--color-background-elevated);border-radius:10px;border-radius:var(--radius-small);box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;max-height:var(--max-height);min-width
|
|
1
|
+
.np-bottom-sheet-v2-container{position:relative;z-index:1060}.np-bottom-sheet-v2-backdrop-container--enter,.np-bottom-sheet-v2-backdrop-container--leave{transition-duration:.15s;transition-property:opacity;transition-timing-function:ease-out}.np-bottom-sheet-v2-backdrop-container--enter-from,.np-bottom-sheet-v2-backdrop-container--leave-to{opacity:0}.np-bottom-sheet-v2-backdrop{background-color:#37517e;background-color:var(--color-content-primary);inset:0;opacity:.4;position:fixed}.np-bottom-sheet-v2{display:flex;flex-direction:column;inset:0;justify-content:flex-end;padding-left:8px;padding-left:var(--size-8);padding-right:8px;padding-right:var(--size-8);padding-top:64px;padding-top:var(--size-64);position:fixed}.np-bottom-sheet-v2-content{max-height:100%}.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-duration:.3s;transition-property:transform;transition-timing-function:ease-out}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter,.np-bottom-sheet-v2-content--leave{transition-property:opacity}}@media (prefers-reduced-motion:no-preference){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{transform:translateY(100%)}}@media (prefers-reduced-motion:reduce){.np-bottom-sheet-v2-content--enter-from,.np-bottom-sheet-v2-content--leave-to{opacity:0}}.np-bottom-sheet-v2-content-inner-container{background-color:#fff;background-color:var(--color-background-elevated);border-top-left-radius:32px;border-top-right-radius:32px;box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;height:100%}.np-bottom-sheet-v2-content-inner-container:focus{outline:none}.np-bottom-sheet-v2-header{align-self:flex-end;padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-content-inner{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;padding-top:0;row-gap:8px;row-gap:var(--size-8)}.np-bottom-sheet-v2-content-inner--has-title{grid-template-rows:auto 1fr}.np-bottom-sheet-v2-content-inner--padding-md{padding:16px;padding:var(--size-16)}.np-bottom-sheet-v2-title{color:#37517e;color:var(--color-content-primary)}.np-bottom-sheet-v2-body{color:#5d7079;color:var(--color-content-secondary)}.np-button-input{align-content:center;border-radius:10px;border-radius:var(--size-10);display:inline-grid;grid-auto-columns:minmax(0,1fr);text-align:start}.np-popover-v2-container{background-color:#fff;background-color:var(--color-background-elevated);border-radius:10px;border-radius:var(--radius-small);box-shadow:0 0 40px rgba(69,71,69,.2);display:flex;flex-direction:column;max-height:var(--max-height);min-width:20rem;width:var(--width);z-index:1060}.np-popover-v2-container:focus{outline:none}.np-popover-v2{display:grid;grid-template-rows:repeat(1,minmax(0,1fr));overflow-y:auto;row-gap:8px;row-gap:var(--size-8)}.np-popover-v2--has-title{grid-template-rows:auto 1fr}.np-popover-v2--padding-md{padding:16px;padding:var(--size-16)}.np-popover-v2-title{color:#37517e;color:var(--color-content-primary)}.np-popover-v2-content{color:#5d7079;color:var(--color-content-secondary)}.np-select-input-placeholder{color:#768e9c;color:var(--color-content-tertiary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-options-container{display:flex;flex-direction:column;height:100%}.np-select-input-options-container:focus{outline:none}@media (min-width:576px){.np-select-input-options-container{max-height:28rem}}.np-select-input-query-container{display:flex;flex-direction:column;padding:8px;padding:var(--size-8);padding-top:0}@media (min-width:576px){.np-select-input-query-container{padding-top:8px;padding-top:var(--size-8)}}.np-select-input-listbox-container{height:var(--initial-height);overflow-y:auto;position:relative;scroll-padding-bottom:8px;scroll-padding-bottom:var(--size-8);scroll-padding-top:8px;scroll-padding-top:var(--size-8)}@media (min-width:576px){.np-select-input-listbox-container{height:auto}}.np-select-input-listbox-container--has-group{scroll-padding-top:32px;scroll-padding-top:var(--size-32)}.np-select-input-listbox{padding:8px;padding:var(--size-8)}.np-select-input-listbox:focus{outline:none}.np-select-input-separator-item{border-top-width:1px;margin:8px;margin:var(--size-8)}.np-select-input-group-item--without-needle:first-child{margin-top:-8px;margin-top:calc(var(--size-8)*-1)}.np-select-input-group-item-header{background-color:#fff;background-color:var(--color-background-elevated);color:#5d7079;color:var(--color-content-secondary);padding:8px 16px 4px;padding:var(--size-8) var(--size-16) var(--size-4);position:sticky;top:0;z-index:10}.np-select-input-option-container{align-items:center;border-radius:10px;border-radius:var(--radius-small);color:#37517e;color:var(--color-content-primary);-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);display:flex;padding:12px 16px;padding:var(--size-12) var(--size-16)}.np-select-input-option-container--selected{box-shadow:inset 0 0 0 1px #c9cbce;box-shadow:inset 0 0 0 1px var(--color-interactive-secondary)}.np-select-input-option-container--active{background-color:var(--color-background-screen-hover)}.np-select-input-option-container--disabled{opacity:.45}.np-select-input-option-check{color:var(--color-interactive-primary)}.np-select-input-option-check--not-selected{visibility:hidden}.np-select-input-option{flex:1}.np-select-input-option-content-container{align-items:center;color:#37517e;color:var(--color-content-primary);-moz-column-gap:8px;column-gap:8px;-moz-column-gap:var(--size-8);column-gap:var(--size-8);display:flex}.np-select-input-option-content-icon{display:flex}.np-select-input-option-content-icon--not-within-trigger{align-self:flex-start}.np-select-input-option-content-text{display:flex;flex:1;flex-direction:column;overflow:hidden}.np-select-input-option-content-text-secondary{color:#5d7079;color:var(--color-content-secondary)}.np-select-input-option-content-text-within-trigger{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.np-select-input-option-content-text-line-1>:not([hidden])~:not([hidden]){margin-left:8px;margin-left:var(--size-8);margin-right:8px;margin-right:var(--size-8)}.np-select-input-addon-container{align-items:center;display:inline-flex;pointer-events:none}.np-select-input-addon{align-items:center;background:none;border-radius:.125rem;border-width:0;display:inline-flex;height:32px;height:var(--size-32);justify-content:center;width:32px;width:var(--size-32)}.np-select-input-addon--interactive{color:#c9cbce;color:var(--color-interactive-secondary);pointer-events:auto}.np-select-input-addon--interactive:hover{color:#b5b7ba;color:var(--color-interactive-secondary-hover)}.np-select-input-addon--interactive:focus{outline:none}.np-select-input-addon--interactive:focus-visible{outline:var(--ring-outline-color) solid var(--ring-outline-width);outline-offset:var(--ring-outline-offset)}.np-select-input-addon-separator{border-inline-start-width:1px;height:24px;height:var(--size-24)}
|
|
@@ -93,6 +93,10 @@
|
|
|
93
93
|
padding: var(--size-12) var(--size-16);
|
|
94
94
|
color: var(--color-content-primary);
|
|
95
95
|
|
|
96
|
+
&--selected {
|
|
97
|
+
box-shadow: inset 0 0 0 1px var(--color-interactive-secondary);
|
|
98
|
+
}
|
|
99
|
+
|
|
96
100
|
&--active {
|
|
97
101
|
background-color: var(--color-background-screen-hover);
|
|
98
102
|
}
|
|
@@ -103,6 +107,8 @@
|
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
.np-select-input-option-check {
|
|
110
|
+
color: var(--color-interactive-primary);
|
|
111
|
+
|
|
106
112
|
&--not-selected {
|
|
107
113
|
visibility: hidden;
|
|
108
114
|
}
|
|
@@ -122,7 +128,7 @@
|
|
|
122
128
|
.np-select-input-option-content-icon {
|
|
123
129
|
display: flex;
|
|
124
130
|
|
|
125
|
-
&--not-
|
|
131
|
+
&--not-within-trigger {
|
|
126
132
|
align-self: flex-start;
|
|
127
133
|
}
|
|
128
134
|
}
|
|
@@ -138,7 +144,7 @@
|
|
|
138
144
|
color: var(--color-content-secondary);
|
|
139
145
|
}
|
|
140
146
|
|
|
141
|
-
.np-select-input-option-content-text-
|
|
147
|
+
.np-select-input-option-content-text-within-trigger {
|
|
142
148
|
overflow: hidden;
|
|
143
149
|
text-overflow: ellipsis;
|
|
144
150
|
white-space: nowrap;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Calendar } from '@transferwise/icons';
|
|
2
|
+
import { Calendar, ChevronDown } from '@transferwise/icons';
|
|
3
3
|
import { Flag } from '@wise/art';
|
|
4
|
+
import classNames from 'classnames';
|
|
4
5
|
import { useState } from 'react';
|
|
5
6
|
|
|
6
7
|
import { getMonthNames } from '../common/dateUtils';
|
|
7
8
|
import Drawer from '../drawer';
|
|
8
9
|
import Modal from '../modal';
|
|
10
|
+
import { within, userEvent } from '../test-utils';
|
|
9
11
|
|
|
10
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
SelectInput,
|
|
14
|
+
type SelectInputItem,
|
|
15
|
+
SelectInputOptionContent,
|
|
16
|
+
SelectInputTriggerButton,
|
|
17
|
+
} from './SelectInput';
|
|
11
18
|
|
|
12
19
|
export default {
|
|
13
20
|
component: SelectInput,
|
|
@@ -78,11 +85,11 @@ export const Basic: StoryObj<{
|
|
|
78
85
|
])
|
|
79
86
|
.slice(0, -1)}
|
|
80
87
|
value={selectedMonth}
|
|
81
|
-
renderValue={(month,
|
|
88
|
+
renderValue={(month, withinTrigger) => (
|
|
82
89
|
<SelectInputOptionContent
|
|
83
90
|
title={month.name}
|
|
84
91
|
note="Note"
|
|
85
|
-
description={
|
|
92
|
+
description={withinTrigger ? undefined : `Month #${month.id}`}
|
|
86
93
|
icon={<Calendar size={24} />}
|
|
87
94
|
/>
|
|
88
95
|
)}
|
|
@@ -137,7 +144,7 @@ export const Months: StoryObj<{
|
|
|
137
144
|
onClear: () => void;
|
|
138
145
|
}> = {
|
|
139
146
|
render: function Story({ onChange, onClear }) {
|
|
140
|
-
const [selectedMonth, setSelectedMonth] = useState<Month | null>(
|
|
147
|
+
const [selectedMonth, setSelectedMonth] = useState<Month | null>(months[0]);
|
|
141
148
|
|
|
142
149
|
return (
|
|
143
150
|
<div className="d-flex flex-column">
|
|
@@ -171,6 +178,11 @@ export const Months: StoryObj<{
|
|
|
171
178
|
},
|
|
172
179
|
};
|
|
173
180
|
|
|
181
|
+
Months.play = ({ canvasElement }) => {
|
|
182
|
+
const canvas = within(canvasElement);
|
|
183
|
+
userEvent.click(canvas.getByText('January'));
|
|
184
|
+
};
|
|
185
|
+
|
|
174
186
|
interface Currency {
|
|
175
187
|
code: string;
|
|
176
188
|
name: string;
|
|
@@ -265,6 +277,41 @@ export const Currencies: StoryObj<{
|
|
|
265
277
|
},
|
|
266
278
|
};
|
|
267
279
|
|
|
280
|
+
export const CustomTrigger: StoryObj = {
|
|
281
|
+
render: function Story() {
|
|
282
|
+
return (
|
|
283
|
+
<div>
|
|
284
|
+
<SelectInput
|
|
285
|
+
placeholder="Month"
|
|
286
|
+
items={months.map((month) => ({
|
|
287
|
+
type: 'option',
|
|
288
|
+
value: month,
|
|
289
|
+
}))}
|
|
290
|
+
renderValue={(month, withinTrigger) =>
|
|
291
|
+
withinTrigger ? month.name : <SelectInputOptionContent title={month.name} />
|
|
292
|
+
}
|
|
293
|
+
renderTrigger={({ content, className }) => (
|
|
294
|
+
<SelectInputTriggerButton
|
|
295
|
+
className={classNames(
|
|
296
|
+
className,
|
|
297
|
+
'btn-unstyled np-text-link-large align-items-center',
|
|
298
|
+
)}
|
|
299
|
+
style={{ display: 'inline-flex', columnGap: '0.25rem' }}
|
|
300
|
+
>
|
|
301
|
+
{content}
|
|
302
|
+
<ChevronDown size={16} />
|
|
303
|
+
</SelectInputTriggerButton>
|
|
304
|
+
)}
|
|
305
|
+
/>
|
|
306
|
+
</div>
|
|
307
|
+
);
|
|
308
|
+
},
|
|
309
|
+
play: ({ canvasElement }) => {
|
|
310
|
+
const triggerButton = within(canvasElement).getByRole('button');
|
|
311
|
+
userEvent.click(triggerButton);
|
|
312
|
+
},
|
|
313
|
+
};
|
|
314
|
+
|
|
268
315
|
export const WithinDrawer: StoryObj<{
|
|
269
316
|
onChange: (value: Currency) => void;
|
|
270
317
|
}> = {
|