@cfx-dev/ui-components 4.5.8 → 4.5.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.
|
@@ -7,6 +7,7 @@ export interface ButtonProps<T = HTMLButtonElement> {
|
|
|
7
7
|
title?: string;
|
|
8
8
|
type?: HTMLButtonElement['type'];
|
|
9
9
|
icon?: IconName;
|
|
10
|
+
iconClassName?: string;
|
|
10
11
|
theme?: ButtonTheme;
|
|
11
12
|
tabIndex?: number;
|
|
12
13
|
className?: string;
|
|
@@ -19,8 +20,9 @@ export interface ButtonProps<T = HTMLButtonElement> {
|
|
|
19
20
|
onMouseUp?: (event: React.MouseEvent<T>) => void;
|
|
20
21
|
decorator?: React.ReactNode;
|
|
21
22
|
ref?: React.Ref<T>;
|
|
23
|
+
style?: React.CSSProperties;
|
|
22
24
|
}
|
|
23
|
-
export declare function ButtonContent(props: Pick<ButtonProps, 'text' | 'icon' | 'decorator'>): React.ReactNode;
|
|
25
|
+
export declare function ButtonContent(props: Pick<ButtonProps, 'text' | 'icon' | 'decorator' | 'iconClassName'>): React.ReactNode;
|
|
24
26
|
export declare function getButtonClassName<T = HTMLButtonElement>(props: Partial<Omit<ButtonProps<T>, 'onClick'>>): string;
|
|
25
27
|
declare function Button(props: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
26
28
|
declare const _default: React.MemoExoticComponent<typeof Button>;
|
|
@@ -1,113 +1,115 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
1
|
+
import { jsx as s, jsxs as A, Fragment as q } from "react/jsx-runtime";
|
|
2
2
|
import m from "react";
|
|
3
|
-
import { Icon as
|
|
4
|
-
import { clsx as
|
|
3
|
+
import { Icon as I } from "../Icon/Icon.js";
|
|
4
|
+
import { clsx as B } from "../../utils/clsx.js";
|
|
5
5
|
import { noop as d } from "../../utils/functional.js";
|
|
6
|
-
const
|
|
7
|
-
unsetAll:
|
|
8
|
-
root:
|
|
9
|
-
fullWidth:
|
|
10
|
-
primary:
|
|
11
|
-
secondary:
|
|
6
|
+
const M = "cfxui__Button__unsetAll__44b96", j = "cfxui__Button__root__e2ace", F = "cfxui__Button__fullWidth__f61d9", v = "cfxui__Button__primary__1c59f", w = "cfxui__Button__secondary__b2b84", D = "cfxui__Button__linked__330cb", L = "cfxui__Button__quicklink__204ac", P = "cfxui__Button__icon__44e51", R = "cfxui__Button__icononly__4f786", U = "cfxui__Button__decorator__39a9b", t = {
|
|
7
|
+
unsetAll: M,
|
|
8
|
+
root: j,
|
|
9
|
+
fullWidth: F,
|
|
10
|
+
primary: v,
|
|
11
|
+
secondary: w,
|
|
12
12
|
"on-light": "cfxui__Button__on-light__ae69c",
|
|
13
|
-
linked:
|
|
14
|
-
quicklink:
|
|
15
|
-
icon:
|
|
16
|
-
icononly:
|
|
17
|
-
decorator:
|
|
13
|
+
linked: D,
|
|
14
|
+
quicklink: L,
|
|
15
|
+
icon: P,
|
|
16
|
+
icononly: R,
|
|
17
|
+
decorator: U
|
|
18
18
|
};
|
|
19
|
-
function
|
|
19
|
+
function $(c) {
|
|
20
20
|
const {
|
|
21
21
|
text: o = null,
|
|
22
22
|
icon: n,
|
|
23
|
+
iconClassName: u,
|
|
23
24
|
decorator: l = null
|
|
24
25
|
} = c;
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ A(q, { children: [
|
|
26
27
|
o,
|
|
27
|
-
!!n && /* @__PURE__ */ s(
|
|
28
|
+
!!n && /* @__PURE__ */ s(I, { name: n, className: B(t.icon, u) }),
|
|
28
29
|
!!l && /* @__PURE__ */ s("div", { className: t.decorator, children: l })
|
|
29
30
|
] });
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function z(c) {
|
|
32
33
|
const {
|
|
33
34
|
text: o = null,
|
|
34
35
|
icon: n,
|
|
35
|
-
theme:
|
|
36
|
-
disabled:
|
|
37
|
-
className:
|
|
38
|
-
autofocus:
|
|
39
|
-
fullWidth:
|
|
40
|
-
tabIndex:
|
|
36
|
+
theme: u = "default",
|
|
37
|
+
disabled: l = !1,
|
|
38
|
+
className: a = "",
|
|
39
|
+
autofocus: i = !1,
|
|
40
|
+
fullWidth: _ = !1,
|
|
41
|
+
tabIndex: e
|
|
41
42
|
} = c;
|
|
42
|
-
return
|
|
43
|
-
[t.disabled]:
|
|
43
|
+
return B(t.unsetAll, t.root, t[u], a, {
|
|
44
|
+
[t.disabled]: l,
|
|
44
45
|
[t.icononly]: !!n && (o === null || typeof o > "u"),
|
|
45
46
|
[t.text]: !!o,
|
|
46
|
-
[t.autofocus]:
|
|
47
|
-
[t.fullWidth]:
|
|
47
|
+
[t.autofocus]: i || typeof e < "u",
|
|
48
|
+
[t.fullWidth]: _
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function E(c) {
|
|
51
52
|
const {
|
|
52
53
|
text: o = null,
|
|
53
54
|
icon: n,
|
|
55
|
+
iconClassName: u,
|
|
54
56
|
title: l = "",
|
|
55
57
|
type: a = "button",
|
|
56
|
-
className:
|
|
58
|
+
className: i = "",
|
|
57
59
|
theme: _ = "default",
|
|
58
60
|
disabled: e = !1,
|
|
59
|
-
onClick:
|
|
60
|
-
onMouseDown:
|
|
61
|
-
onMouseUp:
|
|
61
|
+
onClick: x = d,
|
|
62
|
+
onMouseDown: h = d,
|
|
63
|
+
onMouseUp: k = d,
|
|
62
64
|
autofocus: r = !1,
|
|
63
65
|
tabIndex: f,
|
|
64
|
-
fullWidth:
|
|
65
|
-
ariaLabel:
|
|
66
|
-
ref:
|
|
67
|
-
...
|
|
68
|
-
} = c,
|
|
66
|
+
fullWidth: b = !1,
|
|
67
|
+
ariaLabel: p = "",
|
|
68
|
+
ref: y,
|
|
69
|
+
...C
|
|
70
|
+
} = c, N = m.useMemo(() => z({
|
|
69
71
|
text: o,
|
|
70
72
|
icon: n,
|
|
71
73
|
theme: _,
|
|
72
74
|
disabled: e,
|
|
73
|
-
className:
|
|
75
|
+
className: i,
|
|
74
76
|
autofocus: r,
|
|
75
|
-
fullWidth:
|
|
77
|
+
fullWidth: b,
|
|
76
78
|
tabIndex: f
|
|
77
79
|
}), [
|
|
78
80
|
r,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
i,
|
|
82
|
+
b,
|
|
81
83
|
e,
|
|
82
84
|
n,
|
|
83
85
|
f,
|
|
84
86
|
o,
|
|
85
87
|
_
|
|
86
|
-
]),
|
|
87
|
-
e ||
|
|
88
|
-
}, [e,
|
|
88
|
+
]), W = m.useCallback((g) => {
|
|
89
|
+
e || x(g);
|
|
90
|
+
}, [e, x]);
|
|
89
91
|
return /* @__PURE__ */ s(
|
|
90
92
|
"button",
|
|
91
93
|
{
|
|
92
|
-
ref:
|
|
94
|
+
ref: y,
|
|
93
95
|
disabled: e,
|
|
94
|
-
className:
|
|
95
|
-
onClick:
|
|
96
|
-
onMouseDown:
|
|
97
|
-
onMouseUp:
|
|
96
|
+
className: N,
|
|
97
|
+
onClick: W,
|
|
98
|
+
onMouseDown: h,
|
|
99
|
+
onMouseUp: k,
|
|
98
100
|
autoFocus: r,
|
|
99
101
|
tabIndex: f,
|
|
100
102
|
title: l,
|
|
101
103
|
type: a,
|
|
102
|
-
"aria-label":
|
|
103
|
-
...
|
|
104
|
-
children: /* @__PURE__ */ s(
|
|
104
|
+
"aria-label": p,
|
|
105
|
+
...C,
|
|
106
|
+
children: /* @__PURE__ */ s($, { ...c })
|
|
105
107
|
}
|
|
106
108
|
);
|
|
107
109
|
}
|
|
108
|
-
const
|
|
110
|
+
const Q = m.memo(E);
|
|
109
111
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
$ as ButtonContent,
|
|
113
|
+
Q as default,
|
|
114
|
+
z as getButtonClassName
|
|
113
115
|
};
|