bianic-ui 1.15.0 → 1.16.0-alpha.1

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 (54) hide show
  1. package/dist/cjs/index.js +287 -220
  2. package/dist/cjs/lib.css +1 -1
  3. package/dist/cjs/types/components/Forms/DatePicker/DateInputDisplay.d.ts +3 -1
  4. package/dist/cjs/types/components/Forms/DatePicker/DatePicker.d.ts +4 -1
  5. package/dist/cjs/types/components/Forms/Dropdown/DropdownContainer.d.ts +2 -2
  6. package/dist/cjs/types/components/Forms/LiveSearch/Example/CustomDropdown.d.ts +1 -2
  7. package/dist/cjs/types/components/Forms/LiveSearch/Example/DeprecatedSimulation.d.ts +4 -0
  8. package/dist/cjs/types/components/Forms/LiveSearch/hooks/useLiveSearch.d.ts +9 -0
  9. package/dist/cjs/types/components/Forms/LiveSearch/index.d.ts +2 -6
  10. package/dist/cjs/types/components/Forms/LiveSearch/types/index.d.ts +36 -0
  11. package/dist/cjs/types/components/Forms/LiveSearch/utils/dropdownUtils.d.ts +8 -0
  12. package/dist/cjs/types/components/Forms/LiveSearch/utils/searchUtils.d.ts +3 -0
  13. package/dist/cjs/types/components/InfoPanel/index.d.ts +3 -3
  14. package/dist/cjs/types/components/Menu/MenuContainer.d.ts +7 -1
  15. package/dist/cjs/types/components/Menu/MenuContainerNoAnchor.d.ts +13 -0
  16. package/dist/cjs/types/components/Modal/Modal.d.ts +2 -2
  17. package/dist/cjs/types/components/Popover/popoverHoverDemo.d.ts +4 -1
  18. package/dist/cjs/types/components/Tab/Tab.d.ts +2 -1
  19. package/dist/cjs/types/components/Tooltip/PropsInterface.d.ts +12 -5
  20. package/dist/cjs/types/components/Tooltip/index.d.ts +1 -1
  21. package/dist/{esm/types/stories/Form/LiveSearch/LivesearchOld.stories.d.ts → cjs/types/stories/Form/LiveSearch/DeprecatedSimulation.stories.d.ts} +2 -2
  22. package/dist/cjs/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +7 -3
  23. package/dist/cjs/types/stories/Tooltip/Tooltip.stories.d.ts +8 -0
  24. package/dist/cjs/types/utility/hooks/usePopupPosition.d.ts +9 -0
  25. package/dist/esm/index.js +288 -221
  26. package/dist/esm/lib.css +1 -1
  27. package/dist/esm/types/components/Forms/DatePicker/DateInputDisplay.d.ts +3 -1
  28. package/dist/esm/types/components/Forms/DatePicker/DatePicker.d.ts +4 -1
  29. package/dist/esm/types/components/Forms/Dropdown/DropdownContainer.d.ts +2 -2
  30. package/dist/esm/types/components/Forms/LiveSearch/Example/CustomDropdown.d.ts +1 -2
  31. package/dist/esm/types/components/Forms/LiveSearch/Example/DeprecatedSimulation.d.ts +4 -0
  32. package/dist/esm/types/components/Forms/LiveSearch/hooks/useLiveSearch.d.ts +9 -0
  33. package/dist/esm/types/components/Forms/LiveSearch/index.d.ts +2 -6
  34. package/dist/esm/types/components/Forms/LiveSearch/types/index.d.ts +36 -0
  35. package/dist/esm/types/components/Forms/LiveSearch/utils/dropdownUtils.d.ts +8 -0
  36. package/dist/esm/types/components/Forms/LiveSearch/utils/searchUtils.d.ts +3 -0
  37. package/dist/esm/types/components/InfoPanel/index.d.ts +3 -3
  38. package/dist/esm/types/components/Menu/MenuContainer.d.ts +7 -1
  39. package/dist/esm/types/components/Menu/MenuContainerNoAnchor.d.ts +13 -0
  40. package/dist/esm/types/components/Modal/Modal.d.ts +2 -2
  41. package/dist/esm/types/components/Popover/popoverHoverDemo.d.ts +4 -1
  42. package/dist/esm/types/components/Tab/Tab.d.ts +2 -1
  43. package/dist/esm/types/components/Tooltip/PropsInterface.d.ts +12 -5
  44. package/dist/esm/types/components/Tooltip/index.d.ts +1 -1
  45. package/dist/{cjs/types/stories/Form/LiveSearch/LivesearchOld.stories.d.ts → esm/types/stories/Form/LiveSearch/DeprecatedSimulation.stories.d.ts} +2 -2
  46. package/dist/esm/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +7 -3
  47. package/dist/esm/types/stories/Tooltip/Tooltip.stories.d.ts +8 -0
  48. package/dist/esm/types/utility/hooks/usePopupPosition.d.ts +9 -0
  49. package/dist/index.d.ts +37 -28
  50. package/package.json +1 -1
  51. package/dist/cjs/types/components/Forms/LiveSearch/PropsInterface.d.ts +0 -23
  52. package/dist/cjs/types/components/Forms/LiveSearch/Simulation.d.ts +0 -4
  53. package/dist/esm/types/components/Forms/LiveSearch/PropsInterface.d.ts +0 -23
  54. package/dist/esm/types/components/Forms/LiveSearch/Simulation.d.ts +0 -4
package/dist/cjs/index.js CHANGED
@@ -443,10 +443,10 @@ var minWidthConfig$1 = {
443
443
  tn: 'min-w-[64px]',
444
444
  };
445
445
  var iconOnlySizeConfig$1 = {
446
- lg: 'py-[13px] h-[48px] h-[48px] flex items-center justify-center gap-[10px]',
446
+ lg: 'py-[13px] h-[48px] w-[48px] flex items-center justify-center gap-[10px]',
447
447
  md: 'py-[11px] h-[40px] w-[40px] flex items-center justify-center gap-[5px]',
448
- sm: 'py-[8px] h-[30px] h-[30px] flex items-center justify-center gap-[5px] ',
449
- tn: 'py-[4px] h-[22px] h-[22px] flex items-center justify-center gap-[3px]',
448
+ sm: 'py-[8px] h-[30px] w-[30px] flex items-center justify-center gap-[5px] ',
449
+ tn: 'py-[4px] h-[22px] w-[22px] flex items-center justify-center gap-[3px]',
450
450
  };
451
451
  var shadow = 'shadow-[0px_6px_18px_1px_rgba(188,199,237,0.5)] disabled:shadow-none active:shadow-none';
452
452
  var variantConfig$2 = {
@@ -1724,7 +1724,133 @@ var TreeItem = function (_a) {
1724
1724
  })))));
1725
1725
  };
1726
1726
 
