@versini/ui-button 4.2.0 → 4.2.1
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/dist/components/Button/ButtonIcon.js +93 -90
- package/dist/index.js +3 -3
- package/package.json +2 -2
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { BaseButton_private as
|
|
4
|
-
import { getButtonClasses as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
}), []),
|
|
1
|
+
import { jsxs as W, jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import Y, { useRef as d, useEffect as D, useCallback as J, useMemo as O, useState as K, useLayoutEffect as $ } from "react";
|
|
3
|
+
import { BaseButton_private as L } from "../../chunks/BaseButton.BFKIL4GO.js";
|
|
4
|
+
import { getButtonClasses as Q, getIconClasses as U, getButtonIconLabelClasses as V, TYPE_ICON as X } from "../../chunks/utilities.DZA7UB1Y.js";
|
|
5
|
+
function Z() {
|
|
6
|
+
const t = d(!1);
|
|
7
|
+
return D(() => (t.current = !0, () => {
|
|
8
|
+
t.current = !1;
|
|
9
|
+
}), []), J(() => t.current, []);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
13
|
-
} : (
|
|
14
|
-
|
|
15
|
-
typeof
|
|
11
|
+
function z(t) {
|
|
12
|
+
return O(() => t.every((n) => n == null) ? () => {
|
|
13
|
+
} : (n) => {
|
|
14
|
+
t.forEach((e) => {
|
|
15
|
+
typeof e == "function" ? e(n) : e != null && (e.current = n);
|
|
16
16
|
});
|
|
17
|
-
},
|
|
17
|
+
}, t);
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const tt = {
|
|
20
20
|
x: 0,
|
|
21
21
|
y: 0,
|
|
22
22
|
width: 0,
|
|
@@ -26,104 +26,107 @@ const X = {
|
|
|
26
26
|
bottom: 0,
|
|
27
27
|
right: 0
|
|
28
28
|
};
|
|
29
|
-
function
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
function b(t) {
|
|
30
|
+
const n = Z(), e = d(0), i = d(null), [C, I] = K(tt), l = O(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((R) => {
|
|
31
|
+
const c = R[0];
|
|
32
|
+
c && (cancelAnimationFrame(e.current), e.current = requestAnimationFrame(() => {
|
|
33
|
+
i.current && n() && I(c.contentRect);
|
|
34
34
|
}));
|
|
35
|
-
}), [
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
}), [
|
|
35
|
+
}), [n]);
|
|
36
|
+
return D(() => (i.current && (l == null || l.observe(i.current, t)), () => {
|
|
37
|
+
l == null || l.disconnect(), e.current && cancelAnimationFrame(e.current);
|
|
38
|
+
}), [l, t]), [i, C];
|
|
39
39
|
}
|
|
40
|
-
const
|
|
40
|
+
const v = {
|
|
41
41
|
small: 24,
|
|
42
42
|
// w-6
|
|
43
43
|
medium: 32,
|
|
44
44
|
// w-8
|
|
45
45
|
large: 48
|
|
46
46
|
// w-12
|
|
47
|
-
},
|
|
47
|
+
}, E = {
|
|
48
48
|
small: 8 * 2,
|
|
49
49
|
// px-2 x 2
|
|
50
50
|
medium: 12 * 2,
|
|
51
51
|
// px-3 x 2
|
|
52
52
|
large: 16 * 2
|
|
53
53
|
// px-4 x 2
|
|
54
|
-
},
|
|
54
|
+
}, A = 2, et = Y.forwardRef(
|
|
55
55
|
({
|
|
56
|
-
children:
|
|
57
|
-
disabled:
|
|
58
|
-
mode:
|
|
59
|
-
focusMode:
|
|
60
|
-
fullWidth:
|
|
61
|
-
className:
|
|
62
|
-
type:
|
|
63
|
-
raw:
|
|
64
|
-
noBorder:
|
|
65
|
-
"aria-label":
|
|
66
|
-
label:
|
|
67
|
-
size:
|
|
68
|
-
labelRight:
|
|
69
|
-
labelLeft:
|
|
70
|
-
noBackground:
|
|
71
|
-
align:
|
|
72
|
-
radius:
|
|
73
|
-
variant:
|
|
74
|
-
iconClassName:
|
|
75
|
-
animated:
|
|
76
|
-
...
|
|
77
|
-
},
|
|
78
|
-
const
|
|
79
|
-
type:
|
|
80
|
-
mode:
|
|
81
|
-
focusMode:
|
|
82
|
-
fullWidth:
|
|
83
|
-
disabled:
|
|
84
|
-
raw:
|
|
85
|
-
className:
|
|
86
|
-
noBorder:
|
|
87
|
-
size:
|
|
88
|
-
labelRight:
|
|
89
|
-
labelLeft:
|
|
90
|
-
noBackground:
|
|
91
|
-
align:
|
|
92
|
-
radius:
|
|
93
|
-
variant:
|
|
94
|
-
animated:
|
|
95
|
-
}),
|
|
96
|
-
return
|
|
97
|
-
|
|
98
|
-
}, [
|
|
99
|
-
|
|
56
|
+
children: t,
|
|
57
|
+
disabled: n = !1,
|
|
58
|
+
mode: e = "system",
|
|
59
|
+
focusMode: i = "system",
|
|
60
|
+
fullWidth: C = !1,
|
|
61
|
+
className: I,
|
|
62
|
+
type: l = "button",
|
|
63
|
+
raw: R = !1,
|
|
64
|
+
noBorder: c = !1,
|
|
65
|
+
"aria-label": B,
|
|
66
|
+
label: F,
|
|
67
|
+
size: s = "medium",
|
|
68
|
+
labelRight: y,
|
|
69
|
+
labelLeft: h,
|
|
70
|
+
noBackground: S = !1,
|
|
71
|
+
align: j = "center",
|
|
72
|
+
radius: P = "large",
|
|
73
|
+
variant: T = "primary",
|
|
74
|
+
iconClassName: _,
|
|
75
|
+
animated: u = !1,
|
|
76
|
+
...k
|
|
77
|
+
}, q) => {
|
|
78
|
+
const G = Q({
|
|
79
|
+
type: X,
|
|
80
|
+
mode: e,
|
|
81
|
+
focusMode: i,
|
|
82
|
+
fullWidth: C,
|
|
83
|
+
disabled: n,
|
|
84
|
+
raw: R,
|
|
85
|
+
className: I,
|
|
86
|
+
noBorder: c,
|
|
87
|
+
size: s,
|
|
88
|
+
labelRight: y,
|
|
89
|
+
labelLeft: h,
|
|
90
|
+
noBackground: S,
|
|
91
|
+
align: j,
|
|
92
|
+
radius: P,
|
|
93
|
+
variant: T,
|
|
94
|
+
animated: u
|
|
95
|
+
}), H = U({ mode: e, raw: R, iconClassName: _ }), g = V({ animated: u }), [o, f] = b(), [a, p] = b(), [x, N] = b(), m = d(0), r = d(null), M = z([q, r]);
|
|
96
|
+
return $(() => {
|
|
97
|
+
u || (m.current = N.width + E[s] + (c ? 0 : A), r && r.current && (f.width > 0 ? r.current.style.width = `${f.width + m.current}px` : p.width > 0 ? r.current.style.width = `${p.width + m.current}px` : r.current.style.width = `${v[s]}px`));
|
|
98
|
+
}, [u, N, s, c, f, p]), $(() => {
|
|
99
|
+
x && x.current && u && (m.current = N.width + E[s] + (c ? 0 : A));
|
|
100
|
+
}, [N, x, s, c, u]), $(() => {
|
|
101
|
+
r && r.current && u && (y && o && f.width > 0 ? (o.current && (o.current.style.opacity = "100"), r.current.style.width = `${f.width + m.current}px`) : h && p.width > 0 ? (a.current && (a.current.style.opacity = "100"), r.current.style.width = `${p.width + m.current}px`) : (o.current && (o.current.style.opacity = "0"), a.current && (a.current.style.opacity = "0"), r.current.style.width = `${v[s]}px`));
|
|
100
102
|
}, [
|
|
101
|
-
w,
|
|
102
|
-
i,
|
|
103
|
-
c,
|
|
104
|
-
N,
|
|
105
103
|
f,
|
|
104
|
+
y,
|
|
106
105
|
o,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
p,
|
|
107
|
+
h,
|
|
108
|
+
a,
|
|
109
|
+
s,
|
|
110
|
+
u
|
|
111
|
+
]), /* @__PURE__ */ W(
|
|
112
|
+
L,
|
|
110
113
|
{
|
|
111
|
-
ref:
|
|
112
|
-
className:
|
|
113
|
-
disabled:
|
|
114
|
-
type:
|
|
115
|
-
"aria-label":
|
|
116
|
-
...
|
|
114
|
+
ref: M,
|
|
115
|
+
className: G,
|
|
116
|
+
disabled: n,
|
|
117
|
+
type: l,
|
|
118
|
+
"aria-label": B || F,
|
|
119
|
+
...k,
|
|
117
120
|
children: [
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ w("span", { ref: a, className: g, children: h && /* @__PURE__ */ w("span", { className: "pr-2", children: h }) }),
|
|
122
|
+
/* @__PURE__ */ w("span", { ref: x, className: H, children: t }),
|
|
123
|
+
/* @__PURE__ */ w("span", { ref: o, className: g, children: y && /* @__PURE__ */ w("span", { className: "pl-2", children: y }) })
|
|
121
124
|
]
|
|
122
125
|
}
|
|
123
126
|
);
|
|
124
127
|
}
|
|
125
128
|
);
|
|
126
|
-
|
|
129
|
+
et.displayName = "ButtonIcon";
|
|
127
130
|
export {
|
|
128
|
-
|
|
131
|
+
et as ButtonIcon
|
|
129
132
|
};
|
package/dist/index.js
CHANGED
|
@@ -7,13 +7,13 @@ import { jsx as e } from "react/jsx-runtime";
|
|
|
7
7
|
import a from "clsx";
|
|
8
8
|
import m from "react";
|
|
9
9
|
/*!
|
|
10
|
-
@versini/ui-button v4.2.
|
|
10
|
+
@versini/ui-button v4.2.1
|
|
11
11
|
© 2025 gizmette.com
|
|
12
12
|
*/
|
|
13
13
|
try {
|
|
14
14
|
window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
|
|
15
|
-
version: "4.2.
|
|
16
|
-
buildTime: "01/
|
|
15
|
+
version: "4.2.1",
|
|
16
|
+
buildTime: "01/26/2025 05:19 PM EST",
|
|
17
17
|
homepage: "https://github.com/aversini/ui-components",
|
|
18
18
|
license: "MIT"
|
|
19
19
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/ui-button",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"sideEffects": [
|
|
53
53
|
"**/*.css"
|
|
54
54
|
],
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "2afa12a4fcc5da2231f908342e8e18524126274b"
|
|
56
56
|
}
|