@brightlocal/ui-components 2.23.0 → 2.24.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.
Files changed (90) hide show
  1. package/AI_USAGE.md +1 -1
  2. package/README.md +3 -2
  3. package/component-meta.json +116 -25
  4. package/deprecations.json +22 -0
  5. package/dist/alert.cjs +1 -1
  6. package/dist/alert.d.ts.map +1 -1
  7. package/dist/alert.js +6 -9
  8. package/dist/blocks/sidebar.cjs +1 -1
  9. package/dist/blocks/sidebar.d.ts.map +1 -1
  10. package/dist/blocks/sidebar.js +151 -156
  11. package/dist/brand-illustration-motif.cjs +1 -0
  12. package/dist/brand-illustration-motif.d.ts +55 -0
  13. package/dist/brand-illustration-motif.d.ts.map +1 -0
  14. package/dist/brand-illustration-motif.js +67 -0
  15. package/dist/chart.cjs +7 -7
  16. package/dist/chart.d.ts +287 -2
  17. package/dist/chart.d.ts.map +1 -1
  18. package/dist/chart.js +408 -152
  19. package/dist/combobox.cjs +3 -3
  20. package/dist/combobox.d.ts +14 -1
  21. package/dist/combobox.d.ts.map +1 -1
  22. package/dist/combobox.js +387 -376
  23. package/dist/data-table.cjs +1 -0
  24. package/dist/{blocks/data-table.d.ts → data-table.d.ts} +159 -4
  25. package/dist/data-table.d.ts.map +1 -0
  26. package/dist/data-table.js +721 -0
  27. package/dist/field.cjs +1 -1
  28. package/dist/field.d.ts +16 -1
  29. package/dist/field.d.ts.map +1 -1
  30. package/dist/field.js +23 -7
  31. package/dist/global-layout.cjs +1 -1
  32. package/dist/global-layout.d.ts +32 -2
  33. package/dist/global-layout.d.ts.map +1 -1
  34. package/dist/global-layout.js +179 -109
  35. package/dist/index.cjs +1 -1
  36. package/dist/index.d.ts +2 -1
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +526 -511
  39. package/dist/label.cjs +1 -1
  40. package/dist/label.d.ts +9 -0
  41. package/dist/label.d.ts.map +1 -1
  42. package/dist/label.js +26 -22
  43. package/dist/lib/spring-settle.cjs +1 -0
  44. package/dist/lib/spring-settle.d.ts +20 -0
  45. package/dist/lib/spring-settle.d.ts.map +1 -0
  46. package/dist/lib/spring-settle.js +4 -0
  47. package/dist/link.cjs +1 -1
  48. package/dist/link.d.ts +3 -2
  49. package/dist/link.d.ts.map +1 -1
  50. package/dist/link.js +22 -11
  51. package/dist/loading.cjs +1 -1
  52. package/dist/loading.d.ts +2 -1
  53. package/dist/loading.d.ts.map +1 -1
  54. package/dist/loading.js +106 -85
  55. package/dist/select.cjs +2 -2
  56. package/dist/select.d.ts +16 -1
  57. package/dist/select.d.ts.map +1 -1
  58. package/dist/select.js +112 -79
  59. package/dist/table.cjs +1 -1
  60. package/dist/table.d.ts +29 -0
  61. package/dist/table.d.ts.map +1 -1
  62. package/dist/table.js +2 -2
  63. package/dist/text-reveal-motion.cjs +1 -1
  64. package/dist/text-reveal-motion.d.ts.map +1 -1
  65. package/dist/text-reveal-motion.js +236 -219
  66. package/dist/typography.cjs +1 -1
  67. package/dist/typography.d.ts +20 -4
  68. package/dist/typography.d.ts.map +1 -1
  69. package/dist/typography.js +263 -228
  70. package/package.json +2 -14
  71. package/src/blocks/sidebar.tsx +11 -23
  72. package/src/components/alert.tsx +1 -4
  73. package/src/components/brand-illustration-motif.tsx +143 -0
  74. package/src/components/chart.tsx +632 -1
  75. package/src/components/combobox.tsx +47 -0
  76. package/src/{blocks → components}/data-table.tsx +270 -16
  77. package/src/components/field.tsx +31 -0
  78. package/src/components/global-layout.tsx +144 -5
  79. package/src/components/label.tsx +13 -1
  80. package/src/components/link.tsx +13 -1
  81. package/src/components/loading.tsx +71 -38
  82. package/src/components/select.tsx +82 -2
  83. package/src/components/table.tsx +31 -2
  84. package/src/components/text-reveal-motion.tsx +90 -64
  85. package/src/components/typography.tsx +74 -18
  86. package/src/index.ts +2 -1
  87. package/src/lib/spring-settle.ts +19 -0
  88. package/dist/blocks/data-table.cjs +0 -1
  89. package/dist/blocks/data-table.d.ts.map +0 -1
  90. package/dist/blocks/data-table.js +0 -654
