react-miui 0.17.0 → 0.17.2
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/CHANGELOG.md +11 -0
- package/dist/components/layout/header/Header.d.ts.map +1 -1
- package/dist/components/layout/header/Header.js +6 -8
- package/dist/components/layout/header/Header.js.map +1 -1
- package/dist/components/ui/action/EqualActions.d.ts +1 -0
- package/dist/components/ui/action/EqualActions.d.ts.map +1 -1
- package/dist/components/ui/action/EqualActions.js +2 -1
- package/dist/components/ui/action/EqualActions.js.map +1 -1
- package/dist/components/ui/action/EqualActions.module.scss +5 -0
- package/dist/components/ui/modal/Modal.d.ts +1 -0
- package/dist/components/ui/modal/Modal.d.ts.map +1 -1
- package/dist/components/ui/modal/Modal.js +8 -2
- package/dist/components/ui/modal/Modal.js.map +1 -1
- package/dist/components/ui/toaster/Notification.d.ts.map +1 -1
- package/dist/components/ui/toaster/Notification.js +6 -2
- package/dist/components/ui/toaster/Notification.js.map +1 -1
- package/dist/components/ui/toaster/Toaster.module.scss +2 -2
- package/docs/classes/Drawer.html +14 -14
- package/docs/classes/Pop.html +14 -14
- package/docs/classes/ToasterProvider.html +10 -10
- package/docs/enums/ICON.html +14 -14
- package/docs/functions/Action.html +4 -4
- package/docs/functions/Button.html +4 -4
- package/docs/functions/Card.html +4 -4
- package/docs/functions/Checkbox.html +4 -4
- package/docs/functions/Choice.html +5 -5
- package/docs/functions/DirectionPad.html +4 -4
- package/docs/functions/EqualActions.html +4 -4
- package/docs/functions/HandleEsc.html +4 -4
- package/docs/functions/Header.html +4 -4
- package/docs/functions/HeaderIconAction.html +4 -4
- package/docs/functions/Icon-1.html +4 -4
- package/docs/functions/If.html +4 -4
- package/docs/functions/Input.html +5 -5
- package/docs/functions/Item-1.html +4 -4
- package/docs/functions/KeyValue.html +4 -4
- package/docs/functions/Label.html +4 -4
- package/docs/functions/List-1.html +4 -4
- package/docs/functions/Message.html +4 -4
- package/docs/functions/Modal-1.html +4 -4
- package/docs/functions/ModalButtons-1.html +4 -4
- package/docs/functions/PopOption.html +4 -4
- package/docs/functions/SearchContainer.html +4 -4
- package/docs/functions/Section-1.html +4 -4
- package/docs/functions/Select.html +4 -4
- package/docs/functions/Selector.html +5 -5
- package/docs/functions/Spacer.html +4 -4
- package/docs/functions/Stats.html +4 -4
- package/docs/functions/StickyHeader-1.html +4 -4
- package/docs/functions/StickyHeader.Content.html +5 -5
- package/docs/functions/Table.html +4 -4
- package/docs/functions/TextArea.html +4 -4
- package/docs/functions/Toggle.html +4 -4
- package/docs/functions/useToaster.html +5 -5
- package/docs/index.html +4 -4
- package/docs/modules/Item.html +7 -7
- package/docs/modules/List.html +6 -6
- package/docs/modules/Modal.html +6 -6
- package/docs/modules/ModalButtons.html +6 -6
- package/docs/modules/Section.html +6 -6
- package/docs/modules/StickyHeader.html +6 -6
- package/docs/modules.html +4 -4
- package/docs/pages/tutorials/Test.html +4 -4
- package/docs/variables/Item.Label.html +5 -5
- package/docs/variables/Item.Value.html +5 -5
- package/docs/variables/List.Header.html +5 -5
- package/docs/variables/Modal.NegateMargin.html +5 -5
- package/docs/variables/ModalButtons.Button.html +5 -5
- package/docs/variables/Section.Container.html +5 -5
- package/esm/components/layout/header/Header.d.ts.map +1 -1
- package/esm/components/layout/header/Header.js +6 -8
- package/esm/components/layout/header/Header.js.map +1 -1
- package/esm/components/ui/action/EqualActions.d.ts +1 -0
- package/esm/components/ui/action/EqualActions.d.ts.map +1 -1
- package/esm/components/ui/action/EqualActions.js +2 -1
- package/esm/components/ui/action/EqualActions.js.map +1 -1
- package/esm/components/ui/action/EqualActions.module.scss +5 -0
- package/esm/components/ui/modal/Modal.d.ts +1 -0
- package/esm/components/ui/modal/Modal.d.ts.map +1 -1
- package/esm/components/ui/modal/Modal.js +8 -2
- package/esm/components/ui/modal/Modal.js.map +1 -1
- package/esm/components/ui/toaster/Notification.d.ts.map +1 -1
- package/esm/components/ui/toaster/Notification.js +7 -3
- package/esm/components/ui/toaster/Notification.js.map +1 -1
- package/esm/components/ui/toaster/Toaster.module.scss +2 -2
- package/package.json +15 -14
- package/src/components/layout/header/Header.tsx +6 -9
- package/src/components/ui/action/EqualActions.module.scss +5 -0
- package/src/components/ui/action/EqualActions.tsx +4 -1
- package/src/components/ui/modal/Modal.tsx +11 -1
- package/src/components/ui/toaster/Notification.tsx +8 -2
- package/src/components/ui/toaster/Toaster.module.scss +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAOxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,aAAK,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEjC,UAAU,KAAK;IACX,cAAc,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;IAC9B,MAAM,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;CAClC;AAED,UAAU,aAAa;IACnB,YAAY,EAAE,OAAO,iBAAiB,CAAC;CAC1C;AAGD,QAAA,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,aAoH9B,CAAC;AAGF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
2
|
import classnames from "classnames";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
3
4
|
import { makeVariants } from "../../../utils/index.js";
|
|
4
5
|
import { ModalNegateMargin } from "./ModalNoMargin.js";
|
|
5
6
|
import styles from "./Modal.module.scss";
|
|
6
|
-
const Modal = ({ children, onClose, isOpen, title, className, onOverlayClick = "close", closeOnEsc = true, variant, }) => {
|
|
7
|
+
const Modal = ({ children, onClose, isOpen, title, className, onOverlayClick = "close", closeOnEsc = true, portal = true, variant, }) => {
|
|
7
8
|
const [isClosing, setIsClosing] = useState(false);
|
|
8
9
|
const [isRendered, setIsRendered] = useState(false);
|
|
9
10
|
const overlayRef = useRef(null);
|
|
@@ -73,10 +74,15 @@ const Modal = ({ children, onClose, isOpen, title, className, onOverlayClick = "
|
|
|
73
74
|
[styles.isClosing]: isClosing,
|
|
74
75
|
[styles.full]: v.includes("full"),
|
|
75
76
|
});
|
|
76
|
-
|
|
77
|
+
const tree = (React.createElement("div", { className: overlayCls, onClick: handleOverlayClick, ref: overlayRef, onAnimationEnd: handleAnimationEnd },
|
|
77
78
|
React.createElement("div", { className: containerCls, ref: containerRef },
|
|
78
79
|
titleElem,
|
|
79
80
|
children)));
|
|
81
|
+
if (portal) {
|
|
82
|
+
const root = typeof portal === "boolean" ? document.body : portal;
|
|
83
|
+
return createPortal(tree, root);
|
|
84
|
+
}
|
|
85
|
+
return tree;
|
|
80
86
|
};
|
|
81
87
|
Modal.NegateMargin = ModalNegateMargin;
|
|
82
88
|
export { Modal };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../../src/components/ui/modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,UAAU,M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;KACnC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,KAAK,CAAC,YAAY,GAAG,iBAAiB,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/toaster/Notification.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Notification.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/toaster/Notification.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAIrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAIrC,UAAU,KAAK;IACX,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;CACvC;AAGD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAsBjC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import React, { useCallback } from "react";
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import styles from "./Toaster.module.scss";
|
|
4
4
|
const Notification = (props) => {
|
|
5
|
+
const [forceHide, setForceHide] = useState(false);
|
|
5
6
|
const handleRemove = useCallback(() => {
|
|
6
7
|
props.onRemove(props.toast.id);
|
|
7
8
|
}, [props.toast.id]);
|
|
9
|
+
const handleForceHide = useCallback(() => {
|
|
10
|
+
setForceHide(true);
|
|
11
|
+
}, []);
|
|
8
12
|
return (React.createElement("div", { className: classnames(styles.toast, {
|
|
9
|
-
[styles.hide]: props.toast.hide,
|
|
10
|
-
}), key: props.toast.id, onTransitionEnd: handleRemove },
|
|
13
|
+
[styles.hide]: props.toast.hide || forceHide,
|
|
14
|
+
}), key: props.toast.id, onTransitionEnd: handleRemove, onClick: handleForceHide },
|
|
11
15
|
React.createElement("span", null, props.toast.text)));
|
|
12
16
|
};
|
|
13
17
|
export { Notification };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.js","sourceRoot":"","sources":["../../../../src/components/ui/toaster/Notification.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Notification.js","sourceRoot":"","sources":["../../../../src/components/ui/toaster/Notification.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,UAAU,MAAM,YAAY,CAAC;AAIpC,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAQ3C,MAAM,YAAY,GAAoB,CAAC,KAAK,EAAE,EAAE;IAC5C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAErB,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE;QACrC,YAAY,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACH,6BACI,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE;YAChC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,SAAS;SAC/C,CAAC,EACF,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,EACnB,eAAe,EAAE,YAAY,EAC7B,OAAO,EAAE,eAAe;QAExB,kCAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAQ,CAC7B,CACT,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-miui",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"author": "Jacek Nowacki",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"prepack": "yarn compile",
|
|
16
16
|
"prepublishOnly": "yarn audit && yarn lint && yarn test && yarn docs",
|
|
17
17
|
"start:dev": "next dev",
|
|
18
|
-
"deploy:dev": "next build && next export && netlify deploy --dir out"
|
|
18
|
+
"deploy:dev": "next build && next export && netlify deploy --dir out",
|
|
19
|
+
"prepare": "husky install"
|
|
19
20
|
},
|
|
20
21
|
"exports": {
|
|
21
22
|
"./global.scss": "./src/global.scss",
|
|
@@ -29,17 +30,20 @@
|
|
|
29
30
|
"module": "./esm/index.js",
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"classnames": "^2.3.1",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
33
|
+
"nodemon": "^2.0.19",
|
|
34
|
+
"oop-timers": "^4.0.1"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@babel/core": "^7.12.10",
|
|
37
38
|
"@babel/preset-env": "^7.12.11",
|
|
38
39
|
"@babel/preset-typescript": "^7.12.7",
|
|
39
40
|
"@dzek69/eslint-config-base": "^2.2.0",
|
|
41
|
+
"@dzek69/eslint-config-import": "^1.0.0",
|
|
42
|
+
"@dzek69/eslint-config-import-typescript": "^1.0.0",
|
|
40
43
|
"@dzek69/eslint-config-react": "^1.2.2",
|
|
41
44
|
"@dzek69/eslint-config-typescript": "^1.0.1",
|
|
42
|
-
"@
|
|
45
|
+
"@knodes/typedoc-plugin-pages": "^0.23.1",
|
|
46
|
+
"@types/jest": "^29.2.0",
|
|
43
47
|
"@types/react": "^17.0.4",
|
|
44
48
|
"@types/react-dom": "^17.0.3",
|
|
45
49
|
"@typescript-eslint/eslint-plugin": "^5.30.3",
|
|
@@ -47,24 +51,21 @@
|
|
|
47
51
|
"babel-plugin-module-extension": "^0.1.3",
|
|
48
52
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
49
53
|
"eslint": "^8.18.0",
|
|
54
|
+
"eslint-plugin-import": "^2.26.0",
|
|
50
55
|
"eslint-plugin-react": "^7.24.0",
|
|
51
56
|
"fast-glob": "^3.2.7",
|
|
52
57
|
"fs-extra": "^9.0.1",
|
|
53
|
-
"husky": "^
|
|
54
|
-
"jest": "^
|
|
58
|
+
"husky": "^8.0.1",
|
|
59
|
+
"jest": "^29.2.2",
|
|
55
60
|
"must": "^0.13.4",
|
|
56
61
|
"next": "^12.1.0",
|
|
57
62
|
"react": "^17.0.2",
|
|
58
63
|
"react-dom": "^17.0.2",
|
|
59
64
|
"react-use": "^17.2.4",
|
|
60
65
|
"sass": "^1.35.2",
|
|
61
|
-
"ts-node": "^9.
|
|
66
|
+
"ts-node": "^10.9.1",
|
|
62
67
|
"typedoc": "^0.23.8",
|
|
63
|
-
"typescript": "^4.7.4"
|
|
64
|
-
"eslint-plugin-import": "^2.26.0",
|
|
65
|
-
"@dzek69/eslint-config-import": "^1.0.0",
|
|
66
|
-
"@dzek69/eslint-config-import-typescript": "^1.0.0",
|
|
67
|
-
"@knodes/typedoc-plugin-pages": "^0.23.1"
|
|
68
|
+
"typescript": "^4.7.4"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"react": "^17.0.0",
|
|
@@ -76,7 +77,7 @@
|
|
|
76
77
|
}
|
|
77
78
|
},
|
|
78
79
|
"libraryTemplate": {
|
|
79
|
-
"version": "3.5.
|
|
80
|
+
"version": "3.5.3",
|
|
80
81
|
"language": "typescript",
|
|
81
82
|
"fixDefaultForCommonJS": true,
|
|
82
83
|
"jsx": true
|
|
@@ -21,17 +21,13 @@ interface Props {
|
|
|
21
21
|
after?: ReactNode;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
// eslint-disable-next-line max-statements
|
|
25
24
|
const Header: React.FC<Props> = (props) => {
|
|
26
25
|
const { center, children, variant, position = "top" } = props;
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return c && typeof c === "object" && "type" in c && c.type === Action;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
27
|
+
const chld = React.Children.toArray(props.children);
|
|
28
|
+
const justActions = chld.every(c => {
|
|
29
|
+
return c && typeof c === "object" && "type" in c && c.type === Action;
|
|
30
|
+
});
|
|
35
31
|
|
|
36
32
|
const cls = classnames(styles.header, {
|
|
37
33
|
[styles["header--center"]]: center,
|
|
@@ -41,7 +37,8 @@ const Header: React.FC<Props> = (props) => {
|
|
|
41
37
|
|
|
42
38
|
let contents = children;
|
|
43
39
|
if (justActions) {
|
|
44
|
-
|
|
40
|
+
const mode = position === "top" || position === "bottom" ? "horizontal" : "vertical";
|
|
41
|
+
contents = <EqualActions className={styles.actions} mode={mode}>{contents}</EqualActions>;
|
|
45
42
|
}
|
|
46
43
|
|
|
47
44
|
let before: ReactNode;
|
|
@@ -7,6 +7,7 @@ import styles from "./EqualActions.module.scss";
|
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
9
9
|
className?: string;
|
|
10
|
+
mode?: "horizontal" | "vertical";
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const EqualActions: React.FC<Props> = (props) => {
|
|
@@ -21,8 +22,10 @@ const EqualActions: React.FC<Props> = (props) => {
|
|
|
21
22
|
"--actions-count": React.Children.count(props.children),
|
|
22
23
|
} as React.CSSProperties;
|
|
23
24
|
|
|
25
|
+
const cls = classnames(styles.actions, props.className, { [styles.vertical]: props.mode === "vertical" });
|
|
26
|
+
|
|
24
27
|
return (
|
|
25
|
-
<div className={
|
|
28
|
+
<div className={cls} style={style}>
|
|
26
29
|
{props.children}
|
|
27
30
|
</div>
|
|
28
31
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
2
|
|
|
3
3
|
import classnames from "classnames";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
4
5
|
|
|
5
6
|
import { makeVariants } from "../../../utils/index.js";
|
|
6
7
|
|
|
@@ -17,6 +18,7 @@ interface Props {
|
|
|
17
18
|
title?: React.ReactNode;
|
|
18
19
|
className?: string;
|
|
19
20
|
variant?: Variant | Variant[];
|
|
21
|
+
portal?: boolean | HTMLElement;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
interface SubComponents {
|
|
@@ -32,6 +34,7 @@ const Modal: React.FC<Props> & SubComponents = ({
|
|
|
32
34
|
className,
|
|
33
35
|
onOverlayClick = "close",
|
|
34
36
|
closeOnEsc = true,
|
|
37
|
+
portal = true,
|
|
35
38
|
variant,
|
|
36
39
|
}) => {
|
|
37
40
|
const [isClosing, setIsClosing] = useState(false);
|
|
@@ -119,7 +122,7 @@ const Modal: React.FC<Props> & SubComponents = ({
|
|
|
119
122
|
[styles.full]: v.includes("full"),
|
|
120
123
|
});
|
|
121
124
|
|
|
122
|
-
|
|
125
|
+
const tree = (
|
|
123
126
|
<div
|
|
124
127
|
className={overlayCls}
|
|
125
128
|
onClick={handleOverlayClick}
|
|
@@ -132,6 +135,13 @@ const Modal: React.FC<Props> & SubComponents = ({
|
|
|
132
135
|
</div>
|
|
133
136
|
</div>
|
|
134
137
|
);
|
|
138
|
+
|
|
139
|
+
if (portal) {
|
|
140
|
+
const root = typeof portal === "boolean" ? document.body : portal;
|
|
141
|
+
return createPortal(tree, root);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return tree;
|
|
135
145
|
};
|
|
136
146
|
Modal.NegateMargin = ModalNegateMargin;
|
|
137
147
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback } from "react";
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
2
|
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
|
|
@@ -13,17 +13,23 @@ interface Props {
|
|
|
13
13
|
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
15
15
|
const Notification: React.FC<Props> = (props) => {
|
|
16
|
+
const [forceHide, setForceHide] = useState(false);
|
|
16
17
|
const handleRemove = useCallback(() => {
|
|
17
18
|
props.onRemove(props.toast.id);
|
|
18
19
|
}, [props.toast.id]);
|
|
19
20
|
|
|
21
|
+
const handleForceHide = useCallback(() => {
|
|
22
|
+
setForceHide(true);
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
20
25
|
return (
|
|
21
26
|
<div
|
|
22
27
|
className={classnames(styles.toast, {
|
|
23
|
-
[styles.hide]: props.toast.hide,
|
|
28
|
+
[styles.hide]: props.toast.hide || forceHide,
|
|
24
29
|
})}
|
|
25
30
|
key={props.toast.id}
|
|
26
31
|
onTransitionEnd={handleRemove}
|
|
32
|
+
onClick={handleForceHide}
|
|
27
33
|
>
|
|
28
34
|
<span>{props.toast.text}</span>
|
|
29
35
|
</div>
|