@yakad/ui 1.2.1 → 1.2.3

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.
@@ -0,0 +1,27 @@
1
+ import React, { useEffect, useRef } from "react";
2
+
3
+ interface ClickAwayListenerProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ onClickAway: React.MouseEventHandler<HTMLDivElement>;
5
+ }
6
+
7
+ function ClickAwayListener(props: ClickAwayListenerProps) {
8
+ const ref = useRef(null);
9
+
10
+ useEffect(() => {
11
+ const handleOutSideClick = (event: MouseEvent) => {
12
+ if (ref.current && !(ref.current as any).contains(event.target)) {
13
+ props.onClickAway && props.onClickAway(event as any);
14
+ }
15
+ };
16
+
17
+ document.addEventListener("click", handleOutSideClick, true);
18
+
19
+ // CleanUp When element unmount
20
+ return () =>
21
+ document.removeEventListener("click", handleOutSideClick, true);
22
+ }, [props.onClickAway]);
23
+
24
+ return <div ref={ref}>{props.children}</div>;
25
+ }
26
+
27
+ export default ClickAwayListener;
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ import { useNavigate } from "react-router-dom";
3
+
4
+ function HistoryBack(props: React.HTMLAttributes<HTMLDivElement>) {
5
+ const navigate = useNavigate();
6
+
7
+ return (
8
+ <div
9
+ {...props}
10
+ onClick={() => {
11
+ navigate(-1);
12
+ props.onClick!(null as any);
13
+ }}
14
+ >
15
+ {props.children}
16
+ </div>
17
+ );
18
+ }
19
+
20
+ export default HistoryBack;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yakad/ui",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
package/index.tsx DELETED
@@ -1,39 +0,0 @@
1
- import Button from "./button/button";
2
- import AppBar from "./appBar/appBar";
3
- import Card from "./card/card";
4
- import Container from "./container/container";
5
- import Footer from "./footer/footer";
6
- import Form from "./form/form";
7
- import GridContainer from "./gridContainer/gridContainer";
8
- import GridItem from "./gridItem/gridItem";
9
- import Hr from "./hr/hr";
10
- import List from "./list/list";
11
- import ListItem from "./listItem/listItem";
12
- import Main from "./main/main";
13
- import Navigation from "./navigation/navigation";
14
- import Page from "./page/page";
15
- import Row from "./row/row";
16
- import Spacer from "./spacer/spacer";
17
- import Stack from "./stack/stack";
18
- import SvgIcon from "./svgIcon/svgIcon";
19
-
20
- export {
21
- Button,
22
- AppBar,
23
- Card,
24
- Container,
25
- Footer,
26
- Form,
27
- GridContainer,
28
- GridItem,
29
- Hr,
30
- List,
31
- ListItem,
32
- Main,
33
- Navigation,
34
- Page,
35
- Row,
36
- Stack,
37
- Spacer,
38
- SvgIcon,
39
- };