@transferwise/components 46.42.0 → 46.43.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/index.js +73 -40
- package/build/index.js.map +1 -1
- package/build/index.mjs +74 -41
- package/build/index.mjs.map +1 -1
- package/build/main.css +41 -51
- package/build/styles/inputs/SelectInput.css +41 -51
- package/build/styles/main.css +41 -51
- package/build/types/common/hooks/useVirtualKeyboard.d.ts +7 -0
- package/build/types/common/hooks/useVirtualKeyboard.d.ts.map +1 -0
- package/build/types/inputs/InputGroup.d.ts.map +1 -1
- package/build/types/inputs/SelectInput.d.ts +3 -1
- package/build/types/inputs/SelectInput.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/circularButton/CircularButton.story.tsx +53 -84
- package/src/common/hooks/useVirtualKeyboard.ts +21 -0
- package/src/inputs/InputGroup.spec.tsx +26 -0
- package/src/inputs/InputGroup.tsx +35 -13
- package/src/inputs/SearchInput.spec.tsx +16 -0
- package/src/inputs/SelectInput.css +41 -51
- package/src/inputs/SelectInput.spec.tsx +1 -1
- package/src/inputs/SelectInput.tsx +4 -1
- package/src/inputs/_BottomSheet.less +35 -49
- package/src/inputs/_BottomSheet.tsx +22 -27
- package/src/inputs/_Popover.less +2 -2
- package/src/main.css +41 -51
|
@@ -10,9 +10,10 @@ import { Transition } from '@headlessui/react';
|
|
|
10
10
|
import { FocusScope } from '@react-aria/focus';
|
|
11
11
|
import { ThemeProvider, useTheme } from '@wise/components-theming';
|
|
12
12
|
import classNames from 'classnames';
|
|
13
|
-
import { useState } from 'react';
|
|
13
|
+
import { Fragment, useState } from 'react';
|
|
14
14
|
|
|
15
15
|
import { CloseButton } from '../common/closeButton';
|
|
16
|
+
import { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard';
|
|
16
17
|
import { PreventScroll } from '../common/preventScroll/PreventScroll';
|
|
17
18
|
import { Size } from '../common/propsValues/size';
|
|
18
19
|
|
|
@@ -42,6 +43,8 @@ export function BottomSheet({
|
|
|
42
43
|
onClose,
|
|
43
44
|
onCloseEnd,
|
|
44
45
|
}: BottomSheetProps) {
|
|
46
|
+
useVirtualKeyboard();
|
|
47
|
+
|
|
45
48
|
const { refs, context } = useFloating<Element>({
|
|
46
49
|
open,
|
|
47
50
|
onOpenChange: (value) => {
|
|
@@ -82,28 +85,22 @@ export function BottomSheet({
|
|
|
82
85
|
afterLeave={onCloseEnd}
|
|
83
86
|
>
|
|
84
87
|
<Transition.Child
|
|
85
|
-
|
|
86
|
-
enterFrom="np-bottom-sheet-v2-backdrop
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
>
|
|
90
|
-
<div className="np-bottom-sheet-v2-backdrop" />
|
|
91
|
-
</Transition.Child>
|
|
88
|
+
className="np-bottom-sheet-v2-backdrop"
|
|
89
|
+
enterFrom="np-bottom-sheet-v2-backdrop--closed"
|
|
90
|
+
leaveTo="np-bottom-sheet-v2-backdrop--closed"
|
|
91
|
+
/>
|
|
92
92
|
|
|
93
93
|
<div className="np-bottom-sheet-v2">
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
>
|
|
101
|
-
<FocusScope>
|
|
102
|
-
<FloatingFocusManager context={context} initialFocus={initialFocusRef}>
|
|
103
|
-
<div
|
|
104
|
-
key={floatingKey} // Force inner state invalidation on open
|
|
94
|
+
<FocusScope>
|
|
95
|
+
<FloatingFocusManager context={context} initialFocus={initialFocusRef}>
|
|
96
|
+
<Fragment
|
|
97
|
+
key={floatingKey} // Force inner state invalidation on open
|
|
98
|
+
>
|
|
99
|
+
<Transition.Child
|
|
105
100
|
ref={refs.setFloating}
|
|
106
|
-
className="np-bottom-sheet-v2-content
|
|
101
|
+
className="np-bottom-sheet-v2-content"
|
|
102
|
+
enterFrom="np-bottom-sheet-v2-content--closed"
|
|
103
|
+
leaveTo="np-bottom-sheet-v2-content--closed"
|
|
107
104
|
{...getFloatingProps()}
|
|
108
105
|
>
|
|
109
106
|
<div className="np-bottom-sheet-v2-header">
|
|
@@ -118,9 +115,7 @@ export function BottomSheet({
|
|
|
118
115
|
className={classNames(
|
|
119
116
|
'np-bottom-sheet-v2-content-inner',
|
|
120
117
|
title && 'np-bottom-sheet-v2-content-inner--has-title',
|
|
121
|
-
|
|
122
|
-
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md',
|
|
123
|
-
},
|
|
118
|
+
padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',
|
|
124
119
|
)}
|
|
125
120
|
>
|
|
126
121
|
{title ? (
|
|
@@ -130,10 +125,10 @@ export function BottomSheet({
|
|
|
130
125
|
{children}
|
|
131
126
|
</div>
|
|
132
127
|
</div>
|
|
133
|
-
</
|
|
134
|
-
</
|
|
135
|
-
</
|
|
136
|
-
</
|
|
128
|
+
</Transition.Child>
|
|
129
|
+
</Fragment>
|
|
130
|
+
</FloatingFocusManager>
|
|
131
|
+
</FocusScope>
|
|
137
132
|
</div>
|
|
138
133
|
</Transition>
|
|
139
134
|
</ThemeProvider>
|
package/src/inputs/_Popover.less
CHANGED
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
display: grid;
|
|
27
27
|
row-gap: var(--size-8);
|
|
28
28
|
overflow-y: auto;
|
|
29
|
-
grid-template-rows:
|
|
29
|
+
grid-template-rows: minmax(0, 1fr);
|
|
30
30
|
|
|
31
31
|
&--has-title {
|
|
32
|
-
grid-template-rows: auto 1fr;
|
|
32
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
&--padding-md {
|
package/src/main.css
CHANGED
|
@@ -2400,67 +2400,37 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2400
2400
|
position: relative;
|
|
2401
2401
|
z-index: 1060;
|
|
2402
2402
|
}
|
|
2403
|
-
.np-bottom-sheet-v2-backdrop-container--enter,
|
|
2404
|
-
.np-bottom-sheet-v2-backdrop-container--leave {
|
|
2405
|
-
transition-property: opacity;
|
|
2406
|
-
transition-timing-function: ease-out;
|
|
2407
|
-
transition-duration: 300ms;
|
|
2408
|
-
}
|
|
2409
|
-
.np-bottom-sheet-v2-backdrop-container--enter-from,
|
|
2410
|
-
.np-bottom-sheet-v2-backdrop-container--leave-to {
|
|
2411
|
-
opacity: 0;
|
|
2412
|
-
}
|
|
2413
2403
|
.np-bottom-sheet-v2-backdrop {
|
|
2414
2404
|
position: fixed;
|
|
2415
2405
|
inset: 0px;
|
|
2416
2406
|
background-color: #37517e;
|
|
2417
2407
|
background-color: var(--color-content-primary);
|
|
2418
2408
|
opacity: 0.4;
|
|
2409
|
+
transition-property: opacity;
|
|
2410
|
+
transition-timing-function: ease-out;
|
|
2411
|
+
transition-duration: 300ms;
|
|
2412
|
+
}
|
|
2413
|
+
.np-bottom-sheet-v2-backdrop--closed {
|
|
2414
|
+
opacity: 0;
|
|
2419
2415
|
}
|
|
2420
2416
|
.np-bottom-sheet-v2 {
|
|
2421
2417
|
position: fixed;
|
|
2422
2418
|
inset: 0px;
|
|
2419
|
+
bottom: env(keyboard-inset-height, 0px);
|
|
2420
|
+
margin-left: 8px;
|
|
2421
|
+
margin-left: var(--size-8);
|
|
2422
|
+
margin-right: 8px;
|
|
2423
|
+
margin-right: var(--size-8);
|
|
2424
|
+
margin-top: 64px;
|
|
2425
|
+
margin-top: var(--size-64);
|
|
2423
2426
|
display: flex;
|
|
2424
2427
|
flex-direction: column;
|
|
2425
2428
|
justify-content: flex-end;
|
|
2426
|
-
padding-left: 8px;
|
|
2427
|
-
padding-left: var(--size-8);
|
|
2428
|
-
padding-right: 8px;
|
|
2429
|
-
padding-right: var(--size-8);
|
|
2430
|
-
padding-top: 64px;
|
|
2431
|
-
padding-top: var(--size-64);
|
|
2432
2429
|
}
|
|
2433
2430
|
.np-bottom-sheet-v2-content {
|
|
2434
|
-
max-height: 100%;
|
|
2435
|
-
}
|
|
2436
|
-
.np-bottom-sheet-v2-content--enter,
|
|
2437
|
-
.np-bottom-sheet-v2-content--leave {
|
|
2438
|
-
transition-property: transform;
|
|
2439
|
-
transition-timing-function: ease-out;
|
|
2440
|
-
transition-duration: 300ms;
|
|
2441
|
-
}
|
|
2442
|
-
@media (prefers-reduced-motion: reduce) {
|
|
2443
|
-
.np-bottom-sheet-v2-content--enter,
|
|
2444
|
-
.np-bottom-sheet-v2-content--leave {
|
|
2445
|
-
transition-property: opacity;
|
|
2446
|
-
}
|
|
2447
|
-
}
|
|
2448
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
2449
|
-
.np-bottom-sheet-v2-content--enter-from,
|
|
2450
|
-
.np-bottom-sheet-v2-content--leave-to {
|
|
2451
|
-
transform: translateY(100%);
|
|
2452
|
-
}
|
|
2453
|
-
}
|
|
2454
|
-
@media (prefers-reduced-motion: reduce) {
|
|
2455
|
-
.np-bottom-sheet-v2-content--enter-from,
|
|
2456
|
-
.np-bottom-sheet-v2-content--leave-to {
|
|
2457
|
-
opacity: 0;
|
|
2458
|
-
}
|
|
2459
|
-
}
|
|
2460
|
-
.np-bottom-sheet-v2-content-inner-container {
|
|
2461
2431
|
display: flex;
|
|
2462
|
-
height: 100%;
|
|
2463
2432
|
flex-direction: column;
|
|
2433
|
+
overflow: auto;
|
|
2464
2434
|
border-top-left-radius: 32px;
|
|
2465
2435
|
/* TODO: Tokenize */
|
|
2466
2436
|
border-top-right-radius: 32px;
|
|
@@ -2469,30 +2439,50 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2469
2439
|
background-color: var(--color-background-elevated);
|
|
2470
2440
|
box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
|
|
2471
2441
|
}
|
|
2472
|
-
.np-bottom-sheet-v2-content
|
|
2442
|
+
.np-bottom-sheet-v2-content:focus {
|
|
2473
2443
|
outline: none;
|
|
2474
2444
|
}
|
|
2445
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
2446
|
+
.np-bottom-sheet-v2-content {
|
|
2447
|
+
transition-property: transform;
|
|
2448
|
+
transition-timing-function: ease-out;
|
|
2449
|
+
transition-duration: 300ms;
|
|
2450
|
+
}
|
|
2451
|
+
.np-bottom-sheet-v2-content--closed {
|
|
2452
|
+
transform: translateY(100%);
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
@media (prefers-reduced-motion: reduce) {
|
|
2456
|
+
.np-bottom-sheet-v2-content {
|
|
2457
|
+
transition-property: opacity;
|
|
2458
|
+
transition-timing-function: ease-out;
|
|
2459
|
+
transition-duration: 300ms;
|
|
2460
|
+
}
|
|
2461
|
+
.np-bottom-sheet-v2-content--closed {
|
|
2462
|
+
opacity: 0;
|
|
2463
|
+
}
|
|
2464
|
+
}
|
|
2475
2465
|
.np-bottom-sheet-v2-header {
|
|
2476
2466
|
align-self: flex-end;
|
|
2477
2467
|
padding: 16px;
|
|
2478
2468
|
padding: var(--size-16);
|
|
2479
2469
|
}
|
|
2480
2470
|
.np-bottom-sheet-v2-content-inner {
|
|
2481
|
-
padding-top: 0px;
|
|
2482
2471
|
display: grid;
|
|
2472
|
+
grid-template-rows: minmax(0, 1fr);
|
|
2483
2473
|
grid-row-gap: 8px;
|
|
2484
2474
|
grid-row-gap: var(--size-8);
|
|
2485
2475
|
row-gap: 8px;
|
|
2486
2476
|
row-gap: var(--size-8);
|
|
2487
|
-
overflow
|
|
2488
|
-
grid-template-rows: repeat(1, minmax(0, 1fr));
|
|
2477
|
+
overflow: auto;
|
|
2489
2478
|
}
|
|
2490
2479
|
.np-bottom-sheet-v2-content-inner--has-title {
|
|
2491
|
-
grid-template-rows: auto 1fr;
|
|
2480
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
2492
2481
|
}
|
|
2493
2482
|
.np-bottom-sheet-v2-content-inner--padding-md {
|
|
2494
2483
|
padding: 16px;
|
|
2495
2484
|
padding: var(--size-16);
|
|
2485
|
+
padding-top: 0px;
|
|
2496
2486
|
}
|
|
2497
2487
|
.np-bottom-sheet-v2-title {
|
|
2498
2488
|
color: #37517e;
|
|
@@ -2539,10 +2529,10 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2539
2529
|
row-gap: 8px;
|
|
2540
2530
|
row-gap: var(--size-8);
|
|
2541
2531
|
overflow-y: auto;
|
|
2542
|
-
grid-template-rows:
|
|
2532
|
+
grid-template-rows: minmax(0, 1fr);
|
|
2543
2533
|
}
|
|
2544
2534
|
.np-popover-v2--has-title {
|
|
2545
|
-
grid-template-rows: auto 1fr;
|
|
2535
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
2546
2536
|
}
|
|
2547
2537
|
.np-popover-v2--padding-md {
|
|
2548
2538
|
padding: 16px;
|