next-recomponents 2.0.63 → 2.0.65
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +11 -7
- package/dist/index.mjs +11 -7
- package/package.json +1 -1
- package/src/tabs/index.tsx +10 -5
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -39862,7 +39862,7 @@ var import_react23 = __toESM(require("react"));
|
|
|
39862
39862
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
39863
39863
|
function TabContainer({
|
|
39864
39864
|
children,
|
|
39865
|
-
labelMaxWidth
|
|
39865
|
+
labelMaxWidth,
|
|
39866
39866
|
currentIndex = 0
|
|
39867
39867
|
}) {
|
|
39868
39868
|
const [index, setIndex] = (0, import_react23.useState)(0);
|
|
@@ -39878,15 +39878,16 @@ function TabContainer({
|
|
|
39878
39878
|
(0, import_react23.useEffect)(() => {
|
|
39879
39879
|
setIndex(currentIndex);
|
|
39880
39880
|
}, [currentIndex]);
|
|
39881
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "w-full bg-white", children: [
|
|
39882
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { role: "tablist", className: "flex gap-1 border-b border-slate-200", children: labels.map((label, k) => {
|
|
39883
|
-
var _a, _b;
|
|
39881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "w-full bg-white border shadow rounded-lg ", children: [
|
|
39882
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { role: "tablist", className: "flex gap-1 border-b border-slate-200 ", children: labels.map((label, k) => {
|
|
39883
|
+
var _a, _b, _c, _d;
|
|
39884
|
+
const icon = (_b = (_a = items.find((i) => i.props.label == label)) == null ? void 0 : _a.props) == null ? void 0 : _b.icon;
|
|
39884
39885
|
const active = k === index;
|
|
39885
|
-
const isDisabled = (
|
|
39886
|
+
const isDisabled = (_d = (_c = items.find((i) => i.props.label == label)) == null ? void 0 : _c.props) == null ? void 0 : _d.disabled;
|
|
39886
39887
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
39887
39888
|
"button",
|
|
39888
39889
|
{
|
|
39889
|
-
style: { maxWidth: labelMaxWidth },
|
|
39890
|
+
style: labelMaxWidth ? { maxWidth: labelMaxWidth } : {},
|
|
39890
39891
|
title: label,
|
|
39891
39892
|
role: "tab",
|
|
39892
39893
|
type: "button",
|
|
@@ -39901,7 +39902,10 @@ function TabContainer({
|
|
|
39901
39902
|
isDisabled ? " text-gray-300 cursor-not-allowed hover:text-gray-300 hover:bg-white" : ""
|
|
39902
39903
|
].join(" "),
|
|
39903
39904
|
children: [
|
|
39904
|
-
|
|
39905
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
39906
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children: icon }),
|
|
39907
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "truncate", children: label })
|
|
39908
|
+
] }),
|
|
39905
39909
|
active && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "absolute left-0 right-0 -bottom-px h-0.5 bg-indigo-600 rounded-full" })
|
|
39906
39910
|
]
|
|
39907
39911
|
},
|
package/dist/index.mjs
CHANGED
|
@@ -39859,7 +39859,7 @@ import React11, { useEffect as useEffect15, useState as useState19 } from "react
|
|
|
39859
39859
|
import { Fragment as Fragment3, jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
39860
39860
|
function TabContainer({
|
|
39861
39861
|
children,
|
|
39862
|
-
labelMaxWidth
|
|
39862
|
+
labelMaxWidth,
|
|
39863
39863
|
currentIndex = 0
|
|
39864
39864
|
}) {
|
|
39865
39865
|
const [index, setIndex] = useState19(0);
|
|
@@ -39875,15 +39875,16 @@ function TabContainer({
|
|
|
39875
39875
|
useEffect15(() => {
|
|
39876
39876
|
setIndex(currentIndex);
|
|
39877
39877
|
}, [currentIndex]);
|
|
39878
|
-
return /* @__PURE__ */ jsxs27("div", { className: "w-full bg-white", children: [
|
|
39879
|
-
/* @__PURE__ */ jsx35("div", { role: "tablist", className: "flex gap-1 border-b border-slate-200", children: labels.map((label, k) => {
|
|
39880
|
-
var _a, _b;
|
|
39878
|
+
return /* @__PURE__ */ jsxs27("div", { className: "w-full bg-white border shadow rounded-lg ", children: [
|
|
39879
|
+
/* @__PURE__ */ jsx35("div", { role: "tablist", className: "flex gap-1 border-b border-slate-200 ", children: labels.map((label, k) => {
|
|
39880
|
+
var _a, _b, _c, _d;
|
|
39881
|
+
const icon = (_b = (_a = items.find((i) => i.props.label == label)) == null ? void 0 : _a.props) == null ? void 0 : _b.icon;
|
|
39881
39882
|
const active = k === index;
|
|
39882
|
-
const isDisabled = (
|
|
39883
|
+
const isDisabled = (_d = (_c = items.find((i) => i.props.label == label)) == null ? void 0 : _c.props) == null ? void 0 : _d.disabled;
|
|
39883
39884
|
return /* @__PURE__ */ jsxs27(
|
|
39884
39885
|
"button",
|
|
39885
39886
|
{
|
|
39886
|
-
style: { maxWidth: labelMaxWidth },
|
|
39887
|
+
style: labelMaxWidth ? { maxWidth: labelMaxWidth } : {},
|
|
39887
39888
|
title: label,
|
|
39888
39889
|
role: "tab",
|
|
39889
39890
|
type: "button",
|
|
@@ -39898,7 +39899,10 @@ function TabContainer({
|
|
|
39898
39899
|
isDisabled ? " text-gray-300 cursor-not-allowed hover:text-gray-300 hover:bg-white" : ""
|
|
39899
39900
|
].join(" "),
|
|
39900
39901
|
children: [
|
|
39901
|
-
|
|
39902
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2", children: [
|
|
39903
|
+
icon && /* @__PURE__ */ jsx35("div", { children: icon }),
|
|
39904
|
+
/* @__PURE__ */ jsx35("div", { className: "truncate", children: label })
|
|
39905
|
+
] }),
|
|
39902
39906
|
active && /* @__PURE__ */ jsx35("span", { className: "absolute left-0 right-0 -bottom-px h-0.5 bg-indigo-600 rounded-full" })
|
|
39903
39907
|
]
|
|
39904
39908
|
},
|
package/package.json
CHANGED
package/src/tabs/index.tsx
CHANGED
|
@@ -8,7 +8,7 @@ interface TabContainerProps {
|
|
|
8
8
|
|
|
9
9
|
export default function TabContainer({
|
|
10
10
|
children,
|
|
11
|
-
labelMaxWidth
|
|
11
|
+
labelMaxWidth,
|
|
12
12
|
currentIndex = 0,
|
|
13
13
|
}: TabContainerProps) {
|
|
14
14
|
const [index, setIndex] = useState(0);
|
|
@@ -28,15 +28,16 @@ export default function TabContainer({
|
|
|
28
28
|
}, [currentIndex]);
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<div className="w-full bg-white">
|
|
32
|
-
<div role="tablist" className="flex gap-1 border-b border-slate-200">
|
|
31
|
+
<div className="w-full bg-white border shadow rounded-lg ">
|
|
32
|
+
<div role="tablist" className="flex gap-1 border-b border-slate-200 ">
|
|
33
33
|
{labels.map((label, k) => {
|
|
34
|
+
const icon = items.find((i) => i.props.label == label)?.props?.icon;
|
|
34
35
|
const active = k === index;
|
|
35
36
|
const isDisabled = items.find((i) => i.props.label == label)?.props
|
|
36
37
|
?.disabled;
|
|
37
38
|
return (
|
|
38
39
|
<button
|
|
39
|
-
style={{ maxWidth: labelMaxWidth }}
|
|
40
|
+
style={labelMaxWidth ? { maxWidth: labelMaxWidth } : {}}
|
|
40
41
|
key={label + k}
|
|
41
42
|
title={label}
|
|
42
43
|
role="tab"
|
|
@@ -56,7 +57,10 @@ export default function TabContainer({
|
|
|
56
57
|
: "",
|
|
57
58
|
].join(" ")}
|
|
58
59
|
>
|
|
59
|
-
|
|
60
|
+
<div className="flex items-center gap-2">
|
|
61
|
+
{icon && <div>{icon}</div>}
|
|
62
|
+
<div className="truncate">{label}</div>
|
|
63
|
+
</div>
|
|
60
64
|
{active && (
|
|
61
65
|
<span className="absolute left-0 right-0 -bottom-px h-0.5 bg-indigo-600 rounded-full" />
|
|
62
66
|
)}
|
|
@@ -76,6 +80,7 @@ interface TabItemProps {
|
|
|
76
80
|
label: string;
|
|
77
81
|
children: ReactNode;
|
|
78
82
|
disabled?: boolean;
|
|
83
|
+
icon?: ReactNode;
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
export function TabItem({ children }: TabItemProps) {
|