@pittorica/tabs-react 0.23.1 → 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.
- package/dist/index.js +40 -38
- 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
|
|
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
|
|
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:
|
|
42
|
-
pb:
|
|
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:
|
|
50
|
-
target:
|
|
49
|
+
href: N,
|
|
50
|
+
target: k,
|
|
51
51
|
rel: L,
|
|
52
52
|
htmlFor: D,
|
|
53
53
|
type: S,
|
|
54
|
-
|
|
55
|
-
|
|
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})`),
|
|
59
|
-
const
|
|
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:
|
|
68
|
-
style:
|
|
69
|
-
href:
|
|
70
|
-
target:
|
|
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
|
-
|
|
75
|
-
|
|
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 $ =
|
|
82
|
-
const t =
|
|
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
|
-
},
|
|
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] =
|
|
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
|
-
},
|
|
99
|
+
}, g = W(
|
|
98
100
|
() => ({
|
|
99
101
|
value: c,
|
|
100
|
-
onValueChange:
|
|
102
|
+
onValueChange: b,
|
|
101
103
|
color: n
|
|
102
104
|
}),
|
|
103
105
|
[c, n]
|
|
104
106
|
);
|
|
105
|
-
return /* @__PURE__ */ f($, { value:
|
|
106
|
-
},
|
|
107
|
-
const e =
|
|
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
|
|
116
|
+
var b;
|
|
115
117
|
const o = p.target;
|
|
116
118
|
if (o.getAttribute("role") !== "tab") return;
|
|
117
119
|
const s = [
|
|
118
|
-
...((
|
|
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
|
|
142
|
-
|
|
143
|
-
const d =
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
199
|
-
Root:
|
|
200
|
-
List:
|
|
201
|
-
Trigger:
|
|
202
|
-
Content:
|
|
200
|
+
}, P = {
|
|
201
|
+
Root: O,
|
|
202
|
+
List: U,
|
|
203
|
+
Trigger: V,
|
|
204
|
+
Content: z
|
|
203
205
|
};
|
|
204
206
|
export {
|
|
205
|
-
|
|
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.
|
|
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.
|
|
14
|
-
"@pittorica/text-react": "0.23.
|
|
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": "0.23.
|
|
27
|
-
"
|
|
26
|
+
"@pittorica/theme-react": "0.23.2",
|
|
27
|
+
"pittorica": "0.23.2"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": ">=19",
|