bianic-ui 2.2.0-beta.2 → 2.3.0

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.
Files changed (32) hide show
  1. package/dist/cjs/index.js +205 -53
  2. package/dist/cjs/lib.css +1 -1
  3. package/dist/cjs/types/components/Card/config.d.ts +6 -0
  4. package/dist/cjs/types/components/Card/index.d.ts +8 -0
  5. package/dist/cjs/types/components/FileTree/FileTreeSimulation.d.ts +3 -0
  6. package/dist/cjs/types/components/FileTree/TreeItem.d.ts +13 -0
  7. package/dist/cjs/types/components/FileTree/useFileTree.d.ts +12 -0
  8. package/dist/cjs/types/components/PaginationBar/SelectedPage.d.ts +7 -0
  9. package/dist/cjs/types/components/Popover/PropInterface.d.ts +21 -0
  10. package/dist/cjs/types/components/Popover/index.d.ts +2 -10
  11. package/dist/cjs/types/components/Tooltip/PropsInterface.d.ts +6 -2
  12. package/dist/cjs/types/components/index.d.ts +3 -0
  13. package/dist/cjs/types/stories/Card/Card.stories.d.ts +17 -0
  14. package/dist/cjs/types/stories/FileTree/FileTreeSimulation.stories.d.ts +12 -0
  15. package/dist/cjs/types/utility/public/words.d.ts +13 -0
  16. package/dist/esm/index.js +203 -54
  17. package/dist/esm/lib.css +1 -1
  18. package/dist/esm/types/components/Card/config.d.ts +6 -0
  19. package/dist/esm/types/components/Card/index.d.ts +8 -0
  20. package/dist/esm/types/components/FileTree/FileTreeSimulation.d.ts +3 -0
  21. package/dist/esm/types/components/FileTree/TreeItem.d.ts +13 -0
  22. package/dist/esm/types/components/FileTree/useFileTree.d.ts +12 -0
  23. package/dist/esm/types/components/PaginationBar/SelectedPage.d.ts +7 -0
  24. package/dist/esm/types/components/Popover/PropInterface.d.ts +21 -0
  25. package/dist/esm/types/components/Popover/index.d.ts +2 -10
  26. package/dist/esm/types/components/Tooltip/PropsInterface.d.ts +6 -2
  27. package/dist/esm/types/components/index.d.ts +3 -0
  28. package/dist/esm/types/stories/Card/Card.stories.d.ts +17 -0
  29. package/dist/esm/types/stories/FileTree/FileTreeSimulation.stories.d.ts +12 -0
  30. package/dist/esm/types/utility/public/words.d.ts +13 -0
  31. package/dist/index.d.ts +40 -6
  32. package/package.json +51 -7
package/dist/cjs/index.js CHANGED
@@ -103,6 +103,10 @@ function TbCircleCheckFilled (props) {
103
103
  return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":"2","strokeLinecap":"round","strokeLinejoin":"round"},"child":[{"tag":"path","attr":{"d":"M9 6l6 6l-6 6"},"child":[]}]})(props);
104
104
  }function TbChevronUp (props) {
105
105
  return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":"2","strokeLinecap":"round","strokeLinejoin":"round"},"child":[{"tag":"path","attr":{"d":"M6 15l6 -6l6 6"},"child":[]}]})(props);
106
+ }function TbChevronsLeft (props) {
107
+ return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":"2","strokeLinecap":"round","strokeLinejoin":"round"},"child":[{"tag":"path","attr":{"d":"M11 7l-5 5l5 5"},"child":[]},{"tag":"path","attr":{"d":"M17 7l-5 5l5 5"},"child":[]}]})(props);
108
+ }function TbChevronsRight (props) {
109
+ return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":"2","strokeLinecap":"round","strokeLinejoin":"round"},"child":[{"tag":"path","attr":{"d":"M7 7l5 5l-5 5"},"child":[]},{"tag":"path","attr":{"d":"M13 7l5 5l-5 5"},"child":[]}]})(props);
106
110
  }function TbCrop11 (props) {
107
111
  return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none","stroke":"currentColor","strokeWidth":"2","strokeLinecap":"round","strokeLinejoin":"round"},"child":[{"tag":"path","attr":{"d":"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z"},"child":[]}]})(props);
108
112
  }function TbDots (props) {
@@ -459,7 +463,7 @@ var minWidthConfig$1 = {
459
463
  var iconOnlySizeConfig$1 = {
460
464
  lg: 'py-[13px] h-[48px] w-[48px] flex items-center justify-center gap-[10px]',
461
465
  md: 'py-[11px] h-[40px] w-[40px] flex items-center justify-center gap-[5px]',
462
- sm: 'py-[8px] h-[30px] w-[30px] flex items-center justify-center gap-[5px] ',
466
+ sm: 'py-[8px] h-[30px] w-[30px] flex items-center justify-center gap-[5px]',
463
467
  tn: 'py-[4px] h-[22px] w-[22px] flex items-center justify-center gap-[3px]',
464
468
  };
465
469
  var doubleIconSizeConfig = {
@@ -477,7 +481,7 @@ var variantConfig$2 = {
477
481
  warning: "text-primary-white bg-bia-orange active:bg-bia-orange-active hover:bg-bia-orange-hover disabled:bg-bia-orange-light-50 disabled:text-bia-orange-light-90 focus-visible:outline focus-visible:outline-offset-0 focus-visible:outline-bia-orange-light-50 focus-visible:outline-[3px] focus-visible:rounded-md shadow-bia-orange-disabled ".concat(shadow),
478
482
  danger: "text-primary-white bg-bia-red active:bg-bia-red-dark-10 hover:bg-bia-red-hover disabled:bg-bia-red-light-50 disabled:text-bia-red-light-90 focus-visible:outline focus-visible:outline-offset-0 focus-visible:outline-bia-red-light-50 focus-visible:outline-[3px] focus-visible:rounded-md shadow-bia-red-disabled ".concat(shadow),
479
483
  link: "text-bia-blue bg-transparent hover:text-bia-blue-hover disabled:text-bia-blue-light-50 focus-visible:outline-none focus-visible:outline-offset-0 focus-visible:outline-[3px] focus-visible:rounded-md focus-visible:outline-bia-blue-light-50",
480
- subtle: "text-primary-cool bg-bia-grey-disabled active:bg-bia-grey-dark-10 hover:bg-bia-grey-hover disabled:bg-bia-grey-light-50disabled:text-bia-grey-dark-10 focus-visible:outline-none focus-visible:outline-offset-0 focus-visible:outline-[3px] focus-visible:rounded-md focus-visible:outline-bia-blue-light-50 ",
484
+ subtle: "text-primary-cool bg-bia-grey-light-50 active:bg-bia-grey-dark-10 hover:bg-bia-grey-hover disabled:bg-bia-grey-light-50 disabled:text-bia-grey-dark-10 focus-visible:outline-none focus-visible:outline-offset-0 focus-visible:outline-[3px] focus-visible:rounded-md focus-visible:outline-bia-blue-light-50 ",
481
485
  'subtle-link': "text-bia-coolgrey bg-transparent active:text-bia-blue-dark-10 hover:text-bia-blue-light-10 disabled:text-bia-coolgrey-light-50 focus-visible:outline-none focus-visible:outline-offset-0 focus-visible:outline-[3px] focus-visible:rounded-md focus-visible:outline-bia-blue-light-50 ",
482
486
  'default-outlined': "text-primary-black bg-primary-white border-bia-coolgrey border-solid active:bg-bia-coolgrey-light-90 active:border-bia-coolgrey-active hover:border-bia-coolgrey-hover border disabled:bg-primary-white disabled:border-[1px]disabled:border-bia-coolgrey-disabled disabled:text-bia-coolgrey-disabled focus-visible:outline-none focus-visible:outline-offset-0 focus-visible:outline-[3px] focus-visible:rounded-md focus-visible:outline-bia-coolgrey-light-50 focus-visible:border-none",
483
487
  'primary-outlined': "bg-primary-white border border-bia-blue active:text-bia-blue-active active:bg-bia-blue-pastel active:border-bia-blue-active hover:text-bia-blue-hover hover:border-bia-blue-hover disabled:border-[1px]disabled:border-bia-blue-disabled disabled:text-bia-blue-disabled focus-visible:outline-none focus-visible:outline-offset-0 focus-visible:outline-bia-blue-disabled focus-visible:outline-[3px] focus-visible:rounded-md text-bia-blue focus-visible:border-none",
@@ -1555,6 +1559,27 @@ var ContextualButton = React.forwardRef(function (_a, ref) {
1555
1559
  actionElement))));
1556
1560
  });
1557
1561
 
1562
+ var config$2 = {
1563
+ 'dark-background': 'bg-white hover:bg-bia-grey-light-90 outline-none focus:outline-2 focus:outline-bia-blue-light-50 focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 active:bg-bia-grey-light-80',
1564
+ 'light-background': 'bg-bia-grey-light-90 hover:bg-bia-grey-light-80 outline-none focus:outline-2 focus:outline-bia-blue-light-50 focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 active:bg-bia-grey-light-70',
1565
+ 'outline-light-background': 'bg-white border border-bia-grey-light-40 hover:bg-bia-grey-light-90 outline-none focus:outline-2 focus:outline-bia-blue-light-50 focus-visible:outline-2 focus-visible:outline-bia-blue-light-50 active:bg-bia-grey-light-80',
1566
+ };
1567
+
1568
+ var Card = function (_a) {
1569
+ var children = _a.children, disabled = _a.disabled, variant = _a.variant;
1570
+ var base = config$2[variant || 'dark-background'];
1571
+ var removeStateClasses = function (cls) {
1572
+ return cls
1573
+ .replace(/\b(?:hover|active|focus-visible|focus):[^\s]+/g, '')
1574
+ .replace(/\s+/g, ' ')
1575
+ .trim();
1576
+ };
1577
+ var cardClassName = disabled
1578
+ ? "".concat(removeStateClasses(base), " cursor-not-allowed")
1579
+ : base;
1580
+ return (React.createElement("button", { disabled: disabled, "aria-disabled": disabled, className: "rounded-radius-md p-5 ".concat(cardClassName), tabIndex: disabled ? -1 : 0 }, children));
1581
+ };
1582
+
1558
1583
  function Color() {
1559
1584
  var colors = [
1560
1585
  {
@@ -1696,7 +1721,7 @@ var FileTree = function (_a) {
1696
1721
  return (React.createElement("div", { className: "file-tree" },
1697
1722
  data.map(function (_a, index) {
1698
1723
  var label = _a.label, nodes = _a.nodes, props = __rest(_a, ["label", "nodes"]);
1699
- return (React.createElement(TreeItem, __assign({ label: label, nodes: nodes, key: index, color: color, chevronColor: chevronColor, handleRightClick: handleRightClick, onMouseDownTreeItem: onMouseDown }, props)));
1724
+ return (React.createElement(TreeItem$1, __assign({ label: label, nodes: nodes, key: index, color: color, chevronColor: chevronColor, handleRightClick: handleRightClick, onMouseDownTreeItem: onMouseDown }, props)));
1700
1725
  }),
1701
1726
  isOpenContMenu && (React.createElement("div", { style: menuStyle, ref: popupRef, className: "bianic-filetree-contextmenu" }, React.isValidElement(contextMenu)
1702
1727
  ? // Kirimkan handleItemClick sebagai props onClick ke setiap MenuItem
@@ -1706,7 +1731,7 @@ var FileTree = function (_a) {
1706
1731
  })
1707
1732
  : contextMenu))));
1708
1733
  };
1709
- var TreeItem = function (_a) {
1734
+ var TreeItem$1 = function (_a) {
1710
1735
  var label = _a.label, nodes = _a.nodes, color = _a.color, chevronColor = _a.chevronColor, handleRightClick = _a.handleRightClick, onMouseDownTreeItem = _a.onMouseDownTreeItem, props = __rest(_a, ["label", "nodes", "color", "chevronColor", "handleRightClick", "onMouseDownTreeItem"]);
1711
1736
  var treeRef = React.useRef(null);
1712
1737
  var _b = React.useState(false), isExpand = _b[0], setIsExpand = _b[1];
@@ -1747,10 +1772,106 @@ var TreeItem = function (_a) {
1747
1772
  React.createElement(Text, { variant: "small-text" }, label))),
1748
1773
  isExpand && nodes && nodes.length > 0 && (React.createElement("div", { className: "ml-4" }, nodes.map(function (_a, index) {
1749
1774
  var label = _a.label, nodes = _a.nodes, props = __rest(_a, ["label", "nodes"]);
1750
- return (React.createElement(TreeItem, __assign({ label: label, nodes: nodes, key: index, color: color, handleRightClick: handleRightClick, onMouseDownTreeItem: onMouseDownTreeItem }, props)));
1775
+ return (React.createElement(TreeItem$1, __assign({ label: label, nodes: nodes, key: index, color: color, handleRightClick: handleRightClick, onMouseDownTreeItem: onMouseDownTreeItem }, props)));
1751
1776
  })))));
1752
1777
  };
1753
1778
 
1779
+ var TreeItem = function (_a) {
1780
+ var data = _a.data, expandedData = _a.expandedData, setExpandedData = _a.setExpandedData, dataMap = _a.dataMap, activeUnitId = _a.activeUnitId, handleChevronClick = _a.handleChevronClick, handleRightClick = _a.handleRightClick, handleCLick = _a.handleCLick;
1781
+ var isExpanded = !!expandedData.get(data.id);
1782
+ var toogleExpand = function () {
1783
+ var isCurrentlyExpanded = !!expandedData.get(data.id);
1784
+ // create a new Map based on the existing one
1785
+ var newExpandedState = new Map(expandedData);
1786
+ if (isCurrentlyExpanded) {
1787
+ // Logic to collapse this data and all its descendants
1788
+ var collapseDescendants_1 = function (parent) {
1789
+ newExpandedState.set(parent.id, false);
1790
+ if (parent.children && parent.children.length > 0)
1791
+ parent.children.forEach(function (child) { return collapseDescendants_1(child); });
1792
+ };
1793
+ collapseDescendants_1(data);
1794
+ }
1795
+ else {
1796
+ // Logic to expand this data and all its ancestors
1797
+ var current = data;
1798
+ while (current) {
1799
+ newExpandedState.set(current.id, true);
1800
+ current = dataMap[current.parent];
1801
+ }
1802
+ }
1803
+ setExpandedData(newExpandedState);
1804
+ };
1805
+ var clickItemHandler = function () {
1806
+ if (data.children && !isExpanded)
1807
+ toogleExpand();
1808
+ // forward selection event to optional handler; cast is used because this is a click callback without a MouseEvent
1809
+ handleCLick === null || handleCLick === void 0 ? void 0 : handleCLick(data);
1810
+ };
1811
+ var chevronClickHandler = function () {
1812
+ toogleExpand();
1813
+ handleChevronClick === null || handleChevronClick === void 0 ? void 0 : handleChevronClick(data);
1814
+ };
1815
+ return (React.createElement("div", { className: "tree-item" },
1816
+ React.createElement("div", { className: "tree-item-header flex items-center justify-start" },
1817
+ data.children ? (React.createElement("button", { className: "tree-item-chevron", onClick: chevronClickHandler, type: "button" },
1818
+ React.createElement(TbChevronRight, { className: "chevron ".concat(activeUnitId === data.id ? 'text-bia-green hover:text-bia-green-light-10' : 'text-bia-coolgrey-light-50 hover:text-bia-coolgrey-light-20', " ").concat(isExpanded ? 'rotate-90' : ''), size: 18 }))) : (React.createElement("div", { className: "chevron-placeholder aspect-square min-w-[18px]" })),
1819
+ React.createElement("button", { className: "tree-item-label rounded-radius-sm px-0.5 py-[0.5px] text-start font-segoe text-size-sm font-normal text-bia-black ".concat(activeUnitId === data.id ? 'bg-bia-green-light-70' : 'hover:bg-bia-coolgrey-light-90'), onClick: clickItemHandler, type: "button", onContextMenu: function (e) {
1820
+ e.preventDefault();
1821
+ handleRightClick === null || handleRightClick === void 0 ? void 0 : handleRightClick(data);
1822
+ } }, data.label)),
1823
+ isExpanded && data.children && (React.createElement("div", { className: "tree-item-children flex flex-col gap-0.5 rounded-radius-sm pl-[18px]" }, data.children.map(function (childUnit) { return (React.createElement(TreeItem, { key: childUnit.id, data: childUnit, expandedData: expandedData, setExpandedData: setExpandedData, dataMap: dataMap, activeUnitId: activeUnitId, handleRightClick: handleRightClick, handleCLick: handleCLick })); })))));
1824
+ };
1825
+
1826
+ var defaultAlias = {
1827
+ id: null,
1828
+ label: null,
1829
+ parent: null,
1830
+ };
1831
+ var unitTransformator = function (unit, alias) {
1832
+ var _a, _b, _c;
1833
+ if (alias === void 0) { alias = defaultAlias; }
1834
+ var newUnit = {
1835
+ id: unit[(_a = alias.id) !== null && _a !== void 0 ? _a : 'id'],
1836
+ label: unit[(_b = alias.label) !== null && _b !== void 0 ? _b : 'label'],
1837
+ parent: unit[(_c = alias.parent) !== null && _c !== void 0 ? _c : 'parent'],
1838
+ children: [],
1839
+ data: __assign({}, unit),
1840
+ }; // new unit object that will used in TreeItem Component
1841
+ return newUnit;
1842
+ };
1843
+ var useFileTree = function (data, alias) {
1844
+ if (alias === void 0) { alias = defaultAlias; }
1845
+ var _a = React.useState(function () { return new Map(); }), expandedData = _a[0], setExpandedData = _a[1];
1846
+ var usedAlias = __assign(__assign({}, defaultAlias), alias);
1847
+ // A map to store all items by their ID for quick lookup
1848
+ var map = new Map();
1849
+ // An array to hold the root-level objects
1850
+ var tree = [];
1851
+ // First, create a map of all items
1852
+ data.forEach(function (unit) {
1853
+ map.set(unit['id'], unitTransformator(unit, usedAlias));
1854
+ });
1855
+ // build tree structure by linkiing children to parents
1856
+ map.forEach(function (unit) {
1857
+ var parent = map.get(unit.parent);
1858
+ if (parent) {
1859
+ // Find the correct insertion point for the new child
1860
+ var insertionIndex = parent.children.findIndex(function (child) {
1861
+ return unit.label.toLowerCase().localeCompare(child.label.toLowerCase()) < 0;
1862
+ });
1863
+ // Insert the new child at the correct position
1864
+ if (insertionIndex === -1)
1865
+ parent.children.push(unit);
1866
+ else
1867
+ parent.children.splice(insertionIndex, 0, unit);
1868
+ }
1869
+ else
1870
+ tree.push(unit);
1871
+ });
1872
+ return { tree: tree, map: map, expandedData: expandedData, setExpandedData: setExpandedData };
1873
+ };
1874
+
1754
1875
  var getContextualPopupStyle = function (anchorRef, popupRef, position) {
1755
1876
  if (!anchorRef.current || !popupRef.current) {
1756
1877
  return {};
@@ -1989,15 +2110,15 @@ MenuItem.defaultProps = {
1989
2110
  };
1990
2111
 
1991
2112
  function Tooltip(props) {
1992
- var children = props.children, content = props.content, delay = props.delay, _a = props.direction, direction = _a === void 0 ? 'top' : _a, _b = props.maxWidth, maxWidth = _b === void 0 ? undefined : _b;
2113
+ var children = props.children, content = props.content, delay = props.delay, _a = props.direction, direction = _a === void 0 ? 'top' : _a, _b = props.maxWidth, maxWidth = _b === void 0 ? undefined : _b, _c = props.zIndex, zIndex = _c === void 0 ? 150 : _c, className = props.className, style = props.style;
1993
2114
  var timeout;
1994
- var _c = React.useState(false), active = _c[0], setActive = _c[1];
2115
+ var _d = React.useState(false), active = _d[0], setActive = _d[1];
1995
2116
  var anchorRef = React.useRef(null);
1996
2117
  var tooltipContainerRef = React.useRef(null);
1997
- var _d = React.useState({
2118
+ var _e = React.useState({
1998
2119
  maxWidth: maxWidth + 'px',
1999
2120
  whiteSpace: 'nowrap',
2000
- }), tooltipContainerStyle = _d[0], setTooltipContainerStyle = _d[1];
2121
+ }), tooltipContainerStyle = _e[0], setTooltipContainerStyle = _e[1];
2001
2122
  var showTip = function () {
2002
2123
  timeout = setTimeout(function () {
2003
2124
  setActive(true);
@@ -2041,12 +2162,12 @@ function Tooltip(props) {
2041
2162
  }, [content, maxWidth, scrollWidth, offsetHeight]);
2042
2163
  return (React.createElement("div", { className: "tooltip-wrapper relative inline-flex h-fit w-fit flex-col", onMouseEnter: showTip, onMouseLeave: hideTip, ref: anchorRef },
2043
2164
  children,
2044
- active && (React.createElement(TooltipItem, { anchorRef: anchorRef, direction: direction, content: content, tooltipContainerRef: tooltipContainerRef, tooltipContainerStyle: tooltipContainerStyle }))));
2165
+ active && (React.createElement(TooltipItem, { anchorRef: anchorRef, direction: direction, content: content, tooltipContainerRef: tooltipContainerRef, tooltipContainerStyle: tooltipContainerStyle, zIndex: zIndex, className: className, style: style }))));
2045
2166
  }
2046
2167
  var TooltipItem = function (_a) {
2047
- var anchorRef = _a.anchorRef, direction = _a.direction, content = _a.content, tooltipContainerRef = _a.tooltipContainerRef, tooltipContainerStyle = _a.tooltipContainerStyle;
2168
+ var anchorRef = _a.anchorRef, className = _a.className, content = _a.content, direction = _a.direction, style = _a.style, tooltipContainerRef = _a.tooltipContainerRef, tooltipContainerStyle = _a.tooltipContainerStyle, zIndex = _a.zIndex;
2048
2169
  var positionStyle = usePopupPosition(anchorRef, tooltipContainerRef, direction)[0];
2049
- return reactDom.createPortal(React.createElement("div", { className: "tooltip-container break-word absolute z-50 inline-block break-all rounded-[4px] bg-primary-black px-[7px] py-[4px] text-size-sm text-primary-white", style: __assign(__assign({}, positionStyle), tooltipContainerStyle), ref: tooltipContainerRef }, content), document.body);
2170
+ return reactDom.createPortal(React.createElement("div", { className: "tooltip-container break-word absolute inline-block break-all rounded-[4px] bg-primary-black px-[7px] py-[4px] text-size-sm text-primary-white ".concat(className), style: __assign(__assign(__assign({ zIndex: zIndex }, positionStyle), tooltipContainerStyle), style), ref: tooltipContainerRef }, content), document.body);
2050
2171
  };
2051
2172
  Tooltip.defaultProps = {
2052
2173
  delay: 400,
@@ -3590,48 +3711,78 @@ var positionConfig = {
3590
3711
  end: 'justify-end',
3591
3712
  };
3592
3713
 
3714
+ var SelectedPage = function (_a) {
3715
+ var label = _a.label, _b = _a.size, size = _b === void 0 ? 'sm' : _b;
3716
+ var basicButtonStyle = 'bianic-custom-button bianic-fgc-target flex items-center justify-center font-semibold cursor-default';
3717
+ var basicColorStyle = 'text-primary-cool bg-bia-grey-dark-10 focus-visible:outline-none focus-visible:outline-offset-0 focus-visible:outline-[3px] focus-visible:rounded-md focus-visible:outline-bia-blue-light-50';
3718
+ var textStyleOptions = {
3719
+ sm: 'text-size-sm',
3720
+ md: 'text-size-base',
3721
+ };
3722
+ var sizeStyleOptions = "".concat(iconOnlySizeConfig$1[size], " ").concat(radiusConfig$1['default'][size]);
3723
+ var style = "".concat(basicButtonStyle, " ").concat(basicColorStyle, " ").concat(sizeStyleOptions, " ").concat(textStyleOptions[size]);
3724
+ return React.createElement("div", { className: style }, label);
3725
+ };
3726
+
3593
3727
  function PaginationBar(_a) {
3594
3728
  var size = _a.size, position = _a.position, currentPage = _a.currentPage, totalPages = _a.totalPages, onPageChange = _a.onPageChange;
3595
- var _b = React.useState([]), range = _b[0], setRange = _b[1];
3596
- var _c = React.useState([]), showedPages = _c[0], setShowedPages = _c[1];
3729
+ var totalRange = Array.from({ length: totalPages }, function (_, i) { return i + 1; });
3730
+ var PAGE_SIZE = 5;
3731
+ var _b = React.useState(0), startIndex = _b[0], setStartIndex = _b[1];
3732
+ var _c = React.useState(totalRange.slice(startIndex, PAGE_SIZE)), showedPages = _c[0], setShowedPages = _c[1];
3597
3733
  var buttonSizingStyle = size === 'sm' ? 31 : 38;
3598
3734
  var iconSize = size === 'sm' ? 14 : 18;
3599
- React.useEffect(function () {
3600
- var tempRange = [];
3601
- for (var i = 1; i <= totalPages; i += 1) {
3602
- tempRange.push(i);
3603
- }
3604
- setRange(tempRange);
3605
- }, [totalPages]);
3606
- React.useEffect(function () {
3607
- var usedRange = [];
3608
- var startRange = 0;
3609
- var endRange = totalPages > 5 ? 5 : totalPages;
3610
- if (totalPages > 5) {
3611
- if (currentPage < 3) {
3612
- endRange = 5;
3613
- }
3614
- else if (currentPage >= totalPages - 1) {
3615
- startRange = totalPages - 5;
3616
- endRange = totalPages;
3617
- }
3618
- else {
3619
- startRange = currentPage - 3;
3620
- endRange = currentPage + 2;
3621
- }
3622
- }
3623
- usedRange = range.slice(startRange, endRange);
3624
- setShowedPages(usedRange);
3625
- }, [currentPage, totalPages, range]);
3626
3735
  var handlePageChange = function (page) {
3627
- if (page >= 1 && page <= totalPages) {
3736
+ if (page >= 1 && page <= totalPages)
3628
3737
  onPageChange(page);
3629
- }
3630
3738
  };
3739
+ var handleNextRange = function () {
3740
+ var newStartIndex = startIndex + PAGE_SIZE;
3741
+ if (newStartIndex < totalPages)
3742
+ setStartIndex(newStartIndex);
3743
+ else
3744
+ setStartIndex(totalPages - PAGE_SIZE);
3745
+ };
3746
+ var handlePrevRange = function () {
3747
+ var newStartIndex = startIndex - PAGE_SIZE;
3748
+ if (newStartIndex >= 0)
3749
+ setStartIndex(newStartIndex);
3750
+ else
3751
+ setStartIndex(0);
3752
+ };
3753
+ var getStartIndex = function (index) {
3754
+ if (index + PAGE_SIZE > totalPages)
3755
+ return Math.max(0, totalPages - PAGE_SIZE);
3756
+ return index;
3757
+ };
3758
+ React.useEffect(function () {
3759
+ var correctedIndex = getStartIndex(startIndex);
3760
+ setShowedPages(totalRange.slice(correctedIndex, correctedIndex + PAGE_SIZE));
3761
+ }, [startIndex, totalRange, totalPages]);
3631
3762
  return (React.createElement("div", { className: "flex ".concat(positionConfig[position], " gap-[5px]") },
3632
- React.createElement(Button, { variant: "subtle-link", size: size, type: "button", onClick: function () { return handlePageChange(currentPage - 1); }, className: "cursor-pointer", iconLeft: React.createElement(TbChevronLeft, { size: iconSize }), disabled: currentPage === 1 }),
3633
- showedPages.map(function (page) { return (React.createElement(Button, { key: page, variant: currentPage === page ? 'default' : 'subtle-link', size: size, type: "button", onClick: function () { return handlePageChange(page); }, className: "cursor-pointer ".concat(sizeConfig$2[size]), label: page.toString(), minWidth: buttonSizingStyle })); }),
3634
- React.createElement(Button, { variant: "subtle-link", size: size, type: "button", onClick: function () { return handlePageChange(currentPage + 1); }, className: "cursor-pointer", iconLeft: React.createElement(TbChevronRight, { size: iconSize }), disabled: currentPage === totalPages })));
3763
+ totalPages > 5 && (React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: handlePrevRange, className: showedPages[0] === 1 ? '' : 'cursor-pointer', iconLeft: React.createElement(TbChevronsLeft, { size: iconSize }), disabled: showedPages[0] === 1 })),
3764
+ React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: function () {
3765
+ handlePageChange(currentPage - 1);
3766
+ if (showedPages[0] === currentPage)
3767
+ setStartIndex(function (old) { return old - 1; });
3768
+ }, className: currentPage === 1 ? '' : 'cursor-pointer', iconLeft: React.createElement(TbChevronLeft, { size: iconSize }), disabled: currentPage === 1 }),
3769
+ showedPages.map(function (page) {
3770
+ if (page === currentPage) {
3771
+ return React.createElement(SelectedPage, { key: page, label: page.toString(), size: size });
3772
+ }
3773
+ return (React.createElement(Button, { key: page, variant: "subtle", size: size, type: "button", onClick: function () {
3774
+ handlePageChange(page);
3775
+ }, className: "cursor-pointer ".concat(sizeConfig$2[size]), label: page.toString(), minWidth: buttonSizingStyle }));
3776
+ }),
3777
+ React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: function () {
3778
+ handlePageChange(currentPage + 1);
3779
+ if (showedPages[4] === currentPage) {
3780
+ setStartIndex(function (old) { return old + 1; });
3781
+ }
3782
+ }, className: currentPage === totalPages ? '' : 'cursor-pointer', iconLeft: React.createElement(TbChevronRight, { size: iconSize }), disabled: currentPage === totalPages }),
3783
+ totalPages > 5 && (React.createElement(Button, { variant: "subtle", size: size, type: "button", onClick: handleNextRange, className: showedPages[showedPages.length - 1] === totalPages
3784
+ ? ''
3785
+ : 'cursor-pointer', iconLeft: React.createElement(TbChevronsRight, { size: iconSize }), disabled: showedPages[showedPages.length - 1] === totalPages }))));
3635
3786
  }
3636
3787
 
3637
3788
  var activeConfig = {
@@ -3716,20 +3867,19 @@ var classConfig = {
3716
3867
  };
3717
3868
 
3718
3869
  function Popover(_a) {
3719
- var children = _a.children, content = _a.content; _a.delay; var _c = _a.direction, direction = _c === void 0 ? 'bottom' : _c, _d = _a.title, title = _d === void 0 ? '' : _d; _a.maxWidth;
3870
+ var className = _a.className, children = _a.children, content = _a.content, _b = _a.direction, direction = _b === void 0 ? 'bottom' : _b; _a.maxWidth; var _c = _a.title, title = _c === void 0 ? '' : _c, style = _a.style, zIndex = _a.zIndex;
3720
3871
  var wrapperRef = React.useRef(null);
3721
- React.useRef(null);
3722
- var _e = useDetectOutsideClick(wrapperRef, false), isOpen = _e[0], setIsOpen = _e[1];
3872
+ var _d = useDetectOutsideClick(wrapperRef, false), isOpen = _d[0], setIsOpen = _d[1];
3723
3873
  return (React.createElement("div", { className: "Bianic-popover-Wrapper relative block h-fit w-fit", role: "button", ref: wrapperRef, onClick: function () { return setIsOpen(true); } },
3724
3874
  children,
3725
- isOpen && (React.createElement(PopoverItem, { title: title, content: content, anchorRef: wrapperRef, direction: direction }))));
3875
+ isOpen && (React.createElement(PopoverItem, { title: title, content: content, anchorRef: wrapperRef, direction: direction, className: className, style: style, zIndex: zIndex }))));
3726
3876
  }
3727
3877
  var PopoverItem = function (_a) {
3728
- var title = _a.title, content = _a.content, anchorRef = _a.anchorRef, direction = _a.direction;
3878
+ var title = _a.title, content = _a.content, anchorRef = _a.anchorRef, direction = _a.direction, className = _a.className, style = _a.style, zIndex = _a.zIndex;
3729
3879
  var popoverRef = React.useRef(null);
3730
3880
  var positionStyle = usePopupPosition(anchorRef, popoverRef, direction)[0];
3731
3881
  var _b = classConfig[direction], triangleContainer = _b.triangleContainer, triangleShape = _b.triangleShape;
3732
- return reactDom.createPortal(React.createElement("div", { ref: popoverRef, style: positionStyle, className: "Bianic-popover-Tip text-bia-sm absolute z-50 w-[245px] space-y-[5px] rounded-[4px] bg-primary-black px-[20px] py-[17.5px] text-primary-white" },
3882
+ return reactDom.createPortal(React.createElement("div", { ref: popoverRef, style: __assign(__assign(__assign({}, positionStyle), style), { zIndex: zIndex }), className: "Bianic-popover-Tip text-bia-sm absolute z-50 w-[245px] space-y-[5px] rounded-[4px] bg-primary-black px-[20px] py-[17.5px] text-primary-white ".concat(className) },
3733
3883
  React.createElement("div", { className: "flex flex-col" },
3734
3884
  React.createElement("div", { className: "mb-[5px] font-humnst777 text-[16px] font-bold leading-[19.42px]" }, title),
3735
3885
  React.createElement("div", { className: "break-words font-segoe text-[12px] font-normal" }, content)),
@@ -3737,7 +3887,6 @@ var PopoverItem = function (_a) {
3737
3887
  React.createElement("div", { className: "h-0 w-0 ".concat(triangleShape) }))), document.body);
3738
3888
  };
3739
3889
  Popover.defaultProps = {
3740
- delay: 400,
3741
3890
  direction: 'top',
3742
3891
  title: '',
3743
3892
  };
@@ -4302,6 +4451,7 @@ exports.Brand = Brand;
4302
4451
  exports.Breadcrumb = Breadcrumb;
4303
4452
  exports.Button = Button;
4304
4453
  exports.ButtonApp = ButtonApp;
4454
+ exports.Card = Card;
4305
4455
  exports.Checkbox = Checkbox;
4306
4456
  exports.Color = Color;
4307
4457
  exports.ContextualButton = ContextualButton;
@@ -4346,4 +4496,6 @@ exports.TextInput = TextInput;
4346
4496
  exports.Toaster = Toaster;
4347
4497
  exports.Toggle = Toggle;
4348
4498
  exports.Tooltip = Tooltip;
4499
+ exports.TreeItem = TreeItem;
4349
4500
  exports.Window = Window;
4501
+ exports.useFileTree = useFileTree;