bianic-ui 2.14.0-beta.4 → 2.14.0-beta.6

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 (42) hide show
  1. package/dist/cjs/index.js +126 -162
  2. package/dist/cjs/lib.css +1 -1
  3. package/dist/cjs/types/components/FileTree/TreeItem.d.ts +5 -4
  4. package/dist/cjs/types/components/InfoPanel/index.d.ts +9 -3
  5. package/dist/cjs/types/components/Stepper/Horizontal/configs.d.ts +2 -5
  6. package/dist/cjs/types/components/Stepper/Horizontal/index.d.ts +1 -1
  7. package/dist/cjs/types/components/Stepper/Horizontal/types.d.ts +2 -2
  8. package/dist/cjs/types/components/Stepper/index.d.ts +1 -1
  9. package/dist/cjs/types/components/Table/TableCell/index.d.ts +2 -1
  10. package/dist/cjs/types/components/index.d.ts +1 -2
  11. package/dist/cjs/types/stories/FileTree/FileTree.stories.d.ts +1 -1
  12. package/dist/cjs/types/stories/FileTree/FileTreeContextMenu.stories.d.ts +1 -1
  13. package/dist/cjs/types/stories/Form/Dropdown/DropdownContainer.test.stories.d.ts +28 -0
  14. package/dist/cjs/types/stories/Form/LiveSearch/Livesearch.test.stories.d.ts +27 -0
  15. package/dist/cjs/types/stories/HorizontalStepper/HorizontalStepper.stories.d.ts +3 -0
  16. package/dist/cjs/types/stories/HorizontalStepper/HorizontalStepper.test.stories.d.ts +18 -0
  17. package/dist/cjs/types/stories/InfoPanel/InfoPanel.stories.d.ts +1 -0
  18. package/dist/cjs/types/stories/Sidebar/SidebarContainer.stories.d.ts +1 -0
  19. package/dist/cjs/types/stories/Table/TableCell.stories.d.ts +4 -0
  20. package/dist/cjs/types/utility/hooks/usePopupPosition.d.ts +1 -1
  21. package/dist/esm/index.js +127 -162
  22. package/dist/esm/lib.css +1 -1
  23. package/dist/esm/types/components/FileTree/TreeItem.d.ts +5 -4
  24. package/dist/esm/types/components/InfoPanel/index.d.ts +9 -3
  25. package/dist/esm/types/components/Stepper/Horizontal/configs.d.ts +2 -5
  26. package/dist/esm/types/components/Stepper/Horizontal/index.d.ts +1 -1
  27. package/dist/esm/types/components/Stepper/Horizontal/types.d.ts +2 -2
  28. package/dist/esm/types/components/Stepper/index.d.ts +1 -1
  29. package/dist/esm/types/components/Table/TableCell/index.d.ts +2 -1
  30. package/dist/esm/types/components/index.d.ts +1 -2
  31. package/dist/esm/types/stories/FileTree/FileTree.stories.d.ts +1 -1
  32. package/dist/esm/types/stories/FileTree/FileTreeContextMenu.stories.d.ts +1 -1
  33. package/dist/esm/types/stories/Form/Dropdown/DropdownContainer.test.stories.d.ts +28 -0
  34. package/dist/esm/types/stories/Form/LiveSearch/Livesearch.test.stories.d.ts +27 -0
  35. package/dist/esm/types/stories/HorizontalStepper/HorizontalStepper.stories.d.ts +3 -0
  36. package/dist/esm/types/stories/HorizontalStepper/HorizontalStepper.test.stories.d.ts +18 -0
  37. package/dist/esm/types/stories/InfoPanel/InfoPanel.stories.d.ts +1 -0
  38. package/dist/esm/types/stories/Sidebar/SidebarContainer.stories.d.ts +1 -0
  39. package/dist/esm/types/stories/Table/TableCell.stories.d.ts +4 -0
  40. package/dist/esm/types/utility/hooks/usePopupPosition.d.ts +1 -1
  41. package/dist/index.d.ts +18 -27
  42. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -1819,84 +1819,15 @@ function Divider(_a) {
1819
1819
  return (React.createElement("div", { className: "bianic-divider bg-bia-grey-light-50 ".concat(margin, " ").concat(config, " ").concat(className) }));
1820
1820
  }
1821
1821
 
