@cfx-dev/ui-components 0.0.21 → 0.0.22
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.
|
@@ -21,4 +21,6 @@ export interface ButtonProps {
|
|
|
21
21
|
onMouseUp?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
22
22
|
decorator?: React.ReactNode;
|
|
23
23
|
}
|
|
24
|
+
export declare function ButtonContent(props: Partial<ButtonProps>): React.ReactNode;
|
|
25
|
+
export declare function getButtonClassName(props: Partial<ButtonProps>): string;
|
|
24
26
|
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,59 +1,105 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { clsx as
|
|
4
|
-
import { noop as
|
|
5
|
-
import { s as
|
|
6
|
-
|
|
1
|
+
import { jsx as c, jsxs as j, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import b from "react";
|
|
3
|
+
import { clsx as z } from "../../utils/clsx.js";
|
|
4
|
+
import { noop as p } from "../../utils/functional.js";
|
|
5
|
+
import { s as t } from "../../Button.module-Z6njvP9Z.js";
|
|
6
|
+
function F(a) {
|
|
7
7
|
const {
|
|
8
|
-
text:
|
|
9
|
-
icon:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
8
|
+
text: e = null,
|
|
9
|
+
icon: l = null,
|
|
10
|
+
decorator: o = null
|
|
11
|
+
} = a;
|
|
12
|
+
return /* @__PURE__ */ j(w, { children: [
|
|
13
|
+
!!l && /* @__PURE__ */ c("span", { className: t["icon-node"], children: l }),
|
|
14
|
+
e,
|
|
15
|
+
!!o && /* @__PURE__ */ c("div", { className: t.decorator, children: o })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
function I(a) {
|
|
19
|
+
const {
|
|
20
|
+
text: e = null,
|
|
21
|
+
icon: l = null,
|
|
22
|
+
theme: o = "default",
|
|
23
|
+
size: s = "normal",
|
|
24
|
+
disabled: f = !1,
|
|
25
|
+
straightCorners: d = !1,
|
|
26
|
+
className: r = "",
|
|
27
|
+
autofocus: u = !1,
|
|
28
|
+
fullWidth: i = !1,
|
|
29
|
+
tabIndex: n
|
|
30
|
+
} = a;
|
|
31
|
+
return z(t.root, t[o], t[s], r, {
|
|
32
|
+
[t.disabled]: f,
|
|
33
|
+
[t.icon]: !!l && (e === null || typeof e > "u"),
|
|
34
|
+
[t.text]: !!e,
|
|
35
|
+
[t.autofocus]: u || typeof n < "u",
|
|
36
|
+
[t["straight-borders"]]: d,
|
|
37
|
+
[t.fullWidth]: i
|
|
32
38
|
});
|
|
33
|
-
|
|
39
|
+
}
|
|
40
|
+
const U = b.forwardRef(function(e, l) {
|
|
41
|
+
const {
|
|
42
|
+
text: o = null,
|
|
43
|
+
icon: s = null,
|
|
44
|
+
title: f = "",
|
|
45
|
+
type: d = "button",
|
|
46
|
+
className: r = "",
|
|
47
|
+
theme: u = "default",
|
|
48
|
+
size: i = "normal",
|
|
49
|
+
disabled: n = !1,
|
|
50
|
+
straightCorners: x = !1,
|
|
51
|
+
onClick: C = p,
|
|
52
|
+
onMouseDown: g = p,
|
|
53
|
+
onMouseUp: k = p,
|
|
54
|
+
autofocus: m = !1,
|
|
55
|
+
fullWidth: N = !1,
|
|
56
|
+
tabIndex: h,
|
|
57
|
+
ariaLabel: B = ""
|
|
58
|
+
} = e, y = b.useMemo(() => I({
|
|
59
|
+
text: o,
|
|
60
|
+
icon: s,
|
|
61
|
+
theme: u,
|
|
62
|
+
size: i,
|
|
63
|
+
disabled: n,
|
|
64
|
+
straightCorners: x,
|
|
65
|
+
className: r,
|
|
66
|
+
autofocus: m,
|
|
67
|
+
fullWidth: N,
|
|
68
|
+
tabIndex: h
|
|
69
|
+
}), [
|
|
70
|
+
m,
|
|
71
|
+
r,
|
|
72
|
+
n,
|
|
73
|
+
N,
|
|
74
|
+
s,
|
|
75
|
+
i,
|
|
76
|
+
x,
|
|
77
|
+
h,
|
|
78
|
+
o,
|
|
79
|
+
u
|
|
80
|
+
]), M = b.useCallback((W) => {
|
|
81
|
+
n || C(W);
|
|
82
|
+
}, [n, C]);
|
|
83
|
+
return /* @__PURE__ */ c(
|
|
34
84
|
"button",
|
|
35
85
|
{
|
|
36
|
-
ref:
|
|
37
|
-
disabled:
|
|
38
|
-
className:
|
|
39
|
-
onClick:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"aria-label": y,
|
|
49
|
-
children: [
|
|
50
|
-
!!e && /* @__PURE__ */ i("span", { className: o["icon-node"], children: e }),
|
|
51
|
-
t,
|
|
52
|
-
!!r && /* @__PURE__ */ i("div", { className: o.decorator, children: r })
|
|
53
|
-
]
|
|
86
|
+
ref: l,
|
|
87
|
+
disabled: n,
|
|
88
|
+
className: y,
|
|
89
|
+
onClick: M,
|
|
90
|
+
onMouseDown: g,
|
|
91
|
+
onMouseUp: k,
|
|
92
|
+
autoFocus: m,
|
|
93
|
+
tabIndex: h,
|
|
94
|
+
title: f,
|
|
95
|
+
type: d,
|
|
96
|
+
"aria-label": B,
|
|
97
|
+
children: /* @__PURE__ */ c(F, { ...e })
|
|
54
98
|
}
|
|
55
99
|
);
|
|
56
100
|
});
|
|
57
101
|
export {
|
|
58
|
-
|
|
102
|
+
U as Button,
|
|
103
|
+
F as ButtonContent,
|
|
104
|
+
I as getButtonClassName
|
|
59
105
|
};
|
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ButtonProps } from './Button';
|
|
3
3
|
|
|
4
|
-
export interface LinkButtonProps {
|
|
4
|
+
export interface LinkButtonProps extends Omit<ButtonProps, 'autofocus' | 'onCLick' | 'onMouseDown' | 'onMouseUp' | 'ariaLabel'> {
|
|
5
5
|
to: string;
|
|
6
|
-
|
|
7
|
-
title?: string;
|
|
8
|
-
icon?: React.ReactNode;
|
|
9
|
-
theme?: ButtonTheme;
|
|
10
|
-
size?: ButtonSize;
|
|
11
|
-
disabled?: boolean;
|
|
6
|
+
isHrefProp?: boolean;
|
|
12
7
|
onClick?(): void;
|
|
13
|
-
tabIndex?: number;
|
|
14
|
-
className?: string;
|
|
15
8
|
target?: string;
|
|
16
9
|
Component?: React.ElementType;
|
|
17
|
-
decorator?: React.ReactNode;
|
|
18
10
|
}
|
|
19
11
|
export declare const LinkButton: React.ForwardRefExoticComponent<LinkButtonProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -1,48 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const P = a.forwardRef(function(i, c) {
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import n from "react";
|
|
3
|
+
import { noop as k } from "../../utils/functional.js";
|
|
4
|
+
import { isExternalUrl as d } from "../../utils/links.js";
|
|
5
|
+
import { getButtonClassName as x, ButtonContent as B } from "./Button.js";
|
|
6
|
+
const M = n.forwardRef(function(t, a) {
|
|
8
7
|
const {
|
|
9
|
-
to:
|
|
10
|
-
text: t = null,
|
|
11
|
-
icon: n = null,
|
|
8
|
+
to: o,
|
|
12
9
|
title: m = "",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Component: h
|
|
22
|
-
} = i, N = j(o.root, o[f], o[p], d, {
|
|
23
|
-
[o.disabled]: u,
|
|
24
|
-
[o.icon]: !!n && !t,
|
|
25
|
-
[o.text]: !!t
|
|
26
|
-
}), r = E(e), b = r ? "a" : h || "a", L = a.useMemo(() => r ? { href: e } : { to: e }, [e, r]);
|
|
27
|
-
return /* @__PURE__ */ R(
|
|
28
|
-
b,
|
|
10
|
+
tabIndex: s,
|
|
11
|
+
target: f = "",
|
|
12
|
+
onClick: l = k,
|
|
13
|
+
isHrefProp: r = !1,
|
|
14
|
+
Component: c
|
|
15
|
+
} = t, u = n.useMemo(() => x(t), [t]), e = d(o), C = e ? "a" : c || "a", p = n.useMemo(() => e || r ? { href: o } : { to: o }, [o, e, r]);
|
|
16
|
+
return /* @__PURE__ */ i(
|
|
17
|
+
C,
|
|
29
18
|
{
|
|
30
|
-
ref:
|
|
31
|
-
className:
|
|
32
|
-
tabIndex:
|
|
19
|
+
ref: a,
|
|
20
|
+
className: u,
|
|
21
|
+
tabIndex: s,
|
|
33
22
|
title: m,
|
|
34
|
-
target:
|
|
23
|
+
target: f,
|
|
35
24
|
rel: "noopener noreferrer",
|
|
36
|
-
onClickCapture:
|
|
37
|
-
...
|
|
38
|
-
children:
|
|
39
|
-
!!n && /* @__PURE__ */ l("span", { className: o["icon-node"], children: n }),
|
|
40
|
-
t,
|
|
41
|
-
!!s && /* @__PURE__ */ l("div", { className: o.decorator, children: s })
|
|
42
|
-
]
|
|
25
|
+
onClickCapture: l,
|
|
26
|
+
...p,
|
|
27
|
+
children: /* @__PURE__ */ i(B, { ...t })
|
|
43
28
|
}
|
|
44
29
|
);
|
|
45
30
|
});
|
|
46
31
|
export {
|
|
47
|
-
|
|
32
|
+
M as LinkButton
|
|
48
33
|
};
|