fiboui 2.1.0 → 2.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,5 +1,5 @@
1
1
  "use client";
2
- import { B as o, C as s, c as t, R as c, b as x, S as b, T as i, a as r } from "./index-OLW4l8s8.js";
2
+ import { B as o, C as s, c as t, R as c, b as x, S as b, T as i, a as r } from "./index-Cud42ieq.js";
3
3
  export {
4
4
  o as Button,
5
5
  s as Checkbox,
package/dist/layout.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { C as e, a as o, b as r, D as t, H as l, L as n, c, e as i, d as S, S as d, V as u, Z as C } from "./index-CWz0hYog.js";
3
- import { R as m } from "./index-C8y7FIYH.js";
2
+ import { C as e, a as o, b as r, D as t, H as l, L as n, c, e as i, d as S, S as d, V as u, Z as C } from "./index-D0tQrTAU.js";
3
+ import { R as m } from "./index-CgPc0zLh.js";
4
4
  export {
5
5
  e as Center,
6
6
  o as Column,
@@ -0,0 +1,358 @@
1
+ "use client";
2
+ var q = Object.defineProperty;
3
+ var I = (e, t, n) => t in e ? q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
4
+ var b = (e, t, n) => I(e, typeof t != "symbol" ? t + "" : t, n);
5
+ import h, { useCallback as R, useSyncExternalStore as E, memo as T, useState as w, useRef as _, useEffect as v, StrictMode as L } from "react";
6
+ import { n as k, S as F, w as z, z as $, A as j, x as H, R as x, B as D, P as N, D as W, G } from "./builder-KX69ixME.js";
7
+ import { createRoot as C } from "react-dom/client";
8
+ import { P as Y } from "./PluginManager-D5-ApsSN.js";
9
+ function J(e) {
10
+ return (t) => e.subscribe(t);
11
+ }
12
+ function fe(e) {
13
+ const t = R(J(e), [e]);
14
+ return E(t, () => e.value, () => e.value);
15
+ }
16
+ function me(e) {
17
+ const t = R(
18
+ (n) => e.subscribe(n),
19
+ [e]
20
+ );
21
+ return E(t, () => e.getState(), () => e.getState());
22
+ }
23
+ function he(e) {
24
+ const t = R(
25
+ (n) => e.subscribe(n),
26
+ [e]
27
+ );
28
+ return E(t, () => e.get(), () => e.get());
29
+ }
30
+ function pe(e, t, n) {
31
+ if (!t || n === void 0)
32
+ return e;
33
+ const r = n;
34
+ let i = { ...e };
35
+ return r < 768 && t.mobile ? i = { ...i, ...t.mobile } : r >= 768 && r < 1024 && t.tablet ? i = { ...i, ...t.tablet } : r >= 1024 && t.desktop && (i = { ...i, ...t.desktop }), i;
36
+ }
37
+ function we(e, t) {
38
+ const n = T(e, t);
39
+ return (r) => h.createElement(n, r);
40
+ }
41
+ const K = {
42
+ linear: (e) => e,
43
+ easeIn: (e) => e * e,
44
+ easeOut: (e) => e * (2 - e),
45
+ easeInOut: (e) => e < 0.5 ? 2 * e * e : -1 + (4 - 2 * e) * e,
46
+ easeInCubic: (e) => e * e * e,
47
+ easeOutCubic: (e) => --e * e * e + 1,
48
+ elastic: (e) => e === 0 || e === 1 ? e : Math.pow(2, -10 * e) * Math.sin((e - 0.075) * (2 * Math.PI) / 0.3) + 1,
49
+ bounce: (e) => e < 1 / 2.75 ? 7.5625 * e * e : e < 2 / 2.75 ? 7.5625 * (e -= 1.5 / 2.75) * e + 0.75 : e < 2.5 / 2.75 ? 7.5625 * (e -= 2.25 / 2.75) * e + 0.9375 : 7.5625 * (e -= 2.625 / 2.75) * e + 0.984375
50
+ };
51
+ function be(e, t) {
52
+ const { duration: n = 300, delay: r = 0, easing: i = K.easeOut } = t || {}, [o, c] = w(e), s = _(), l = _(o);
53
+ return l.current = o, v(() => {
54
+ s.current && cancelAnimationFrame(s.current);
55
+ let u = null;
56
+ const a = l.current, d = (m) => {
57
+ u || (u = m);
58
+ const f = m - u - r;
59
+ if (f < 0) {
60
+ s.current = requestAnimationFrame(d);
61
+ return;
62
+ }
63
+ const p = Math.min(f / n, 1), y = i(p), S = a + (e - a) * y;
64
+ c(S), p < 1 && (s.current = requestAnimationFrame(d));
65
+ };
66
+ return s.current = requestAnimationFrame(d), () => {
67
+ s.current && cancelAnimationFrame(s.current);
68
+ };
69
+ }, [e, n, r]), o;
70
+ }
71
+ function ge(e, t) {
72
+ const { stiffness: n = 170, damping: r = 26, mass: i = 1 } = t || {}, [o, c] = w(e), s = _(0), l = _();
73
+ return v(() => {
74
+ let u = o, a = s.current;
75
+ const d = () => {
76
+ const m = -n * (u - e), f = -r * a, p = (m + f) / i;
77
+ a += p * (1 / 60), u += a * (1 / 60), c(u), s.current = a, (Math.abs(a) > 0.01 || Math.abs(u - e) > 0.01) && (l.current = requestAnimationFrame(d));
78
+ };
79
+ return l.current = requestAnimationFrame(d), () => {
80
+ l.current && cancelAnimationFrame(l.current);
81
+ };
82
+ }, [e, n, r, i]), o;
83
+ }
84
+ function ve(e, t = 300) {
85
+ const [n, r] = w(e), [i, o] = w(
86
+ e ? "entered" : "exited"
87
+ );
88
+ return v(() => {
89
+ if (e) {
90
+ r(!0), o("entering");
91
+ const c = setTimeout(() => o("entered"), 50);
92
+ return () => clearTimeout(c);
93
+ } else {
94
+ o("exiting");
95
+ const c = setTimeout(() => {
96
+ o("exited"), r(!1);
97
+ }, t);
98
+ return () => clearTimeout(c);
99
+ }
100
+ }, [e, t]), { shouldRender: n, stage: i };
101
+ }
102
+ function Me(e, t = 50) {
103
+ return Array.from({ length: e }, (n, r) => r * t);
104
+ }
105
+ function Q(e) {
106
+ if (typeof window > "u" || typeof window.matchMedia != "function")
107
+ return () => {
108
+ };
109
+ const t = window.matchMedia("(prefers-reduced-motion: reduce)");
110
+ return t.addEventListener("change", e), () => t.removeEventListener("change", e);
111
+ }
112
+ function Ee() {
113
+ return E(
114
+ Q,
115
+ () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches,
116
+ () => !1
117
+ );
118
+ }
119
+ function ye() {
120
+ const [e, t] = w(0);
121
+ return v(() => {
122
+ if (typeof window > "u") return;
123
+ const n = () => {
124
+ const r = document.documentElement.scrollHeight - window.innerHeight;
125
+ t(r > 0 ? Math.min(1, Math.max(0, window.scrollY / r)) : 0);
126
+ };
127
+ return n(), window.addEventListener("scroll", n, { passive: !0 }), window.addEventListener("resize", n), () => {
128
+ window.removeEventListener("scroll", n), window.removeEventListener("resize", n);
129
+ };
130
+ }, []), e;
131
+ }
132
+ const P = {
133
+ linear: (e) => e,
134
+ easeIn: (e) => e * e,
135
+ easeOut: (e) => e * (2 - e),
136
+ easeInOut: (e) => e < 0.5 ? 2 * e * e : -1 + (4 - 2 * e) * e
137
+ };
138
+ function U(e, t, n) {
139
+ return e + (t - e) * n;
140
+ }
141
+ const g = /* @__PURE__ */ new WeakMap();
142
+ F.prototype.spring = function(e, t = {}) {
143
+ this.animate(e, { ...t, curve: "spring", damping: t.damping ?? 26, stiffness: t.stiffness ?? 170 });
144
+ };
145
+ F.prototype.animate = function(e, t = {}) {
146
+ const n = this.value, r = e, i = g.get(this);
147
+ if (i && cancelAnimationFrame(i), t.curve === "spring") {
148
+ const u = t.stiffness ?? 170, a = t.damping ?? 26, d = t.mass ?? 1;
149
+ let m = n, f = t.velocity ?? 0;
150
+ const p = 1 / 60, y = () => {
151
+ var A;
152
+ const S = -u * (m - r) - a * f;
153
+ f += S / d * p, m += f * p, this.value = m, Math.abs(m - r) > 0.01 || Math.abs(f) > 0.01 ? g.set(this, requestAnimationFrame(y)) : (this.value = r, g.delete(this), (A = t.onComplete) == null || A.call(t));
154
+ };
155
+ g.set(this, requestAnimationFrame(y));
156
+ return;
157
+ }
158
+ const o = t.duration || 300, c = P[t.curve || "easeOut"] ?? P.easeOut;
159
+ let s = null;
160
+ const l = (u) => {
161
+ var d;
162
+ s || (s = u);
163
+ const a = Math.min((u - s) / o, 1);
164
+ this.value = U(n, r, c(a)), a < 1 ? g.set(this, requestAnimationFrame(l)) : (g.delete(this), (d = t.onComplete) == null || d.call(t));
165
+ };
166
+ g.set(this, requestAnimationFrame(l));
167
+ };
168
+ F.prototype.snapTo = function(e, t = {}) {
169
+ this.animate(e, { duration: 300, curve: "easeOut", ...t });
170
+ };
171
+ function _e(e = {}) {
172
+ return k(e.curve ?? "easeOut", {
173
+ stiffness: e.stiffness,
174
+ damping: e.damping,
175
+ mass: e.mass
176
+ });
177
+ }
178
+ function M(e) {
179
+ return !!e && typeof e == "object" && "value" in e && typeof e.subscribe == "function";
180
+ }
181
+ function X(e) {
182
+ return !e || typeof e != "object" || M(e) ? !1 : Object.prototype.hasOwnProperty.call(e, "show");
183
+ }
184
+ function Z(e) {
185
+ if (typeof window > "u" || typeof window.matchMedia != "function")
186
+ return () => {
187
+ };
188
+ const t = window.matchMedia("(prefers-reduced-motion: reduce)");
189
+ return t.addEventListener("change", e), () => t.removeEventListener("change", e);
190
+ }
191
+ function V() {
192
+ return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
193
+ }
194
+ function ee() {
195
+ return E(Z, V, () => !1);
196
+ }
197
+ function te(e) {
198
+ return M(e) ? !!e.value : !!e;
199
+ }
200
+ function ne(e) {
201
+ const [t, n] = w(() => te(e));
202
+ return v(() => {
203
+ if (!M(e)) {
204
+ n(!!e);
205
+ return;
206
+ }
207
+ return n(!!e.value), e.subscribe((r) => n(!!r));
208
+ }, [e]), M(e) ? t : !!e;
209
+ }
210
+ function B({
211
+ show: e,
212
+ enter: t = "fadeIn",
213
+ exit: n = "fadeOut",
214
+ duration: r = 200,
215
+ reducedMotion: i = "reduce",
216
+ children: o
217
+ }) {
218
+ const c = ne(e), [s, l] = w(c), [u, a] = w(c ? "enter" : "idle"), d = i !== "never" && ee();
219
+ if (v(() => {
220
+ if ($(), c) {
221
+ l(!0), a(d ? "idle" : "enter");
222
+ return;
223
+ }
224
+ if (s) {
225
+ if (d) {
226
+ l(!1), a("idle");
227
+ return;
228
+ }
229
+ a("exit");
230
+ }
231
+ }, [c, d]), !s) return null;
232
+ const m = u === "exit" ? n : u === "enter" ? t : void 0, f = m && !d ? j(m) : void 0;
233
+ return h.createElement(
234
+ "div",
235
+ {
236
+ className: f ? `fibo-anim fibo-anim-${f}` : void 0,
237
+ style: f ? { "--fibo-dur": `${r}ms`, "--fibo-ease": "ease" } : void 0,
238
+ "data-fibo-presence": u,
239
+ onAnimationEnd: (p) => {
240
+ p.target === p.currentTarget && (u === "exit" && l(!1), u === "enter" && a("idle"));
241
+ }
242
+ },
243
+ o
244
+ );
245
+ }
246
+ class re extends H {
247
+ constructor(n = !0) {
248
+ super();
249
+ b(this, "_show", !0);
250
+ b(this, "_enter", "fadeIn");
251
+ b(this, "_exit", "fadeOut");
252
+ this.show(n);
253
+ }
254
+ show(n) {
255
+ return this._show = n, M(n) && (this.bindSignal(n), this.observer()), this;
256
+ }
257
+ enter(n) {
258
+ return this._enter = n, this;
259
+ }
260
+ exit(n) {
261
+ return this._exit = n, this;
262
+ }
263
+ duration(n) {
264
+ return this._transitionDuration = n, this;
265
+ }
266
+ build() {
267
+ return h.createElement(B, {
268
+ show: this._show,
269
+ enter: this._enter,
270
+ exit: this._exit,
271
+ duration: this._transitionDuration,
272
+ reducedMotion: this._reducedMotion,
273
+ children: this.processChildren()
274
+ });
275
+ }
276
+ }
277
+ const ie = z(re);
278
+ function se(e) {
279
+ return X(e) ? h.createElement(B, e) : ie(e ?? !0);
280
+ }
281
+ se.displayName = "Presence";
282
+ class oe {
283
+ constructor() {
284
+ b(this, "_rootComponent", null);
285
+ b(this, "_rootElement", null);
286
+ b(this, "_plugins", []);
287
+ }
288
+ use(t) {
289
+ return this._plugins.push(t), this;
290
+ }
291
+ plugins(t) {
292
+ return this._plugins.push(...t), this;
293
+ }
294
+ root(t) {
295
+ return this._rootComponent = t, this;
296
+ }
297
+ mount(t) {
298
+ const n = document.getElementById(t);
299
+ if (!n)
300
+ throw new Error(`Root element with id "${t}" not found`);
301
+ this._rootElement = n, this.build();
302
+ }
303
+ build() {
304
+ if (!this._rootComponent || !this._rootElement)
305
+ throw new Error("Root component and mount element must be provided");
306
+ const t = Y.getInstance();
307
+ this._plugins.forEach((o) => {
308
+ t.use(o);
309
+ });
310
+ const n = this._rootComponent, r = () => h.createElement(x, {
311
+ children: h.createElement(D, {
312
+ stateMap: /* @__PURE__ */ new Map(),
313
+ children: h.createElement(N, {
314
+ providers: /* @__PURE__ */ new Map(),
315
+ children: h.createElement(n, null)
316
+ })
317
+ })
318
+ });
319
+ C(this._rootElement).render(h.createElement(r));
320
+ }
321
+ }
322
+ const Se = () => new oe();
323
+ function O(e) {
324
+ return G(e);
325
+ }
326
+ function Re({ children: e }) {
327
+ return O(e);
328
+ }
329
+ function Fe(e, t, n) {
330
+ const r = typeof e == "string" ? document.querySelector(e) : e;
331
+ if (!r)
332
+ throw new Error(`mount: element not found: ${String(e)}`);
333
+ const i = typeof t == "function" && !W(t) ? t() : t, o = O(i), c = C(r), s = h.createElement(x, { children: o });
334
+ return c.render(
335
+ (n == null ? void 0 : n.strict) === !1 ? s : h.createElement(L, null, s)
336
+ ), c;
337
+ }
338
+ export {
339
+ K as E,
340
+ Se as F,
341
+ se as P,
342
+ me as a,
343
+ he as b,
344
+ pe as c,
345
+ be as d,
346
+ ge as e,
347
+ Me as f,
348
+ ve as g,
349
+ Ee as h,
350
+ ye as i,
351
+ _e as j,
352
+ oe as k,
353
+ Re as l,
354
+ Fe as m,
355
+ we as n,
356
+ O as t,
357
+ fe as u
358
+ };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { R as e } from "./Router-i6Nc6qVs.js";
3
- import { L as o, N as r, c as t, a as i, b as n, d as L, u as c } from "./Link-DDzSPY1Q.js";
2
+ import { R as e } from "./Router-BwbaHooU.js";
3
+ import { L as o, N as r, c as t, a as i, b as n, d as L, u as c } from "./Link-ElmaMZB8.js";
4
4
  export {
5
5
  o as Link,
6
6
  r as NavLink,
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { jsx as g } from "react/jsx-runtime";
3
- import { useState as i, useEffect as p, createContext as m, useContext as h } from "react";
4
- const l = {
2
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
3
+ import { useState as a, useEffect as s, createContext as h, useContext as d } from "react";
4
+ const b = {
5
5
  name: "material",
6
6
  colors: {
7
7
  primary: "#6750A4",
@@ -84,7 +84,7 @@ const l = {
84
84
  lg: "0 8px 16px rgba(0,0,0,0.14)"
85
85
  },
86
86
  fontFamily: "Roboto, sans-serif"
87
- }, S = {
87
+ }, y = {
88
88
  name: "cupertino",
89
89
  colors: {
90
90
  primary: "#007AFF",
@@ -166,7 +166,7 @@ const l = {
166
166
  lg: "0 4px 16px rgba(0,0,0,0.12)"
167
167
  },
168
168
  fontFamily: '-apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif'
169
- }, d = {
169
+ }, S = {
170
170
  name: "web",
171
171
  colors: {
172
172
  primary: "#3B82F6",
@@ -245,42 +245,58 @@ const l = {
245
245
  lg: "0 10px 15px rgba(0,0,0,0.1)"
246
246
  },
247
247
  fontFamily: "Inter, system-ui, sans-serif"
248
- }, s = m(void 0), a = {
249
- material: l,
250
- cupertino: S,
251
- web: d
248
+ }, c = h(void 0), f = {
249
+ material: b,
250
+ cupertino: y,
251
+ web: S
252
252
  };
253
- function b({
254
- theme: t = "material",
253
+ function W({
254
+ theme: o = "material",
255
255
  children: F
256
256
  }) {
257
- const [n, r] = i(t), [x, f] = i(a[t]);
258
- p(() => {
259
- r(t);
260
- }, [t]), p(() => {
261
- const o = a[n];
262
- if (f(o), typeof document < "u") {
257
+ const [n, i] = a(o), [t, x] = a(f[o]);
258
+ s(() => {
259
+ i(o);
260
+ }, [o]), s(() => {
261
+ const r = f[n];
262
+ if (x(r), typeof document < "u") {
263
263
  const e = document.documentElement;
264
- e.classList.remove("fibo-theme-material", "fibo-theme-cupertino", "fibo-theme-web"), e.classList.add(`fibo-theme-${n}`), e.style.setProperty("--fibo-primary", o.colors.primary), e.style.setProperty("--fibo-secondary", o.colors.secondary), e.style.setProperty("--fibo-background", o.colors.background), e.style.setProperty("--fibo-surface", o.colors.surface), e.style.setProperty("--fibo-error", o.colors.error), e.style.setProperty("--fibo-font-family", o.fontFamily);
264
+ e.classList.remove("fibo-theme-material", "fibo-theme-cupertino", "fibo-theme-web"), e.classList.add(`fibo-theme-${n}`), e.style.setProperty("--fibo-primary", r.colors.primary), e.style.setProperty("--fibo-secondary", r.colors.secondary), e.style.setProperty("--fibo-background", r.colors.background), e.style.setProperty("--fibo-surface", r.colors.surface), e.style.setProperty("--fibo-error", r.colors.error), e.style.setProperty("--fibo-font-family", r.fontFamily);
265
265
  }
266
266
  }, [n]);
267
- const c = {
268
- theme: x,
267
+ const g = {
268
+ theme: t,
269
269
  themeName: n,
270
- setTheme: r
271
- };
272
- return /* @__PURE__ */ g(s.Provider, { value: c, children: F });
270
+ setTheme: i
271
+ }, l = [
272
+ `--fibo-primary:${t.colors.primary}`,
273
+ `--fibo-secondary:${t.colors.secondary}`,
274
+ `--fibo-background:${t.colors.background}`,
275
+ `--fibo-surface:${t.colors.surface}`,
276
+ `--fibo-error:${t.colors.error}`,
277
+ `--fibo-font-family:${t.fontFamily}`
278
+ ].join(";");
279
+ return /* @__PURE__ */ p(c.Provider, { value: g, children: /* @__PURE__ */ m("div", { className: `fibo-theme-${n}`, "data-fibo-theme": n, children: [
280
+ /* @__PURE__ */ p(
281
+ "style",
282
+ {
283
+ "data-fibo-theme-vars": "1",
284
+ dangerouslySetInnerHTML: { __html: `:root{${l}}` }
285
+ }
286
+ ),
287
+ F
288
+ ] }) });
273
289
  }
274
- function z() {
275
- const t = h(s);
276
- if (!t)
290
+ function B() {
291
+ const o = d(c);
292
+ if (!o)
277
293
  throw new Error("useFiboTheme must be used within a FiboThemeProvider");
278
- return t;
294
+ return o;
279
295
  }
280
296
  export {
281
- b as F,
282
- S as c,
283
- l as m,
284
- z as u,
285
- d as w
297
+ W as F,
298
+ y as c,
299
+ b as m,
300
+ B as u,
301
+ S as w
286
302
  };
package/dist/structure.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { B as e } from "./index-BaX5zy8O.js";
3
- import { B as i, C as o, c as t, G as l, d, L as B, a as T, T as m, b as n } from "./index-C4xZywsh.js";
2
+ import { B as e } from "./index-hNxXTy6z.js";
3
+ import { B as i, C as o, c as t, G as l, d, L as B, a as T, T as m, b as n } from "./index-D7exw6yn.js";
4
4
  export {
5
5
  i as Banner,
6
6
  e as Box,