1822
- function TreeItem$1(_a) {
1823
- var label = _a.label, _b = _a.nodes, nodes = _b === void 0 ? undefined : _b, _c = _a.color, color = _c === void 0 ? undefined : _c, _d = _a.chevronColor, chevronColor = _d === void 0 ? undefined : _d, _e = _a.handleRightClick, handleRightClick = _e === void 0 ? undefined : _e, _f = _a.onMouseDownTreeItem, onMouseDownTreeItem = _f === void 0 ? undefined : _f, props = __rest(_a, ["label", "nodes", "color", "chevronColor", "handleRightClick", "onMouseDownTreeItem"]);
1824
- var treeRef = React.useRef(null);
1825
- var _g = React.useState(false), isExpand = _g[0], setIsExpand = _g[1];
1826
- var _h = React.useState(false), isFocused = _h[0], setIsFocused = _h[1];
1827
- var _j = useDetectOutsideClick(treeRef, false, 'mousedown'), isClickRight = _j[0], setIsClickRight = _j[1];
1828
- var focusedIconColor = chevronColor || color
1829
- ? "text-bia-".concat(chevronColor || color)
1830
- : 'text-bia-coolgrey-light-50';
1831
- var focusedBgColor = color ? "bg-bia-".concat(color) : 'bg-bia-coolgrey-light-50';
1832
- var clickRightClass = 'outline outline-[3px] outline-bia-blue-light-50';
1833
- var textClass = "flex items-center rounded-radius-sm px-[2px] cursor-pointer hover:bg-bia-coolgrey-light-90 focus:pointer-events-none ".concat(isFocused && focusedBgColor, " ").concat(isClickRight && clickRightClass);
1834
- return (React.createElement("div", { className: "bianic-tree-item" },
1835
- React.createElement("div", { className: "justify-left group flex items-center", ref: treeRef },
1836
- nodes && nodes.length > 0 ? (React.createElement("button", { type: "button", className: "cursor-pointer", onClick: function () {
1837
- setIsExpand(function (prev) { return !prev; });
1838
- } },
1839
- React.createElement(TbChevronRight, { className: "".concat(isFocused ? focusedIconColor : 'text-bia-coolgrey-light-20', " ").concat(isExpand && 'rotate-90'), size: 18 }))) : (React.createElement("div", { className: "aspect-square w-[18px]" })),
1840
- React.createElement("button", __assign({ type: "button", onFocus: function (e) {
1841
- var _a;
1842
- setIsFocused(true);
1843
- (_a = props === null || props === void 0 ? void 0 : props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
1844
- }, onBlur: function (e) {
1845
- var _a;
1846
- setIsFocused(false);
1847
- setIsClickRight(false); // Reset isClickRight saat blur
1848
- (_a = props === null || props === void 0 ? void 0 : props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
1849
- }, className: textClass, onMouseDown: function (e) {
1850
- if (e.button === 2) {
1851
- // 2 = tombol kanan mouse
1852
- e.preventDefault(); // Blokir default lebih awal
1853
- }
1854
- onMouseDownTreeItem === null || onMouseDownTreeItem === void 0 ? void 0 : onMouseDownTreeItem(e, __assign({ label: label, nodes: nodes }, props));
1855
- }, onContextMenu: function (e) {
1856
- e.preventDefault();
1857
- setIsClickRight(true);
1858
- handleRightClick === null || handleRightClick === void 0 ? void 0 : handleRightClick(e);
1859
- } }, props),
1860
- React.createElement(Text, { variant: "small-text" }, label))),
1861
- isExpand && nodes && nodes.length > 0 && (React.createElement("div", { className: "ml-4" }, nodes.map(function (_a) {
1862
- var childLabel = _a.label, childNodes = _a.nodes, childProps = __rest(_a, ["label", "nodes"]);
1863
- return (React.createElement(TreeItem$1, __assign({ label: childLabel, nodes: childNodes, key: childLabel, color: color, handleRightClick: handleRightClick, onMouseDownTreeItem: onMouseDownTreeItem }, childProps)));
1864
- })))));
1865
- }
1866
- function FileTree(_a) {
1867
- var data = _a.data, _b = _a.color, color = _b === void 0 ? undefined : _b, _c = _a.chevronColor, chevronColor = _c === void 0 ? undefined : _c, _d = _a.contextMenu, contextMenu = _d === void 0 ? undefined : _d, _e = _a.onMouseDown, onMouseDown = _e === void 0 ? undefined : _e;
1868
- var popupRef = React.useRef(null); // Ref untuk div utama
1869
- var _f = useDetectOutsideClick(popupRef, false), isOpenContMenu = _f[0], setIsOpenContMenu = _f[1];
1870
- var _g = React.useState({ x: 0, y: 0 }), contMenuPosition = _g[0], setContMenuPosition = _g[1];
1871
- var menuStyle = {
1872
- position: 'fixed',
1873
- top: "".concat(contMenuPosition.y, "px"),
1874
- left: "".concat(contMenuPosition.x, "px"),
1875
- // Pastikan z-index cukup tinggi agar muncul di atas elemen lain
1876
- zIndex: 1000,
1877
- };
1878
- var handleRightClick = function (event) {
1879
- setIsOpenContMenu(true);
1880
- setContMenuPosition({ x: event.clientX, y: event.clientY });
1881
- };
1882
- return (React.createElement("div", { className: "file-tree" },
1883
- data.map(function (_a) {
1884
- var label = _a.label, nodes = _a.nodes, props = __rest(_a, ["label", "nodes"]);
1885
- return (React.createElement(TreeItem$1, __assign({ label: label, nodes: nodes, key: label, color: color, chevronColor: chevronColor, handleRightClick: handleRightClick, onMouseDownTreeItem: onMouseDown }, props)));
1886
- }),
1887
- isOpenContMenu && (React.createElement("div", { style: menuStyle, ref: popupRef, className: "bianic-filetree-contextmenu" }, React.isValidElement(contextMenu)
1888
- ? // Kirimkan handleItemClick sebagai props onClick ke setiap MenuItem
1889
- React.cloneElement(contextMenu, {
1890
- isWithOverlay: false,
1891
- onClickItem: function () { return setIsOpenContMenu(false); },
1892
- })
1893
- : contextMenu))));
1894
- }
1895
-
1896
1822
  function TreeItem(_a) {
1897
- var data = _a.data, expandedData = _a.expandedData, setExpandedData = _a.setExpandedData, dataMap = _a.dataMap, _b = _a.activeUnitId, activeUnitId = _b === void 0 ? undefined : _b, _c = _a.handleChevronClick, handleChevronClick = _c === void 0 ? undefined : _c, _d = _a.handleRightClick, handleRightClick = _d === void 0 ? undefined : _d, _e = _a.handleCLick, handleCLick = _e === void 0 ? undefined : _e;
1823
+ var data = _a.data, expandedData = _a.expandedData, setExpandedData = _a.setExpandedData, dataMap = _a.dataMap, _b = _a.activeUnitId, activeUnitId = _b === void 0 ? undefined : _b, _c = _a.handleChevronClick, handleChevronClick = _c === void 0 ? undefined : _c, _d = _a.handleRightClick, handleRightClick = _d === void 0 ? undefined : _d, _e = _a.handleClick, handleClick = _e === void 0 ? undefined : _e;
1898
1824
  var isExpanded = !!expandedData.get(data.id);
1899
- var toogleExpand = function () {
1825
+ var hasActiveDescendant = function (unit) {
1826
+ var _a;
1827
+ return !!((_a = unit.children) === null || _a === void 0 ? void 0 : _a.some(function (child) { return child.id === activeUnitId || hasActiveDescendant(child); }));
1828
+ };
1829
+ var isChevronActive = activeUnitId === data.id || (!isExpanded && hasActiveDescendant(data));
1830
+ var toggleExpand = function () {
1900
1831
  var isCurrentlyExpanded = !!expandedData.get(data.id);
1901
1832
  // create a new Map based on the existing one
1902
1833
  var newExpandedState = new Map(expandedData);
@@ -1922,24 +1853,24 @@ function TreeItem(_a) {
1922
1853
  };
1923
1854
  var clickItemHandler = function () {
1924
1855
  if (data.children && !isExpanded)
1925
- toogleExpand();
1926
- // forward selection event to optional handler; cast is used because this is a click callback without a MouseEvent
1927
- handleCLick === null || handleCLick === void 0 ? void 0 : handleCLick(data);
1856
+ toggleExpand();
1857
+ handleClick === null || handleClick === void 0 ? void 0 : handleClick(data);
1928
1858
  };
1929
1859
  var chevronClickHandler = function () {
1930
- toogleExpand();
1860
+ toggleExpand();
1931
1861
  handleChevronClick === null || handleChevronClick === void 0 ? void 0 : handleChevronClick(data);
1932
1862
  };
1933
- return (React.createElement("div", { className: "tree-item" },
1863
+ return (React.createElement("div", { className: "tree-item", role: "treeitem", "aria-expanded": data.children ? isExpanded : undefined, "aria-selected": activeUnitId === data.id },
1934
1864
  React.createElement("div", { className: "tree-item-header flex items-center justify-start" },
1935
- data.children ? (React.createElement("button", { className: "tree-item-chevron", onClick: chevronClickHandler, type: "button" },
1936
- 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]" })),
1865
+ data.children ? (React.createElement("button", { className: "tree-item-chevron", onClick: chevronClickHandler, type: "button", "aria-label": isExpanded ? 'Collapse' : 'Expand' },
1866
+ React.createElement(TbChevronRight, { className: "chevron ".concat(isChevronActive ? '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, "aria-hidden": "true" }))) : (React.createElement("div", { className: "chevron-placeholder aspect-square min-w-[18px]" })),
1937
1867
  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) {
1938
1868
  e.preventDefault();
1939
1869
  handleRightClick === null || handleRightClick === void 0 ? void 0 : handleRightClick(data);
1940
1870
  } }, data.label)),
1941
- 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 })); })))));
1871
+ isExpanded && data.children && (React.createElement("div", { className: "tree-item-children flex flex-col gap-0.5 rounded-radius-sm pl-[18px]", role: "group" }, data.children.map(function (childUnit) { return (React.createElement(TreeItem, { key: childUnit.id, data: childUnit, expandedData: expandedData, setExpandedData: setExpandedData, dataMap: dataMap, activeUnitId: activeUnitId, handleChevronClick: handleChevronClick, handleRightClick: handleRightClick, handleClick: handleClick })); })))));
1942
1872
  }
