next-recomponents 2.0.64 → 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 CHANGED
@@ -291,6 +291,7 @@ interface TabItemProps {
291
291
  label: string;
292
292
  children: ReactNode;
293
293
  disabled?: boolean;
294
+ icon?: ReactNode;
294
295
  }
295
296
  declare function TabItem({ children }: TabItemProps): react_jsx_runtime.JSX.Element;
296
297
 
package/dist/index.d.ts CHANGED
@@ -291,6 +291,7 @@ interface TabItemProps {
291
291
  label: string;
292
292
  children: ReactNode;
293
293
  disabled?: boolean;
294
+ icon?: ReactNode;
294
295
  }
295
296
  declare function TabItem({ children }: TabItemProps): react_jsx_runtime.JSX.Element;
296
297
 
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 = 100,
39865
+ labelMaxWidth,
39866
39866
  currentIndex = 0
39867
39867
  }) {
39868
39868
  const [index, setIndex] = (0, import_react23.useState)(0);
@@ -39880,13 +39880,14 @@ function TabContainer({
39880
39880
  }, [currentIndex]);
39881
39881
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "w-full bg-white border shadow rounded-lg ", children: [
39882
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;
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 = (_b = (_a = items.find((i) => i.props.label == label)) == null ? void 0 : _a.props) == null ? void 0 : _b.disabled;
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
- label,
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 = 100,
39862
+ labelMaxWidth,
39863
39863
  currentIndex = 0
39864
39864
  }) {
39865
39865
  const [index, setIndex] = useState19(0);
@@ -39877,13 +39877,14 @@ function TabContainer({
39877
39877
  }, [currentIndex]);
39878
39878
  return /* @__PURE__ */ jsxs27("div", { className: "w-full bg-white border shadow rounded-lg ", children: [
39879
39879
  /* @__PURE__ */ jsx35("div", { role: "tablist", className: "flex gap-1 border-b border-slate-200 ", children: labels.map((label, k) => {
39880
- var _a, _b;
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 = (_b = (_a = items.find((i) => i.props.label == label)) == null ? void 0 : _a.props) == null ? void 0 : _b.disabled;
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
- label,
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "2.0.64",
3
+ "version": "2.0.65",
4
4
  "description": "description nueva",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@ interface TabContainerProps {
8
8
 
9
9
  export default function TabContainer({
10
10
  children,
11
- labelMaxWidth = 100,
11
+ labelMaxWidth,
12
12
  currentIndex = 0,
13
13
  }: TabContainerProps) {
14
14
  const [index, setIndex] = useState(0);
@@ -31,12 +31,13 @@ export default function TabContainer({
31
31
  <div className="w-full bg-white border shadow rounded-lg ">
32
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
- {label}
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) {