nntc-ui 0.0.25 → 0.0.26
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/index.d.ts +1 -0
- package/index.js +55 -47
- package/package.json +1 -1
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -2025,11 +2025,15 @@ function Tabs(props) {
|
|
|
2025
2025
|
} = props;
|
|
2026
2026
|
const [isMounted, setIsMounted] = useState8(false);
|
|
2027
2027
|
const [selectedTab, setSelectedTab] = useState8(defaultSelected);
|
|
2028
|
-
const handleClick = (
|
|
2029
|
-
if (
|
|
2028
|
+
const handleClick = (item3) => () => {
|
|
2029
|
+
if (item3.onClick) {
|
|
2030
|
+
item3.onClick();
|
|
2031
|
+
return;
|
|
2032
|
+
}
|
|
2033
|
+
if (allowDeselect && selectedTab === item3.value) {
|
|
2030
2034
|
setSelectedTab(void 0);
|
|
2031
2035
|
} else {
|
|
2032
|
-
setSelectedTab(
|
|
2036
|
+
setSelectedTab(item3.value);
|
|
2033
2037
|
}
|
|
2034
2038
|
};
|
|
2035
2039
|
useEffect5(() => {
|
|
@@ -2051,51 +2055,55 @@ function Tabs(props) {
|
|
|
2051
2055
|
tabs_exports[size],
|
|
2052
2056
|
classes?.root
|
|
2053
2057
|
),
|
|
2054
|
-
children: items2.map((item3) =>
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
/* @__PURE__ */ jsxs13(
|
|
2070
|
-
"div",
|
|
2071
|
-
{
|
|
2072
|
-
className: classnames15(
|
|
2073
|
-
tabTitle,
|
|
2074
|
-
classes?.tabTitle,
|
|
2075
|
-
selectedTab === item3.value ? classes?.tabSelectedTitle : void 0
|
|
2076
|
-
),
|
|
2077
|
-
children: [
|
|
2078
|
-
item3.icon && /* @__PURE__ */ jsx24("span", { className: tabIcon, children: typeof item3.icon === "string" ? /* @__PURE__ */ jsx24("span", { className: tabIcon, dangerouslySetInnerHTML: { __html: item3.icon } }) : item3.icon }),
|
|
2079
|
-
item3.name && /* @__PURE__ */ jsx24("span", { title: item3.name, children: item3.name })
|
|
2080
|
-
]
|
|
2081
|
-
}
|
|
2058
|
+
children: items2.map((item3) => {
|
|
2059
|
+
const isButton = !!item3.onClick;
|
|
2060
|
+
const isSelected = !isButton && selectedTab === item3.value;
|
|
2061
|
+
return /* @__PURE__ */ jsxs13(
|
|
2062
|
+
"div",
|
|
2063
|
+
{
|
|
2064
|
+
className: classnames15(
|
|
2065
|
+
tab,
|
|
2066
|
+
filled7 && tabFilled,
|
|
2067
|
+
isVertical && tabVertical,
|
|
2068
|
+
disableBorder2 && disableBorder,
|
|
2069
|
+
isSelected ? selected2 : void 0,
|
|
2070
|
+
isSelected && filled7 ? selectedFilled : void 0,
|
|
2071
|
+
classes?.tab,
|
|
2072
|
+
isSelected ? classes?.tabSelected : void 0
|
|
2082
2073
|
),
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2074
|
+
onClick: handleClick(item3),
|
|
2075
|
+
children: [
|
|
2076
|
+
/* @__PURE__ */ jsxs13(
|
|
2077
|
+
"div",
|
|
2078
|
+
{
|
|
2079
|
+
className: classnames15(
|
|
2080
|
+
tabTitle,
|
|
2081
|
+
classes?.tabTitle,
|
|
2082
|
+
isSelected ? classes?.tabSelectedTitle : void 0
|
|
2083
|
+
),
|
|
2084
|
+
children: [
|
|
2085
|
+
item3.icon && /* @__PURE__ */ jsx24("span", { className: tabIcon, children: typeof item3.icon === "string" ? /* @__PURE__ */ jsx24("span", { className: tabIcon, dangerouslySetInnerHTML: { __html: item3.icon } }) : item3.icon }),
|
|
2086
|
+
item3.name && /* @__PURE__ */ jsx24("span", { title: item3.name, children: item3.name })
|
|
2087
|
+
]
|
|
2088
|
+
}
|
|
2089
|
+
),
|
|
2090
|
+
/* @__PURE__ */ jsx24(
|
|
2091
|
+
"div",
|
|
2092
|
+
{
|
|
2093
|
+
className: classnames15(
|
|
2094
|
+
tabBorder,
|
|
2095
|
+
isVertical && tabBorderVertical,
|
|
2096
|
+
disableBorder2 && disableBorder,
|
|
2097
|
+
classes?.tabBorder,
|
|
2098
|
+
isSelected ? classes?.tabSelectedBorder : void 0
|
|
2099
|
+
)
|
|
2100
|
+
}
|
|
2101
|
+
)
|
|
2102
|
+
]
|
|
2103
|
+
},
|
|
2104
|
+
`tab-${item3.value}`
|
|
2105
|
+
);
|
|
2106
|
+
})
|
|
2099
2107
|
}
|
|
2100
2108
|
);
|
|
2101
2109
|
}
|