@pittorica/tabs-react 0.23.0 → 0.23.2

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 (2) hide show
  1. package/dist/index.js +40 -38
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as f } from "react/jsx-runtime";
2
- import { createContext as K, useRef as q, useState as E, useMemo as F, use as W } from "react";
2
+ import { createContext as q, useRef as E, useState as F, useMemo as W, use as H } from "react";
3
3
  function w(t) {
4
4
  var a, r, e = "";
5
5
  if (typeof t == "string" || typeof t == "number") e += t;
@@ -22,7 +22,7 @@ function A(t) {
22
22
  } else for (r in t) t[r] && (e && (e += " "), e += r);
23
23
  return e;
24
24
  }
25
- function H() {
25
+ function M() {
26
26
  for (var t, a, r = 0, e = "", n = arguments.length; r < n; r++) (t = arguments[r]) && (a = A(t)) && (e && (e += " "), e += a);
27
27
  return e;
28
28
  }
@@ -38,25 +38,26 @@ const m = ({
38
38
  ml: s,
39
39
  p: u,
40
40
  pt: c,
41
- pr: g,
42
- pb: b,
41
+ pr: b,
42
+ pb: g,
43
43
  pl: d,
44
44
  width: y,
45
45
  height: x,
46
46
  position: T,
47
47
  style: C,
48
48
  className: R,
49
- href: k,
50
- target: N,
49
+ href: N,
50
+ target: k,
51
51
  rel: L,
52
52
  htmlFor: D,
53
53
  type: S,
54
- disabled: j,
55
- ...B
54
+ name: j,
55
+ disabled: B,
56
+ ...I
56
57
  }) => {
57
58
  const i = {};
58
- e && (i.display = e), y && (i.width = y), x && (i.height = x), T && (i.position = T), n && (i.margin = `var(--pittorica-space-${n})`), l && (i.marginTop = `var(--pittorica-space-${l})`), p && (i.marginRight = `var(--pittorica-space-${p})`), o && (i.marginBottom = `var(--pittorica-space-${o})`), s && (i.marginLeft = `var(--pittorica-space-${s})`), u && (i.padding = `var(--pittorica-space-${u})`), c && (i.paddingTop = `var(--pittorica-space-${c})`), g && (i.paddingRight = `var(--pittorica-space-${g})`), b && (i.paddingBottom = `var(--pittorica-space-${b})`), d && (i.paddingLeft = `var(--pittorica-space-${d})`);
59
- const I = {
59
+ e && (i.display = e), y && (i.width = y), x && (i.height = x), T && (i.position = T), n && (i.margin = `var(--pittorica-space-${n})`), l && (i.marginTop = `var(--pittorica-space-${l})`), p && (i.marginRight = `var(--pittorica-space-${p})`), o && (i.marginBottom = `var(--pittorica-space-${o})`), s && (i.marginLeft = `var(--pittorica-space-${s})`), u && (i.padding = `var(--pittorica-space-${u})`), c && (i.paddingTop = `var(--pittorica-space-${c})`), b && (i.paddingRight = `var(--pittorica-space-${b})`), g && (i.paddingBottom = `var(--pittorica-space-${g})`), d && (i.paddingLeft = `var(--pittorica-space-${d})`);
60
+ const K = {
60
61
  ...C,
61
62
  ...i
62
63
  };
@@ -64,26 +65,27 @@ const m = ({
64
65
  a,
65
66
  {
66
67
  ref: t,
67
- className: H("pittorica-box", R),
68
- style: I,
69
- href: k,
70
- target: N,
68
+ className: M("pittorica-box", R),
69
+ style: K,
70
+ href: N,
71
+ target: k,
71
72
  rel: L,
72
73
  htmlFor: D,
73
74
  type: S,
74
- disabled: j,
75
- ...B,
75
+ name: j,
76
+ disabled: B,
77
+ ...I,
76
78
  children: r
77
79
  }
78
80
  );
79
81
  };
80
82
  m.displayName = "Box";
81
- const $ = K(null), v = () => {
82
- const t = W($);
83
+ const $ = q(null), v = () => {
84
+ const t = H($);
83
85
  if (!t)
84
86
  throw new Error("Tabs components must be wrapped in <Tabs.Root />");
85
87
  return t;
86
- }, M = ({
88
+ }, O = ({
87
89
  children: t,
88
90
  defaultValue: a,
89
91
  value: r,
@@ -92,30 +94,30 @@ const $ = K(null), v = () => {
92
94
  className: l,
93
95
  ...p
94
96
  }) => {
95
- const [o, s] = E(a), u = r !== void 0, c = u ? r : o, g = (d) => {
97
+ const [o, s] = F(a), u = r !== void 0, c = u ? r : o, b = (d) => {
96
98
  u || s(d), e == null || e(d);
97
- }, b = F(
99
+ }, g = W(
98
100
  () => ({
99
101
  value: c,
100
- onValueChange: g,
102
+ onValueChange: b,
101
103
  color: n
102
104
  }),
103
105
  [c, n]
104
106
  );
105
- return /* @__PURE__ */ f($, { value: b, children: /* @__PURE__ */ f(m, { ...p, className: h("pittorica-tabs-root", l), children: t }) });
106
- }, O = ({ children: t, className: a, ...r }) => {
107
- const e = q(null), { onValueChange: n } = v();
107
+ return /* @__PURE__ */ f($, { value: g, children: /* @__PURE__ */ f(m, { ...p, className: h("pittorica-tabs-root", l), children: t }) });
108
+ }, U = ({ children: t, className: a, ...r }) => {
109
+ const e = E(null), { onValueChange: n } = v();
108
110
  return /* @__PURE__ */ f(
109
111
  m,
110
112
  {
111
113
  ref: e,
112
114
  role: "tablist",
113
115
  onKeyDown: (p) => {
114
- var g;
116
+ var b;
115
117
  const o = p.target;
116
118
  if (o.getAttribute("role") !== "tab") return;
117
119
  const s = [
118
- ...((g = e.current) == null ? void 0 : g.querySelectorAll('[role="tab"]')) || []
120
+ ...((b = e.current) == null ? void 0 : b.querySelectorAll('[role="tab"]')) || []
119
121
  ], u = s.indexOf(o);
120
122
  let c = null;
121
123
  switch (p.key) {
@@ -138,9 +140,9 @@ const $ = K(null), v = () => {
138
140
  }
139
141
  if (c !== null) {
140
142
  p.preventDefault();
141
- const b = s[c];
142
- b.focus();
143
- const d = b.dataset.value;
143
+ const g = s[c];
144
+ g.focus();
145
+ const d = g.dataset.value;
144
146
  d && n(d);
145
147
  }
146
148
  },
@@ -149,7 +151,7 @@ const $ = K(null), v = () => {
149
151
  children: t
150
152
  }
151
153
  );
152
- }, U = ({
154
+ }, V = ({
153
155
  value: t,
154
156
  children: a,
155
157
  className: r,
@@ -177,7 +179,7 @@ const $ = K(null), v = () => {
177
179
  children: a
178
180
  }
179
181
  );
180
- }, V = ({
182
+ }, z = ({
181
183
  value: t,
182
184
  children: a,
183
185
  className: r,
@@ -195,12 +197,12 @@ const $ = K(null), v = () => {
195
197
  children: l ? a : null
196
198
  }
197
199
  );
198
- }, J = {
199
- Root: M,
200
- List: O,
201
- Trigger: U,
202
- Content: V
200
+ }, P = {
201
+ Root: O,
202
+ List: U,
203
+ Trigger: V,
204
+ Content: z
203
205
  };
204
206
  export {
205
- J as Tabs
207
+ P as Tabs
206
208
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pittorica/tabs-react",
3
- "version": "0.23.0",
3
+ "version": "0.23.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -10,8 +10,8 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "clsx": "^2.1.1",
13
- "@pittorica/box-react": "0.23.0",
14
- "@pittorica/text-react": "0.23.0"
13
+ "@pittorica/box-react": "0.23.2",
14
+ "@pittorica/text-react": "0.23.2"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@testing-library/jest-dom": "^6.9.1",
@@ -23,8 +23,8 @@
23
23
  "typescript": "^5.0.0",
24
24
  "vite": "^5.0.0",
25
25
  "vitest": "^2.1.9",
26
- "@pittorica/theme-react": "0.23.0",
27
- "pittorica": "0.23.0"
26
+ "@pittorica/theme-react": "0.23.2",
27
+ "pittorica": "0.23.2"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "react": ">=19",