@@ -1,315 +1,321 @@
1
- import { jsx as y, jsxs as O } from "react/jsx-runtime";
2
- import * as yt from "react";
3
- import { useId as Et, useMemo as Ct, useRef as S, useState as Ft, useCallback as Xt, useEffect as lt } from "react";
4
- import { animate as j } from "framer-motion";
5
- import { cn as $t } from "@brightlocal/ui-components/lib/utils";
6
- import { usePrefersReducedMotion as Dt } from "./hooks/use-prefers-reduced-motion.js";
7
- const wt = "M250 500C388.071 500 500 388.071 500 250C500 111.929 388.071 0 250 0C111.929 0 0 111.929 0 250C0 388.071 111.929 500 250 500Z", bt = "M492.425 259.355C332.265 293.145 293.145 332.265 259.355 492.425C257.225 502.525 242.775 502.525 240.645 492.425C206.855 332.265 167.735 293.145 7.575 259.355C-2.525 257.225 -2.525 242.775 7.575 240.645C167.735 206.855 206.855 167.735 240.645 7.575C242.775 -2.525 257.225 -2.525 259.355 7.575C293.145 167.735 332.265 206.855 492.425 240.645C502.525 242.775 502.525 257.225 492.425 259.355Z", Rt = "M258.366 5.58795L296.379 97.3854C298.509 102.526 304.729 104.546 309.47 101.636L394.177 49.7215C401.057 45.5112 409.598 51.7117 407.708 59.5523L384.506 156.16C383.206 161.571 387.046 166.861 392.596 167.301L491.645 175.092C499.685 175.722 502.945 185.763 496.815 191.003L421.259 255.528C417.029 259.138 417.029 265.679 421.259 269.299L496.815 333.824C502.945 339.065 499.685 349.106 491.645 349.736L392.596 357.526C387.046 357.966 383.206 363.257 384.506 368.667L407.708 465.275C409.588 473.116 401.047 479.326 394.177 475.106L309.47 423.192C304.729 420.282 298.509 422.302 296.379 427.442L258.366 519.24C255.275 526.69 244.725 526.69 241.634 519.24L203.621 427.442C201.491 422.302 195.271 420.282 190.53 423.192L105.823 475.106C98.9428 479.316 90.4021 473.116 92.2922 465.275L115.494 368.667C116.794 363.257 112.954 357.966 107.403 357.526L8.35543 349.736C0.314784 349.106 -2.94548 339.065 3.18502 333.824L78.7411 269.299C82.9715 265.689 82.9715 259.148 78.7411 255.528L3.18502 191.003C-2.94548 185.763 0.314784 175.722 8.35543 175.092L107.403 167.301C112.954 166.861 116.794 161.571 115.494 156.16L92.2922 59.5523C90.4121 51.7117 98.9528 45.5012 105.823 49.7215L190.53 101.636C195.271 104.546 201.491 102.526 203.621 97.3854L241.634 5.58795C244.725 -1.86265 255.275 -1.86265 258.366 5.58795Z", z = (f) => f < 0 ? 0 : f > 1 ? 1 : f, Ht = [
8
- wt,
9
- bt,
10
- Rt,
11
- wt,
12
- Rt,
13
- bt
14
- ], Tt = 30, _t = 15, qt = typeof navigator < "u" && typeof navigator.hardwareConcurrency == "number" && navigator.hardwareConcurrency <= 4;
15
- function zt(f, H, C) {
16
- let w = !1, b = null;
17
- const i = { ballX: 0, clipRight: 100, rotate: 0, pathD: "" };
18
- function Z() {
19
- w = !1, f.style.transform = `translateX(${i.ballX}px)`, b && (b.style.clipPath = `inset(0 ${i.clipRight}% 0 0)`), H.style.transform = `rotate(${i.rotate}deg)`, C.setAttribute("d", i.pathD);
1
+ import { jsx as C, jsxs as W } from "react/jsx-runtime";
2
+ import * as wt from "react";
3
+ import { useId as Tt, useMemo as bt, useRef as M, useState as Xt, useCallback as Ft, useEffect as it } from "react";
4
+ import { animate as Z } from "framer-motion";
5
+ import { cn as Dt } from "@brightlocal/ui-components/lib/utils";
6
+ import { usePrefersReducedMotion as qt } from "./hooks/use-prefers-reduced-motion.js";
7
+ import { SETTLE_REST_DELTA as Rt } from "./lib/spring-settle.js";
8
+ const xt = "M250 500C388.071 500 500 388.071 500 250C500 111.929 388.071 0 250 0C111.929 0 0 111.929 0 250C0 388.071 111.929 500 250 500Z", At = "M492.425 259.355C332.265 293.145 293.145 332.265 259.355 492.425C257.225 502.525 242.775 502.525 240.645 492.425C206.855 332.265 167.735 293.145 7.575 259.355C-2.525 257.225 -2.525 242.775 7.575 240.645C167.735 206.855 206.855 167.735 240.645 7.575C242.775 -2.525 257.225 -2.525 259.355 7.575C293.145 167.735 332.265 206.855 492.425 240.645C502.525 242.775 502.525 257.225 492.425 259.355Z", Lt = "M258.366 5.58795L296.379 97.3854C298.509 102.526 304.729 104.546 309.47 101.636L394.177 49.7215C401.057 45.5112 409.598 51.7117 407.708 59.5523L384.506 156.16C383.206 161.571 387.046 166.861 392.596 167.301L491.645 175.092C499.685 175.722 502.945 185.763 496.815 191.003L421.259 255.528C417.029 259.138 417.029 265.679 421.259 269.299L496.815 333.824C502.945 339.065 499.685 349.106 491.645 349.736L392.596 357.526C387.046 357.966 383.206 363.257 384.506 368.667L407.708 465.275C409.588 473.116 401.047 479.326 394.177 475.106L309.47 423.192C304.729 420.282 298.509 422.302 296.379 427.442L258.366 519.24C255.275 526.69 244.725 526.69 241.634 519.24L203.621 427.442C201.491 422.302 195.271 420.282 190.53 423.192L105.823 475.106C98.9428 479.316 90.4021 473.116 92.2922 465.275L115.494 368.667C116.794 363.257 112.954 357.966 107.403 357.526L8.35543 349.736C0.314784 349.106 -2.94548 339.065 3.18502 333.824L78.7411 269.299C82.9715 265.689 82.9715 259.148 78.7411 255.528L3.18502 191.003C-2.94548 185.763 0.314784 175.722 8.35543 175.092L107.403 167.301C112.954 166.861 116.794 161.571 115.494 156.16L92.2922 59.5523C90.4121 51.7117 98.9528 45.5012 105.823 49.7215L190.53 101.636C195.271 104.546 201.491 102.526 203.621 97.3854L241.634 5.58795C244.725 -1.86265 255.275 -1.86265 258.366 5.58795Z", N = (u) => u < 0 ? 0 : u > 1 ? 1 : u, zt = [
9
+ xt,
10
+ At,
11
+ Lt,
12
+ xt,
13
+ Lt,
14
+ At
15
+ ];
16
+ function Nt(u, T, w, S) {
17
+ let b = !1, X = null;
18
+ const c = { ballX: 0, clipRight: 100, rotate: 0, pathD: "" };
19
+ function j() {
20
+ b = !1, u.style.transform = `translateX(${c.ballX}px)`, X && (X.style.clipPath = `inset(0 ${c.clipRight}% 0 0)`), T.style.transform = `rotate(${c.rotate}deg)`, S?.setAttribute(
21
+ "gradientTransform",
22
+ `rotate(${-c.rotate} 0.5 0.5)`
23
+ ), w.setAttribute("d", c.pathD);
20
24
  }
21
- function N(T, G, J, K) {
22
- i.ballX = T, i.clipRight = G, i.rotate = J, i.pathD = K, w || (w = !0, requestAnimationFrame(Z));
25
+ function U(F, G, O, s) {
26
+ c.ballX = F, c.clipRight = G, c.rotate = O, c.pathD = s, b || (b = !0, requestAnimationFrame(j));
23
27
  }
24
- return N.setItem = (T) => {
25
- b = T;
26
- }, N;
28
+ return U.setItem = (F) => {
29
+ X = F;
30
+ }, U;
27
31
  }
28
- function xt(f, H) {
29
- return new Promise((C) => {
30
- const w = performance.now();
32
+ function Mt(u, T) {
33
+ return new Promise((w) => {
34
+ const S = performance.now();
31
35
  function b() {
32
- H.cancelled || performance.now() - w >= f ? C() : requestAnimationFrame(b);
36
+ T.cancelled || performance.now() - S >= u ? w() : requestAnimationFrame(b);
33
37
  }
34
38
  requestAnimationFrame(b);
35
39
  });
36
40
  }
37
- const Nt = yt.forwardRef(
41
+ const Ut = wt.forwardRef(
38
42
  ({
39
- className: f,
40
- dataHook: H,
41
- holdTime: C = 1300,
42
- shimmer: w = !0,
43
+ className: u,
44
+ dataHook: T,
45
+ holdTime: w = 1300,
46
+ shimmer: S = !0,
43
47
  gradientFrom: b = "var(--loading-gradient-from)",
44
- gradientTo: i = "var(--loading-gradient-to)",
45
- loadingLabel: Z,
46
- trackingEl: N,
47
- trackingLabel: T,
48
- children: G,
49
- ...J
50
- }, K) => {
51
- const o = Ht, Q = 0.8, V = 180, Y = 24, tt = 1, U = Dt(), it = Et(), ct = Ct(
52
- () => `text-reveal-gradient-${it.replace(/:/g, "")}`,
53
- [it]
54
- ), et = S(null), nt = S(null), rt = S(null), at = S(null), ft = S(null), ot = S(null), st = S(null), P = S([]), F = yt.Children.toArray(G), [Mt, Lt] = Ft({ widths: [], ballSize: 0 }), { widths: d, ballSize: a } = Mt, vt = Xt(
55
- (n) => (t) => {
56
- P.current[n] = t;
48
+ gradientTo: X = "var(--loading-gradient-to)",
49
+ loadingLabel: c,
50
+ trackingEl: j,
51
+ trackingLabel: U,
52
+ children: F,
53
+ ...G
54
+ }, O) => {
55
+ const s = zt, J = 0.8, K = 180, Q = 24, V = 1, _ = qt(), ct = Tt(), ft = bt(
56
+ () => `text-reveal-gradient-${ct.replace(/:/g, "")}`,
57
+ [ct]
58
+ ), Y = M(null), tt = M(null), et = M(null), nt = M(null), rt = M(null), at = M(null), ot = M(null), v = M([]), k = wt.Children.toArray(F), [vt, St] = Xt({ widths: [], ballSize: 0 }), { widths: p, ballSize: a } = vt, kt = Ft(
59
+ (n) => (e) => {
60
+ v.current[n] = e;
57
61
  },
58
62
  []
59
63
  );
60
- lt(() => {
61
- if (P.current.length === 0 || !P.current[0]) return;
64
+ it(() => {
65
+ if (v.current.length === 0 || !v.current[0]) return;
62
66
  let n = !1;
63
- function t() {
67
+ function e() {
64
68
  if (n) return;
65
- const u = [];
69
+ const m = [];
66
70
  let R = 32;
67
- for (let p = 0; p < F.length; p++) {
68
- const x = P.current[p];
69
- if (x && (u[p] = x.scrollWidth, p === 0)) {
70
- const X = x.firstElementChild ?? x, e = parseFloat(getComputedStyle(X).fontSize) || 16;
71
- R = Math.round(e * 1.5);
71
+ for (let h = 0; h < k.length; h++) {
72
+ const x = v.current[h];
73
+ if (x && (m[h] = x.scrollWidth, h === 0)) {
74
+ const E = x.firstElementChild ?? x, t = parseFloat(getComputedStyle(E).fontSize) || 16;
75
+ R = Math.round(t * 1.5);
72
76
  }
73
77
  }
74
- Lt({ widths: u, ballSize: R });
78
+ St({ widths: m, ballSize: R });
75
79
  }
76
80
  return document.fonts.ready.then(() => {
77
- n || requestAnimationFrame(t);
81
+ n || requestAnimationFrame(e);
78
82
  }), () => {
79
83
  n = !0;
80
84
  };
81
- }, [F.length]), lt(() => {
82
- if (U) return;
83
- const n = ft.current;
85
+ }, [k.length]), it(() => {
86
+ if (_) return;
87
+ const n = rt.current;
84
88
  if (!n) return;
85
- const t = n;
86
- let u, R = null;
87
- const p = 0.12 + Math.random() * 0.06, x = 0.08 + Math.random() * 0.04, X = Math.random() * Math.PI * 2, e = Math.random() * Math.PI * 2;
88
- let _ = -1 / 0;
89
- function W(c) {
90
- R || (R = c);
91
- const s = (c - R) / 1e3, l = Math.sin(s * p + X) * Math.PI + Math.sin(s * x + e) * 0.5;
92
- if (Math.abs(l - _) > 0.01) {
93
- _ = l;
94
- const k = Math.cos(l), q = Math.sin(l);
95
- t.setAttribute("x1", `${50 + 45 * k}%`), t.setAttribute("y1", `${50 + 45 * q}%`), t.setAttribute("x2", `${50 - 45 * k}%`), t.setAttribute("y2", `${50 - 45 * q}%`);
89
+ const e = n;
90
+ let m, R = null;
91
+ const h = 0.12 + Math.random() * 0.06, x = 0.08 + Math.random() * 0.04, E = Math.random() * Math.PI * 2, t = Math.random() * Math.PI * 2;
92
+ let D = -1 / 0;
93
+ function B(f) {
94
+ R || (R = f);
95
+ const l = (f - R) / 1e3, o = -Math.PI / 4 + Math.sin(l * h + E) * 0.5 + Math.sin(l * x + t) * 0.25;
96
+ if (Math.abs(o - D) > 0.01) {
97
+ D = o;
98
+ const q = Math.cos(o), i = Math.sin(o);
99
+ e.setAttribute("x1", `${50 + 45 * q}%`), e.setAttribute("y1", `${50 + 45 * i}%`), e.setAttribute("x2", `${50 - 45 * q}%`), e.setAttribute("y2", `${50 - 45 * i}%`);
96
100
  }
97
- u = requestAnimationFrame(W);
101
+ m = requestAnimationFrame(B);
98
102
  }
99
- return u = requestAnimationFrame(W), () => cancelAnimationFrame(u);
100
- }, [U]);
101
- function At(n) {
102
- n.style.opacity = "1", j(0, 1, {
103
+ return m = requestAnimationFrame(B), () => cancelAnimationFrame(m);
104
+ }, [_]);
105
+ function Et(n) {
106
+ n.style.opacity = "1", Z(0, 1, {
103
107
  duration: 1.2,
104
108
  ease: [0.25, 1, 0.5, 1],
105
- onUpdate: (t) => {
106
- n.style.transform = `translateX(${-100 + t * 200}%)`;
109
+ onUpdate: (e) => {
110
+ n.style.transform = `translateX(${-100 + e * 200}%)`;
107
111
  },
108
112
  onComplete: () => {
109
113
  n.style.opacity = "0";
110
114
  }
111
115
  });
112
116
  }
113
- lt(() => {
114
- if (!rt.current || !at.current || !et.current || !nt.current || !ot.current || !st.current || d.length === 0 || a === 0)
117
+ it(() => {
118
+ if (!et.current || !nt.current || !Y.current || !tt.current || !at.current || !ot.current || p.length === 0 || a === 0)
115
119
  return;
116
- const n = rt.current, t = at.current, u = et.current, R = nt.current, p = ot.current, x = st.current;
117
- function X(c) {
118
- const s = `${c}px`;
119
- p.style.width = s, x.style.width = s;
120
+ const n = et.current, e = nt.current, m = Y.current, R = tt.current, h = at.current, x = ot.current;
121
+ function E(f) {
122
+ const l = `${f}px`;
123
+ h.style.width = l, x.style.width = l;
120
124
  }
121
- if (U) {
122
- n.setAttribute("d", o[0]), t.style.opacity = "1";
123
- const c = P.current[0];
124
- c && (c.style.opacity = "1", c.style.clipPath = "none"), X(d[0] ?? 0);
125
- const s = a * 0.25, l = (d[0] ?? 0) + s + a / 2;
126
- u.style.transform = `translateX(${l}px)`;
125
+ if (_) {
126
+ n.setAttribute("d", s[0]), e.style.opacity = "1";
127
+ const f = v.current[0];
128
+ f && (f.style.opacity = "1", f.style.clipPath = "none"), E(p[0] ?? 0);
129
+ const l = a * 0.25, o = (p[0] ?? 0) + l + a / 2;
130
+ m.style.transform = `translateX(${o}px)`;
127
131
  return;
128
132
  }
129
- const e = { cancelled: !1 }, _ = a * 0.25;
130
- async function W() {
131
- const { interpolate: c } = await import("flubber");
132
- if (e.cancelled) return;
133
- const s = qt ? _t : Tt, l = [];
134
- for (let M = 0; M < o.length; M++) {
135
- const L = c(
136
- o[M],
137
- o[(M + 1) % o.length]
138
- ), v = [];
139
- for (let A = 0; A <= s; A++)
140
- v.push(L(A / s));
141
- l.push(v);
142
- }
143
- const k = zt(u, t, n);
144
- t.style.opacity = "1";
145
- let q = 0, m = 0, I = 0;
146
- for (; !e.cancelled; ) {
147
- const M = q % F.length, L = d[M] ?? 0;
148
- X(L);
149
- const v = -(_ + a / 2), A = L + _ + a / 2, ut = A - v, pt = P.current[M];
133
+ const t = { cancelled: !1 }, D = a * 0.25;
134
+ async function B() {
135
+ const { interpolate: f } = await import("flubber");
136
+ if (t.cancelled) return;
137
+ const l = [];
138
+ for (let A = 0; A < s.length; A++)
139
+ l.push(
140
+ f(s[A], s[(A + 1) % s.length])
141
+ );
142
+ const o = Nt(
143
+ m,
144
+ e,
145
+ n,
146
+ rt.current
147
+ );
148
+ e.style.opacity = "1";
149
+ let q = 0, i = 0, g = 0;
150
+ for (; !t.cancelled; ) {
151
+ const A = q % k.length, P = p[A] ?? 0;
152
+ E(P);
153
+ const I = -(D + a / 2), z = P + D + a / 2, ut = z - I, pt = v.current[A];
150
154
  if (!pt) break;
151
- k.setItem(pt);
152
- for (let r = 0; r < F.length; r++) {
153
- const h = P.current[r];
154
- h && (h.style.opacity = r === M ? "1" : "0", h.style.clipPath = "inset(0 100% 0 0)");
155
+ o.setItem(pt);
156
+ for (let r = 0; r < k.length; r++) {
157
+ const d = v.current[r];
158
+ d && (d.style.opacity = r === A ? "1" : "0", d.style.clipPath = "inset(0 100% 0 0)");
155
159
  }
156
- const Pt = l[m % o.length], B = 360, mt = I;
160
+ const mt = l[i], H = 360, ht = g;
157
161
  if (await new Promise((r) => {
158
- if (e.cancelled) {
162
+ if (t.cancelled) {
159
163
  r();
160
164
  return;
161
165
  }
162
- const h = j(v, A, {
166
+ const d = Z(I, z, {
163
167
  type: "spring",
164
- stiffness: V * Q,
165
- damping: Y,
166
- mass: tt,
167
- onUpdate: (g) => {
168
- if (e.cancelled) {
169
- h.stop(), r();
168
+ stiffness: K * J,
169
+ damping: Q,
170
+ mass: V,
171
+ onUpdate: (y) => {
172
+ if (t.cancelled) {
173
+ d.stop(), r();
170
174
  return;
171
175
  }
172
- const E = z((g - v) / ut), $ = L > 0 ? 100 - z(g / L) * 100 : 100, D = Math.round(E * s);
173
- k(
174
- g,
175
- $,
176
- mt + E * B,
177
- Pt[D]
178
- );
176
+ const L = N((y - I) / ut), $ = P > 0 ? 100 - N(y / P) * 100 : 100;
177
+ o(y, $, ht + L * H, mt(L));
179
178
  },
180
179
  onComplete: () => {
181
- I = mt + B, m = (m + 1) % o.length, r();
180
+ g = ht + H, i = (i + 1) % s.length, t.cancelled || o(z, 0, g, mt(1)), r();
182
181
  }
183
182
  });
184
- }), e.cancelled) break;
185
- if (w && At(R), C > 0) {
186
- const r = performance.now(), h = A;
187
- for (; !e.cancelled && performance.now() - r < C && (await xt(300, e), !(e.cancelled || performance.now() - r >= C)); ) {
188
- const g = (m + 1) % o.length, E = l[m % o.length], $ = I, D = I + 360;
189
- await j(0, 1, {
190
- type: "spring",
191
- stiffness: 30,
192
- damping: 9,
193
- mass: 0.5,
194
- onUpdate: (gt) => {
195
- const It = Math.round(z(gt) * s);
196
- k(
197
- h,
198
- 0,
199
- $ + gt * (D - $),
200
- E[It]
201
- );
183
+ }), t.cancelled) break;
184
+ if (S && Et(R), w > 0) {
185
+ const r = performance.now(), d = z;
186
+ for (; !t.cancelled && performance.now() - r < w && (await Mt(300, t), !(t.cancelled || performance.now() - r >= w)); ) {
187
+ const y = (i + 1) % s.length, L = l[i], $ = g, st = g + 360;
188
+ await new Promise((lt) => {
189
+ if (t.cancelled) {
190
+ lt();
191
+ return;
202
192
  }
203
- }), I = D, m = g;
193
+ const It = Z(0, 1 + Rt, {
194
+ type: "spring",
195
+ stiffness: 30,
196
+ damping: 9,
197
+ mass: 0.5,
198
+ restDelta: Rt,
199
+ onUpdate: ($t) => {
200
+ if (t.cancelled) {
201
+ It.stop(), lt();
202
+ return;
203
+ }
204
+ const Ct = N($t);
205
+ o(
206
+ d,
207
+ 0,
208
+ $ + Ct * (st - $),
209
+ L(Ct)
210
+ );
211
+ },
212
+ onComplete: lt
213
+ });
214
+ }), t.cancelled || o(d, 0, st, L(1)), g = st, i = y;
204
215
  }
205
216
  }
206
- if (e.cancelled) break;
207
- const kt = l[m % o.length], ht = I;
217
+ if (t.cancelled) break;
218
+ const gt = l[i], yt = g;
208
219
  if (await new Promise((r) => {
209
- if (e.cancelled) {
220
+ if (t.cancelled) {
210
221
  r();
211
222
  return;
212
223
  }
213
- const h = j(A, v, {
224
+ const d = Z(z, I, {
214
225
  type: "spring",
215
- stiffness: V * Q,
216
- damping: Y,
217
- mass: tt,
218
- onUpdate: (g) => {
219
- if (e.cancelled) {
220
- h.stop(), r();
226
+ stiffness: K * J,
227
+ damping: Q,
228
+ mass: V,
229
+ onUpdate: (y) => {
230
+ if (t.cancelled) {
231
+ d.stop(), r();
221
232
  return;
222
233
  }
223
- const E = z(1 - (g - v) / ut), $ = L > 0 ? 100 - z(g / L) * 100 : 100, D = Math.round(E * s);
224
- k(
225
- g,
226
- $,
227
- ht - E * B,
228
- kt[D]
229
- );
234
+ const L = N(1 - (y - I) / ut), $ = P > 0 ? 100 - N(y / P) * 100 : 100;
235
+ o(y, $, yt - L * H, gt(L));
230
236
  },
231
237
  onComplete: () => {
232
- I = ht - B, m = (m + 1) % o.length, r();
238
+ g = yt - H, i = (i + 1) % s.length, t.cancelled || o(I, 100, g, gt(1)), r();
233
239
  }
234
240
  });
235
- }), e.cancelled) break;
236
- await xt(300, e), q++;
241
+ }), t.cancelled) break;
242
+ await Mt(300, t), q++;
237
243
  }
238
244
  }
239
- return W(), () => {
240
- e.cancelled = !0;
245
+ return B(), () => {
246
+ t.cancelled = !0;
241
247
  };
242
248
  }, [
243
- d,
249
+ p,
244
250
  a,
245
- F.length,
246
- U,
247
- Q,
248
- C,
251
+ k.length,
252
+ _,
253
+ J,
249
254
  w,
255
+ S,
256
+ K,
257
+ Q,
250
258
  V,
251
- Y,
252
- tt,
253
- o
259
+ s
254
260
  ]);
255
- const dt = Ct(
256
- () => d.length > 0 ? Math.max(...d) : 0,
257
- [d]
258
- ), St = d.length > 0 && a > 0;
259
- return /* @__PURE__ */ y(
261
+ const dt = bt(
262
+ () => p.length > 0 ? Math.max(...p) : 0,
263
+ [p]
264
+ ), Pt = p.length > 0 && a > 0;
265
+ return /* @__PURE__ */ C(
260
266
  "div",
261
267
  {
262
- ref: K,
263
- className: $t("relative inline-flex items-center", f),
264
- "data-hook": H,
268
+ ref: O,
269
+ className: Dt("relative inline-flex items-center", u),
270
+ "data-hook": T,
265
271
  "data-slot": "text-reveal",
266
- "data-tracking-el": N,
267
- "data-tracking-label": T,
272
+ "data-tracking-el": j,
273
+ "data-tracking-label": U,
268
274
  style: {
269
- opacity: St ? 1 : 0,
275
+ opacity: Pt ? 1 : 0,
270
276
  transition: "opacity 0.4s ease-out"
271
277
  },
272
- ...J,
273
- children: /* @__PURE__ */ O(
278
+ ...G,
279
+ children: /* @__PURE__ */ W(
274
280
  "div",
275
281
  {
276
- ref: ot,
282
+ ref: at,
277
283
  className: "relative flex items-center",
278
284
  style: {
279
285
  width: dt || void 0,
280
286
  transition: "width 0.3s ease-out"
281
287
  },
282
288
  children: [
283
- /* @__PURE__ */ O(
289
+ /* @__PURE__ */ W(
284
290
  "span",
285
291
  {
286
- ref: st,
292
+ ref: ot,
287
293
  className: "relative inline-block overflow-hidden",
288
294
  style: {
289
295
  width: dt || void 0,
290
296
  transition: "width 0.3s ease-out"
291
297
  },
292
298
  children: [
293
- F.map((n, t) => /* @__PURE__ */ y(
299
+ k.map((n, e) => /* @__PURE__ */ C(
294
300
  "span",
295
301
  {
296
- ref: vt(t),
302
+ ref: kt(e),
297
303
  style: {
298
304
  display: "block",
299
305
  whiteSpace: "nowrap",
300
306
  opacity: 0,
301
307
  clipPath: "inset(0 100% 0 0)",
302
308
  willChange: "clip-path",
303
- ...t > 0 ? { position: "absolute", top: 0, left: 0 } : {}
309
+ ...e > 0 ? { position: "absolute", top: 0, left: 0 } : {}
304
310
  },
305
311
  children: n
306
312
  },
307
- t
313
+ e
308
314
  )),
309
- /* @__PURE__ */ y(
315
+ /* @__PURE__ */ C(
310
316
  "div",
311
317
  {
312
- ref: nt,
318
+ ref: tt,
313
319
  className: "pointer-events-none absolute inset-0",
314
320
  style: {
315
321
  opacity: 0,
@@ -322,10 +328,10 @@ const Nt = yt.forwardRef(
322
328
  ]
323
329
  }
324
330
  ),
325
- /* @__PURE__ */ y(
331
+ /* @__PURE__ */ C(
326
332
  "div",
327
333
  {
328
- ref: et,
334
+ ref: Y,
329
335
  className: "absolute",
330
336
  style: {
331
337
  left: -a / 2,
@@ -336,10 +342,10 @@ const Nt = yt.forwardRef(
336
342
  transform: "translateX(0px)",
337
343
  willChange: "transform"
338
344
  },
339
- children: /* @__PURE__ */ O(
345
+ children: /* @__PURE__ */ W(
340
346
  "svg",
341
347
  {
342
- "aria-label": Z ?? "Loading",
348
+ "aria-label": c ?? "Loading",
343
349
  "data-slot": "text-reveal-ball",
344
350
  fill: "none",
345
351
  height: a,
@@ -349,25 +355,36 @@ const Nt = yt.forwardRef(
349
355
  width: a,
350
356
  xmlns: "http://www.w3.org/2000/svg",
351
357
  children: [
352
- /* @__PURE__ */ y("defs", { children: /* @__PURE__ */ O("linearGradient", { ref: ft, id: ct, children: [
353
- /* @__PURE__ */ y("stop", { offset: "-20%", stopColor: b }),
354
- /* @__PURE__ */ y("stop", { offset: "120%", stopColor: i })
355
- ] }) }),
356
- /* @__PURE__ */ y(
358
+ /* @__PURE__ */ C("defs", { children: /* @__PURE__ */ W(
359
+ "linearGradient",
360
+ {
361
+ ref: rt,
362
+ id: ft,
363
+ x1: "81.8%",
364
+ x2: "18.2%",
365
+ y1: "18.2%",
366
+ y2: "81.8%",
367
+ children: [
368
+ /* @__PURE__ */ C("stop", { offset: "-60%", stopColor: b }),
369
+ /* @__PURE__ */ C("stop", { offset: "120%", stopColor: X })
370
+ ]
371
+ }
372
+ ) }),
373
+ /* @__PURE__ */ C(
357
374
  "g",
358
375
  {
359
- ref: at,
376
+ ref: nt,
360
377
  style: {
361
378
  opacity: 0,
362
379
  transformOrigin: "250px 250px",
363
380
  willChange: "transform"
364
381
  },
365
- children: /* @__PURE__ */ y(
382
+ children: /* @__PURE__ */ C(
366
383
  "path",
367
384
  {
368
- ref: rt,
369
- d: o[0],
370
- fill: `url(#${ct})`
385
+ ref: et,
386
+ d: s[0],
387
+ fill: `url(#${ft})`
371
388
  }
372
389
  )
373
390
  }
@@ -384,7 +401,7 @@ const Nt = yt.forwardRef(
384
401
  );
385
402
  }
386
403
  );
387
- Nt.displayName = "TextRevealMotion";
404
+ Ut.displayName = "TextRevealMotion";
388
405
  export {
389
- Nt as TextRevealMotion
406
+ Ut as TextRevealMotion
390
407
  };