@transferwise/components 0.0.0-experimental-94569f6 → 0.0.0-experimental-5769182
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 +58 -41
- package/build/styles/inputs/SelectInput.css +54 -39
- package/build/styles/main.css +58 -41
- package/build/styles/statusIcon/StatusIcon.css +4 -2
- package/build/types/field/Field.d.ts +6 -1
- 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/field/Field.story.tsx +17 -36
- package/src/field/Field.tests.story.tsx +33 -0
- package/src/field/Field.tsx +23 -13
- package/src/inlineAlert/InlineAlert.story.tsx +13 -5
- package/src/inlineAlert/InlineAlert.tsx +14 -7
- package/src/inputs/SelectInput.css +54 -39
- package/src/inputs/_BottomSheet.less +52 -34
- package/src/inputs/_BottomSheet.tsx +28 -22
- package/src/main.css +58 -41
- package/src/statusIcon/StatusIcon.css +4 -2
- package/src/statusIcon/StatusIcon.less +4 -2
- package/src/statusIcon/StatusIcon.tsx +1 -1
- package/build/types/common/hooks/useVirtualKeyboard.d.ts +0 -2
- package/build/types/common/hooks/useVirtualKeyboard.d.ts.map +0 -1
- package/src/common/hooks/useVirtualKeyboard.ts +0 -16
package/src/field/Field.tsx
CHANGED
|
@@ -15,15 +15,28 @@ 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 */
|
|
18
19
|
hint?: React.ReactNode;
|
|
20
|
+
message?: React.ReactNode;
|
|
21
|
+
/** @deprecated use `message` and `type={Sentiment.NEGATIVE}` prop instead */
|
|
19
22
|
error?: React.ReactNode;
|
|
23
|
+
sentiment?: `${Sentiment.NEGATIVE | Sentiment.NEUTRAL | Sentiment.POSITIVE | Sentiment.WARNING}`;
|
|
20
24
|
className?: string;
|
|
21
25
|
children?: React.ReactNode;
|
|
22
26
|
};
|
|
23
27
|
|
|
24
|
-
export const Field = ({
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
export const Field = ({
|
|
29
|
+
id,
|
|
30
|
+
label,
|
|
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;
|
|
27
40
|
|
|
28
41
|
const labelId = useId();
|
|
29
42
|
|
|
@@ -35,14 +48,16 @@ export const Field = ({ id, label, hint, error, className, children }: FieldProp
|
|
|
35
48
|
return (
|
|
36
49
|
<FieldLabelIdContextProvider value={labelId}>
|
|
37
50
|
<InputIdContextProvider value={inputId}>
|
|
38
|
-
<InputDescribedByProvider value={
|
|
51
|
+
<InputDescribedByProvider value={message ? descriptionId : undefined}>
|
|
39
52
|
<InputInvalidProvider value={hasError}>
|
|
40
53
|
<div
|
|
41
54
|
className={classNames(
|
|
42
55
|
'form-group d-block',
|
|
43
56
|
{
|
|
57
|
+
'has-success': sentiment === Sentiment.POSITIVE,
|
|
58
|
+
'has-warning': sentiment === Sentiment.WARNING,
|
|
44
59
|
'has-error': hasError,
|
|
45
|
-
'has-info':
|
|
60
|
+
'has-info': sentiment === Sentiment.NEUTRAL,
|
|
46
61
|
},
|
|
47
62
|
className,
|
|
48
63
|
)}
|
|
@@ -51,14 +66,9 @@ export const Field = ({ id, label, hint, error, className, children }: FieldProp
|
|
|
51
66
|
{label}
|
|
52
67
|
{children}
|
|
53
68
|
</Label>
|
|
54
|
-
{
|
|
55
|
-
<InlineAlert type={
|
|
56
|
-
{
|
|
57
|
-
</InlineAlert>
|
|
58
|
-
)}
|
|
59
|
-
{hasError && (
|
|
60
|
-
<InlineAlert type={Sentiment.NEGATIVE} id={descriptionId}>
|
|
61
|
-
{error}
|
|
69
|
+
{message && (
|
|
70
|
+
<InlineAlert type={sentiment} id={descriptionId}>
|
|
71
|
+
{message}
|
|
62
72
|
</InlineAlert>
|
|
63
73
|
)}
|
|
64
74
|
</div>
|
|
@@ -51,7 +51,7 @@ export const Basic = () => {
|
|
|
51
51
|
|
|
52
52
|
return (
|
|
53
53
|
<>
|
|
54
|
-
{/*eslint-disable-next-line react/no-adjacent-inline-elements */}
|
|
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,7 +60,11 @@ 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>
|
|
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>
|
|
64
68
|
<div className={`form-group ${typeClass}`}>
|
|
65
69
|
<label className="control-label" htmlFor="id0">
|
|
66
70
|
Toggleable
|
|
@@ -73,14 +77,18 @@ export const Basic = () => {
|
|
|
73
77
|
Negative
|
|
74
78
|
</label>
|
|
75
79
|
<Input id="id1" value="Neptune is cool" />
|
|
76
|
-
<InlineAlert type="
|
|
80
|
+
<InlineAlert type="negative">{message}</InlineAlert>
|
|
77
81
|
</div>
|
|
78
|
-
<div className="form-group has-
|
|
82
|
+
<div className="form-group has-success">
|
|
79
83
|
<label className="control-label" htmlFor="id2">
|
|
80
84
|
Positive
|
|
81
85
|
</label>
|
|
82
86
|
<Input id="id2" value="Neptune is cool" />
|
|
83
|
-
<InlineAlert type="positive">
|
|
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>
|
|
84
92
|
</div>
|
|
85
93
|
<div className="form-group has-neutral">
|
|
86
94
|
<label className="control-label" htmlFor="id3">
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AlertCircle as AlertCircleIcon } from '@transferwise/icons';
|
|
2
1
|
import classNames from 'classnames';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
4
3
|
|
|
5
|
-
import { Sentiment } from '../common';
|
|
4
|
+
import { Sentiment, Size } from '../common';
|
|
5
|
+
import StatusIcon from '../statusIcon';
|
|
6
6
|
|
|
7
7
|
export interface InlineAlertProps {
|
|
8
8
|
id?: string;
|
|
@@ -17,15 +17,22 @@ export default function InlineAlert({
|
|
|
17
17
|
className,
|
|
18
18
|
children,
|
|
19
19
|
}: InlineAlertProps) {
|
|
20
|
-
const danger = type === 'negative' || type === 'error';
|
|
21
20
|
return (
|
|
22
21
|
<div
|
|
23
22
|
role="alert"
|
|
24
23
|
id={id}
|
|
25
|
-
className={classNames(
|
|
24
|
+
className={classNames(
|
|
25
|
+
'alert alert-detach',
|
|
26
|
+
`alert-${[Sentiment.NEGATIVE, Sentiment.ERROR].includes(type as Sentiment) ? 'danger' : type}`,
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
26
29
|
>
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
<div className="d-inline-flex">
|
|
31
|
+
{type !== Sentiment.NEUTRAL && type !== Sentiment.PENDING && (
|
|
32
|
+
<StatusIcon sentiment={type} size={Size.SMALL} />
|
|
33
|
+
)}
|
|
34
|
+
<div className="np-text-body-default">{children}</div>
|
|
35
|
+
</div>
|
|
29
36
|
</div>
|
|
30
37
|
);
|
|
31
38
|
}
|
|
@@ -2,36 +2,66 @@
|
|
|
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
|
+
}
|
|
5
15
|
.np-bottom-sheet-v2-backdrop {
|
|
6
16
|
position: fixed;
|
|
7
17
|
inset: 0px;
|
|
8
18
|
background-color: #37517e;
|
|
9
19
|
background-color: var(--color-content-primary);
|
|
10
20
|
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;
|
|
17
21
|
}
|
|
18
22
|
.np-bottom-sheet-v2 {
|
|
19
23
|
position: fixed;
|
|
20
24
|
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);
|
|
28
25
|
display: flex;
|
|
29
26
|
flex-direction: column;
|
|
30
27
|
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);
|
|
31
34
|
}
|
|
32
35
|
.np-bottom-sheet-v2-content {
|
|
33
|
-
display: flex;
|
|
34
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
|
+
display: flex;
|
|
64
|
+
height: 100%;
|
|
35
65
|
flex-direction: column;
|
|
36
66
|
border-top-left-radius: 32px;
|
|
37
67
|
/* TODO: Tokenize */
|
|
@@ -41,45 +71,30 @@
|
|
|
41
71
|
background-color: var(--color-background-elevated);
|
|
42
72
|
box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
|
|
43
73
|
}
|
|
44
|
-
.np-bottom-sheet-v2-content:focus {
|
|
74
|
+
.np-bottom-sheet-v2-content-inner-container:focus {
|
|
45
75
|
outline: none;
|
|
46
76
|
}
|
|
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
|
-
}
|
|
67
77
|
.np-bottom-sheet-v2-header {
|
|
68
78
|
align-self: flex-end;
|
|
69
79
|
padding: 16px;
|
|
70
80
|
padding: var(--size-16);
|
|
71
81
|
}
|
|
72
82
|
.np-bottom-sheet-v2-content-inner {
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
padding-top: 0px;
|
|
84
|
+
display: grid;
|
|
85
|
+
grid-row-gap: 8px;
|
|
86
|
+
grid-row-gap: var(--size-8);
|
|
75
87
|
row-gap: 8px;
|
|
76
88
|
row-gap: var(--size-8);
|
|
77
|
-
overflow: auto;
|
|
89
|
+
overflow-y: auto;
|
|
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;
|
|
78
94
|
}
|
|
79
95
|
.np-bottom-sheet-v2-content-inner--padding-md {
|
|
80
96
|
padding: 16px;
|
|
81
97
|
padding: var(--size-16);
|
|
82
|
-
padding-top: 0px;
|
|
83
98
|
}
|
|
84
99
|
.np-bottom-sheet-v2-title {
|
|
85
100
|
color: #37517e;
|
|
@@ -3,80 +3,98 @@
|
|
|
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
|
+
|
|
6
18
|
.np-bottom-sheet-v2-backdrop {
|
|
7
19
|
position: fixed;
|
|
8
20
|
inset: 0px;
|
|
9
21
|
background-color: var(--color-content-primary);
|
|
10
22
|
opacity: 0.4;
|
|
11
|
-
transition-property: opacity;
|
|
12
|
-
transition-timing-function: ease-out;
|
|
13
|
-
transition-duration: 300ms;
|
|
14
|
-
|
|
15
|
-
&--closed {
|
|
16
|
-
opacity: 0;
|
|
17
|
-
}
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
.np-bottom-sheet-v2 {
|
|
21
26
|
position: fixed;
|
|
22
27
|
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);
|
|
27
28
|
display: flex;
|
|
28
29
|
flex-direction: column;
|
|
29
30
|
justify-content: flex-end;
|
|
31
|
+
padding-left: var(--size-8);
|
|
32
|
+
padding-right: var(--size-8);
|
|
33
|
+
padding-top: var(--size-64);
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
.np-bottom-sheet-v2-content {
|
|
33
|
-
display: flex;
|
|
34
37
|
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
|
-
}
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
&--enter, &--leave {
|
|
46
40
|
transition-property: transform;
|
|
47
41
|
transition-timing-function: ease-out;
|
|
48
42
|
transition-duration: 300ms;
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
@media (prefers-reduced-motion: reduce) {
|
|
45
|
+
& {
|
|
46
|
+
transition-property: opacity;
|
|
47
|
+
}
|
|
52
48
|
}
|
|
53
49
|
}
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
&--enter-from, &--leave-to {
|
|
52
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
53
|
+
& {
|
|
54
|
+
transform: translateY(100%);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
@media (prefers-reduced-motion: reduce) {
|
|
59
|
+
& {
|
|
60
|
+
opacity: 0;
|
|
61
|
+
}
|
|
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
|
+
|
|
66
80
|
.np-bottom-sheet-v2-header {
|
|
67
81
|
align-self: flex-end;
|
|
68
82
|
padding: var(--size-16);
|
|
69
83
|
}
|
|
70
84
|
|
|
71
85
|
.np-bottom-sheet-v2-content-inner {
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
padding-top: 0px;
|
|
87
|
+
display: grid;
|
|
74
88
|
row-gap: var(--size-8);
|
|
75
|
-
overflow: auto;
|
|
89
|
+
overflow-y: auto;
|
|
90
|
+
grid-template-rows: repeat(1, minmax(0, 1fr));
|
|
91
|
+
|
|
92
|
+
&--has-title {
|
|
93
|
+
grid-template-rows: auto 1fr;
|
|
94
|
+
}
|
|
76
95
|
|
|
77
96
|
&--padding-md {
|
|
78
97
|
padding: var(--size-16);
|
|
79
|
-
padding-top: 0px;
|
|
80
98
|
}
|
|
81
99
|
}
|
|
82
100
|
|
|
@@ -10,10 +10,9 @@ 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 {
|
|
13
|
+
import { useState } from 'react';
|
|
14
14
|
|
|
15
15
|
import { CloseButton } from '../common/closeButton';
|
|
16
|
-
import { useVirtualKeyboard } from '../common/hooks/useVirtualKeyboard';
|
|
17
16
|
import { PreventScroll } from '../common/preventScroll/PreventScroll';
|
|
18
17
|
import { Size } from '../common/propsValues/size';
|
|
19
18
|
|
|
@@ -43,8 +42,6 @@ export function BottomSheet({
|
|
|
43
42
|
onClose,
|
|
44
43
|
onCloseEnd,
|
|
45
44
|
}: BottomSheetProps) {
|
|
46
|
-
useVirtualKeyboard();
|
|
47
|
-
|
|
48
45
|
const { refs, context } = useFloating<Element>({
|
|
49
46
|
open,
|
|
50
47
|
onOpenChange: (value) => {
|
|
@@ -85,22 +82,28 @@ export function BottomSheet({
|
|
|
85
82
|
afterLeave={onCloseEnd}
|
|
86
83
|
>
|
|
87
84
|
<Transition.Child
|
|
88
|
-
|
|
89
|
-
enterFrom="np-bottom-sheet-v2-backdrop--
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
enter="np-bottom-sheet-v2-backdrop-container--enter"
|
|
86
|
+
enterFrom="np-bottom-sheet-v2-backdrop-container--enter-from"
|
|
87
|
+
leave="np-bottom-sheet-v2-backdrop-container--leave"
|
|
88
|
+
leaveTo="np-bottom-sheet-v2-backdrop-container--leave-to"
|
|
89
|
+
>
|
|
90
|
+
<div className="np-bottom-sheet-v2-backdrop" />
|
|
91
|
+
</Transition.Child>
|
|
92
92
|
|
|
93
93
|
<div className="np-bottom-sheet-v2">
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
<Transition.Child
|
|
95
|
+
className="np-bottom-sheet-v2-content"
|
|
96
|
+
enter="np-bottom-sheet-v2-content--enter"
|
|
97
|
+
enterFrom="np-bottom-sheet-v2-content--enter-from"
|
|
98
|
+
leave="np-bottom-sheet-v2-content--leave"
|
|
99
|
+
leaveTo="np-bottom-sheet-v2-content--leave-to"
|
|
100
|
+
>
|
|
101
|
+
<FocusScope>
|
|
102
|
+
<FloatingFocusManager context={context} initialFocus={initialFocusRef}>
|
|
103
|
+
<div
|
|
104
|
+
key={floatingKey} // Force inner state invalidation on open
|
|
100
105
|
ref={refs.setFloating}
|
|
101
|
-
className="np-bottom-sheet-v2-content"
|
|
102
|
-
enterFrom="np-bottom-sheet-v2-content--closed"
|
|
103
|
-
leaveTo="np-bottom-sheet-v2-content--closed"
|
|
106
|
+
className="np-bottom-sheet-v2-content-inner-container"
|
|
104
107
|
{...getFloatingProps()}
|
|
105
108
|
>
|
|
106
109
|
<div className="np-bottom-sheet-v2-header">
|
|
@@ -114,7 +117,10 @@ export function BottomSheet({
|
|
|
114
117
|
<div
|
|
115
118
|
className={classNames(
|
|
116
119
|
'np-bottom-sheet-v2-content-inner',
|
|
117
|
-
|
|
120
|
+
title && 'np-bottom-sheet-v2-content-inner--has-title',
|
|
121
|
+
{
|
|
122
|
+
'np-bottom-sheet-v2-content-inner--padding-md': padding === 'md',
|
|
123
|
+
},
|
|
118
124
|
)}
|
|
119
125
|
>
|
|
120
126
|
{title ? (
|
|
@@ -124,10 +130,10 @@ export function BottomSheet({
|
|
|
124
130
|
{children}
|
|
125
131
|
</div>
|
|
126
132
|
</div>
|
|
127
|
-
</
|
|
128
|
-
</
|
|
129
|
-
</
|
|
130
|
-
</
|
|
133
|
+
</div>
|
|
134
|
+
</FloatingFocusManager>
|
|
135
|
+
</FocusScope>
|
|
136
|
+
</Transition.Child>
|
|
131
137
|
</div>
|
|
132
138
|
</Transition>
|
|
133
139
|
</ThemeProvider>
|
package/src/main.css
CHANGED
|
@@ -2400,36 +2400,66 @@ 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
|
+
}
|
|
2403
2413
|
.np-bottom-sheet-v2-backdrop {
|
|
2404
2414
|
position: fixed;
|
|
2405
2415
|
inset: 0px;
|
|
2406
2416
|
background-color: #37517e;
|
|
2407
2417
|
background-color: var(--color-content-primary);
|
|
2408
2418
|
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;
|
|
2415
2419
|
}
|
|
2416
2420
|
.np-bottom-sheet-v2 {
|
|
2417
2421
|
position: fixed;
|
|
2418
2422
|
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);
|
|
2426
2423
|
display: flex;
|
|
2427
2424
|
flex-direction: column;
|
|
2428
2425
|
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);
|
|
2429
2432
|
}
|
|
2430
2433
|
.np-bottom-sheet-v2-content {
|
|
2431
|
-
display: flex;
|
|
2432
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
|
+
display: flex;
|
|
2462
|
+
height: 100%;
|
|
2433
2463
|
flex-direction: column;
|
|
2434
2464
|
border-top-left-radius: 32px;
|
|
2435
2465
|
/* TODO: Tokenize */
|
|
@@ -2439,45 +2469,30 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
|
|
|
2439
2469
|
background-color: var(--color-background-elevated);
|
|
2440
2470
|
box-shadow: 0 0 40px rgba(69, 71, 69, 0.2);
|
|
2441
2471
|
}
|
|
2442
|
-
.np-bottom-sheet-v2-content:focus {
|
|
2472
|
+
.np-bottom-sheet-v2-content-inner-container:focus {
|
|
2443
2473
|
outline: none;
|
|
2444
2474
|
}
|
|
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
|
-
}
|
|
2465
2475
|
.np-bottom-sheet-v2-header {
|
|
2466
2476
|
align-self: flex-end;
|
|
2467
2477
|
padding: 16px;
|
|
2468
2478
|
padding: var(--size-16);
|
|
2469
2479
|
}
|
|
2470
2480
|
.np-bottom-sheet-v2-content-inner {
|
|
2471
|
-
|
|
2472
|
-
|
|
2481
|
+
padding-top: 0px;
|
|
2482
|
+
display: grid;
|
|
2483
|
+
grid-row-gap: 8px;
|
|
2484
|
+
grid-row-gap: var(--size-8);
|
|
2473
2485
|
row-gap: 8px;
|
|
2474
2486
|
row-gap: var(--size-8);
|
|
2475
|
-
overflow: auto;
|
|
2487
|
+
overflow-y: auto;
|
|
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;
|
|
2476
2492
|
}
|
|
2477
2493
|
.np-bottom-sheet-v2-content-inner--padding-md {
|
|
2478
2494
|
padding: 16px;
|
|
2479
2495
|
padding: var(--size-16);
|
|
2480
|
-
padding-top: 0px;
|
|
2481
2496
|
}
|
|
2482
2497
|
.np-bottom-sheet-v2-title {
|
|
2483
2498
|
color: #37517e;
|
|
@@ -4193,14 +4208,16 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
4193
4208
|
height: var(--size-32);
|
|
4194
4209
|
}
|
|
4195
4210
|
}
|
|
4196
|
-
.status-circle.negative
|
|
4211
|
+
.status-circle.negative,
|
|
4212
|
+
.status-circle.error {
|
|
4197
4213
|
background-color: var(--color-sentiment-negative);
|
|
4198
4214
|
}
|
|
4199
4215
|
.status-circle.neutral {
|
|
4200
4216
|
background-color: #5d7079;
|
|
4201
4217
|
background-color: var(--color-content-secondary);
|
|
4202
4218
|
}
|
|
4203
|
-
.status-circle.positive
|
|
4219
|
+
.status-circle.positive,
|
|
4220
|
+
.status-circle.success {
|
|
4204
4221
|
background-color: var(--color-sentiment-positive);
|
|
4205
4222
|
}
|
|
4206
4223
|
.tw-stepper {
|
|
@@ -66,13 +66,15 @@
|
|
|
66
66
|
height: var(--size-32);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
.status-circle.negative
|
|
69
|
+
.status-circle.negative,
|
|
70
|
+
.status-circle.error {
|
|
70
71
|
background-color: var(--color-sentiment-negative);
|
|
71
72
|
}
|
|
72
73
|
.status-circle.neutral {
|
|
73
74
|
background-color: #5d7079;
|
|
74
75
|
background-color: var(--color-content-secondary);
|
|
75
76
|
}
|
|
76
|
-
.status-circle.positive
|
|
77
|
+
.status-circle.positive,
|
|
78
|
+
.status-circle.success {
|
|
77
79
|
background-color: var(--color-sentiment-positive);
|
|
78
80
|
}
|