@etsoo/materialui 1.1.78 → 1.1.79
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/ButtonLink.d.ts +6 -2
- package/lib/ButtonLink.js +7 -7
- package/package.json +5 -5
- package/src/ButtonLink.tsx +22 -17
package/lib/ButtonLink.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ButtonProps } from
|
|
2
|
+
import { ButtonProps } from "@mui/material";
|
|
3
3
|
/**
|
|
4
4
|
* ButtonLink props
|
|
5
5
|
*/
|
|
6
|
-
export type ButtonLinkProps = Omit<ButtonProps,
|
|
6
|
+
export type ButtonLinkProps = Omit<ButtonProps, "href" | "onClick"> & {
|
|
7
7
|
/**
|
|
8
8
|
* To href
|
|
9
9
|
*/
|
|
10
10
|
href: string;
|
|
11
|
+
/**
|
|
12
|
+
* Link state
|
|
13
|
+
*/
|
|
14
|
+
state?: any;
|
|
11
15
|
};
|
|
12
16
|
/**
|
|
13
17
|
* ButtonLink
|
package/lib/ButtonLink.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Button } from
|
|
2
|
-
import React from
|
|
3
|
-
import { useNavigate } from
|
|
1
|
+
import { Button } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useNavigate } from "react-router-dom";
|
|
4
4
|
/**
|
|
5
5
|
* ButtonLink
|
|
6
6
|
* @param props Props
|
|
@@ -8,12 +8,12 @@ import { useNavigate } from 'react-router-dom';
|
|
|
8
8
|
*/
|
|
9
9
|
export function ButtonLink(props) {
|
|
10
10
|
// Destruct
|
|
11
|
-
const { href, ...rest } = props;
|
|
11
|
+
const { href, state, ...rest } = props;
|
|
12
12
|
// Navigate
|
|
13
13
|
const navigate = useNavigate();
|
|
14
|
-
const onClick = href.includes(
|
|
15
|
-
? () => window.open(href,
|
|
16
|
-
: () => navigate(href);
|
|
14
|
+
const onClick = href.includes("://")
|
|
15
|
+
? () => window.open(href, "_blank")
|
|
16
|
+
: () => navigate(href, { state });
|
|
17
17
|
// Layout
|
|
18
18
|
return React.createElement(Button, { ...rest, onClick: onClick });
|
|
19
19
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.79",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"@etsoo/react": "^1.6.56",
|
|
56
56
|
"@etsoo/shared": "^1.1.93",
|
|
57
57
|
"@mui/icons-material": "^5.11.11",
|
|
58
|
-
"@mui/material": "^5.11.
|
|
58
|
+
"@mui/material": "^5.11.15",
|
|
59
59
|
"@mui/x-data-grid": "^6.0.3",
|
|
60
60
|
"@types/pica": "^9.0.1",
|
|
61
61
|
"@types/pulltorefreshjs": "^0.1.5",
|
|
62
|
-
"@types/react": "^18.0.
|
|
62
|
+
"@types/react": "^18.0.31",
|
|
63
63
|
"@types/react-avatar-editor": "^13.0.0",
|
|
64
64
|
"@types/react-dom": "^18.0.11",
|
|
65
65
|
"@types/react-input-mask": "^3.0.2",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"@testing-library/jest-dom": "^5.16.5",
|
|
86
86
|
"@testing-library/react": "^14.0.0",
|
|
87
87
|
"@types/jest": "^29.5.0",
|
|
88
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
89
|
-
"@typescript-eslint/parser": "^5.
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^5.57.0",
|
|
89
|
+
"@typescript-eslint/parser": "^5.57.0",
|
|
90
90
|
"jest": "^29.5.0",
|
|
91
91
|
"jest-environment-jsdom": "^29.5.0",
|
|
92
92
|
"typescript": "^5.0.2"
|
package/src/ButtonLink.tsx
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { Button, ButtonProps } from
|
|
2
|
-
import React from
|
|
3
|
-
import { useNavigate } from
|
|
1
|
+
import { Button, ButtonProps } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useNavigate } from "react-router-dom";
|
|
4
4
|
/**
|
|
5
5
|
* ButtonLink props
|
|
6
6
|
*/
|
|
7
|
-
export type ButtonLinkProps = Omit<ButtonProps,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
export type ButtonLinkProps = Omit<ButtonProps, "href" | "onClick"> & {
|
|
8
|
+
/**
|
|
9
|
+
* To href
|
|
10
|
+
*/
|
|
11
|
+
href: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Link state
|
|
15
|
+
*/
|
|
16
|
+
state?: any;
|
|
12
17
|
};
|
|
13
18
|
|
|
14
19
|
/**
|
|
@@ -17,16 +22,16 @@ export type ButtonLinkProps = Omit<ButtonProps, 'href' | 'onClick'> & {
|
|
|
17
22
|
* @returns Component
|
|
18
23
|
*/
|
|
19
24
|
export function ButtonLink(props: ButtonLinkProps) {
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
// Destruct
|
|
26
|
+
const { href, state, ...rest } = props;
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
// Navigate
|
|
29
|
+
const navigate = useNavigate();
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
const onClick = href.includes("://")
|
|
32
|
+
? () => window.open(href, "_blank")
|
|
33
|
+
: () => navigate(href, { state });
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
// Layout
|
|
36
|
+
return <Button {...rest} onClick={onClick} />;
|
|
32
37
|
}
|