next-recomponents 2.0.64 → 2.0.66
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 +20 -16
- package/dist/index.mjs +20 -16
- package/package.json +1 -1
- package/src/tabs/index.tsx +8 -3
- package/src/use-resources/index.ts +12 -12
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -36685,22 +36685,22 @@ function useResources({
|
|
|
36685
36685
|
);
|
|
36686
36686
|
async function doSome() {
|
|
36687
36687
|
var _a, _b, _c, _d, _e;
|
|
36688
|
-
const
|
|
36689
|
-
|
|
36690
|
-
|
|
36691
|
-
|
|
36692
|
-
|
|
36693
|
-
|
|
36694
|
-
|
|
36695
|
-
|
|
36696
|
-
|
|
36697
|
-
|
|
36688
|
+
const keys2 = Object.keys(info);
|
|
36689
|
+
for (let key of keys2) {
|
|
36690
|
+
if (key) {
|
|
36691
|
+
if ((_a = info[key]) == null ? void 0 : _a.id) {
|
|
36692
|
+
await results[key].find((_b = info[key]) == null ? void 0 : _b.id, (_c = info[key]) == null ? void 0 : _c.defaultParams);
|
|
36693
|
+
} else if ((_d = info[key]) == null ? void 0 : _d.defaultParams) {
|
|
36694
|
+
await results[key].show((_e = info[key]) == null ? void 0 : _e.defaultParams);
|
|
36695
|
+
} else {
|
|
36696
|
+
results[key].setLoaded();
|
|
36697
|
+
}
|
|
36698
36698
|
}
|
|
36699
36699
|
}
|
|
36700
36700
|
}
|
|
36701
36701
|
(0, import_react8.useEffect)(() => {
|
|
36702
36702
|
doSome();
|
|
36703
|
-
}, [
|
|
36703
|
+
}, []);
|
|
36704
36704
|
return results;
|
|
36705
36705
|
}
|
|
36706
36706
|
|
|
@@ -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);
|
|
@@ -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 = (
|
|
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
|
@@ -36664,22 +36664,22 @@ function useResources({
|
|
|
36664
36664
|
);
|
|
36665
36665
|
async function doSome() {
|
|
36666
36666
|
var _a, _b, _c, _d, _e;
|
|
36667
|
-
const
|
|
36668
|
-
|
|
36669
|
-
|
|
36670
|
-
|
|
36671
|
-
|
|
36672
|
-
|
|
36673
|
-
|
|
36674
|
-
|
|
36675
|
-
|
|
36676
|
-
|
|
36667
|
+
const keys2 = Object.keys(info);
|
|
36668
|
+
for (let key of keys2) {
|
|
36669
|
+
if (key) {
|
|
36670
|
+
if ((_a = info[key]) == null ? void 0 : _a.id) {
|
|
36671
|
+
await results[key].find((_b = info[key]) == null ? void 0 : _b.id, (_c = info[key]) == null ? void 0 : _c.defaultParams);
|
|
36672
|
+
} else if ((_d = info[key]) == null ? void 0 : _d.defaultParams) {
|
|
36673
|
+
await results[key].show((_e = info[key]) == null ? void 0 : _e.defaultParams);
|
|
36674
|
+
} else {
|
|
36675
|
+
results[key].setLoaded();
|
|
36676
|
+
}
|
|
36677
36677
|
}
|
|
36678
36678
|
}
|
|
36679
36679
|
}
|
|
36680
36680
|
useEffect4(() => {
|
|
36681
36681
|
doSome();
|
|
36682
|
-
}, [
|
|
36682
|
+
}, []);
|
|
36683
36683
|
return results;
|
|
36684
36684
|
}
|
|
36685
36685
|
|
|
@@ -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);
|
|
@@ -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 = (
|
|
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);
|
|
@@ -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
|
-
|
|
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) {
|
|
@@ -448,23 +448,23 @@ export default function useResources<T extends Record<string, ItemsRecord>>({
|
|
|
448
448
|
);
|
|
449
449
|
|
|
450
450
|
async function doSome() {
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
451
|
+
const keys = Object.keys(info);
|
|
452
|
+
|
|
453
|
+
for (let key of keys) {
|
|
454
|
+
if (key) {
|
|
455
|
+
if (info[key]?.id) {
|
|
456
|
+
await results[key].find(info[key]?.id, info[key]?.defaultParams);
|
|
457
|
+
} else if (info[key]?.defaultParams) {
|
|
458
|
+
await results[key].show(info[key]?.defaultParams);
|
|
459
|
+
} else {
|
|
460
|
+
results[key].setLoaded();
|
|
461
|
+
}
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
useEffect(() => {
|
|
466
466
|
doSome();
|
|
467
|
-
}, [
|
|
467
|
+
}, []);
|
|
468
468
|
|
|
469
469
|
return results;
|
|
470
470
|
}
|