quirk-ui 0.0.103 → 0.0.104

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,6 +1,6 @@
1
1
  import { jsx as b, jsxs as h } from "react/jsx-runtime";
2
- import T, { useState as x, useId as L, useRef as u, useMemo as I, useEffect as d } from "react";
3
- import { TabsContext as R, useTabsContext as g } from "./Context.js";
2
+ import T, { useState as x, useId as L, useRef as v, useMemo as I, useEffect as d } from "react";
3
+ import { TabsContext as R, useTabsContext as m } from "./Context.js";
4
4
  import '../../assets/index33.css';const A = "_tabs_1wmov_1", C = "_tabsList_1wmov_7", H = "_left_1wmov_13", N = "_center_1wmov_17", W = "_right_1wmov_21", k = "_tabsTrigger_1wmov_25", M = "_active_1wmov_40", j = "_tabsPanelWrapper_1wmov_45", D = "_tabsPanel_1wmov_45", n = {
5
5
  tabs: A,
6
6
  tabsList: C,
@@ -16,31 +16,31 @@ import '../../assets/index33.css';const A = "_tabs_1wmov_1", C = "_tabsList_1wmo
16
16
  center: n.center,
17
17
  right: n.right
18
18
  };
19
- function v({
19
+ function P({
20
20
  children: r,
21
21
  defaultIndex: e = 0,
22
22
  align: a = "left"
23
23
  }) {
24
- const [s, l] = x(e), o = L(), p = [], _ = [], f = u(null), i = u([]), y = I(
25
- () => ({ activeIndex: s, setActiveIndex: l, idPrefix: o, align: a, panelRefs: i }),
24
+ const [s, c] = x(e), o = L(), p = [], _ = [], l = v(null), i = v([]), y = I(
25
+ () => ({ activeIndex: s, setActiveIndex: c, idPrefix: o, align: a, panelRefs: i }),
26
26
  [s, o, a]
27
27
  );
28
28
  return T.Children.forEach(r, (t) => {
29
- var c;
30
- (t == null ? void 0 : t.type) === w ? p.push(t) : ((t == null ? void 0 : t.type) === $ || ((c = t == null ? void 0 : t.type) == null ? void 0 : c.name) === "Panel") && _.push(t);
29
+ var f;
30
+ (t == null ? void 0 : t.type) === w ? p.push(t) : ((t == null ? void 0 : t.type) === $ || ((f = t == null ? void 0 : t.type) == null ? void 0 : f.name) === "Panel") && _.push(t);
31
31
  }), d(() => {
32
- const t = f.current, c = i.current[s];
33
- if (console.log({ wrapper: t, currentPanel: c, activeIndex: s }), t && c) {
34
- const m = t.offsetHeight, P = c.offsetHeight;
35
- m !== P && (t.style.height = `${m}px`, t.offsetHeight, t.style.height = `${P}px`);
32
+ const t = l.current, f = i.current[s];
33
+ if (t && f) {
34
+ const u = t.offsetHeight, g = f.offsetHeight;
35
+ console.log({ prevHeight: u, newHeight: g }), u !== g && (t.style.height = `${u}px`, t.offsetHeight, t.style.height = `${g}px`);
36
36
  }
37
37
  }, [s]), /* @__PURE__ */ b(R.Provider, { value: y, children: /* @__PURE__ */ h("div", { className: n.tabs, children: [
38
38
  p,
39
- /* @__PURE__ */ b("div", { ref: f, className: n.tabsPanelWrapper, children: _ })
39
+ /* @__PURE__ */ b("div", { ref: l, className: n.tabsPanelWrapper, children: _ })
40
40
  ] }) });
41
41
  }
42
42
  function w({ children: r }) {
43
- const { align: e } = g();
43
+ const { align: e } = m();
44
44
  return /* @__PURE__ */ b(
45
45
  "div",
46
46
  {
@@ -52,8 +52,8 @@ function w({ children: r }) {
52
52
  );
53
53
  }
54
54
  function K({ children: r, index: e }) {
55
- const { activeIndex: a, setActiveIndex: s, idPrefix: l } = g(), o = u(null), p = (f) => {
56
- f.key === "ArrowRight" ? s((i) => i + 1) : f.key === "ArrowLeft" && s((i) => Math.max(0, i - 1));
55
+ const { activeIndex: a, setActiveIndex: s, idPrefix: c } = m(), o = v(null), p = (l) => {
56
+ l.key === "ArrowRight" ? s((i) => i + 1) : l.key === "ArrowLeft" && s((i) => Math.max(0, i - 1));
57
57
  }, _ = a === e;
58
58
  return /* @__PURE__ */ b(
59
59
  "button",
@@ -61,7 +61,7 @@ function K({ children: r, index: e }) {
61
61
  className: `${n.tabsTrigger} ${_ ? n.active : ""}`,
62
62
  role: "tab",
63
63
  ref: o,
64
- id: `${l}-tab-${e}`,
64
+ id: `${c}-tab-${e}`,
65
65
  "aria-selected": a === e,
66
66
  tabIndex: a === e ? 0 : -1,
67
67
  onClick: () => s(e),
@@ -71,12 +71,12 @@ function K({ children: r, index: e }) {
71
71
  );
72
72
  }
73
73
  function $({ children: r, index: e }) {
74
- const { activeIndex: a, idPrefix: s, panelRefs: l } = g();
74
+ const { activeIndex: a, idPrefix: s, panelRefs: c } = m();
75
75
  return e !== a ? null : /* @__PURE__ */ b(
76
76
  "div",
77
77
  {
78
78
  ref: (o) => {
79
- l.current[e] = o;
79
+ c.current[e] = o;
80
80
  },
81
81
  className: n.tabsPanel,
82
82
  role: "tabpanel",
@@ -88,11 +88,11 @@ function $({ children: r, index: e }) {
88
88
  }
89
89
  );
90
90
  }
91
- v.List = w;
92
- v.Trigger = K;
93
- v.Panel = $;
91
+ P.List = w;
92
+ P.Trigger = K;
93
+ P.Panel = $;
94
94
  export {
95
- v as Tabs,
95
+ P as Tabs,
96
96
  E as alignClassMap,
97
- v as default
97
+ P as default
98
98
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.0.103",
4
+ "version": "0.0.104",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {