albinasoft-ui-package 1.1.14 → 1.1.16

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.
@@ -72,17 +72,17 @@ function CustomDatatable(_a) {
72
72
  filter: filter,
73
73
  floatingFilter: floatingFilter,
74
74
  getQuickFilterText: function (params) {
75
- return params.value ? params.value.toLocaleLowerCase("tr-TR") : "";
75
+ return params.value ? params.value.toString().toLocaleLowerCase("tr-TR") : "";
76
76
  },
77
77
  filterParams: {
78
78
  textFormatter: function (value) {
79
- return value ? value.toLocaleLowerCase("tr-TR") : null;
79
+ return value ? value.toString().toLocaleLowerCase("tr-TR") : null;
80
80
  },
81
81
  filterOptions: ["contains"],
82
82
  defaultOption: "contains",
83
83
  suppressAndOrCondition: true,
84
84
  },
85
- }, quickFilterText: quickFilterText ? quickFilterText.toLocaleLowerCase("tr-TR") : "", pagination: pagination, paginationPageSize: paginationPageSize, paginationPageSizeSelector: paginationPageSizeSelector }))));
85
+ }, quickFilterText: quickFilterText ? quickFilterText.toString().toLocaleLowerCase("tr-TR") : "", pagination: pagination, paginationPageSize: paginationPageSize, paginationPageSizeSelector: paginationPageSizeSelector }))));
86
86
  }
87
87
  exports.CustomDatatable = CustomDatatable;
88
88
  exports.default = CustomDatatable;
@@ -1,17 +1,17 @@
1
1
  import React from "react";
2
- declare enum AlignTabs {
2
+ export declare enum AlignTabs {
3
3
  START = "start",
4
4
  CENTER = "center",
5
5
  END = "end"
6
6
  }
7
- declare enum TabSize {
7
+ export declare enum TabSize {
8
8
  XS = "XS",
9
9
  S = "S",
10
10
  M = "M",
11
11
  L = "L",
12
12
  XL = "XL"
13
13
  }
14
- interface TabItem {
14
+ export interface TabItem {
15
15
  key: string;
16
16
  title: React.ReactNode;
17
17
  /**
@@ -21,9 +21,18 @@ interface TabItem {
21
21
  */
22
22
  content: React.ReactNode | ((goTo: (key: string) => void) => React.ReactNode);
23
23
  icon?: React.ReactNode;
24
+ /** basic veya card başlığına ek CSS sınıfı */
25
+ titleClassName?: string;
26
+ /** icon span’ına ek CSS sınıfı */
27
+ iconClassName?: string;
24
28
  }
25
- interface CustomTabProps {
29
+ export interface CustomTabProps {
26
30
  tabs: TabItem[];
31
+ /** Dışarıdan kontrol için aktif sekme anahtarı (opsiyonel) */
32
+ activeKey?: string;
33
+ /** Sekme değiştiğinde tetiklenen callback (opsiyonel) */
34
+ onTabChange?: (newKey: string) => void;
35
+ /** Başlangıçta hangi sekme açık olsun (opsiyonel) */
27
36
  defaultActiveKey?: string;
28
37
  align?: AlignTabs;
29
38
  transparent?: boolean;
@@ -32,5 +41,4 @@ interface CustomTabProps {
32
41
  size?: TabSize;
33
42
  }
34
43
  declare const CustomTab: React.FC<CustomTabProps>;
35
- export { CustomTab, AlignTabs, TabSize };
36
44
  export default CustomTab;
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
35
35
  };
36
36
  var _a;
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.TabSize = exports.AlignTabs = exports.CustomTab = void 0;
38
+ exports.TabSize = exports.AlignTabs = void 0;
39
39
  var react_1 = __importStar(require("react"));
40
40
  var react_bootstrap_1 = require("react-bootstrap");
41
41
  var AlignTabs;
@@ -43,8 +43,7 @@ var AlignTabs;
43
43
  AlignTabs["START"] = "start";
44
44
  AlignTabs["CENTER"] = "center";
45
45
  AlignTabs["END"] = "end";
46
- })(AlignTabs || (AlignTabs = {}));
47
- exports.AlignTabs = AlignTabs;
46
+ })(AlignTabs = exports.AlignTabs || (exports.AlignTabs = {}));
48
47
  var TabSize;
49
48
  (function (TabSize) {
50
49
  TabSize["XS"] = "XS";
@@ -52,8 +51,7 @@ var TabSize;
52
51
  TabSize["M"] = "M";
53
52
  TabSize["L"] = "L";
54
53
  TabSize["XL"] = "XL";
55
- })(TabSize || (TabSize = {}));
56
- exports.TabSize = TabSize;
54
+ })(TabSize = exports.TabSize || (exports.TabSize = {}));
57
55
  var sizeConfig = (_a = {},
58
56
  _a[TabSize.XS] = { iconSize: 15, fsClass: "fs-5" },
59
57
  _a[TabSize.S] = { iconSize: 20, fsClass: "fs-4" },
@@ -62,30 +60,45 @@ var sizeConfig = (_a = {},
62
60
  _a[TabSize.XL] = { iconSize: 35, fsClass: "fw-bolder fs-1" },
63
61
  _a);
64
62
  var CustomTab = function (_a) {
65
- var _b;
66
- var tabs = _a.tabs, defaultActiveKey = _a.defaultActiveKey, _c = _a.align, align = _c === void 0 ? AlignTabs.CENTER : _c, _d = _a.transparent, transparent = _d === void 0 ? false : _d, _e = _a.isFullWidth, isFullWidth = _e === void 0 ? false : _e, _f = _a.isBasic, isBasic = _f === void 0 ? true : _f, _g = _a.size, size = _g === void 0 ? TabSize.M : _g;
67
- var _h = (0, react_1.useState)(defaultActiveKey || ((_b = tabs[0]) === null || _b === void 0 ? void 0 : _b.key) || ""), activeTabKey = _h[0], setActiveTabKey = _h[1];
63
+ var _b, _c, _d;
64
+ var tabs = _a.tabs, controlledKey = _a.activeKey, onTabChange = _a.onTabChange, defaultActiveKey = _a.defaultActiveKey, _e = _a.align, align = _e === void 0 ? AlignTabs.CENTER : _e, _f = _a.transparent, transparent = _f === void 0 ? false : _f, _g = _a.isFullWidth, isFullWidth = _g === void 0 ? false : _g, _h = _a.isBasic, isBasic = _h === void 0 ? true : _h, _j = _a.size, size = _j === void 0 ? TabSize.M : _j;
65
+ // uncontrolled kullanım için state
66
+ var _k = (0, react_1.useState)((_d = (_b = controlledKey !== null && controlledKey !== void 0 ? controlledKey : defaultActiveKey) !== null && _b !== void 0 ? _b : (_c = tabs[0]) === null || _c === void 0 ? void 0 : _c.key) !== null && _d !== void 0 ? _d : ""), internalKey = _k[0], setInternalKey = _k[1];
67
+ // controlledKey değişince sync et
68
+ (0, react_1.useEffect)(function () {
69
+ if (controlledKey !== undefined && controlledKey !== internalKey) {
70
+ setInternalKey(controlledKey);
71
+ }
72
+ }, [controlledKey]);
73
+ // hem user click hem goToTab için ortak handler
74
+ var changeTab = function (newKey) {
75
+ if (!newKey || !tabs.some(function (t) { return t.key === newKey; }))
76
+ return;
77
+ // uncontrolled mod
78
+ if (controlledKey === undefined) {
79
+ setInternalKey(newKey);
80
+ }
81
+ // her durumda parent bilgilensin
82
+ onTabChange === null || onTabChange === void 0 ? void 0 : onTabChange(newKey);
83
+ };
84
+ var activeTabKey = internalKey;
85
+ var _l = sizeConfig[size], iconSize = _l.iconSize, fsClass = _l.fsClass;
68
86
  var alignmentClass = align === AlignTabs.CENTER
69
87
  ? "justify-content-center"
70
88
  : align === AlignTabs.END
71
89
  ? "justify-content-end"
72
90
  : "justify-content-start";
73
91
  var navStyle = transparent ? { background: "transparent" } : undefined;
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
- };
92
+ // içerikten tetiklemek isteyenler için
93
+ var goToTab = changeTab;
81
94
  return (react_1.default.createElement("div", { className: "m-3" },
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: {
95
+ react_1.default.createElement(react_bootstrap_1.Tab.Container, { activeKey: activeTabKey, onSelect: changeTab },
96
+ 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 changeTab(tab.key); }, className: "btn w-100 ".concat(activeTabKey === tab.key ? "btn-primary" : "btn-outline-primary", " ").concat(tab.titleClassName || ""), style: {
84
97
  padding: "10px 15px",
85
98
  textAlign: "center",
86
99
  border: "none",
87
100
  borderRadius: "20px 20px 0 0",
88
- } }, tab.title)) : (react_1.default.createElement("div", { onClick: function () { return setActiveTabKey(tab.key); }, className: "card flex-fill ".concat(activeTabKey === tab.key ? "bg-primary" : "bg-soft-primary", " text-light"), style: {
101
+ } }, tab.title)) : (react_1.default.createElement("div", { onClick: function () { return changeTab(tab.key); }, className: "card flex-fill ".concat(activeTabKey === tab.key ? "bg-primary" : "bg-soft-primary", " text-light"), style: {
89
102
  padding: "0 5px",
90
103
  textAlign: "center",
91
104
  margin: "0 5px",
@@ -93,20 +106,17 @@ var CustomTab = function (_a) {
93
106
  cursor: "pointer",
94
107
  } },
95
108
  react_1.default.createElement("div", { className: "card-body d-flex flex-column text-center justify-content-center" },
96
- react_1.default.createElement("span", { style: { fontSize: iconSize } }, tab.icon),
97
- react_1.default.createElement("span", { className: fsClass }, tab.title)))))); })),
109
+ react_1.default.createElement("span", { className: tab.iconClassName, style: { fontSize: iconSize } }, tab.icon),
110
+ react_1.default.createElement("span", { className: "".concat(fsClass, " ").concat(tab.titleClassName || "") }, tab.title)))))); })),
98
111
  react_1.default.createElement(react_bootstrap_1.Tab.Content, { style: {
99
112
  padding: "10px",
100
113
  border: "10px solid transparent",
101
- borderRadius: "".concat(isFullWidth ? "6px" : "20px"),
114
+ borderRadius: isFullWidth ? "6px" : "20px",
102
115
  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",
116
+ "linear-gradient(180deg, rgba(var(--bs-primary-rgb),1) 0%, " +
117
+ "rgba(var(--bs-primary-rgb),0.1) 15%, rgba(var(--bs-primary-rgb),0) 35%) border-box",
105
118
  } }, 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)); })))));
119
+ ? tab.content(goToTab)
120
+ : tab.content)); })))));
110
121
  };
111
- exports.CustomTab = CustomTab;
112
122
  exports.default = CustomTab;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "albinasoft-ui-package",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {