albinasoft-ui-package 1.1.13 → 1.1.14
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.
@@ -14,7 +14,12 @@ declare enum TabSize {
|
|
14
14
|
interface TabItem {
|
15
15
|
key: string;
|
16
16
|
title: React.ReactNode;
|
17
|
-
|
17
|
+
/**
|
18
|
+
* Ya doğrudan içerik,
|
19
|
+
* ya da sekme değiştirecek bir fonksiyon alır:
|
20
|
+
* (goTo: (newKey:string)=>void) => ReactNode
|
21
|
+
*/
|
22
|
+
content: React.ReactNode | ((goTo: (key: string) => void) => React.ReactNode);
|
18
23
|
icon?: React.ReactNode;
|
19
24
|
}
|
20
25
|
interface CustomTabProps {
|
@@ -72,13 +72,15 @@ var CustomTab = function (_a) {
|
|
72
72
|
: "justify-content-start";
|
73
73
|
var navStyle = transparent ? { background: "transparent" } : undefined;
|
74
74
|
var _j = sizeConfig[size], iconSize = _j.iconSize, fsClass = _j.fsClass;
|
75
|
+
// Bu fonksiyonu içeriğe geçiriyoruz:
|
76
|
+
var goToTab = function (key) {
|
77
|
+
if (tabs.some(function (t) { return t.key === key; })) {
|
78
|
+
setActiveTabKey(key);
|
79
|
+
}
|
80
|
+
};
|
75
81
|
return (react_1.default.createElement("div", { className: "m-3" },
|
76
|
-
react_1.default.createElement(react_bootstrap_1.Tab.Container, { activeKey: activeTabKey, onSelect: function (
|
77
|
-
react_1.default.createElement(react_bootstrap_1.Nav, { variant: "tabs", className: "d-flex ".concat(alignmentClass, " m-0"), style: __assign({ width: "100%" }, navStyle) }, tabs.map(function (tab) { return (react_1.default.createElement(react_bootstrap_1.Nav.Item, { key: tab.key, className: isFullWidth ? "flex-grow-1" : "", style: {
|
78
|
-
margin: isBasic ? "0 5px" : undefined,
|
79
|
-
} }, isBasic ? (react_1.default.createElement("div", { onClick: function () { return setActiveTabKey(tab.key); }, className: "btn w-100 ".concat(activeTabKey === tab.key
|
80
|
-
? "btn-primary"
|
81
|
-
: "btn-outline-primary"), style: {
|
82
|
+
react_1.default.createElement(react_bootstrap_1.Tab.Container, { activeKey: activeTabKey, onSelect: function (k) { var _a; return setActiveTabKey(k || ((_a = tabs[0]) === null || _a === void 0 ? void 0 : _a.key) || ""); } },
|
83
|
+
react_1.default.createElement(react_bootstrap_1.Nav, { variant: "tabs", className: "d-flex ".concat(alignmentClass, " m-0"), style: __assign({ width: "100%" }, navStyle) }, tabs.map(function (tab) { return (react_1.default.createElement(react_bootstrap_1.Nav.Item, { key: tab.key, className: isFullWidth ? "flex-grow-1" : "", style: { margin: isBasic ? "0 5px" : undefined } }, isBasic ? (react_1.default.createElement("div", { onClick: function () { return setActiveTabKey(tab.key); }, className: "btn w-100 ".concat(activeTabKey === tab.key ? "btn-primary" : "btn-outline-primary"), style: {
|
82
84
|
padding: "10px 15px",
|
83
85
|
textAlign: "center",
|
84
86
|
border: "none",
|
@@ -91,14 +93,20 @@ var CustomTab = function (_a) {
|
|
91
93
|
cursor: "pointer",
|
92
94
|
} },
|
93
95
|
react_1.default.createElement("div", { className: "card-body d-flex flex-column text-center justify-content-center" },
|
94
|
-
react_1.default.createElement("span", { style: { fontSize: iconSize } }, tab.icon
|
96
|
+
react_1.default.createElement("span", { style: { fontSize: iconSize } }, tab.icon),
|
95
97
|
react_1.default.createElement("span", { className: fsClass }, tab.title)))))); })),
|
96
98
|
react_1.default.createElement(react_bootstrap_1.Tab.Content, { style: {
|
97
99
|
padding: "10px",
|
98
100
|
border: "10px solid transparent",
|
99
101
|
borderRadius: "".concat(isFullWidth ? "6px" : "20px"),
|
100
|
-
background: "linear-gradient(var(--bs-body-bg),var(--bs-body-bg)) padding-box,
|
101
|
-
|
102
|
+
background: "linear-gradient(var(--bs-body-bg),var(--bs-body-bg)) padding-box, " +
|
103
|
+
"linear-gradient(180deg, rgba(var(--bs-primary-rgb), 1) 0%, " +
|
104
|
+
"rgba(var(--bs-primary-rgb), 0.1) 15%, rgba(var(--bs-primary-rgb), 0) 35%) border-box",
|
105
|
+
} }, tabs.map(function (tab) { return (react_1.default.createElement(react_bootstrap_1.Tab.Pane, { eventKey: tab.key, key: tab.key }, typeof tab.content === "function"
|
106
|
+
? // eğer fonksiyon ise, goToTab callback’ini ver
|
107
|
+
tab.content(goToTab)
|
108
|
+
: // değilse doğrudan render et
|
109
|
+
tab.content)); })))));
|
102
110
|
};
|
103
111
|
exports.CustomTab = CustomTab;
|
104
112
|
exports.default = CustomTab;
|