1727
- var MenuContainer = React.forwardRef(function MenuContainer(propsComp, ref) {
1727
+ var getContextualPopupStyle = function (anchorRef, popupRef, position) {
1728
+ if (!anchorRef.current || !popupRef.current) {
1729
+ return {};
1730
+ }
1731
+ var style = {};
1732
+ var anchorRect = anchorRef.current.getBoundingClientRect();
1733
+ var popupRect = popupRef.current.getBoundingClientRect();
1734
+ var popupHeight = popupRect.height;
1735
+ var popupWidth = popupRect.width;
1736
+ switch (position) {
1737
+ case 'top':
1738
+ style.top = "".concat(anchorRect.top - popupHeight + window.scrollY - 10, "px");
1739
+ style.left = "".concat(anchorRect.left - 0.5 * popupWidth + 0.5 * anchorRect.width + window.scrollX, "px");
1740
+ break;
1741
+ case 'bottom':
1742
+ style.top = "".concat(anchorRect.top + anchorRect.height + window.scrollY + 10, "px");
1743
+ style.left = "".concat(anchorRect.left - 0.5 * popupWidth + 0.5 * anchorRect.width + window.scrollX, "px");
1744
+ break;
1745
+ case 'left':
1746
+ style.top = "".concat(anchorRect.top - 0.5 * popupHeight + window.scrollY + 0.5 * anchorRect.height, "px");
1747
+ style.left = "".concat(anchorRect.left - popupWidth - 10 + window.scrollX, "px");
1748
+ break;
1749
+ case 'right':
1750
+ style.top = "".concat(anchorRect.top - 0.5 * popupHeight + window.scrollY + 0.5 * anchorRect.height, "px");
1751
+ style.left = "".concat(anchorRect.right + 10 + window.scrollX, "px");
1752
+ break;
1753
+ case 'top-left':
1754
+ style.top = "".concat(anchorRect.top - popupHeight + window.scrollY - 10, "px");
1755
+ style.left = "".concat(anchorRect.left + window.scrollX, "px");
1756
+ break;
1757
+ case 'top-right':
1758
+ style.top = "".concat(anchorRect.top - popupHeight + window.scrollY - 10, "px");
1759
+ style.left = "".concat(anchorRect.left + anchorRect.width - popupWidth + window.scrollX, "px");
1760
+ break;
1761
+ case 'bottom-left':
1762
+ style.top = "".concat(anchorRect.top + anchorRect.height + window.scrollY + 10, "px");
1763
+ style.left = "".concat(anchorRect.left + window.scrollX, "px");
1764
+ break;
1765
+ case 'bottom-right':
1766
+ style.top = "".concat(anchorRect.top + anchorRect.height + window.scrollY + 10, "px");
1767
+ style.left = "".concat(anchorRect.left + anchorRect.width - popupWidth + window.scrollX, "px");
1768
+ break;
1769
+ }
1770
+ return style;
1771
+ };
1772
+ var getDropdownStyle = function (anchorRef, popupRef) {
1773
+ if (!anchorRef.current || !popupRef.current) {
1774
+ return {};
1775
+ }
1776
+ var anchorRect = anchorRef.current.getBoundingClientRect();
1777
+ var popupHeight = popupRef.current.offsetHeight;
1778
+ var spaceToBottom = window.innerHeight - anchorRect.bottom;
1779
+ var spaceToTop = anchorRect.top;
1780
+ var style = {
1781
+ left: "".concat(anchorRect.left + window.scrollX, "px"),
1782
+ };
1783
+ // If space below is less than popup height,
1784
+ // AND space above is more than space below
1785
+ // then flip up
1786
+ if (spaceToBottom < popupHeight && spaceToTop > spaceToBottom) {
1787
+ style.top = "".concat(anchorRect.top - popupHeight + window.scrollY, "px");
1788
+ }
1789
+ else {
1790
+ style.top = "".concat(anchorRect.bottom + window.scrollY, "px");
1791
+ }
1792
+ return style;
1793
+ };
1794
+ var usePopupPosition = function (anchorRef, popupRef, position) {
1795
+ // In projects where bianic-ui is installed,
1796
+ // there is a delay in rendering styles,
1797
+ // which causes popups to lose their position and need to be re-rendered.
1798
+ var _a = React.useState(0), repeateRender = _a[0], setRepeateRender = _a[1];
1799
+ var _b = React.useState({}), positionStyle = _b[0], setPositionStyle = _b[1];
1800
+ var calcPosition = function () {
1801
+ var newStyle = position !== undefined
1802
+ ? getContextualPopupStyle(anchorRef, popupRef, position)
1803
+ : getDropdownStyle(anchorRef, popupRef);
1804
+ setPositionStyle(newStyle);
1805
+ };
1806
+ React.useLayoutEffect(function () {
1807
+ if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current))
1808
+ return;
1809
+ calcPosition();
1810
+ window.addEventListener('scroll', calcPosition);
1811
+ window.addEventListener('resize', calcPosition);
1812
+ setRepeateRender(0);
1813
+ return function () {
1814
+ window.removeEventListener('scroll', calcPosition);
1815
+ window.removeEventListener('resize', calcPosition);
1816
+ };
1817
+ }, [anchorRef]);
1818
+ React.useEffect(function () {
1819
+ if (repeateRender < 5 && (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)) {
1820
+ calcPosition();
1821
+ setRepeateRender(repeateRender + 1);
1822
+ }
1823
+ }, [repeateRender]);
1824
+ return [positionStyle, calcPosition];
1825
+ };
1826
+
1827
+ var MenuContainer = function (props) {
1828
+ var _a = props.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = props.children, _b = props.open, open = _b === void 0 ? true : _b, _c = props.onClose, onClose = _c === void 0 ? function () { } : _c, _d = props.className, className = _d === void 0 ? '' : _d, _e = props.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = props.zIndex, zIndex = _f === void 0 ? 100 : _f, _g = props.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, anchorRef = props.anchorRef, restProps = __rest(props, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex", "onClickItem", "anchorRef"]);
1829
+ if (!open)
1830
+ return null;
1831
+ var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
1832
+ var MenuContainerRef = React.useRef(null);
1833
+ var positionStyle = usePopupPosition(anchorRef, MenuContainerRef)[0];
1834
+ return (React.createElement(React.Fragment, null,
1835
+ isWithOverlay && (React.createElement("div", { className: "bianic-menu-overlay fixed left-0 top-0 z-0 h-screen w-screen", onClick: function () { return onClose(); }, style: { zIndex: zIndex } })),
1836
+ reactDom.createPortal(React.createElement("div", __assign({ ref: MenuContainerRef, className: "absolute w-fit bg-bia-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] ".concat(radiusClass, " ").concat(className), style: __assign({ zIndex: zIndex + 10, minWidth: anchorRef.current
1837
+ ? anchorRef.current.offsetWidth
1838
+ : undefined }, positionStyle) }, restProps), React.Children.map(children, function (child) {
1839
+ return React.isValidElement(child)
1840
+ ? // Kirimkan handleItemClick sebagai props onClick ke setiap MenuItem
1841
+ React.cloneElement(child, {
1842
+ onClose: function () { return onClose(); },
1843
+ zIndex: zIndex + 10,
1844
+ inheritedOnClick: function () { return onClickItem(); },
1845
+ })
1846
+ : child;
1847
+ })), document.body)));
1848
+ };
1849
+ MenuContainer.defaultProps = {
1850
+ isTopFlat: false,
1851
+ };
1852
+
1853
+ var MenuContainerNoAnchor = React.forwardRef(function MenuContainerNoAnchor(propsComp, ref) {
1728
1854
  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.zIndex, zIndex = _f === void 0 ? 100 : _f, _g = propsComp.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex", "onClickItem"]);
1729
1855
  var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
1730
1856
  return (open && (React.createElement(React.Fragment, null,
@@ -1742,7 +1868,7 @@ var MenuContainer = React.forwardRef(function MenuContainer(propsComp, ref) {
1742
1868
  : child;
1743
1869
  })))));
1744
1870
  });