1873
+ var TreeItem$1 = React.memo(TreeItem);
1943
1874
 
1944
1875
  var defaultAlias = {
1945
1876
  id: null,
@@ -2073,32 +2004,66 @@ var getDropdownStyle = function (anchorRef, popupRef) {
2073
2004
  }
2074
2005
  return style;
2075
2006
  };
2007
+ var noop = function () { };
2008
+ var isSameStyle = function (a, b) {
2009
+ return a.position === b.position &&
2010
+ a.top === b.top &&
2011
+ a.left === b.left &&
2012
+ a.right === b.right &&
2013
+ a.bottom === b.bottom;
2014
+ };
2076
2015
  var usePopupPosition = function (anchorRef, popupRef, position) {
2077
2016
  if (!anchorRef || !popupRef) {
2078
- return [{}, function () { }];
2017
+ return [{}, noop];
2079
2018
  }
2080
2019
  var _a = React.useState(0), repeateRender = _a[0], setRepeateRender = _a[1];
2081
2020
  var _b = React.useState({}), positionStyle = _b[0], setPositionStyle = _b[1];
2082
- var calcPosition = function () {
2021
+ var resizeObserverRef = React.useRef(null);
2022
+ var observedNodesRef = React.useRef({ popup: null, anchor: null });
2023
+ var calcPosition = React.useCallback(function () {
2083
2024
  var newStyle = position !== undefined
2084
2025
  ? getContextualPopupStyle(anchorRef, popupRef, position)
2085
2026
  : getDropdownStyle(anchorRef, popupRef);
2086
- setPositionStyle(newStyle);
2087
- };
2027
+ // Keep the same object when nothing changed, so React skips the re-render
2028
+ setPositionStyle(function (prev) { return (isSameStyle(prev, newStyle) ? prev : newStyle); });
2029
+ }, [anchorRef, popupRef, position]);
2030
+ var calcPositionRef = React.useRef(calcPosition);
2031
+ calcPositionRef.current = calcPosition;
2032
+ // Window listeners: mount only
2088
2033
  React.useLayoutEffect(function () {
2089
- if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) || !(popupRef === null || popupRef === void 0 ? void 0 : popupRef.current))
2090
- return;
2091
- calcPosition();
2092
- var resizeObserver = new ResizeObserver(calcPosition);
2093
- resizeObserver.observe(popupRef.current);
2094
- window.addEventListener('scroll', calcPosition, true);
2095
- window.addEventListener('resize', calcPosition);
2034
+ var handler = function () { return calcPositionRef.current(); };
2035
+ window.addEventListener('scroll', handler, true);
2036
+ window.addEventListener('resize', handler);
2096
2037
  return function () {
2097
- resizeObserver.disconnect();
2098
- window.removeEventListener('scroll', calcPosition, true);
2099
- window.removeEventListener('resize', calcPosition);
2038
+ window.removeEventListener('scroll', handler, true);
2039
+ window.removeEventListener('resize', handler);
2100
2040
  };
2101
- }, [anchorRef, popupRef]);
2041
+ }, []);
2042
+ // Follow the popup and anchor nodes that are really on screen.
2043
+ React.useLayoutEffect(function () {
2044
+ var _a;
2045
+ var popupNode = popupRef.current;
2046
+ var anchorNode = anchorRef.current;
2047
+ var observed = observedNodesRef.current;
2048
+ if (observed.popup === popupNode && observed.anchor === anchorNode)
2049
+ return;
2050
+ (_a = resizeObserverRef.current) === null || _a === void 0 ? void 0 : _a.disconnect();
2051
+ resizeObserverRef.current = null;
2052
+ observedNodesRef.current = { popup: popupNode, anchor: anchorNode };
2053
+ if (!popupNode || !anchorNode)
2054
+ return;
2055
+ var resizeObserver = new ResizeObserver(function () { return calcPositionRef.current(); });
2056
+ resizeObserver.observe(popupNode);
2057
+ resizeObserver.observe(anchorNode);
2058
+ resizeObserverRef.current = resizeObserver;
2059
+ calcPositionRef.current();
2060
+ });
2061
+ React.useLayoutEffect(function () { return function () {
2062
+ var _a;
2063
+ (_a = resizeObserverRef.current) === null || _a === void 0 ? void 0 : _a.disconnect();
2064
+ resizeObserverRef.current = null;
2065
+ observedNodesRef.current = { popup: null, anchor: null };
2066
+ }; }, []);
2102
2067
  React.useEffect(function () {
2103
2068
  // In projects where bianic-ui is installed,
2104
2069
  // there is a delay in rendering styles,
@@ -2560,7 +2525,7 @@ function Checkbox(_a) {
2560
2525
  var isValidIndeterminate = isIndeterminate && props.checked;
2561
2526
  var backgroundClass = size === 'tn' && props.checked ? 'bg-bia-blue' : 'bg-bia-white';
2562
2527
  var peerCheckedClass = size === 'tn' ? '' : 'peer-checked:border-2';
2563
- return (React.createElement("div", { className: "flex items-center" },
2528
+ return (React.createElement("div", { className: "inline-flex items-center" },
2564
2529
  React.createElement("div", { className: "relative flex flex-shrink-0 items-center justify-center rounded-full ".concat(backgroundClass, " ").concat(checkClass) },
2565
2530
  React.createElement("input", __assign({ id: id, type: "checkbox", className: "checkbox peer absolute box-content h-full w-full cursor-pointer appearance-none rounded-full border-2 border-bia-coolgrey-light-50 checked:border-bia-blue hover:border-bia-blue-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-bia-blue focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:border-bia-coolgrey-light-50 disabled:checked:border-bia-blue-light-50", onChange: function (e) { return onChange(e); }, disabled: disabled }, props)),
2566
2531
  React.createElement("div", { className: "check-icon z-1 group flex h-full w-full items-center justify-center rounded-full text-bia-grey outline-2 outline-transparent peer-checked:border-primary-white peer-checked:bg-bia-blue peer-checked:hover:border-bia-blue-hover peer-checked:hover:outline-bia-blue-hover peer-checked:peer-hover:bg-bia-blue-hover peer-focus-visible:outline-bia-blue peer-disabled:bg-bia-grey-light-80 peer-disabled:peer-checked:bg-bia-blue-light-50 peer-disabled:peer-checked:outline-bia-blue-light-50 ".concat(peerCheckedClass) }, isValidIndeterminate ? (React.createElement(TbMinus, { className: "stroke-[3px] text-bia-grey-dark-10 peer-checked:group-[]:text-bia-white peer-hover:group-[]:text-bia-blue-hover peer-checked:peer-hover:group-[]:text-bia-white peer-disabled:group-[]:text-bia-grey-dark-10 peer-disabled:peer-checked:group-[]:text-bia-white", size: 14 })) : (React.createElement(TbCheck, { className: "stroke-[3px] text-bia-grey-dark-10 peer-checked:group-[]:text-bia-white peer-hover:group-[]:text-bia-blue-hover peer-checked:peer-hover:group-[]:text-bia-white peer-disabled:group-[]:text-bia-grey-dark-10 peer-disabled:peer-checked:group-[]:text-bia-white", size: 14 })))),
@@ -2665,7 +2630,11 @@ var DropdownElement = React.forwardRef(function (_a, ref) {
2665
2630
  function DropdownContainer(propsComp) {
2666
2631
  var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.size, size = _f === void 0 ? 'md' : _f, _g = propsComp.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, _h = propsComp.zIndex, zIndex = _h === void 0 ? 100 : _h, anchorRef = propsComp.anchorRef, matchAnchorWidth = propsComp.matchAnchorWidth, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex", "anchorRef", "matchAnchorWidth"]);
2667
2632
  var dropdownRef = React.useRef(null);
2668
- var positionStyle = usePopupPosition(anchorRef, dropdownRef)[0];
2633
+ var _j = usePopupPosition(anchorRef, dropdownRef), positionStyle = _j[0], recalcPosition = _j[1];
2634
+ React.useLayoutEffect(function () {
2635
+ if (open)
2636
+ recalcPosition();
2637
+ }, [open, recalcPosition]);
2669
2638
  var newStyle = React.useMemo(function () {
2670
2639
  var _a, _b, _c;
2671
2640
  if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)) {
@@ -3009,7 +2978,7 @@ function LiveSearch(_a) {
3009
2978
  : 20,
3010
2979
  } },
3011
2980
  !isSearchTermExist && (React.createElement(TbZoom, { className: "text-primary-black", style: { fontSize: iconSize } })),
3012
- isSearchTermExist && !onChangeButton && (React.createElement("button", { type: "button", onClick: function () { return setValue({ id: null, label: '' }); }, className: "flex h-full w-full items-center disabled:cursor-not-allowed", disabled: disabled },
2981
+ isSearchTermExist && !onChangeButton && (React.createElement("button", { type: "button", "aria-label": "Clear search", onClick: function () { return setValue({ id: null, label: '' }); }, className: "flex h-full w-full items-center disabled:cursor-not-allowed", disabled: disabled },
3013
2982
  React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } }))),
3014
2983
  isSearchTermExist && onChangeButton),
3015
2984
  children === undefined && isOpen && (
@@ -3199,7 +3168,7 @@ var rightPaddingConfig = {
3199
3168
  tn: 'pr-[3px]',
3200
3169
  };
3201
3170
 
3202
- var colorUnion = [
3171
+ var colorUnion$1 = [
3203
3172
  'default',
3204
3173
  'blue',
3205
3174
  'teal',
@@ -3219,7 +3188,7 @@ function TagLabel(_a) {
3219
3188
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
3220
3189
  _a.right;
3221
3190
  var _k = _a.bgColor, bgColor = _k === void 0 ? 'grey-light-50' : _k, _l = _a.textColor, textColor = _l === void 0 ? 'black' : _l, _m = _a.outlineColor, outlineColor = _m === void 0 ? undefined : _m, _o = _a.isBlock, isBlock = _o === void 0 ? undefined : _o, _p = _a.maxWidth, maxWidth = _p === void 0 ? undefined : _p, _q = _a.isDark, isDark = _q === void 0 ? undefined : _q; _a.style; var props = __rest(_a, ["color", "size", "variant", "closeHandler", "open", "text", "leftIcon", "rightIcon", "left", "right", "bgColor", "textColor", "outlineColor", "isBlock", "maxWidth", "isDark", "style"]);
3222
- var validatedColor = validUnion(color, colorUnion);
3191
+ var validatedColor = validUnion(color, colorUnion$1);
3223
3192
  var validatedSize = validUnion(size, sizeUnion$1);
3224
3193
  var validatedVariant = validUnion(variant, variantUnion);
3225
3194
  var containerRef = React.useRef(null);
@@ -4923,10 +4892,21 @@ var sizeConfig$2 = {
4923
4892
  'form-md': 'min-h-[40px] h-fit whitespace-nowrap px-2.5 py-[9.5px]',
4924
4893
  };
4925
4894
 
4895
+ var colorUnion = ['yellow', 'blue', 'grey', 'white', 'custom'];
4926
4896
  function InfoPanel(_a) {
4927
- var _b = _a.variant, variant = _b === void 0 ? 'container' : _b, _c = _a.color, color = _c === void 0 ? 'yellow' : _c, _d = _a.className, className = _d === void 0 ? '' : _d, _e = _a.children, children = _e === void 0 ? null : _e;
4897
+ var _b = _a.variant, variant = _b === void 0 ? 'container' : _b, _c = _a.color, color = _c === void 0 ? 'yellow' : _c, _d = _a.bgColor, bgColor = _d === void 0 ? undefined : _d, _e = _a.textColor, textColor = _e === void 0 ? undefined : _e, _f = _a.outlineColor, outlineColor = _f === void 0 ? undefined : _f, _g = _a.className, className = _g === void 0 ? '' : _g, _h = _a.children, children = _h === void 0 ? null : _h;
4928
4898
  var sizeClass = sizeConfig$2[variant || 'container'];
4929
- var colorClass = colorConfig[color || 'yellow'];
4899
+ var validColor = validUnion(color, colorUnion);
4900
+ var presetColor = validColor === 'custom' ? 'yellow' : validColor;
4901
+ var colorClass = validColor === 'custom' && bgColor
4902
+ ? [
4903
+ "bg-bia-".concat(bgColor),
4904
+ textColor && "text-bia-".concat(textColor),
4905
+ outlineColor && "border border-bia-".concat(outlineColor),
4906
+ ]
4907
+ .filter(Boolean)
4908
+ .join(' ')
4909
+ : colorConfig[presetColor];
4930
4910
  var allClasses = "".concat(sizeClass, " ").concat(colorClass, " ").concat(className);
4931
4911
  return (React.createElement("div", { className: "flex items-center justify-center rounded-radius-md ".concat(allClasses) }, children));
4932
4912
  }
@@ -5487,6 +5467,24 @@ function SidebarItemInner(_a, ref) {
5487
5467
  : child;
5488
5468
  });
5489
5469
  };
5470
+ // Leaf items (no children of their own) are the only ones that can be picked.
5471
+ var collectLeafItems = function (nodes) {
5472
+ return React.Children.toArray(nodes)
5473
+ .filter(isSidebarItemElement)
5474
+ .flatMap(function (node) {
5475
+ return React.Children.toArray(node.props.children).some(isSidebarItemElement)
5476
+ ? collectLeafItems(node.props.children)
5477
+ : [node];
5478
+ });
5479
+ };
5480
+ var handleDropdownItemClick = function (value) {
5481
+ var _a, _b;
5482
+ var picked = collectLeafItems(children).find(function (leaf) { return leaf.props.id !== undefined && leaf.props.id === value; });
5483
+ if (!picked)
5484
+ return;
5485
+ (_b = (_a = picked.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
5486
+ setActiveId(picked.props.id);
5487
+ };
5490
5488
  var renderDropdownItems = function () {
5491
5489
  return childrenArray.filter(isSidebarItemElement).map(function (child) {
5492
5490
  var _a, _b, _c;
@@ -5494,12 +5492,12 @@ function SidebarItemInner(_a, ref) {
5494
5492
  var childNotificationCount = grandChildren.length > 0
5495
5493
  ? sumNotificationCounts(child.props.children)
5496
5494
  : ((_a = child.props.notificationCount) !== null && _a !== void 0 ? _a : 0);
5497
- return (React.createElement(DropdownItem, { key: (_b = child.props.id) !== null && _b !== void 0 ? _b : String((_c = child.key) !== null && _c !== void 0 ? _c : ''), content: React.createElement("div", { className: "relative" },
5495
+ return (React.createElement(DropdownItem, { key: (_b = child.props.id) !== null && _b !== void 0 ? _b : String((_c = child.key) !== null && _c !== void 0 ? _c : ''), value: child.props.id, disabled: child.props.disabled, content: React.createElement("div", { className: "relative" },
5498
5496
  child.props.title,
5499
5497
  isMinimized && childNotificationCount > 0 && (React.createElement("div", { className: "absolute -right-[8px] top-[2px] h-[6px] w-[6px] rounded-radius-full ".concat(colorClass) }))) }, grandChildren.length > 0 &&
5500
5498
  grandChildren.map(function (grandChild) {
5501
5499
  var _a, _b;
5502
- return (React.createElement(DropdownItem, { key: (_a = grandChild.props.id) !== null && _a !== void 0 ? _a : String((_b = grandChild.key) !== null && _b !== void 0 ? _b : ''), content: React.createElement("div", { className: "flex justify-between gap-x-[11px]" },
5500
+ return (React.createElement(DropdownItem, { key: (_a = grandChild.props.id) !== null && _a !== void 0 ? _a : String((_b = grandChild.key) !== null && _b !== void 0 ? _b : ''), value: grandChild.props.id, disabled: grandChild.props.disabled, content: React.createElement("div", { className: "flex justify-between gap-x-[11px]" },
5503
5501
  grandChild.props.title,
5504
5502
  grandChild.props.notificationCount ? (React.createElement(TagLabel, { text: String(grandChild.props.notificationCount), color: "custom", bgColor: color, textColor: "white", size: "tn" })) : null) }));
5505
5503
  })));
@@ -5540,7 +5538,7 @@ function SidebarItemInner(_a, ref) {
5540
5538
  isActive && (React.createElement("div", { className: "absolute right-0 ml-auto h-full w-1 rounded-l-radius-md bg-bia-white" }))),
5541
5539
  !isMinimized && hasChildren && isChildExpanded && renderChildren(),
5542
5540
  React.createElement("div", { className: "dropdown-anchor absolute left-[60px] top-0", ref: childDropdownRef }),
5543
- isMinimized && hasChildren && (React.createElement(DropdownContainer, { open: isChildExpanded, onClose: function () { return setIsChildExpanded(false); }, anchorRef: childDropdownRef }, renderDropdownItems()))));
5541
+ isMinimized && hasChildren && (React.createElement(DropdownContainer, { open: isChildExpanded, onClose: function () { return setIsChildExpanded(false); }, anchorRef: childDropdownRef, onClickItem: function (_, value) { return handleDropdownItemClick(value); } }, renderDropdownItems()))));
5544
5542
  }
5545
5543
  var SidebarItem = React.forwardRef(SidebarItemInner);
5546
5544
  SidebarItem.displayName = 'SidebarItem';
@@ -5641,7 +5639,7 @@ function SidebarProfileInner(_a, ref) {
5641
5639
  }, className: cn$1('cubic-bezier(0.68, -0.1, 0.32, 1.2) flex w-full items-center gap-x-2.5 delay-500 duration-300', buttonClass, className) }),
5642
5640
  avatarImage,
5643
5641
  React.createElement("div", { className: "flex min-w-0 flex-col" },
5644
- React.createElement(Text, { variant: "normal-text", className: cn$1('truncate text-bia-white delay-[400ms]', isMinimized
5642
+ React.createElement(Text, { variant: "normal-text", className: cn$1('truncate text-left text-bia-white delay-[400ms]', isMinimized
5645
5643
  ? 'opacity-0 duration-300 ease-in-out'
5646
5644
  : 'opacity-100 delay-1000 duration-700 ease-in-out') }, username),
5647
5645
  React.createElement(Text, { variant: "small-text", className: cn$1('truncate text-left text-bia-white delay-[400ms]', isMinimized
@@ -5837,13 +5835,18 @@ var headTextConfig = {
5837
5835
  tn: 'text-size-sm font-semibold font-segoe',
5838
5836
  };
5839
5837
 
5838
+ var verticalAlignConfig = {
5839
+ top: 'align-top',
5840
+ middle: 'align-middle',
5841
+ bottom: 'align-bottom',
5842
+ };
5840
5843
  function TableCell(_a) {
5841
- var _b = _a.variant, variant = _b === void 0 ? 'body' : _b, className = _a.className, children = _a.children, _c = _a.size, size = _c === void 0 ? 'md' : _c, _d = _a.lined, lined = _d === void 0 ? false : _d, _e = _a.bgColor, bgColor = _e === void 0 ? '' : _e, props = __rest(_a, ["variant", "className", "children", "size", "lined", "bgColor"]);
5844
+ var _b = _a.variant, variant = _b === void 0 ? 'body' : _b, className = _a.className, children = _a.children, _c = _a.size, size = _c === void 0 ? 'md' : _c, _d = _a.lined, lined = _d === void 0 ? false : _d, _e = _a.bgColor, bgColor = _e === void 0 ? '' : _e, _f = _a.verticalAlign, verticalAlign = _f === void 0 ? 'top' : _f, props = __rest(_a, ["variant", "className", "children", "size", "lined", "bgColor", "verticalAlign"]);
5842
5845
  var bottomLined = lined ? 'border-b border-bia-grey' : '';
5843
5846
  var bgColorClass = "bg-bia-".concat(bgColor);
5844
5847
  var isHead = variant === 'head';
5845
5848
  var textConfig = isHead ? headTextConfig[size] : bodyTextConfig[size];
5846
- var columnClass = "p-0 ".concat(sizeConfig[size], " ").concat(bottomLined, " ").concat(bgColorClass, " ").concat(textConfig, " ").concat(className);
5849
+ var columnClass = "p-0 h-[30px] ".concat(verticalAlignConfig[verticalAlign], " ").concat(sizeConfig[size], " ").concat(bottomLined, " ").concat(bgColorClass, " ").concat(textConfig, " ").concat(className);
5847
5850
  if (variant === 'head') {
5848
5851
  return (React.createElement("th", __assign({ className: "bianic-table-cell table-head bg-bia-grey-light-80 ".concat(columnClass) }, props), children));
5849
5852
  }
@@ -9302,37 +9305,15 @@ var navbarItemConfig = {
9302
9305
  current: 'cursor-default',
9303
9306
  clickable: 'cursor-pointer hover:bg-bia-white/15 active:bg-bia-white-transparent-80 focus-visible:outline focus-visible:outline-[3px] focus-visible:outline-offset-0 focus-visible:outline-bia-blue-light-50',
9304
9307
  static: 'cursor-default',
9305
- disabled: 'cursor-default',
9308
+ disabled: 'cursor-not-allowed',
9306
9309
  };
9307
9310
  var navbarCircleConfig = {
9311
+ filledBase: 'bg-bia-white border-bia-white',
9308
9312
  currentDefault: 'bg-bia-white border-bia-white text-bia-black',
9309
9313
  other: 'border-bia-white text-bia-white',
9310
9314
  disabled: 'border-bia-white-transparent-40 text-bia-white-transparent-40',
9311
9315
  };
9312
- var navbarCurrentColorConfig = {
9313
- blue: 'bg-bia-blue border-bia-blue text-bia-white',
9314
- green: 'bg-bia-green border-bia-green text-bia-white',
9315
- teal: 'bg-bia-teal border-bia-teal text-bia-white',
9316
- crayola: 'bg-bia-crayola border-bia-crayola text-bia-white',
9317
- orange: 'bg-bia-orange border-bia-orange text-bia-white',
9318
- red: 'bg-bia-red border-bia-red text-bia-white',
9319
- };
9320
- var navbarProcessedColorConfig = {
9321
- blue: 'border-bia-blue text-bia-white',
9322
- green: 'border-bia-green text-bia-white',
9323
- teal: 'border-bia-teal text-bia-white',
9324
- crayola: 'border-bia-crayola text-bia-white',
9325
- orange: 'border-bia-orange text-bia-white',
9326
- red: 'border-bia-red text-bia-white',
9327
- };
9328
- var navbarProcessedFilledColorConfig = {
9329
- blue: 'bg-bia-blue border-bia-blue text-bia-white',
9330
- green: 'bg-bia-green border-bia-green text-bia-white',
9331
- teal: 'bg-bia-teal border-bia-teal text-bia-white',
9332
- crayola: 'bg-bia-crayola border-bia-crayola text-bia-white',
9333
- orange: 'bg-bia-orange border-bia-orange text-bia-white',
9334
- red: 'bg-bia-red border-bia-red text-bia-white',
9335
- };
9316
+ var BIA_COLOR_NAME = /^(?:(?:white|black)(?:-transparent-(?:[1-9]0|75))?|(?:red|yellow|green|teal|blue|grey|coolgrey|pink|sky|orange|crayola|verdantgreen|margueriteblue|brown)(?:-(?:hover|active|disabled|pastel|(?:light|dark)-[1-9]0))?|purple(?:-(?:hover|active|disabled|pastel))?)$/;
9336
9317
  var navbarLabelConfig = {
9337
9318
  enabled: 'whitespace-nowrap leading-4 text-bia-white',
9338
9319
  disabled: 'whitespace-nowrap leading-4 text-bia-white-transparent-40',
@@ -9342,14 +9323,6 @@ var navbarChevronConfig = {
9342
9323
  disabled: 'shrink-0 text-bia-white-transparent-40',
9343
9324
  };
9344
9325
 
9345
- var NAVBAR_COLORS = [
9346
- 'blue',
9347
- 'green',
9348
- 'teal',
9349
- 'crayola',
9350
- 'orange',
9351
- 'red',
9352
- ];
9353
9326
  var circleTextColor = function (circleClass) { var _a, _b; return (_b = (_a = circleClass.match(/text-bia-\S+/)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : ''; };
9354
9327
  function resolveItemState(isCurrent, isDisabled, isClickable) {
9355
9328
  if (isCurrent)
@@ -9360,18 +9333,14 @@ function resolveItemState(isCurrent, isDisabled, isClickable) {
9360
9333
  return 'clickable';
9361
9334
  return 'static';
9362
9335
  }
9363
- function resolveCircleClass(isCurrent, isDisabled, isProcessed, navColor, processedIcon) {
9364
- if (isCurrent) {
9365
- if (navColor)
9366
- return navbarCurrentColorConfig[navColor];
9367
- return navbarCircleConfig.currentDefault;
9368
- }
9336
+ function resolveCircleClass(isCurrent, isDisabled, isProcessed, color) {
9369
9337
  if (isDisabled)
9370
9338
  return navbarCircleConfig.disabled;
9371
- if (isProcessed && navColor) {
9372
- if (processedIcon)
9373
- return navbarProcessedFilledColorConfig[navColor];
9374
- return navbarProcessedColorConfig[navColor];
9339
+ if (isCurrent || isProcessed) {
9340
+ if (typeof color !== 'string' || !BIA_COLOR_NAME.test(color)) {
9341
+ return navbarCircleConfig.currentDefault;
9342
+ }
9343
+ return "".concat(navbarCircleConfig.filledBase, " text-bia-").concat(color);
9375
9344
  }
9376
9345
  return navbarCircleConfig.other;
9377
9346
  }
@@ -9390,10 +9359,6 @@ function NavbarHorizontalStepper(_a) {
9390
9359
  _a.size;
9391
9360
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
9392
9361
  _a.showLabels;
9393
- // size and showLabels are accepted for API parity, ignored on navbar
9394
- var navColor = color === undefined
9395
- ? undefined
9396
- : validUnion(color, NAVBAR_COLORS);
9397
9362
  return (React.createElement("nav", { "aria-label": "Progress", className: cn$1('flex', className) },
9398
9363
  React.createElement("ol", { className: "flex items-center" }, steps.map(function (step, index) {
9399
9364
  var _a;
@@ -9403,7 +9368,7 @@ function NavbarHorizontalStepper(_a) {
9403
9368
  var isClickable = !isCurrent && !isDisabled && Boolean(onStepClick);
9404
9369
  var itemState = resolveItemState(isCurrent, isDisabled, isClickable);
9405
9370
  var itemClass = cn$1('flex h-6 items-center gap-[5px] px-[5px] py-[3px]', !isCurrent && 'rounded-radius-sm', navbarItemConfig[itemState]);
9406
- var circleClass = resolveCircleClass(isCurrent, isDisabled, isProcessed, navColor, processedIcon);
9371
+ var circleClass = resolveCircleClass(isCurrent, isDisabled, isProcessed, color);
9407
9372
  var labelClass = isDisabled
9408
9373
  ? navbarLabelConfig.disabled
9409
9374
  : navbarLabelConfig.enabled;
@@ -9774,7 +9739,6 @@ exports.DropdownContainer = DropdownContainer;
9774
9739
  exports.DropdownItem = DropdownItem;
9775
9740
  exports.DropzoneFileUploader = DropzoneFileUploader;
9776
9741
  exports.EmptyTable = EmptyTable;
9777
- exports.FileTree = FileTree;
9778
9742
  exports.FormGroup = FormGroup;
9779
9743
  exports.FormGroupButton = FormGroupButton;
9780
9744
  exports.FormGroupLabel = FormGroupLabel;
@@ -9826,7 +9790,7 @@ exports.TextInput = TextInput;
9826
9790
  exports.Toaster = Toaster;
9827
9791
  exports.Toggle = Toggle;
9828
9792
  exports.Tooltip = Tooltip;
9829
- exports.TreeItem = TreeItem;
9793
+ exports.TreeItem = TreeItem$1;
9830
9794
  exports.VerticalStepper = StepperItem;
9831
9795
  exports.Window = Window;
9832
9796
  exports.YearPicker = YearPicker;