@cfx-dev/ui-components 5.0.8 → 5.0.9
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.
|
@@ -6,6 +6,7 @@ export interface LinkButtonProps extends BtnExtendedProps {
|
|
|
6
6
|
to: string;
|
|
7
7
|
isHrefProp?: boolean;
|
|
8
8
|
target?: string;
|
|
9
|
+
rel?: React.AnchorHTMLAttributes<HTMLAnchorElement>['rel'];
|
|
9
10
|
Component?: React.ElementType;
|
|
10
11
|
}
|
|
11
12
|
export declare function LinkButton(props: LinkButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import o from "react";
|
|
3
|
-
import { isExternalUrl as
|
|
4
|
-
import { getButtonClassName as
|
|
5
|
-
function
|
|
3
|
+
import { isExternalUrl as h } from "../../utils/links.js";
|
|
4
|
+
import { getButtonClassName as B, ButtonContent as N } from "./Button.js";
|
|
5
|
+
function P(e) {
|
|
6
6
|
const {
|
|
7
7
|
to: t,
|
|
8
8
|
title: f = "",
|
|
@@ -12,8 +12,9 @@ function M(e) {
|
|
|
12
12
|
isHrefProp: a = !1,
|
|
13
13
|
Component: c,
|
|
14
14
|
disabled: l = !1,
|
|
15
|
-
ref: C
|
|
16
|
-
|
|
15
|
+
ref: C,
|
|
16
|
+
rel: d = "noopener noreferrer"
|
|
17
|
+
} = e, k = o.useMemo(() => B(e), [e]), r = h(t), p = r ? "a" : c || "a", x = o.useMemo(() => r || a ? { href: t } : { to: t }, [t, r, a]), b = o.useCallback((i) => {
|
|
17
18
|
if (l) {
|
|
18
19
|
i.preventDefault();
|
|
19
20
|
return;
|
|
@@ -21,20 +22,20 @@ function M(e) {
|
|
|
21
22
|
n && n(i);
|
|
22
23
|
}, [l, n]);
|
|
23
24
|
return /* @__PURE__ */ s(
|
|
24
|
-
|
|
25
|
+
p,
|
|
25
26
|
{
|
|
26
27
|
ref: C,
|
|
27
|
-
className:
|
|
28
|
+
className: k,
|
|
28
29
|
tabIndex: m,
|
|
29
30
|
title: f,
|
|
30
31
|
target: u,
|
|
31
|
-
rel:
|
|
32
|
-
onClickCapture:
|
|
33
|
-
...
|
|
34
|
-
children: /* @__PURE__ */ s(
|
|
32
|
+
rel: d,
|
|
33
|
+
onClickCapture: b,
|
|
34
|
+
...x,
|
|
35
|
+
children: /* @__PURE__ */ s(N, { ...e })
|
|
35
36
|
}
|
|
36
37
|
);
|
|
37
38
|
}
|
|
38
39
|
export {
|
|
39
|
-
|
|
40
|
+
P as LinkButton
|
|
40
41
|
};
|