1745
- MenuContainer.defaultProps = {
1871
+ MenuContainerNoAnchor.defaultProps = {
1746
1872
  isTopFlat: false,
1747
1873
  };
1748
1874
 
@@ -1756,11 +1882,10 @@ function MenuItem(_a) {
1756
1882
  var itemClass = "".concat(leftPadding, " ").concat(rightPadding, " ").concat(className);
1757
1883
  var MenuContRef = React.useRef(null);
1758
1884
  React.useEffect(function () {
1759
- var _a;
1760
1885
  if (MenuContRef.current) {
1761
1886
  // Adjust dropdown position to prevent overflow on the right.
1762
- var MenuContRect = (_a = MenuContRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
1763
- var RectRight = MenuContRect === null || MenuContRect === void 0 ? void 0 : MenuContRect.right;
1887
+ var MenuContRect = MenuContRef.current.getBoundingClientRect();
1888
+ var RectRight = MenuContRect.right;
1764
1889
  var innerWindow = window.innerWidth;
1765
1890
  if (RectRight > innerWindow)
1766
1891
  setIsLeft(true);
@@ -1784,60 +1909,23 @@ function MenuItem(_a) {
1784
1909
  React.createElement("div", { className: "ml-auto flex items-center" },
1785
1910
  children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey" })),
1786
1911
  children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] text-bia-coolgrey" }, caption)))),
1787
- children && (React.createElement(MenuContainer, { open: isHovered, onClose: onClose, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex + 10, onClickItem: function () { return inheritedOnClick(); } }, children))));
1912
+ children && (React.createElement(MenuContainerNoAnchor, { open: isHovered, onClose: onClose, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex + 10, onClickItem: function () { return inheritedOnClick(); } }, children))));
1788
1913
  }
1789
1914
  MenuItem.defaultProps = {
1790
1915
  className: '',
1791
1916
  onClick: function () { },
1792
1917
  };
1793
1918
 
1794
- var classConfig$1 = {
1795
- top: {
1796
- tooltipContainer: 'bottom-[calc(100%+5px)] left-1/2 -translate-x-1/2',
1797
- triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
1798
- triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
1799
- },
1800
- right: {
1801
- tooltipContainer: 'left-[calc(100%+5px)] top-1/2 -translate-y-1/2',
1802
- triangleContainer: '-left-[4px] bottom-0 flex items-center w-auto h-full',
1803
- triangleShape: 'border-t-[8px] border-t-transparent border-r-[5px] border-r-primary-black border-b-[8px] border-b-transparent',
1804
- },
1805
- bottom: {
1806
- tooltipContainer: 'top-[calc(100%+5px)] left-1/2 -translate-x-1/2',
1807
- triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
1808
- triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
1809
- },
1810
- left: {
1811
- tooltipContainer: 'right-[calc(100%+5px)] top-1/2 -translate-y-1/2',
1812
- triangleContainer: '-right-[4px] bottom-0 flex items-center w-auto h-full',
1813
- triangleShape: 'border-t-[8px] border-t-transparent border-l-[5px] border-l-primary-black border-b-[8px] border-b-transparent',
1814
- },
1815
- 'top-right': {
1816
- tooltipContainer: 'bottom-[calc(100%+5px)] right-0',
1817
- triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
1818
- triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
1819
- },
1820
- 'top-left': {
1821
- tooltipContainer: 'bottom-[calc(100%+5px)] left-0',
1822
- triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
1823
- triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
1824
- },
1825
- 'bottom-right': {
1826
- tooltipContainer: 'top-[calc(100%+5px)] right-0',
1827
- triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
1828
- triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
1829
- },
1830
- 'bottom-left': {
1831
- tooltipContainer: 'top-[calc(100%+5px)] left-0',
1832
- triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
1833
- triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
1834
- },
1835
- };
1836
-
1837
1919
  function Tooltip(props) {
1838
1920
  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;
1839
1921
  var timeout;
1840
1922
  var _c = React.useState(false), active = _c[0], setActive = _c[1];
1923
+ var anchorRef = React.useRef(null);
1924
+ var tooltipContainerRef = React.useRef(null);
1925
+ var _d = React.useState({
1926
+ maxWidth: maxWidth + 'px',
1927
+ whiteSpace: 'nowrap',
1928
+ }), tooltipContainerStyle = _d[0], setTooltipContainerStyle = _d[1];
1841
1929
  var showTip = function () {
1842
1930
  timeout = setTimeout(function () {
1843
1931
  setActive(true);
@@ -1847,12 +1935,6 @@ function Tooltip(props) {
1847
1935
  clearInterval(timeout);
1848
1936
  setActive(false);
1849
1937
  };
1850
- var _d = classConfig$1[direction], tooltipContainer = _d.tooltipContainer; _d.triangleContainer; _d.triangleShape;
1851
- var tooltipContainerRef = React.useRef(null);
1852
- var _e = React.useState({
1853
- maxWidth: maxWidth + 'px',
1854
- whiteSpace: 'nowrap',
1855
- }), tooltipContainerStyle = _e[0], setTooltipContainerStyle = _e[1];
1856
1938
  var tooltipContainerElement = tooltipContainerRef === null || tooltipContainerRef === void 0 ? void 0 : tooltipContainerRef.current;
1857
1939
  var scrollWidth = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.scrollWidth; // Mendapatkan lebar konten aktual
1858
1940
  var offsetWidth = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.offsetWidth;
@@ -1885,10 +1967,15 @@ function Tooltip(props) {
1885
1967
  setTooltipContainerStyle(function (prev) { return (__assign(__assign({}, prev), { width: newWidth_1, whiteSpace: newWhiteSpace_1 })); });
1886
1968
  }
1887
1969
  }, [content, maxWidth, scrollWidth, offsetHeight]);
1888
- return (React.createElement("div", { className: "tooltip-wrapper relative inline-flex h-fit w-fit flex-col", onMouseEnter: showTip, onMouseLeave: hideTip },
1970
+ return (React.createElement("div", { className: "tooltip-wrapper relative inline-flex h-fit w-fit flex-col", onMouseEnter: showTip, onMouseLeave: hideTip, ref: anchorRef },
1889
1971
  children,
1890
- active && (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 ".concat(tooltipContainer), style: tooltipContainerStyle, ref: tooltipContainerRef }, content))));
1972
+ active && (React.createElement(TooltipItem, { anchorRef: anchorRef, direction: direction, content: content, tooltipContainerRef: tooltipContainerRef, tooltipContainerStyle: tooltipContainerStyle }))));
1891
1973
  }
1974
+ var TooltipItem = function (_a) {
1975
+ var anchorRef = _a.anchorRef, direction = _a.direction, content = _a.content, tooltipContainerRef = _a.tooltipContainerRef, tooltipContainerStyle = _a.tooltipContainerStyle;
1976
+ var positionStyle = usePopupPosition(anchorRef, tooltipContainerRef, direction)[0];
1977
+ 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);
1978
+ };
1892
1979
  Tooltip.defaultProps = {
1893
1980
  delay: 400,
1894
1981
  direction: 'top',
@@ -2385,71 +2472,24 @@ var sizeConfig$6 = {
2385
2472
  },
2386
2473
  };
2387
2474
 
2388
- var getDropdownStyle = function (anchorRef, dropdownRef) {
2389
- if (!anchorRef.current || !dropdownRef.current) {
2390
- return { minWidth: 'auto' };
2391
- }
2392
- var anchorRect = anchorRef.current.getBoundingClientRect();
2393
- var dropdownHeight = dropdownRef.current.offsetHeight;
2394
- var spaceToBottom = window.innerHeight - anchorRect.bottom;
2395
- var spaceToTop = anchorRect.top;
2396
- var style = {
2397
- left: "".concat(anchorRect.left, "px"),
2398
- minWidth: "".concat(anchorRect.width, "px"),
2399
- };
2400
- // If space below is less than dropdown height,
2401
- // AND space above is more than space below
2402
- // then flip up
2403
- if (spaceToBottom < dropdownHeight && spaceToTop > spaceToBottom) {
2404
- style.bottom = "".concat(window.innerHeight - anchorRect.top, "px");
2405
- }
2406
- else {
2407
- style.top = "".concat(anchorRect.bottom, "px");
2408
- }
2409
- return style;
2410
- };
2411
2475
  var DropdownContainer = function (propsComp) {
2412
2476
  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, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex", "anchorRef"]);
2413
2477
  if (!open)
2414
2478
  return null;
2415
- var _j = React.useState({ minWidth: 'auto' }), positionStyle = _j[0], setPositionStyle = _j[1];
2416
2479
  var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
2417
2480
  var sizeClass = containerSizeConfig[size] || containerSizeConfig['md'];
2418
2481
  var containerClass = "".concat(sizeClass, " ").concat(radiusClass, " ").concat(className);
2419
2482
  var dropdownRef = React.useRef(null);
2483
+ var positionStyle = usePopupPosition(anchorRef, dropdownRef)[0];
2420
2484
  var handleClickDrpdownItem = function (e, val) {
2421
2485
  onClickItem(e, val);
2422
2486
  onClose();
2423
2487
  };
2424
- // In projects where bianic-ui is installed,
2425
- // there is a delay in rendering styles,
2426
- // which causes dropdowns to lose their position and need to be re-rendered.
2427
- var _k = React.useState(0), repeateRender = _k[0], setRepeateRender = _k[1];
2428
- React.useLayoutEffect(function () {
2429
- if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current))
2430
- return;
2431
- var newStyle = getDropdownStyle(anchorRef, dropdownRef);
2432
- setPositionStyle(newStyle);
2433
- var handleScrollOrResize = function () {
2434
- setPositionStyle(getDropdownStyle(anchorRef, dropdownRef));
2435
- };
2436
- window.addEventListener('scroll', handleScrollOrResize);
2437
- window.addEventListener('resize', handleScrollOrResize);
2438
- setRepeateRender(0);
2439
- return function () {
2440
- window.removeEventListener('scroll', handleScrollOrResize);
2441
- window.removeEventListener('resize', handleScrollOrResize);
2442
- };
2443
- }, [anchorRef]);
2444
- React.useEffect(function () {
2445
- if (repeateRender < 5 && (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)) {
2446
- setPositionStyle(getDropdownStyle(anchorRef, dropdownRef));
2447
- setRepeateRender(repeateRender + 1);
2448
- }
2449
- }, [repeateRender]);
2450
2488
  return (React.createElement(React.Fragment, null,
2451
2489
  isWithOverlay && (React.createElement("div", { className: "bianic-dropdown-overlay fixed left-0 top-0 h-screen w-screen", style: { zIndex: zIndex }, onClick: function () { return onClose(); } })),
2452
- reactDom.createPortal(React.createElement("div", __assign({ ref: dropdownRef, className: "fixed max-w-fit bianic-dropdown-container bg-bia-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] ".concat(containerClass), style: __assign({ zIndex: zIndex + 10 }, positionStyle) }, restProps), React.Children.map(children, function (child) {
2490
+ reactDom.createPortal(React.createElement("div", __assign({ ref: dropdownRef, className: "bianic-dropdown-container absolute max-w-fit bg-bia-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] ".concat(containerClass), style: __assign({ minWidth: anchorRef.current
2491
+ ? anchorRef.current.offsetWidth
2492
+ : undefined, zIndex: zIndex + 10 }, positionStyle) }, restProps), React.Children.map(children, function (child) {
2453
2493
  return React.isValidElement(child)
2454
2494
  ? // Kirimkan handleItemClick sebagai props onClick ke setiap DropdownItem
2455
2495
  React.cloneElement(child, {
@@ -2520,111 +2560,129 @@ var matchSearchTerm = function (content, term, variant) {
2520
2560
  return lowerContent.includes(lowerTerm);
2521
2561
  }
2522
2562
  };
2523
- function LiveSearch(_a) {
2524
- var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, placeholder = _a.placeholder, _d = _a.required, required = _d === void 0 ? false : _d, options = _a.options, setValue = _a.setValue, value = _a.value, _e = _a.readOnly, readOnly = _e === void 0 ? false : _e, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, _h = _a.autoComplete, autoComplete = _h === void 0 ? 'off' : _h, _j = _a.children, children = _j === void 0 ? undefined : _j, _k = _a.dropContProps, dropContProps = _k === void 0 ? { className: undefined } : _k, _l = _a.searchVariant, searchVariant = _l === void 0 ? 'include' : _l;
2525
- var _m = React.useState(false), isOpen = _m[0], setIsOpen = _m[1];
2526
- var _o = React.useState(value.label || ''), searchTerm = _o[0], setSearchTerm = _o[1];
2527
- var _p = sizeConfig$6[size], iconClass = _p.iconClass, iconSize = _p.iconSize, inputClass = _p.inputClass;
2528
- var dropContClassName = dropContProps.className, dropContOnClickItem = dropContProps.onClickItem, restDropContProps = __rest(dropContProps, ["className", "onClickItem"]);
2529
- var isValueExist = value && value.label !== undefined && value.label !== '';
2530
- var inputRef = React.useRef(null);
2531
- var dropdownContRef = React.useRef(null);
2532
- // Will be used soon
2533
- // const handleOutsideClick = (e: MouseEvent) => {
2534
- // if (inputRef.current && !inputRef.current.contains(e.target as Node)) {
2535
- // setIsOpen(false)
2536
- // }
2537
- // }
2538
- // useEffect(() => {
2539
- // document.addEventListener('mousedown', handleOutsideClick)
2540
- // return () => {
2541
- // document.removeEventListener('mousedown', handleOutsideClick)
2542
- // }
2543
- // })
2544
- // Synchronize internal searchTerm with external value prop
2545
- React.useEffect(function () {
2546
- // Only update searchTerm if the label from the value prop differs from the current searchTerm
2547
- // This prevents infinite loops if searchTerm is already the same as value.label
2548
- if (value.label !== searchTerm) {
2549
- setSearchTerm(value.label || '');
2550
- }
2551
- }, [value.label, searchTerm]);
2552
- var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (item) {
2553
- return item.label.toLowerCase().includes(value.label.toLowerCase());
2563
+ var filterOptions = function (options, searchTerm) {
2564
+ return options === null || options === void 0 ? void 0 : options.filter(function (item) {
2565
+ return item.label.toLowerCase().includes(searchTerm.toLowerCase());
2554
2566
  });
2555
- var handleInputChange = function (e) {
2556
- var newSearchTerm = e.target.value;
2557
- setSearchTerm(newSearchTerm);
2558
- setIsOpen(true); // Ensure dropdown opens when typing
2559
- };
2560
- var handleDropdownItemClick = React.useCallback(function (clickedValue) {
2561
- setSearchTerm(clickedValue.label); // Set input text to the selected label
2562
- setValue(clickedValue); // Update the value in the parent
2563
- setIsOpen(false);
2564
- }, [setValue]);
2565
- // Recursive function to filter and clone DropdownItems, including nested items
2566
- var processDropdownChildren = function (nodes, currentSearchTerm, includeAllIfNoSearch) {
2567
- return React.Children.map(nodes, function (child) {
2568
- if (!React.isValidElement(child) || child.type !== DropdownItem) {
2569
- return child;
2570
- }
2571
- var itemProps = child.props;
2572
- // Assume content is a string for filtering; otherwise, filtering won't work well
2573
- var itemContent = typeof itemProps.content === 'string' ? itemProps.content : '';
2574
- var itemValue = itemProps.value;
2575
- var isDisabled = itemProps.disabled;
2576
- // 2. Filtering Logic (Uses Global Search Variant)
2577
- if (!includeAllIfNoSearch) {
2578
- // Use the matchSearchTerm utility with the selected searchVariant
2579
- if (currentSearchTerm && !matchSearchTerm(itemValue, currentSearchTerm, searchVariant)) {
2580
- return null; // Item does not match the search criteria
2581
- }
2567
+ };
2568
+
2569
+ var getItemLabel = function (value) {
2570
+ var _a;
2571
+ return typeof value === 'object' && value !== null && 'label' in value
2572
+ ? (_a = value.label) !== null && _a !== void 0 ? _a : ''
2573
+ : String(value !== null && value !== void 0 ? value : '');
2574
+ };
2575
+ var processDropdownChildren = function (nodes, currentSearchTerm, includeAllIfNoSearch, searchVariant, handleDropdownItemClick) {
2576
+ if (searchVariant === void 0) { searchVariant = 'include'; }
2577
+ return React.Children.map(nodes, function (child) {
2578
+ if (!React.isValidElement(child) || child.type !== DropdownItem) {
2579
+ return child;
2580
+ }
2581
+ var itemProps = child.props;
2582
+ var itemContent = typeof itemProps.content === 'string' ? itemProps.content : '';
2583
+ var itemValue = itemProps.value;
2584
+ var isDisabled = itemProps.disabled;
2585
+ // Filtering Logic
2586
+ if (!includeAllIfNoSearch) {
2587
+ var itemValueStr = typeof itemValue === 'object'
2588
+ ? itemValue.label
2589
+ : String(itemValue || '');
2590
+ if (currentSearchTerm &&
2591
+ !matchSearchTerm(itemValueStr, currentSearchTerm, searchVariant)) {
2592
+ return null;
2582
2593
  }
2583
- // 3. Process Nested Children (Recursion)
2584
- var clonedChildren = itemProps.children
2585
- ? processDropdownChildren(itemProps.children, currentSearchTerm, includeAllIfNoSearch)
2586
- : null;
2587
- // 4. Clone and Inject Click Handler
2588
- return React.cloneElement(child, {
2589
- onClick: function (e) {
2590
- if (!isDisabled) {
2591
- handleDropdownItemClick({
2592
- id: itemValue !== undefined ? itemValue : itemContent,
2593
- label: itemValue !== undefined ? itemValue : itemContent
2594
- });
2595
- }
2596
- if (dropContOnClickItem) {
2597
- dropContOnClickItem(e, itemValue !== undefined ? itemValue : itemContent);
2594
+ }
2595
+ // Process Nested Children
2596
+ var clonedChildren = itemProps.children
2597
+ ? processDropdownChildren(itemProps.children, currentSearchTerm, includeAllIfNoSearch, searchVariant, handleDropdownItemClick)
2598
+ : null;
2599
+ // Clone and Inject Click Handler
2600
+ return React.cloneElement(child, {
2601
+ onClick: function (e) {
2602
+ if (!isDisabled) {
2603
+ if (itemValue === undefined &&
2604
+ typeof itemProps.content === 'string') {
2605
+ return handleDropdownItemClick(e, itemContent);
2598
2606
  }
2599
- if (itemProps.onClickItem) {
2600
- itemProps.onClickItem(e, itemValue !== undefined ? itemValue : itemContent);
2607
+ if (typeof itemValue === 'object' || itemValue !== undefined) {
2608
+ return handleDropdownItemClick(e, itemValue);
2601
2609
  }
2602
- },
2603
- children: clonedChildren
2604
- });
2610
+ }
2611
+ if (itemProps.onClickItem) {
2612
+ itemProps.onClickItem(e, itemValue !== undefined ? itemValue : itemContent);
2613
+ }
2614
+ },
2615
+ children: clonedChildren,
2605
2616
  });
2606
- };
2607
- // Determine which children to display
2617
+ });
2618
+ };
2619
+ var processRenderedChildren = function (children, searchTerm, searchVariant, handleDropdownItemClick) {
2608
2620
  var renderedChildren = null;
2609
2621
  var hasFilteredResults = false;
2610
2622
  if (searchTerm) {
2611
- // If there's a searchTerm, filter children
2612
- renderedChildren = processDropdownChildren(children, searchTerm, false);
2623
+ renderedChildren = processDropdownChildren(children, searchTerm, false, searchVariant, handleDropdownItemClick);
2613
2624
  hasFilteredResults =
2614
2625
  React.Children.toArray(renderedChildren).filter(Boolean).length > 0;
2615
2626
  }
2616
2627
  else {
2617
- // If searchTerm is empty, display all children without filtering (but with onClick injected)
2618
- renderedChildren = processDropdownChildren(children, '', true);
2628
+ renderedChildren = processDropdownChildren(children, '', true, searchVariant, handleDropdownItemClick);
2619
2629
  hasFilteredResults =
2620
- React.Children.toArray(renderedChildren).filter(Boolean).length > 0; // Should always be true if there are initial children
2630
+ React.Children.toArray(renderedChildren).filter(Boolean).length > 0;
2621
2631
  }
2632
+ return { renderedChildren: renderedChildren, hasFilteredResults: hasFilteredResults };
2633
+ };
2634
+
2635
+ var useLiveSearch = function (_a) {
2636
+ var value = _a.value, setValue = _a.setValue, onChangeText = _a.onChangeText, dropContOnClickItem = _a.dropContOnClickItem;
2637
+ var _b = React.useState(false), isOpen = _b[0], setIsOpen = _b[1];
2638
+ var _c = React.useState(String(value.label || '')), searchTerm = _c[0], setSearchTerm = _c[1];
2639
+ React.useEffect(function () {
2640
+ if (!isOpen && searchTerm !== '') {
2641
+ setSearchTerm(getItemLabel(value));
2642
+ }
2643
+ }, [isOpen]);
2644
+ var handleInputChange = function (e) {
2645
+ var newSearchTerm = e.target.value;
2646
+ setSearchTerm(newSearchTerm);
2647
+ setIsOpen(true);
2648
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(e);
2649
+ };
2650
+ var handleDropdownItemClick = React.useCallback(function (event, clickedValue) {
2651
+ dropContOnClickItem === null || dropContOnClickItem === void 0 ? void 0 : dropContOnClickItem(event, clickedValue);
2652
+ var newLabel = getItemLabel(clickedValue);
2653
+ setSearchTerm(newLabel);
2654
+ setValue(clickedValue);
2655
+ setIsOpen(false);
2656
+ }, [setValue, dropContOnClickItem]);
2657
+ return {
2658
+ isOpen: isOpen,
2659
+ setIsOpen: setIsOpen,
2660
+ searchTerm: searchTerm,
2661
+ handleInputChange: handleInputChange,
2662
+ handleDropdownItemClick: handleDropdownItemClick,
2663
+ };
2664
+ };
2665
+
2666
+ function LiveSearch(_a) {
2667
+ var _b = _a.autoComplete, autoComplete = _b === void 0 ? 'off' : _b, _c = _a.children, children = _c === void 0 ? undefined : _c, descText = _a.descText, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.dropContProps, dropContProps = _e === void 0 ? { className: undefined } : _e, id = _a.id, label = _a.label, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, options = _a.options, placeholder = _a.placeholder, _h = _a.readOnly, readOnly = _h === void 0 ? false : _h, _j = _a.required, required = _j === void 0 ? false : _j, _k = _a.searchVariant, searchVariant = _k === void 0 ? 'include' : _k, setValue = _a.setValue, _l = _a.size, size = _l === void 0 ? 'md' : _l, value = _a.value;
2668
+ var inputRef = React.useRef(null);
2669
+ var dropdownContRef = React.useRef(null);
2670
+ var _m = useLiveSearch({
2671
+ value: value,
2672
+ setValue: setValue,
2673
+ onChangeText: onChangeText,
2674
+ dropContOnClickItem: dropContProps.onClickItem
2675
+ }), isOpen = _m.isOpen, setIsOpen = _m.setIsOpen, searchTerm = _m.searchTerm, handleInputChange = _m.handleInputChange, handleDropdownItemClick = _m.handleDropdownItemClick;
2676
+ var _o = sizeConfig$6[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
2677
+ var dropContClassName = dropContProps.className; dropContProps.onClickItem; var restDropContProps = __rest(dropContProps, ["className", "onClickItem"]);
2678
+ var isValueExist = value && value.label !== undefined && value.label !== '';
2679
+ var filteredOptions = filterOptions(options || [], value.label);
2680
+ var _p = processRenderedChildren(children, searchTerm, searchVariant, handleDropdownItemClick), renderedChildren = _p.renderedChildren, hasFilteredResults = _p.hasFilteredResults;
2622
2681
  return (React.createElement("div", { className: "bianic-livesearch field-group group/form flex w-full flex-col gap-y-2 " },
2623
2682
  label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
2624
2683
  React.createElement("div", { className: "group relative w-full" },
2625
2684
  React.createElement("input", { className: "bianic-livesearch-input field peer w-full rounded border border-bia-grey-dark-10 bg-primary-white read-only:pointer-events-none read-only:border-bia-grey-disabled focus-visible:outline-none enabled:hover:rounded-b-none enabled:hover:border-b-bia-blue enabled:focus:rounded-b-none enabled:focus:border-b-bia-blue disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-10 disabled:text-bia-coolgrey ".concat(inputClass), onClick: function () { return setIsOpen(!isOpen); }, value: searchTerm, required: required, disabled: disabled, id: id, placeholder: placeholder, ref: inputRef, onChange: function (e) {
2626
2685
  onChangeText(e);
2627
- setValue({ id: null, label: e.target.value });
2628
2686
  handleInputChange(e);
2629
2687
  }, type: "text", readOnly: readOnly, autoComplete: autoComplete }),
2630
2688
  React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass) },
@@ -3070,7 +3128,7 @@ var monthMap = [
3070
3128
  'December',
3071
3129
  ];
3072
3130
  var DateInputDisplay = function (_a) {
3073
- var value = _a.value, setValue = _a.setValue, _b = _a.placeholder, placeholder = _b === void 0 ? 'YYYY-MM-DD' : _b, label = _a.label, required = _a.required, id = _a.id, _c = _a.size, size = _c === void 0 ? 'sm' : _c, className = _a.className, _d = _a.disabled, disabled = _d === void 0 ? false : _d, buttonAction = _a.buttonAction, props = __rest(_a, ["value", "setValue", "placeholder", "label", "required", "id", "size", "className", "disabled", "buttonAction"]);
3131
+ var value = _a.value, setValue = _a.setValue, _b = _a.placeholder, placeholder = _b === void 0 ? 'YYYY-MM-DD' : _b, label = _a.label, required = _a.required, id = _a.id, _c = _a.size, size = _c === void 0 ? 'sm' : _c, className = _a.className, _d = _a.disabled, disabled = _d === void 0 ? false : _d, buttonAction = _a.buttonAction, nullDisplay = _a.nullDisplay, props = __rest(_a, ["value", "setValue", "placeholder", "label", "required", "id", "size", "className", "disabled", "buttonAction", "nullDisplay"]);
3074
3132
  var _e = React.useState(false), isEditing = _e[0], setIsEditing = _e[1];
3075
3133
  var _f = React.useState(value), dateString = _f[0], setDateString = _f[1];
3076
3134
  var _g = styleConfig['text'], fieldStyle = _g.fieldStyle;
@@ -3099,11 +3157,13 @@ var DateInputDisplay = function (_a) {
3099
3157
  setIsEditing(false);
3100
3158
  setDateString(value);
3101
3159
  };
3102
- var input = isEditing ? (React.createElement(TextInput, { type: "text", value: dateString !== null && dateString !== void 0 ? dateString : '', onChange: handleTextChange, onBlur: handleBlur, placeholder: placeholder, size: size, autoFocus: true, actionElement: React.createElement("button", { className: "bianic-datepicker-toggle-button text-bia-coolgrey", disabled: disabled, onClick: function () {
3160
+ var input = isEditing ? (React.createElement(TextInput, { type: "text", value: dateString !== null && dateString !== void 0 ? dateString : '', onChange: handleTextChange, onBlur: handleBlur, placeholder: placeholder, size: size, inputClassName: className, autoFocus: true, actionElement: React.createElement("button", { className: "bianic-datepicker-toggle-button text-bia-coolgrey", disabled: disabled, onClick: function () {
3103
3161
  buttonAction && buttonAction();
3104
3162
  } },
3105
3163
  React.createElement(TbCalendar, { size: iconSize })) })) : (React.createElement(React.Fragment, null,
3106
- React.createElement("div", { role: "button", onClick: function () { return setIsEditing(true); }, className: "bianic-text-input bianic-fgc-target w-full min-w-[185px] rounded hover:rounded-b-none hover:border-b-bia-blue focus:rounded-b-none focus-visible:outline-none disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName, " ").concat(value ? 'text-bia-black' : 'text-bia-coolgrey') }, value ? displayDateFormatter(new Date(value)) : placeholder),
3164
+ React.createElement("div", { role: "button", onClick: function () { return setIsEditing(true); }, className: "bianic-text-input bianic-fgc-target w-full min-w-[185px] rounded hover:rounded-b-none hover:border-b-bia-blue focus:rounded-b-none focus-visible:outline-none disabled:border-bia-grey-dark-10 disabled:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(extendedInputClassName, " ").concat(value || nullDisplay ? 'text-bia-black' : 'text-bia-coolgrey', " ").concat(className) }, value
3165
+ ? displayDateFormatter(new Date(value))
3166
+ : nullDisplay || placeholder),
3107
3167
  React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 text-bia-coolgrey ".concat(iconPosition) },
3108
3168
  React.createElement("button", { className: "bianic-datepicker-toggle-button", disabled: disabled, onClick: function () { return buttonAction && buttonAction(); } },
3109
3169
  React.createElement(TbCalendar, { size: iconSize })))));
@@ -3132,15 +3192,15 @@ var displayDateFormatter = function (date) {
3132
3192
  };
3133
3193
 
3134
3194
  function DatePicker(_a) {
3135
- var value = _a.value, onChange = _a.onChange, size = _a.size, disabled = _a.disabled; _a.placeholder; var label = _a.label, minDate = _a.minDate, maxDate = _a.maxDate, required = _a.required;
3195
+ var value = _a.value, onChange = _a.onChange, size = _a.size, disabled = _a.disabled; _a.placeholder; var label = _a.label, minDate = _a.minDate, maxDate = _a.maxDate, required = _a.required, nullDisplay = _a.nullDisplay, inputclassName = _a.inputclassName, containerClassName = _a.containerClassName;
3136
3196
  // State and Ref
3137
3197
  var inputRef = React.useRef(null);
3138
3198
  var wrapperRef = React.useRef(null);
3139
3199
  var pickerRef = React.useRef(null);
3140
3200
  var _c = useDetectOutsideClick(wrapperRef, false, pickerRef), isPickerOpen = _c[0], setIsPickerOpen = _c[1];
3141
- return (React.createElement("div", { className: "bianic-datepicker-container relative", ref: wrapperRef },
3201
+ return (React.createElement("div", { className: "bianic-datepicker-container relative ".concat(containerClassName), ref: wrapperRef },
3142
3202
  React.createElement("div", { className: "bianic-datepicker-field-container" },
3143
- React.createElement(DateInputDisplay, { value: value, setValue: onChange, placeholder: "YYYY-MM-DD", size: size, label: label, required: required, buttonAction: function () { return setIsPickerOpen(!isPickerOpen); }, ref: inputRef, disabled: disabled })),
3203
+ React.createElement(DateInputDisplay, { inputClassName: inputclassName, value: value, setValue: onChange, placeholder: "YYYY-MM-DD", nullDisplay: nullDisplay, size: size, label: label, required: required, buttonAction: function () { return setIsPickerOpen(!isPickerOpen); }, ref: inputRef, disabled: disabled })),
3144
3204
  isPickerOpen && (React.createElement("div", { className: "bianic-datepicker-calendar-container absolute left-0 w-[250px] rounded-b-radius-sm bg-bia-white px-1.5 pb-[17px] pt-[15px] shadow-md" },
3145
3205
  React.createElement(PickerCalendar, { selectedDate: value, onDateChange: onChange, ref: pickerRef, minDate: minDate, maxDate: maxDate })))));
3146
3206
  }
@@ -3338,18 +3398,17 @@ var sizeConfig$3 = {
3338
3398
  };
3339
3399
 
3340
3400
  var InfoPanel = function (_a) {
3341
- var variant = _a.variant, color = _a.color, className = _a.className, textClassName = _a.textClassName;
3401
+ var variant = _a.variant, color = _a.color, className = _a.className, children = _a.children;
3342
3402
  var sizeClass = sizeConfig$3[variant || 'container'];
3343
3403
  var colorClass = colorConfig$1[color || 'yellow'];
3344
3404
  var allClasses = "".concat(sizeClass, " ").concat(colorClass, " ").concat(className);
3345
- return (React.createElement("div", { className: "flex items-center justify-center rounded-radius-md ".concat(allClasses) },
3346
- React.createElement(Text, { variant: "medium-text", extended: textClassName }, "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.")));
3405
+ return (React.createElement("div", { className: "flex items-center justify-center rounded-radius-md ".concat(allClasses) }, children));
3347
3406
  };
3348
3407
  InfoPanel.defaultProps = {
3349
3408
  variant: 'container',
3350
3409
  color: 'yellow',
3351
3410
  className: '',
3352
- textClassName: '',
3411
+ children: null,
3353
3412
  };
3354
3413
 
3355
3414
  function Modal(_a) {
@@ -3375,12 +3434,12 @@ function Modal(_a) {
3375
3434
  if (open) {
3376
3435
  return (
3377
3436
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
3378
- React.createElement("div", { className: "bianic-modal-wrapper fixed inset-0 flex items-center justify-center bg-bia-black-transparent-75", style: { zIndex: !zIndex && isNaN(zIndex) ? 'auto' : zIndex }, id: "wrapper", onClick: handleClose },
3437
+ reactDom.createPortal(React.createElement("div", { className: "bianic-modal-wrapper fixed inset-0 flex items-center justify-center bg-bia-black-transparent-75", style: { zIndex: !zIndex && isNaN(zIndex) ? 'auto' : zIndex }, id: "wrapper", onClick: handleClose },
3379
3438
  React.createElement("div", { className: "bianic-modal flex flex-col gap-[20px] rounded-[5px] bg-white p-[20px] ".concat(modalSize), onClick: onClick },
3380
3439
  React.createElement("div", { className: "bianic-modal-header flex justify-between" },
3381
3440
  React.createElement("div", { className: " text-wrap text-left font-humnst777 text-[18px] font-bold leading-[21.85px] text-primary-black" }, title),
3382
3441
  React.createElement(Button, { variant: "subtle", radius: "full-rounded", iconLeft: React.createElement(TbX, { size: 14 }), size: "tn", onClick: function () { return onClose(); } })),
3383
- React.createElement("div", { className: "bianic-modal-content flex w-full flex-col items-start gap-[20px]" }, rest.children))));
3442
+ React.createElement("div", { className: "bianic-modal-content flex w-full flex-col items-start gap-[20px]" }, rest.children))), document.body));
3384
3443
  }
3385
3444
  return null;
3386
3445
  }
@@ -3436,7 +3495,7 @@ function PaginationBar(_a) {
3436
3495
  return (React.createElement("div", { className: "flex ".concat(positionConfig[position], " gap-[5px]") },
3437
3496
  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 }),
3438
3497
  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 })); }),
3439
- React.createElement(Button, { variant: "subtle-link", size: "md", type: "button", onClick: function () { return handlePageChange(currentPage + 1); }, className: "cursor-pointer", iconLeft: React.createElement(TbChevronRight, { size: iconSize }), disabled: currentPage === totalPages })));
3498
+ 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 })));
3440
3499
  }
3441
3500
 
3442
3501
  var activeConfig = {
@@ -3523,17 +3582,24 @@ var classConfig = {
3523
3582
  function Popover(_a) {
3524
3583
  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;
3525
3584
  var wrapperRef = React.useRef(null);
3585
+ React.useRef(null);
3526
3586
  var _e = useDetectOutsideClick(wrapperRef, false), isOpen = _e[0], setIsOpen = _e[1];
3527
- var _f = classConfig[direction], tooltipContainer = _f.tooltipContainer, triangleContainer = _f.triangleContainer, triangleShape = _f.triangleShape;
3528
- return (React.createElement("div", { className: "Bianic-popover-Wrapper relative block h-fit w-fit", role: "button", ref: wrapperRef, onClick: function () { return setIsOpen(true); } },
3587
+ return (React.createElement("div", { className: "Bianic-popover-Wrapper relative block h-fit w-fit bg-bia-blue", role: "button", ref: wrapperRef, onClick: function () { return setIsOpen(true); } },
3529
3588
  children,
3530
- isOpen && (React.createElement("div", { 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(tooltipContainer) },
3531
- React.createElement("div", { className: "flex flex-col" },
3532
- React.createElement("div", { className: "mb-[5px] font-humnst777 text-[16px] font-bold leading-[19.42px]" }, title),
3533
- React.createElement("div", { className: "break-words font-segoe text-[12px] font-normal" }, content)),
3534
- React.createElement("div", { className: "triangle absolute ".concat(triangleContainer) },
3535
- React.createElement("div", { className: "h-0 w-0 ".concat(triangleShape) }))))));
3589
+ isOpen && (React.createElement(PopoverItem, { title: title, content: content, anchorRef: wrapperRef, direction: direction }))));
3536
3590
  }
3591
+ var PopoverItem = function (_a) {
3592
+ var title = _a.title, content = _a.content, anchorRef = _a.anchorRef, direction = _a.direction;
3593
+ var popoverRef = React.useRef(null);
3594
+ var positionStyle = usePopupPosition(anchorRef, popoverRef, direction)[0];
3595
+ var _b = classConfig[direction], triangleContainer = _b.triangleContainer, triangleShape = _b.triangleShape;
3596
+ 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" },
3597
+ React.createElement("div", { className: "flex flex-col" },
3598
+ React.createElement("div", { className: "mb-[5px] font-humnst777 text-[16px] font-bold leading-[19.42px]" }, title),
3599
+ React.createElement("div", { className: "break-words font-segoe text-[12px] font-normal" }, content)),
3600
+ React.createElement("div", { className: "triangle absolute ".concat(triangleContainer) },
3601
+ React.createElement("div", { className: "h-0 w-0 ".concat(triangleShape) }))), document.body);
3602
+ };
3537
3603
  Popover.defaultProps = {
3538
3604
  delay: 400,
3539
3605
  direction: 'top',
@@ -3754,7 +3820,7 @@ var configTab = {
3754
3820
  };
3755
3821
 
3756
3822
  function Tab(_a) {
3757
- var children = _a.children, active = _a.active, icon = _a.icon, disabled = _a.disabled, _b = _a.mode, mode = _b === void 0 ? 'horizontal' : _b, _c = _a.fit, fit = _c === void 0 ? 'fit-content' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, rest = __rest(_a, ["children", "active", "icon", "disabled", "mode", "fit", "size"]);
3823
+ var children = _a.children, active = _a.active, icon = _a.icon, disabled = _a.disabled, _b = _a.mode, mode = _b === void 0 ? 'horizontal' : _b, _c = _a.fit, fit = _c === void 0 ? 'fit-content' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, className = _a.className, rest = __rest(_a, ["children", "active", "icon", "disabled", "mode", "fit", "size", "className"]);
3758
3824
  var disabledKeyTab = disabled || active ? ' pointer-events-none' : '';
3759
3825
  var cursor;
3760
3826
  if (disabled) {
@@ -3775,8 +3841,9 @@ function Tab(_a) {
3775
3841
  var activeKeyTab = active
3776
3842
  ? 'group-disabled:text-bia-coolgrey-disabled text-primary-black'
3777
3843
  : 'text-bia-coolgrey group-hover:text-bia-coolgrey-hover group-active:text-bia-coolgrey-active group-disabled:text-bia-coolgrey-disabled';
3844
+ var buttonClassName = "".concat(horizontalButtonStyle, " ").concat(disabledKeyTab, " ").concat(fit, " ").concat(className ? className : '');
3778
3845
  return (React.createElement("div", { className: "".concat(mode === 'horizontal' ? 'h-full' : 'w-full', " ").concat(cursor) },
3779
- React.createElement("button", __assign({ type: "button", disabled: disabled }, rest, { className: "flex items-stretch justify-between ".concat(horizontalButtonStyle, " group relative outline-none ").concat(disabledKeyTab, " ").concat(fit) }),
3846
+ React.createElement("button", __assign({ type: "button", className: "flex items-stretch justify-between group relative outline-none ".concat(buttonClassName), disabled: disabled }, rest),
3780
3847
  React.createElement("div", { className: "flex items-center justify-center ".concat(buttonContentStyle) },
3781
3848
  React.createElement("div", { className: "flex items-center justify-center " },
3782
3849
  React.createElement("div", { className: "flex items-center space-x-1 text-nowrap ".concat(activeKeyTab, " ").concat(configTab[size].text) },