@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 W, Fragment as g } from "react/jsx-runtime";
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 A } from "../Icon/Icon.js";
4
- import { clsx as q } from "../../utils/clsx.js";
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 I = "cfxui__Button__unsetAll__44b96", M = "cfxui__Button__root__e2ace", j = "cfxui__Button__fullWidth__f61d9", F = "cfxui__Button__primary__1c59f", v = "cfxui__Button__secondary__b2b84", w = "cfxui__Button__linked__330cb", D = "cfxui__Button__quicklink__204ac", L = "cfxui__Button__icon__44e51", P = "cfxui__Button__icononly__4f786", R = "cfxui__Button__decorator__39a9b", t = {
7
- unsetAll: I,
8
- root: M,
9
- fullWidth: j,
10
- primary: F,
11
- secondary: v,
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: w,
14
- quicklink: D,
15
- icon: L,
16
- icononly: P,
17
- decorator: R
13
+ linked: D,
14
+ quicklink: L,
15
+ icon: P,
16
+ icononly: R,
17
+ decorator: U
18
18
  };
19
- function U(c) {
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__ */ W(g, { children: [
26
+ return /* @__PURE__ */ A(q, { children: [
26
27
  o,
27
- !!n && /* @__PURE__ */ s(A, { name: n, className: t.icon }),
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 $(c) {
32
+ function z(c) {
32
33
  const {
33
34
  text: o = null,
34
35
  icon: n,
35
- theme: l = "default",
36
- disabled: a = !1,
37
- className: u = "",
38
- autofocus: _ = !1,
39
- fullWidth: e = !1,
40
- tabIndex: i
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 q(t.unsetAll, t.root, t[l], u, {
43
- [t.disabled]: a,
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]: _ || typeof i < "u",
47
- [t.fullWidth]: e
47
+ [t.autofocus]: i || typeof e < "u",
48
+ [t.fullWidth]: _
48
49
  });
49
50
  }
50
- function z(c) {
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: u = "",
58
+ className: i = "",
57
59
  theme: _ = "default",
58
60
  disabled: e = !1,
59
- onClick: i = d,
60
- onMouseDown: b = d,
61
- onMouseUp: B = d,
61
+ onClick: x = d,
62
+ onMouseDown: h = d,
63
+ onMouseUp: k = d,
62
64
  autofocus: r = !1,
63
65
  tabIndex: f,
64
- fullWidth: x = !1,
65
- ariaLabel: h = "",
66
- ref: k,
67
- ...p
68
- } = c, y = m.useMemo(() => $({
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: u,
75
+ className: i,
74
76
  autofocus: r,
75
- fullWidth: x,
77
+ fullWidth: b,
76
78
  tabIndex: f
77
79
  }), [
78
80
  r,
79
- u,
80
- x,
81
+ i,
82
+ b,
81
83
  e,
82
84
  n,
83
85
  f,
84
86
  o,
85
87
  _
86
- ]), C = m.useCallback((N) => {
87
- e || i(N);
88
- }, [e, i]);
88
+ ]), W = m.useCallback((g) => {
89
+ e || x(g);
90
+ }, [e, x]);
89
91
  return /* @__PURE__ */ s(
90
92
  "button",
91
93
  {
92
- ref: k,
94
+ ref: y,
93
95
  disabled: e,
94
- className: y,
95
- onClick: C,
96
- onMouseDown: b,
97
- onMouseUp: B,
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": h,
103
- ...p,
104
- children: /* @__PURE__ */ s(U, { ...c })
104
+ "aria-label": p,
105
+ ...C,
106
+ children: /* @__PURE__ */ s($, { ...c })
105
107
  }
106
108
  );
107
109
  }
108
- const O = m.memo(z);
110
+ const Q = m.memo(E);
109
111
  export {
110
- U as ButtonContent,
111
- O as default,
112
- $ as getButtonClassName
112
+ $ as ButtonContent,
113
+ Q as default,
114
+ z as getButtonClassName
113
115
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cfx-dev/ui-components",
3
3
  "private": false,
4
- "version": "4.5.8",
4
+ "version": "4.5.9",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "dist/main.js",