@transferwise/components 0.0.0-experimental-7709e0e → 0.0.0-experimental-94569f6
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 +52 -52
- package/build/index.js.map +1 -1
- package/build/index.mjs +54 -54
- package/build/index.mjs.map +1 -1
- package/build/main.css +41 -58
- package/build/styles/inputs/SelectInput.css +39 -54
- package/build/styles/main.css +41 -58
- package/build/styles/statusIcon/StatusIcon.css +2 -4
- package/build/types/common/hooks/useVirtualKeyboard.d.ts +2 -0
- package/build/types/common/hooks/useVirtualKeyboard.d.ts.map +1 -0
- package/build/types/field/Field.d.ts +1 -6
- package/build/types/field/Field.d.ts.map +1 -1
- package/build/types/inlineAlert/InlineAlert.d.ts +2 -2
- package/build/types/inlineAlert/InlineAlert.d.ts.map +1 -1
- package/build/types/inputs/_BottomSheet.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/common/hooks/useVirtualKeyboard.ts +16 -0
- package/src/field/Field.story.tsx +36 -17
- package/src/field/Field.tsx +13 -23
- package/src/inlineAlert/InlineAlert.story.tsx +5 -13
- package/src/inlineAlert/InlineAlert.tsx +7 -14
- package/src/inputs/SelectInput.css +39 -54
- package/src/inputs/_BottomSheet.less +34 -52
- package/src/inputs/_BottomSheet.tsx +22 -28
- package/src/main.css +41 -58
- package/src/statusIcon/StatusIcon.css +2 -4
- package/src/statusIcon/StatusIcon.less +2 -4
- package/src/statusIcon/StatusIcon.tsx +1 -1
- package/src/field/Field.tests.story.tsx +0 -33
package/src/field/Field.tsx
CHANGED
|
@@ -15,28 +15,15 @@ export type FieldProps = {
|
|
|
15
15
|
/** `null` disables auto-generating the `id` attribute, falling back to nesting-based label association over setting `htmlFor` explicitly. */
|
|
16
16
|
id?: string | null;
|
|
17
17
|
label: React.ReactNode;
|
|
18
|
-
/** @deprecated use `message` and `type={Sentiment.NEUTRAL}` prop instead */
|
|
19
18
|
hint?: React.ReactNode;
|
|
20
|
-
message?: React.ReactNode;
|
|
21
|
-
/** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */
|
|
22
19
|
error?: React.ReactNode;
|
|
23
|
-
sentiment?: `${Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.POSITIVE | Sentiment.WARNING}`;
|
|
24
20
|
className?: string;
|
|
25
21
|
children?: React.ReactNode;
|
|
26
22
|
};
|
|
27
23
|
|
|
28
|
-
export const Field = ({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
message: propMessage,
|
|
32
|
-
sentiment: propType,
|
|
33
|
-
className,
|
|
34
|
-
children,
|
|
35
|
-
...props
|
|
36
|
-
}: FieldProps) => {
|
|
37
|
-
const sentiment = props.error ? Sentiment.NEGATIVE : propType;
|
|
38
|
-
const message = props.error || props.hint || propMessage;
|
|
39
|
-
const hasError = sentiment === Sentiment.NEGATIVE;
|
|
24
|
+
export const Field = ({ id, label, hint, error, className, children }: FieldProps) => {
|
|
25
|
+
const hasError = Boolean(error);
|
|
26
|
+
const hasHint = Boolean(hint) && !hasError;
|
|
40
27
|
|
|
41
28
|
const labelId = useId();
|
|
42
29
|
|
|
@@ -48,16 +35,14 @@ export const Field = ({
|
|
|
48
35
|
return (
|
|
49
36
|
<FieldLabelIdContextProvider value={labelId}>
|
|
50
37
|
<InputIdContextProvider value={inputId}>
|
|
51
|
-
<InputDescribedByProvider value={
|
|
38
|
+
<InputDescribedByProvider value={hasError || hasHint ? descriptionId : undefined}>
|
|
52
39
|
<InputInvalidProvider value={hasError}>
|
|
53
40
|
<div
|
|
54
41
|
className={classNames(
|
|
55
42
|
'form-group d-block',
|
|
56
43
|
{
|
|
57
|
-
'has-success': sentiment === Sentiment.POSITIVE,
|
|
58
|
-
'has-warning': sentiment === Sentiment.WARNING,
|
|
59
44
|
'has-error': hasError,
|
|
60
|
-
'has-info':
|
|
45
|
+
'has-info': hasHint,
|
|
61
46
|
},
|
|
62
47
|
className,
|
|
63
48
|
)}
|
|
@@ -66,9 +51,14 @@ export const Field = ({
|
|
|
66
51
|
{label}
|
|
67
52
|
{children}
|
|
68
53
|
</Label>
|
|
69
|
-
{
|
|
70
|
-
<InlineAlert type={
|
|
71
|
-
{
|
|
54
|
+
{hasHint && (
|
|
55
|
+
<InlineAlert type={Sentiment.NEUTRAL} id={descriptionId}>
|
|
56
|
+
{hint}
|
|
57
|
+
</InlineAlert>
|
|
58
|
+
)}
|
|
59
|
+
{hasError && (
|
|
60
|
+
<InlineAlert type={Sentiment.NEGATIVE} id={descriptionId}>
|
|
61
|
+
{error}
|
|
72
62
|
</InlineAlert>
|
|
73
63
|
)}
|
|
74
64
|
</div>
|
|
@@ -51,7 +51,7 @@ export const Basic = () => {
|
|
|
51
51
|
|
|
52
52
|
return (
|
|
53
53
|
<>
|
|
54
|
-
{/*
|
|
54
|
+
{/*eslint-disable-next-line react/no-adjacent-inline-elements */}
|
|
55
55
|
<p>
|
|
56
56
|
The styling for the input (the coloured border) and the visibility of the inline alert is
|
|
57
57
|
controlled through the use of <code>has-***</code> classes which are applied to the{' '}
|
|
@@ -60,11 +60,7 @@ export const Basic = () => {
|
|
|
60
60
|
element. The available classes are <code>has-error</code>, <code>has-info</code>,{' '}
|
|
61
61
|
<code>has-warning</code> and <code>has-success</code>.
|
|
62
62
|
</p>
|
|
63
|
-
<p>
|
|
64
|
-
Where possible consumers should use{' '}
|
|
65
|
-
<a href="https://storybook.wise.design/?path=/story/field--basic">Field</a> instead of doing
|
|
66
|
-
this manually.
|
|
67
|
-
</p>
|
|
63
|
+
<p>Where possible consumers should use Field instead of doing this manually.</p>
|
|
68
64
|
<div className={`form-group ${typeClass}`}>
|
|
69
65
|
<label className="control-label" htmlFor="id0">
|
|
70
66
|
Toggleable
|
|
@@ -77,18 +73,14 @@ export const Basic = () => {
|
|
|
77
73
|
Negative
|
|
78
74
|
</label>
|
|
79
75
|
<Input id="id1" value="Neptune is cool" />
|
|
80
|
-
<InlineAlert type="
|
|
76
|
+
<InlineAlert type="error">{message}</InlineAlert>
|
|
81
77
|
</div>
|
|
82
|
-
<div className="form-group has-
|
|
78
|
+
<div className="form-group has-positive">
|
|
83
79
|
<label className="control-label" htmlFor="id2">
|
|
84
80
|
Positive
|
|
85
81
|
</label>
|
|
86
82
|
<Input id="id2" value="Neptune is cool" />
|
|
87
|
-
<InlineAlert type="positive">
|
|
88
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
|
|
89
|
-
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
|
90
|
-
ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
91
|
-
</InlineAlert>
|
|
83
|
+
<InlineAlert type="positive">{message}</InlineAlert>
|
|
92
84
|
</div>
|
|
93
85
|
<div className="form-group has-neutral">
|
|
94
86
|
<label className="control-label" htmlFor="id3">
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { AlertCircle as AlertCircleIcon } from '@transferwise/icons';
|
|
1
2
|
import classNames from 'classnames';
|
|
2
|
-
import
|
|
3
|
+
import { ReactNode } from 'react';
|
|
3
4
|
|
|
4
|
-
import { Sentiment
|
|
5
|
-
import StatusIcon from '../statusIcon';
|
|
5
|
+
import { Sentiment } from '../common';
|
|
6
6
|
|
|
7
7
|
export interface InlineAlertProps {
|
|
8
8
|
id?: string;
|
|
@@ -17,22 +17,15 @@ export default function InlineAlert({
|
|
|
17
17
|
className,
|
|
18
18
|
children,
|
|
19
19
|
}: InlineAlertProps) {
|
|
20
|
+
const danger = type === 'negative' || type === 'error';
|
|
20
21
|
return (
|
|
21
22
|
<div
|
|
22
23
|
role="alert"
|
|
23
24
|
id={id}
|
|
24
|
-
className={classNames(
|
|
25
|
-
'alert alert-detach',
|
|
26
|
-
`alert-${[Sentiment.NEGATIVE, Sentiment.ERROR].includes(type as Sentiment) ? 'danger' : type}`,
|
|
27
|
-
className,
|
|
28
|
-
)}
|
|
25
|
+
className={classNames('alert alert-detach', `alert-${danger ? 'danger' : type}`, className)}
|
|
29
26
|
>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
<StatusIcon sentiment={type} size={Size.SMALL} />
|
|
33
|
-
)}
|
|
34
|
-
<div className="np-text-body-default">{children}</div>
|
|
35
|
-
</div>
|
|
27
|
+
{danger && <AlertCircleIcon />}
|
|
28
|
+
<div>{children}</div>
|
|
36
29
|
</div>
|
|
37
30
|
);
|
|
38
31
|
}
|
|
@@ -2,66 +2,36 @@
|
|
|
2
2
|
position: relative;
|
|
3
3
|
z-index: 1060;
|
|
4
4
|
}
|
|
5
|
-
.np-bottom-sheet-v2-backdrop-container--enter,
|
|
6
|
-
.np-bottom-sheet-v2-backdrop-container--leave {
|
|
7
|
-
transition-property: opacity;
|
|
8
|
-
transition-timing-function: ease-out;
|
|
9
|
-
transition-duration: 300ms;
|
|
10
|
-
}
|
|
11
|
-
.np-bottom-sheet-v2-backdrop-container--enter-from,
|
|
12
|
-
.np-bottom-sheet-v2-backdrop-container--leave-to {
|
|
13
|
-
opacity: 0;
|
|
14
|
-
}
|
|
15
5
|
.np-bottom-sheet-v2-backdrop {
|
|
16
6
|
position: fixed;
|
|
17
7
|
inset: 0px;
|
|
18
8
|
background-color: #37517e;
|
|
19
9
|
background-color: var(--color-content-primary);
|
|
20
10
|
opacity: 0.4;
|
|
11
|
+
transition-property: opacity;
|
|
12
|
+
transition-timing-function: ease-out;
|
|
13
|
+
transition-duration: 300ms;
|
|
14
|
+
}
|
|
15
|
+
.np-bottom-sheet-v2-backdrop--closed {
|
|
16
|
+
opacity: 0;
|
|
21
17
|
}
|
|
22
18
|
.np-bottom-sheet-v2 {
|
|
23
19
|
position: fixed;
|
|
24
20
|
inset: 0px;
|
|
21
|
+
bottom: env(keyboard-inset-height, 0px);
|
|
22
|
+
margin-left: 8px;
|
|
23
|
+
margin-left: var(--size-8);
|
|
24
|
+
margin-right: 8px;
|
|
25
|
+
margin-right: var(--size-8);
|
|
26
|
+
margin-top: 64px;
|
|
27
|
+
margin-top: var(--size-64);
|
|
25
28
|
display: flex;
|
|
26
29
|
flex-direction: column;
|
|
27
30
|
justify-content: flex-end;
|
|
28
|
-
padding-left: 8px;
|
|
29
|
-
padding-left: var(--size-8);
|
|
30
|
-
padding-right: 8px;
|
|
31
|
-
padding-right: var(--size-8);
|
|
32
|
-
padding-top: 64px;
|
|
33
|
-
padding-top: var(--size-64);
|
|
34
31
|
}
|
|
35
32
|
.np-bottom-sheet-v2-content {
|
|
36
|
-
max-height: 100%;
|
|
37
|
-
}
|
|
38
|
-
.np-bottom-sheet-v2-content--enter,
|
|
39
|
-
.np-bottom-sheet-v2-content--leave {
|
|
40
|
-
transition-property: transform;
|
|
41
|
-
transition-timing-function: ease-out;
|
|
42
|
-
transition-duration: 300ms;
|
|
43
|
-
}
|
|
44
|
-
@media (prefers-reduced-motion: reduce) {
|
|
45
|
-
.np-bottom-sheet-v2-content--enter,
|
|
46
|
-
.np-bottom-sheet-v2-content--leave {
|
|
47
|
-
transition-property: opacity;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
@media (prefers-reduced-motion: no-preference) {
|
|
51
|
-
.np-bottom-sheet-v2-content--enter-from,
|
|
52
|
-
.np-bottom-sheet-v2-content--leave-to {
|
|
53
|
-
transform: translateY(100%);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
@media (prefers-reduced-motion: reduce) {
|
|
57
|
-
.np-bottom-sheet-v2-content--enter-from,
|
|
58
|
-
.np-bottom-sheet-v2-content--leave-to {
|
|
59
|
-
opacity: 0;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
.np-bottom-sheet-v2-content-inner-container {
|
|
63
33
|
display: flex;
|
|
64
|
-
height: 100%;
|
|
34
|
+
max-height: 100%;
|
|
65
35
|
flex-direction: column;
|
|
66
36
|
border-top-left-radius: 32px;
|
|
67
37
|
/* TODO: Tokenize */
|
|
@@ -71,30 +41,45 @@
|
|
|
71
41
|
background-color: var(--color-background-elevated);
|
|
72
42
|
box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
|
|
73
43
|
}
|
|
74
|
-
.np-bottom-sheet-v2-content
|
|
44
|
+
.np-bottom-sheet-v2-content:focus {
|
|
75
45
|
outline: none;
|
|
76
46
|
}
|
|
47
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
48
|
+
.np-bottom-sheet-v2-content {
|
|
49
|
+
transition-property: transform;
|
|
50
|
+
transition-timing-function: ease-out;
|
|
51
|
+
transition-duration: 300ms;
|
|
52
|
+
}
|
|
53
|
+
.np-bottom-sheet-v2-content--closed {
|
|
54
|
+
transform: translateY(100%);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
@media (prefers-reduced-motion: reduce) {
|
|
58
|
+
.np-bottom-sheet-v2-content {
|
|
59
|
+
transition-property: opacity;
|
|
60
|
+
transition-timing-function: ease-out;
|
|
61
|
+
transition-duration: 300ms;
|
|
62
|
+
}
|
|
63
|
+
.np-bottom-sheet-v2-content--closed {
|
|
64
|
+
opacity: 0;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
77
67
|
.np-bottom-sheet-v2-header {
|
|
78
68
|
align-self: flex-end;
|
|
79
69
|
padding: 16px;
|
|
80
70
|
padding: var(--size-16);
|
|
81
71
|
}
|
|
82
72
|
.np-bottom-sheet-v2-content-inner {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
grid-row-gap: 8px;
|
|
86
|
-
grid-row-gap: var(--size-8);
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
87
75
|
row-gap: 8px;
|
|
88
76
|
row-gap: var(--size-8);
|
|
89
|
-
overflow
|
|
90
|
-
grid-template-rows: repeat(1, minmax(0, 1fr));
|
|
91
|
-
}
|
|
92
|
-
.np-bottom-sheet-v2-content-inner--has-title {
|
|
93
|
-
grid-template-rows: auto 1fr;
|
|
77
|
+
overflow: auto;
|
|
94
78
|
}
|
|
95
79
|
.np-bottom-sheet-v2-content-inner--padding-md {
|
|
96
80
|
padding: 16px;
|
|
97
81
|
padding: var(--size-16);
|
|
82
|
+
padding-top: 0px;
|
|
98
83
|
}
|
|
99
84
|
.np-bottom-sheet-v2-title {
|
|
100
85
|
color: #37517e;
|
|
@@ -3,98 +3,80 @@
|
|
|
3
3
|
z-index: 1060;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.np-bottom-sheet-v2-backdrop-container {
|
|
7
|
-
&--enter, &--leave {
|
|
8
|
-
transition-property: opacity;
|
|
9
|
-
transition-timing-function: ease-out;
|
|
10
|
-
transition-duration: 300ms;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
&--enter-from, &--leave-to {
|
|
14
|
-
opacity: 0;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
6
|
.np-bottom-sheet-v2-backdrop {
|
|
19
7
|
position: fixed;
|
|
20
8
|
inset: 0px;
|
|
21
9
|
background-color: var(--color-content-primary);
|
|
22
10
|
opacity: 0.4;
|
|
11
|
+
transition-property: opacity;
|
|
12
|
+
transition-timing-function: ease-out;
|
|
13
|
+
transition-duration: 300ms;
|
|
14
|
+
|
|
15
|
+
&--closed {
|
|
16
|
+
opacity: 0;
|
|
17
|
+
}
|
|
23
18
|
}
|
|
24
19
|
|
|
25
20
|
.np-bottom-sheet-v2 {
|
|
26
21
|
position: fixed;
|
|
27
22
|
inset: 0px;
|
|
23
|
+
bottom: env(keyboard-inset-height, 0px);
|
|
24
|
+
margin-left: var(--size-8);
|
|
25
|
+
margin-right: var(--size-8);
|
|
26
|
+
margin-top: var(--size-64);
|
|
28
27
|
display: flex;
|
|
29
28
|
flex-direction: column;
|
|
30
29
|
justify-content: flex-end;
|
|
31
|
-
padding-left: var(--size-8);
|
|
32
|
-
padding-right: var(--size-8);
|
|
33
|
-
padding-top: var(--size-64);
|
|
34
30
|
}
|
|
35
31
|
|
|
36
32
|
.np-bottom-sheet-v2-content {
|
|
33
|
+
display: flex;
|
|
37
34
|
max-height: 100%;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
border-top-left-radius: 32px; /* TODO: Tokenize */
|
|
37
|
+
border-top-right-radius: 32px; /* TODO: Tokenize */
|
|
38
|
+
background-color: var(--color-background-elevated);
|
|
39
|
+
box-shadow: 0 0 40px rgb(69 71 69 / 0.2);
|
|
40
|
+
|
|
41
|
+
&:focus {
|
|
42
|
+
outline: none;
|
|
43
|
+
}
|
|
38
44
|
|
|
39
|
-
|
|
45
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
40
46
|
transition-property: transform;
|
|
41
47
|
transition-timing-function: ease-out;
|
|
42
48
|
transition-duration: 300ms;
|
|
43
49
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
transition-property: opacity;
|
|
47
|
-
}
|
|
50
|
+
&--closed {
|
|
51
|
+
transform: translateY(100%);
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
}
|
|
55
|
+
@media (prefers-reduced-motion: reduce) {
|
|
56
|
+
transition-property: opacity;
|
|
57
|
+
transition-timing-function: ease-out;
|
|
58
|
+
transition-duration: 300ms;
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
opacity: 0;
|
|
61
|
-
}
|
|
60
|
+
&--closed {
|
|
61
|
+
opacity: 0;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
.np-bottom-sheet-v2-content-inner-container {
|
|
67
|
-
display: flex;
|
|
68
|
-
height: 100%;
|
|
69
|
-
flex-direction: column;
|
|
70
|
-
border-top-left-radius: 32px; /* TODO: Tokenize */
|
|
71
|
-
border-top-right-radius: 32px; /* TODO: Tokenize */
|
|
72
|
-
background-color: var(--color-background-elevated);
|
|
73
|
-
box-shadow: 0 0 40px rgb(69 71 69 / 0.2);
|
|
74
|
-
|
|
75
|
-
&:focus {
|
|
76
|
-
outline: none;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
66
|
.np-bottom-sheet-v2-header {
|
|
81
67
|
align-self: flex-end;
|
|
82
68
|
padding: var(--size-16);
|
|
83
69
|
}
|
|
84
70
|
|
|
85
71
|
.np-bottom-sheet-v2-content-inner {
|
|
86
|
-
|
|
87
|
-
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
88
74
|
row-gap: var(--size-8);
|
|
89
|
-
overflow
|
|
90
|
-
grid-template-rows: repeat(1, minmax(0, 1fr));
|
|
91
|
-
|
|
92
|
-
&--has-title {
|
|
93
|
-
grid-template-rows: auto 1fr;
|
|
94
|
-
}
|
|
75
|
+
overflow: auto;
|
|
95
76
|
|
|
96
77
|
&--padding-md {
|
|
97
78
|
padding: var(--size-16);
|
|
79
|
+
padding-top: 0px;
|
|
98
80
|
}
|
|
99
81
|
}
|
|
100
82
|
|
|
@@ -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">
|
|
@@ -117,10 +114,7 @@ export function BottomSheet({
|
|
|
117
114
|
<div
|
|
118
115
|
className={classNames(
|
|
119
116
|
'np-bottom-sheet-v2-content-inner',
|
|
120
|
-
|
|
121
|
-
{
|
|
122
|
-
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md',
|
|
123
|
-
},
|
|
117
|
+
padding === 'md' && 'np-bottom-sheet-v2-content-inner--padding-md',
|
|
124
118
|
)}
|
|
125
119
|
>
|
|
126
120
|
{title ? (
|
|
@@ -130,10 +124,10 @@ export function BottomSheet({
|
|
|
130
124
|
{children}
|
|
131
125
|
</div>
|
|
132
126
|
</div>
|
|
133
|
-
</
|
|
134
|
-
</
|
|
135
|
-
</
|
|
136
|
-
</
|
|
127
|
+
</Transition.Child>
|
|
128
|
+
</Fragment>
|
|
129
|
+
</FloatingFocusManager>
|
|
130
|
+
</FocusScope>
|
|
137
131
|
</div>
|
|
138
132
|
</Transition>
|
|
139
133
|
</ThemeProvider>
|
package/src/main.css
CHANGED
|
@@ -2400,66 +2400,36 @@ 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%;
|
|
2432
|
+
max-height: 100%;
|
|
2463
2433
|
flex-direction: column;
|
|
2464
2434
|
border-top-left-radius: 32px;
|
|
2465
2435
|
/* TODO: Tokenize */
|
|
@@ -2469,30 +2439,45 @@ 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
|
-
|
|
2482
|
-
|
|
2483
|
-
grid-row-gap: 8px;
|
|
2484
|
-
grid-row-gap: var(--size-8);
|
|
2471
|
+
display: flex;
|
|
2472
|
+
flex-direction: column;
|
|
2485
2473
|
row-gap: 8px;
|
|
2486
2474
|
row-gap: var(--size-8);
|
|
2487
|
-
overflow
|
|
2488
|
-
grid-template-rows: repeat(1, minmax(0, 1fr));
|
|
2489
|
-
}
|
|
2490
|
-
.np-bottom-sheet-v2-content-inner--has-title {
|
|
2491
|
-
grid-template-rows: auto 1fr;
|
|
2475
|
+
overflow: auto;
|
|
2492
2476
|
}
|
|
2493
2477
|
.np-bottom-sheet-v2-content-inner--padding-md {
|
|
2494
2478
|
padding: 16px;
|
|
2495
2479
|
padding: var(--size-16);
|
|
2480
|
+
padding-top: 0px;
|
|
2496
2481
|
}
|
|
2497
2482
|
.np-bottom-sheet-v2-title {
|
|
2498
2483
|
color: #37517e;
|
|
@@ -4208,16 +4193,14 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4208
4193
|
height: var(--size-32);
|
|
4209
4194
|
}
|
|
4210
4195
|
}
|
|
4211
|
-
.status-circle.negative
|
|
4212
|
-
.status-circle.error {
|
|
4196
|
+
.status-circle.negative {
|
|
4213
4197
|
background-color: var(--color-sentiment-negative);
|
|
4214
4198
|
}
|
|
4215
4199
|
.status-circle.neutral {
|
|
4216
4200
|
background-color: #5d7079;
|
|
4217
4201
|
background-color: var(--color-content-secondary);
|
|
4218
4202
|
}
|
|
4219
|
-
.status-circle.positive
|
|
4220
|
-
.status-circle.success {
|
|
4203
|
+
.status-circle.positive {
|
|
4221
4204
|
background-color: var(--color-sentiment-positive);
|
|
4222
4205
|
}
|
|
4223
4206
|
.tw-stepper {
|
|
@@ -66,15 +66,13 @@
|
|
|
66
66
|
height: var(--size-32);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
.status-circle.negative
|
|
70
|
-
.status-circle.error {
|
|
69
|
+
.status-circle.negative {
|
|
71
70
|
background-color: var(--color-sentiment-negative);
|
|
72
71
|
}
|
|
73
72
|
.status-circle.neutral {
|
|
74
73
|
background-color: #5d7079;
|
|
75
74
|
background-color: var(--color-content-secondary);
|
|
76
75
|
}
|
|
77
|
-
.status-circle.positive
|
|
78
|
-
.status-circle.success {
|
|
76
|
+
.status-circle.positive {
|
|
79
77
|
background-color: var(--color-sentiment-positive);
|
|
80
78
|
}
|