@remvst/design-system 1.1.1 → 1.2.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/lib/dialog-layout/dialog-layout.css +76 -0
- package/lib/dialog-layout/dialog-layout.d.ts +12 -0
- package/lib/dialog-layout/dialog-layout.js +41 -0
- package/lib/dim/dim.css +11 -0
- package/lib/dim/transitioning-dim.css +78 -0
- package/lib/dim/transitioning-dim.d.ts +10 -0
- package/lib/dim/transitioning-dim.js +32 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/package.json +1 -1
- package/src/dialog-layout/dialog-layout.css +76 -0
- package/src/dialog-layout/dialog-layout.tsx +35 -0
- package/src/dim/dim.css +11 -0
- package/src/dim/transitioning-dim.css +78 -0
- package/src/dim/transitioning-dim.tsx +39 -0
- package/src/index.ts +2 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
.dialog-layout {
|
|
2
|
+
margin: var(--spacing-l);
|
|
3
|
+
background: #000;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
width: 90%;
|
|
6
|
+
max-width: 320px;
|
|
7
|
+
|
|
8
|
+
height: 100%;
|
|
9
|
+
max-height: 50%;
|
|
10
|
+
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
|
|
14
|
+
position: relative;
|
|
15
|
+
|
|
16
|
+
color: white;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dialog-layout.modal {
|
|
20
|
+
max-width: 800px;
|
|
21
|
+
flex: 1 0 auto;
|
|
22
|
+
max-height: 90%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.dialog-layout.packed {
|
|
26
|
+
height: auto;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.dialog-layout-top-bar {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
flex: 0 0 15%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.dialog-layout-bottom-bar {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
flex: 0 0 15%;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.dialog-layout-top-bar > * {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: row;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.dialog-layout-top-bar-left {
|
|
49
|
+
flex: 0 0 20%;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dialog-layout-top-bar-center {
|
|
53
|
+
flex: 1 1 auto;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.dialog-layout-top-bar-right {
|
|
58
|
+
flex: 0 0 20%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.dialog-layout-content {
|
|
62
|
+
flex: 1 1 auto;
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
overflow-x: hidden;
|
|
66
|
+
overflow-y: auto;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.dialog-layout-bottom-bar .flow-list {
|
|
70
|
+
flex: 1 0 100%;
|
|
71
|
+
align-items: stretch;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.dialog-layout-bottom-bar .flow-list .main-button {
|
|
75
|
+
height: 100%;
|
|
76
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./dialog-layout.css";
|
|
3
|
+
export declare function DialogLayout(props: React.PropsWithChildren & {
|
|
4
|
+
isModal?: boolean;
|
|
5
|
+
isPacked?: boolean;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
export declare function DialogTopBar(props: React.PropsWithChildren): React.JSX.Element;
|
|
8
|
+
export declare function DialogBottomBar(props: React.PropsWithChildren): React.JSX.Element;
|
|
9
|
+
export declare function DialogTopBarLeft(props: React.PropsWithChildren): React.JSX.Element;
|
|
10
|
+
export declare function DialogTopBarCenter(props: React.PropsWithChildren): React.JSX.Element;
|
|
11
|
+
export declare function DialogTopBarRight(props: React.PropsWithChildren): React.JSX.Element;
|
|
12
|
+
export declare function DialogContent(props: React.PropsWithChildren): React.JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DialogContent = exports.DialogTopBarRight = exports.DialogTopBarCenter = exports.DialogTopBarLeft = exports.DialogBottomBar = exports.DialogTopBar = exports.DialogLayout = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
require("./dialog-layout.css");
|
|
9
|
+
function DialogLayout(props) {
|
|
10
|
+
const classes = ["dialog-layout"];
|
|
11
|
+
if (props.isModal)
|
|
12
|
+
classes.push("modal");
|
|
13
|
+
if (props.isPacked)
|
|
14
|
+
classes.push("packed");
|
|
15
|
+
return react_1.default.createElement("div", { className: classes.join(" ") }, props.children);
|
|
16
|
+
}
|
|
17
|
+
exports.DialogLayout = DialogLayout;
|
|
18
|
+
function DialogTopBar(props) {
|
|
19
|
+
return react_1.default.createElement("div", { className: "dialog-layout-top-bar" }, props.children);
|
|
20
|
+
}
|
|
21
|
+
exports.DialogTopBar = DialogTopBar;
|
|
22
|
+
function DialogBottomBar(props) {
|
|
23
|
+
return react_1.default.createElement("div", { className: "dialog-layout-bottom-bar" }, props.children);
|
|
24
|
+
}
|
|
25
|
+
exports.DialogBottomBar = DialogBottomBar;
|
|
26
|
+
function DialogTopBarLeft(props) {
|
|
27
|
+
return react_1.default.createElement("div", { className: "dialog-layout-top-bar-left" }, props.children);
|
|
28
|
+
}
|
|
29
|
+
exports.DialogTopBarLeft = DialogTopBarLeft;
|
|
30
|
+
function DialogTopBarCenter(props) {
|
|
31
|
+
return react_1.default.createElement("div", { className: "dialog-layout-top-bar-center" }, props.children);
|
|
32
|
+
}
|
|
33
|
+
exports.DialogTopBarCenter = DialogTopBarCenter;
|
|
34
|
+
function DialogTopBarRight(props) {
|
|
35
|
+
return react_1.default.createElement("div", { className: "dialog-layout-top-bar-right" }, props.children);
|
|
36
|
+
}
|
|
37
|
+
exports.DialogTopBarRight = DialogTopBarRight;
|
|
38
|
+
function DialogContent(props) {
|
|
39
|
+
return react_1.default.createElement("div", { className: "dialog-layout-content" }, props.children);
|
|
40
|
+
}
|
|
41
|
+
exports.DialogContent = DialogContent;
|
package/lib/dim/dim.css
CHANGED
|
@@ -2,4 +2,15 @@
|
|
|
2
2
|
width: 100%;
|
|
3
3
|
height: 100%;
|
|
4
4
|
background-color: rgba(0, 0, 0, 0.5);
|
|
5
|
+
|
|
6
|
+
position: relative;
|
|
7
|
+
z-index: 2;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
|
|
15
|
+
backdrop-filter: blur(5px);
|
|
5
16
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--slide-in: slide-up 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1;
|
|
3
|
+
--slide-out: slide-down 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1 forwards;
|
|
4
|
+
--slide-in-x: slide-right 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1;
|
|
5
|
+
--slide-out-x: slide-left 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1 forwards;
|
|
6
|
+
--fade-in: fade-in 0.2s linear 1;
|
|
7
|
+
--fade-out: fade-out 0.2s linear 1 forwards;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@keyframes slide-up {
|
|
11
|
+
0% {
|
|
12
|
+
transform: translateY(100%);
|
|
13
|
+
}
|
|
14
|
+
100% {
|
|
15
|
+
transform: translateY(0%);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes slide-down {
|
|
20
|
+
0% {
|
|
21
|
+
transform: translateY(0%);
|
|
22
|
+
}
|
|
23
|
+
100% {
|
|
24
|
+
transform: translateY(100%);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@keyframes slide-right {
|
|
29
|
+
0% {
|
|
30
|
+
transform: translateX(-100%);
|
|
31
|
+
}
|
|
32
|
+
100% {
|
|
33
|
+
transform: translateX(0%);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@keyframes slide-left {
|
|
38
|
+
0% {
|
|
39
|
+
transform: translateX(0%);
|
|
40
|
+
}
|
|
41
|
+
100% {
|
|
42
|
+
transform: translateX(-100%);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@keyframes fade-in {
|
|
47
|
+
0% {
|
|
48
|
+
opacity: 0%;
|
|
49
|
+
}
|
|
50
|
+
100% {
|
|
51
|
+
opacity: 100%;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@keyframes fade-out {
|
|
56
|
+
0% {
|
|
57
|
+
opacity: 100%;
|
|
58
|
+
}
|
|
59
|
+
100% {
|
|
60
|
+
opacity: 0%;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.dim.opening {
|
|
65
|
+
animation: var(--fade-in);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dim.closing {
|
|
69
|
+
animation: var(--fade-out);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.dim.opening .dialog-layout {
|
|
73
|
+
animation: var(--slide-in);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.dim.closing .dialog-layout {
|
|
77
|
+
animation: var(--slide-out);
|
|
78
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./transitioning-dim.css";
|
|
3
|
+
export declare class TransitioningDim extends React.Component<React.PropsWithChildren, {
|
|
4
|
+
closing: boolean;
|
|
5
|
+
animateOutListener(): void;
|
|
6
|
+
}> {
|
|
7
|
+
constructor(props: React.PropsWithChildren);
|
|
8
|
+
animateOut(): Promise<void>;
|
|
9
|
+
render(): React.JSX.Element;
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TransitioningDim = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const dim_1 = require("./dim");
|
|
9
|
+
require("./transitioning-dim.css");
|
|
10
|
+
class TransitioningDim extends react_1.default.Component {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
this.state = {
|
|
14
|
+
closing: false,
|
|
15
|
+
animateOutListener() { },
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
animateOut() {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
this.setState({
|
|
21
|
+
closing: true,
|
|
22
|
+
animateOutListener: resolve,
|
|
23
|
+
});
|
|
24
|
+
// Safety in case the animation code suckssss
|
|
25
|
+
setTimeout(resolve, 300);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
return (react_1.default.createElement(dim_1.Dim, { onAnimationEnd: this.state.animateOutListener, className: this.state.closing ? "closing" : "opening" }, this.props.children));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.TransitioningDim = TransitioningDim;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ export * from "./animations/animations";
|
|
|
4
4
|
export * from "./balanced-row/balanced-row";
|
|
5
5
|
export * from "./balanced-stack/balanced-stack";
|
|
6
6
|
export * from "./buttons/buttons";
|
|
7
|
+
export * from "./dialog-layout/dialog-layout";
|
|
7
8
|
export * from "./dim/dim";
|
|
9
|
+
export * from "./dim/transitioning-dim";
|
|
8
10
|
export * from "./flow-list/flow-list";
|
|
9
11
|
export * from "./focusable";
|
|
10
12
|
export * from "./frame/frame";
|
package/lib/index.js
CHANGED
|
@@ -20,7 +20,9 @@ __exportStar(require("./animations/animations"), exports);
|
|
|
20
20
|
__exportStar(require("./balanced-row/balanced-row"), exports);
|
|
21
21
|
__exportStar(require("./balanced-stack/balanced-stack"), exports);
|
|
22
22
|
__exportStar(require("./buttons/buttons"), exports);
|
|
23
|
+
__exportStar(require("./dialog-layout/dialog-layout"), exports);
|
|
23
24
|
__exportStar(require("./dim/dim"), exports);
|
|
25
|
+
__exportStar(require("./dim/transitioning-dim"), exports);
|
|
24
26
|
__exportStar(require("./flow-list/flow-list"), exports);
|
|
25
27
|
__exportStar(require("./focusable"), exports);
|
|
26
28
|
__exportStar(require("./frame/frame"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
.dialog-layout {
|
|
2
|
+
margin: var(--spacing-l);
|
|
3
|
+
background: #000;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
width: 90%;
|
|
6
|
+
max-width: 320px;
|
|
7
|
+
|
|
8
|
+
height: 100%;
|
|
9
|
+
max-height: 50%;
|
|
10
|
+
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
|
|
14
|
+
position: relative;
|
|
15
|
+
|
|
16
|
+
color: white;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dialog-layout.modal {
|
|
20
|
+
max-width: 800px;
|
|
21
|
+
flex: 1 0 auto;
|
|
22
|
+
max-height: 90%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.dialog-layout.packed {
|
|
26
|
+
height: auto;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.dialog-layout-top-bar {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: row;
|
|
32
|
+
flex: 0 0 15%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.dialog-layout-bottom-bar {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
flex: 0 0 15%;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.dialog-layout-top-bar > * {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: row;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.dialog-layout-top-bar-left {
|
|
49
|
+
flex: 0 0 20%;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.dialog-layout-top-bar-center {
|
|
53
|
+
flex: 1 1 auto;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.dialog-layout-top-bar-right {
|
|
58
|
+
flex: 0 0 20%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.dialog-layout-content {
|
|
62
|
+
flex: 1 1 auto;
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
overflow-x: hidden;
|
|
66
|
+
overflow-y: auto;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.dialog-layout-bottom-bar .flow-list {
|
|
70
|
+
flex: 1 0 100%;
|
|
71
|
+
align-items: stretch;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.dialog-layout-bottom-bar .flow-list .main-button {
|
|
75
|
+
height: 100%;
|
|
76
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./dialog-layout.css";
|
|
3
|
+
|
|
4
|
+
export function DialogLayout(
|
|
5
|
+
props: React.PropsWithChildren & { isModal?: boolean; isPacked?: boolean },
|
|
6
|
+
) {
|
|
7
|
+
const classes = ["dialog-layout"];
|
|
8
|
+
if (props.isModal) classes.push("modal");
|
|
9
|
+
if (props.isPacked) classes.push("packed");
|
|
10
|
+
return <div className={classes.join(" ")}>{props.children}</div>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function DialogTopBar(props: React.PropsWithChildren) {
|
|
14
|
+
return <div className="dialog-layout-top-bar">{props.children}</div>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function DialogBottomBar(props: React.PropsWithChildren) {
|
|
18
|
+
return <div className="dialog-layout-bottom-bar">{props.children}</div>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function DialogTopBarLeft(props: React.PropsWithChildren) {
|
|
22
|
+
return <div className="dialog-layout-top-bar-left">{props.children}</div>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function DialogTopBarCenter(props: React.PropsWithChildren) {
|
|
26
|
+
return <div className="dialog-layout-top-bar-center">{props.children}</div>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function DialogTopBarRight(props: React.PropsWithChildren) {
|
|
30
|
+
return <div className="dialog-layout-top-bar-right">{props.children}</div>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function DialogContent(props: React.PropsWithChildren) {
|
|
34
|
+
return <div className="dialog-layout-content">{props.children}</div>;
|
|
35
|
+
}
|
package/src/dim/dim.css
CHANGED
|
@@ -2,4 +2,15 @@
|
|
|
2
2
|
width: 100%;
|
|
3
3
|
height: 100%;
|
|
4
4
|
background-color: rgba(0, 0, 0, 0.5);
|
|
5
|
+
|
|
6
|
+
position: relative;
|
|
7
|
+
z-index: 2;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
|
|
15
|
+
backdrop-filter: blur(5px);
|
|
5
16
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--slide-in: slide-up 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1;
|
|
3
|
+
--slide-out: slide-down 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1 forwards;
|
|
4
|
+
--slide-in-x: slide-right 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1;
|
|
5
|
+
--slide-out-x: slide-left 0.2s cubic-bezier(0.33, 1, 0.68, 1) 1 forwards;
|
|
6
|
+
--fade-in: fade-in 0.2s linear 1;
|
|
7
|
+
--fade-out: fade-out 0.2s linear 1 forwards;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@keyframes slide-up {
|
|
11
|
+
0% {
|
|
12
|
+
transform: translateY(100%);
|
|
13
|
+
}
|
|
14
|
+
100% {
|
|
15
|
+
transform: translateY(0%);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes slide-down {
|
|
20
|
+
0% {
|
|
21
|
+
transform: translateY(0%);
|
|
22
|
+
}
|
|
23
|
+
100% {
|
|
24
|
+
transform: translateY(100%);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@keyframes slide-right {
|
|
29
|
+
0% {
|
|
30
|
+
transform: translateX(-100%);
|
|
31
|
+
}
|
|
32
|
+
100% {
|
|
33
|
+
transform: translateX(0%);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@keyframes slide-left {
|
|
38
|
+
0% {
|
|
39
|
+
transform: translateX(0%);
|
|
40
|
+
}
|
|
41
|
+
100% {
|
|
42
|
+
transform: translateX(-100%);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@keyframes fade-in {
|
|
47
|
+
0% {
|
|
48
|
+
opacity: 0%;
|
|
49
|
+
}
|
|
50
|
+
100% {
|
|
51
|
+
opacity: 100%;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@keyframes fade-out {
|
|
56
|
+
0% {
|
|
57
|
+
opacity: 100%;
|
|
58
|
+
}
|
|
59
|
+
100% {
|
|
60
|
+
opacity: 0%;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.dim.opening {
|
|
65
|
+
animation: var(--fade-in);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dim.closing {
|
|
69
|
+
animation: var(--fade-out);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.dim.opening .dialog-layout {
|
|
73
|
+
animation: var(--slide-in);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.dim.closing .dialog-layout {
|
|
77
|
+
animation: var(--slide-out);
|
|
78
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Dim } from "./dim";
|
|
3
|
+
import "./transitioning-dim.css";
|
|
4
|
+
|
|
5
|
+
export class TransitioningDim extends React.Component<
|
|
6
|
+
React.PropsWithChildren,
|
|
7
|
+
{ closing: boolean; animateOutListener(): void }
|
|
8
|
+
> {
|
|
9
|
+
constructor(props: React.PropsWithChildren) {
|
|
10
|
+
super(props);
|
|
11
|
+
this.state = {
|
|
12
|
+
closing: false,
|
|
13
|
+
animateOutListener() {},
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
animateOut(): Promise<void> {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
this.setState({
|
|
20
|
+
closing: true,
|
|
21
|
+
animateOutListener: resolve,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Safety in case the animation code suckssss
|
|
25
|
+
setTimeout(resolve, 300);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
render() {
|
|
30
|
+
return (
|
|
31
|
+
<Dim
|
|
32
|
+
onAnimationEnd={this.state.animateOutListener}
|
|
33
|
+
className={this.state.closing ? "closing" : "opening"}
|
|
34
|
+
>
|
|
35
|
+
{this.props.children}
|
|
36
|
+
</Dim>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,9 @@ export * from "./animations/animations";
|
|
|
5
5
|
export * from "./balanced-row/balanced-row";
|
|
6
6
|
export * from "./balanced-stack/balanced-stack";
|
|
7
7
|
export * from "./buttons/buttons";
|
|
8
|
+
export * from "./dialog-layout/dialog-layout";
|
|
8
9
|
export * from "./dim/dim";
|
|
10
|
+
export * from "./dim/transitioning-dim";
|
|
9
11
|
export * from "./flow-list/flow-list";
|
|
10
12
|
export * from "./focusable";
|
|
11
13
|
export * from "./frame/frame";
|