@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.
@@ -1,22 +1,22 @@
1
- import { jsxs as G, jsx as m } from "react/jsx-runtime";
2
- import H, { useRef as p, useEffect as B, useCallback as M, useMemo as E, useState as W, useLayoutEffect as v } from "react";
3
- import { BaseButton_private as Y } from "../../chunks/BaseButton.BFKIL4GO.js";
4
- import { getButtonClasses as J, getIconClasses as K, getButtonIconLabelClasses as L, TYPE_ICON as Q } from "../../chunks/utilities.DZA7UB1Y.js";
5
- function U() {
6
- const e = p(!1);
7
- return B(() => (e.current = !0, () => {
8
- e.current = !1;
9
- }), []), M(() => e.current, []);
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 V(e) {
12
- return E(() => e.every((r) => r == null) ? () => {
13
- } : (r) => {
14
- e.forEach((t) => {
15
- typeof t == "function" ? t(r) : t != null && (t.current = r);
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
- }, e);
17
+ }, t);
18
18
  }
19
- const X = {
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 I(e) {
30
- const r = U(), t = p(0), s = p(null), [h, R] = W(X), n = E(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((y) => {
31
- const u = y[0];
32
- u && (cancelAnimationFrame(t.current), t.current = requestAnimationFrame(() => {
33
- s.current && r() && R(u.contentRect);
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
- }), [r]);
36
- return B(() => (s.current && (n == null || n.observe(s.current, e)), () => {
37
- n == null || n.disconnect(), t.current && cancelAnimationFrame(t.current);
38
- }), [n, e]), [s, h];
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 Z = {
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
- }, z = {
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
- }, ee = 2, te = H.forwardRef(
54
+ }, A = 2, et = Y.forwardRef(
55
55
  ({
56
- children: e,
57
- disabled: r = !1,
58
- mode: t = "system",
59
- focusMode: s = "system",
60
- fullWidth: h = !1,
61
- className: R,
62
- type: n = "button",
63
- raw: y = !1,
64
- noBorder: u = !1,
65
- "aria-label": A,
66
- label: D,
67
- size: l = "medium",
68
- labelRight: i,
69
- labelLeft: f,
70
- noBackground: O = !1,
71
- align: $ = "center",
72
- radius: F = "large",
73
- variant: S = "primary",
74
- iconClassName: j,
75
- animated: x = !1,
76
- ...P
77
- }, T) => {
78
- const _ = J({
79
- type: Q,
80
- mode: t,
81
- focusMode: s,
82
- fullWidth: h,
83
- disabled: r,
84
- raw: y,
85
- className: R,
86
- noBorder: u,
87
- size: l,
88
- labelRight: i,
89
- labelLeft: f,
90
- noBackground: O,
91
- align: $,
92
- radius: F,
93
- variant: S,
94
- animated: x
95
- }), k = K({ mode: t, raw: y, iconClassName: j }), b = L({ animated: x }), [c, w] = I(), [o, N] = I(), [d, g] = I(), C = p(0), a = p(null), q = V([T, a]);
96
- return v(() => {
97
- d && d.current && (C.current = g.width + z[l] + (u ? 0 : ee));
98
- }, [g, d, l, u]), v(() => {
99
- a && a.current && (i && c && w.width > 0 ? (c.current && (c.current.style.opacity = "100"), a.current.style.width = `${w.width + C.current}px`) : f && N.width > 0 ? (o.current && (o.current.style.opacity = "100"), a.current.style.width = `${N.width + C.current}px`) : (c.current && (c.current.style.opacity = "0"), o.current && (o.current.style.opacity = "0"), a.current.style.width = `${Z[l]}px`));
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
- l
108
- ]), /* @__PURE__ */ G(
109
- Y,
106
+ p,
107
+ h,
108
+ a,
109
+ s,
110
+ u
111
+ ]), /* @__PURE__ */ W(
112
+ L,
110
113
  {
111
- ref: q,
112
- className: _,
113
- disabled: r,
114
- type: n,
115
- "aria-label": A || D,
116
- ...P,
114
+ ref: M,
115
+ className: G,
116
+ disabled: n,
117
+ type: l,
118
+ "aria-label": B || F,
119
+ ...k,
117
120
  children: [
118
- /* @__PURE__ */ m("span", { ref: o, className: b, children: f && /* @__PURE__ */ m("span", { className: "pr-2", children: f }) }),
119
- /* @__PURE__ */ m("span", { ref: d, className: k, children: e }),
120
- /* @__PURE__ */ m("span", { ref: c, className: b, children: i && /* @__PURE__ */ m("span", { className: "pl-2", children: i }) })
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
- te.displayName = "ButtonIcon";
129
+ et.displayName = "ButtonIcon";
127
130
  export {
128
- te as ButtonIcon
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.0
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.0",
16
- buildTime: "01/25/2025 10:54 PM EST",
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.0",
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": "95add63a475dc1307dd4ada55909553876a55b73"
55
+ "gitHead": "2afa12a4fcc5da2231f908342e8e18524126274b"
56
56
  }