bianic-ui 1.15.0-beta.2 → 1.16.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +377 -300
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Forms/DatePicker/DateInputDisplay.d.ts +16 -0
- package/dist/cjs/types/components/Forms/DatePicker/DatePicker.d.ts +9 -4
- package/dist/cjs/types/components/Forms/DatePicker/DatePickerLimitSimulation.d.ts +3 -0
- package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar.d.ts +6 -4
- package/dist/cjs/types/components/Forms/Dropdown/DropdownContainer.d.ts +2 -2
- package/dist/cjs/types/components/Forms/LiveSearch/Example/CustomDropdown.d.ts +1 -2
- package/dist/cjs/types/components/Forms/LiveSearch/Example/DeprecatedSimulation.d.ts +4 -0
- package/dist/cjs/types/components/Forms/LiveSearch/hooks/useLiveSearch.d.ts +9 -0
- package/dist/cjs/types/components/Forms/LiveSearch/index.d.ts +2 -6
- package/dist/cjs/types/components/Forms/LiveSearch/types/index.d.ts +36 -0
- package/dist/cjs/types/components/Forms/LiveSearch/utils/dropdownUtils.d.ts +8 -0
- package/dist/cjs/types/components/Forms/LiveSearch/utils/searchUtils.d.ts +3 -0
- package/dist/cjs/types/components/Forms/index.d.ts +1 -1
- package/dist/cjs/types/components/InfoPanel/index.d.ts +3 -3
- package/dist/cjs/types/components/Menu/MenuContainer.d.ts +7 -1
- package/dist/cjs/types/components/Menu/MenuContainerNoAnchor.d.ts +13 -0
- package/dist/cjs/types/components/Modal/Modal.d.ts +2 -2
- package/dist/cjs/types/components/Tab/Tab.d.ts +2 -1
- package/dist/cjs/types/components/index.d.ts +1 -1
- package/dist/cjs/types/stories/Form/DatePicker/DatepickerLimitSimulation.stories.d.ts +13 -0
- package/dist/{esm/types/stories/Form/LiveSearch/LivesearchOld.stories.d.ts → cjs/types/stories/Form/LiveSearch/DeprecatedSimulation.stories.d.ts} +2 -2
- package/dist/cjs/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +7 -3
- package/dist/cjs/types/utility/hooks/usePopupPosition.d.ts +8 -0
- package/dist/esm/index.js +378 -302
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Forms/DatePicker/DateInputDisplay.d.ts +16 -0
- package/dist/esm/types/components/Forms/DatePicker/DatePicker.d.ts +9 -4
- package/dist/esm/types/components/Forms/DatePicker/DatePickerLimitSimulation.d.ts +3 -0
- package/dist/esm/types/components/Forms/DatePicker/PickerCalendar.d.ts +6 -4
- package/dist/esm/types/components/Forms/Dropdown/DropdownContainer.d.ts +2 -2
- package/dist/esm/types/components/Forms/LiveSearch/Example/CustomDropdown.d.ts +1 -2
- package/dist/esm/types/components/Forms/LiveSearch/Example/DeprecatedSimulation.d.ts +4 -0
- package/dist/esm/types/components/Forms/LiveSearch/hooks/useLiveSearch.d.ts +9 -0
- package/dist/esm/types/components/Forms/LiveSearch/index.d.ts +2 -6
- package/dist/esm/types/components/Forms/LiveSearch/types/index.d.ts +36 -0
- package/dist/esm/types/components/Forms/LiveSearch/utils/dropdownUtils.d.ts +8 -0
- package/dist/esm/types/components/Forms/LiveSearch/utils/searchUtils.d.ts +3 -0
- package/dist/esm/types/components/Forms/index.d.ts +1 -1
- package/dist/esm/types/components/InfoPanel/index.d.ts +3 -3
- package/dist/esm/types/components/Menu/MenuContainer.d.ts +7 -1
- package/dist/esm/types/components/Menu/MenuContainerNoAnchor.d.ts +13 -0
- package/dist/esm/types/components/Modal/Modal.d.ts +2 -2
- package/dist/esm/types/components/Tab/Tab.d.ts +2 -1
- package/dist/esm/types/components/index.d.ts +1 -1
- package/dist/esm/types/stories/Form/DatePicker/DatepickerLimitSimulation.stories.d.ts +13 -0
- package/dist/{cjs/types/stories/Form/LiveSearch/LivesearchOld.stories.d.ts → esm/types/stories/Form/LiveSearch/DeprecatedSimulation.stories.d.ts} +2 -2
- package/dist/esm/types/stories/Form/LiveSearch/LivesearchCustomDropdownExample.stories.d.ts +7 -3
- package/dist/esm/types/utility/hooks/usePopupPosition.d.ts +8 -0
- package/dist/index.d.ts +48 -28
- package/package.json +1 -1
- package/dist/cjs/types/components/Forms/LiveSearch/PropsInterface.d.ts +0 -23
- package/dist/cjs/types/components/Forms/LiveSearch/Simulation.d.ts +0 -4
- package/dist/esm/types/components/Forms/LiveSearch/PropsInterface.d.ts +0 -23
- 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]
|
|
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]
|
|
449
|
-
tn: 'py-[4px] h-[22px]
|
|
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,86 @@ var TreeItem = function (_a) {
|
|
|
1724
1724
|
})))));
|
|
1725
1725
|
};
|
|
1726
1726
|
|
|
1727
|
-
var
|
|
1727
|
+
var getDropdownStyle = function (anchorRef, popupRef) {
|
|
1728
|
+
if (!anchorRef.current || !popupRef.current) {
|
|
1729
|
+
return {};
|
|
1730
|
+
}
|
|
1731
|
+
var anchorRect = anchorRef.current.getBoundingClientRect();
|
|
1732
|
+
var popupHeight = popupRef.current.offsetHeight;
|
|
1733
|
+
var spaceToBottom = window.innerHeight - anchorRect.bottom;
|
|
1734
|
+
var spaceToTop = anchorRect.top;
|
|
1735
|
+
var style = {
|
|
1736
|
+
left: "".concat(anchorRect.left, "px"),
|
|
1737
|
+
};
|
|
1738
|
+
// If space below is less than popup height,
|
|
1739
|
+
// AND space above is more than space below
|
|
1740
|
+
// then flip up
|
|
1741
|
+
if (spaceToBottom < popupHeight && spaceToTop > spaceToBottom) {
|
|
1742
|
+
style.bottom = "".concat(window.innerHeight - anchorRect.top, "px");
|
|
1743
|
+
}
|
|
1744
|
+
else {
|
|
1745
|
+
style.top = "".concat(anchorRect.bottom, "px");
|
|
1746
|
+
}
|
|
1747
|
+
return style;
|
|
1748
|
+
};
|
|
1749
|
+
var usePopupPosition = function (anchorRef, popupRef) {
|
|
1750
|
+
// In projects where bianic-ui is installed,
|
|
1751
|
+
// there is a delay in rendering styles,
|
|
1752
|
+
// which causes popups to lose their position and need to be re-rendered.
|
|
1753
|
+
var _a = React.useState(0), repeateRender = _a[0], setRepeateRender = _a[1];
|
|
1754
|
+
var _b = React.useState({}), positionStyle = _b[0], setPositionStyle = _b[1];
|
|
1755
|
+
React.useLayoutEffect(function () {
|
|
1756
|
+
if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current))
|
|
1757
|
+
return;
|
|
1758
|
+
var newStyle = getDropdownStyle(anchorRef, popupRef);
|
|
1759
|
+
setPositionStyle(newStyle);
|
|
1760
|
+
var handleScrollOrResize = function () {
|
|
1761
|
+
setPositionStyle(getDropdownStyle(anchorRef, popupRef));
|
|
1762
|
+
};
|
|
1763
|
+
window.addEventListener('scroll', handleScrollOrResize);
|
|
1764
|
+
window.addEventListener('resize', handleScrollOrResize);
|
|
1765
|
+
setRepeateRender(0);
|
|
1766
|
+
return function () {
|
|
1767
|
+
window.removeEventListener('scroll', handleScrollOrResize);
|
|
1768
|
+
window.removeEventListener('resize', handleScrollOrResize);
|
|
1769
|
+
};
|
|
1770
|
+
}, [anchorRef]);
|
|
1771
|
+
React.useEffect(function () {
|
|
1772
|
+
if (repeateRender < 5 && (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)) {
|
|
1773
|
+
setPositionStyle(getDropdownStyle(anchorRef, popupRef));
|
|
1774
|
+
setRepeateRender(repeateRender + 1);
|
|
1775
|
+
}
|
|
1776
|
+
}, [repeateRender]);
|
|
1777
|
+
return [positionStyle];
|
|
1778
|
+
};
|
|
1779
|
+
|
|
1780
|
+
var MenuContainer = function (props) {
|
|
1781
|
+
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"]);
|
|
1782
|
+
if (!open)
|
|
1783
|
+
return null;
|
|
1784
|
+
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
1785
|
+
var MenuContainerRef = React.useRef(null);
|
|
1786
|
+
var positionStyle = usePopupPosition(anchorRef, MenuContainerRef)[0];
|
|
1787
|
+
return (React.createElement(React.Fragment, null,
|
|
1788
|
+
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 } })),
|
|
1789
|
+
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
|
|
1790
|
+
? anchorRef.current.offsetWidth
|
|
1791
|
+
: undefined }, positionStyle) }, restProps), React.Children.map(children, function (child) {
|
|
1792
|
+
return React.isValidElement(child)
|
|
1793
|
+
? // Kirimkan handleItemClick sebagai props onClick ke setiap MenuItem
|
|
1794
|
+
React.cloneElement(child, {
|
|
1795
|
+
onClose: function () { return onClose(); },
|
|
1796
|
+
zIndex: zIndex + 10,
|
|
1797
|
+
inheritedOnClick: function () { return onClickItem(); },
|
|
1798
|
+
})
|
|
1799
|
+
: child;
|
|
1800
|
+
})), document.body)));
|
|
1801
|
+
};
|
|
1802
|
+
MenuContainer.defaultProps = {
|
|
1803
|
+
isTopFlat: false,
|
|
1804
|
+
};
|
|
1805
|
+
|
|
1806
|
+
var MenuContainerNoAnchor = React.forwardRef(function MenuContainerNoAnchor(propsComp, ref) {
|
|
1728
1807
|
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
1808
|
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
1730
1809
|
return (open && (React.createElement(React.Fragment, null,
|
|
@@ -1742,7 +1821,7 @@ var MenuContainer = React.forwardRef(function MenuContainer(propsComp, ref) {
|
|
|
1742
1821
|
: child;
|
|
1743
1822
|
})))));
|
|
1744
1823
|
});
|
|
1745
|
-
|
|
1824
|
+
MenuContainerNoAnchor.defaultProps = {
|
|
1746
1825
|
isTopFlat: false,
|
|
1747
1826
|
};
|
|
1748
1827
|
|
|
@@ -1756,11 +1835,10 @@ function MenuItem(_a) {
|
|
|
1756
1835
|
var itemClass = "".concat(leftPadding, " ").concat(rightPadding, " ").concat(className);
|
|
1757
1836
|
var MenuContRef = React.useRef(null);
|
|
1758
1837
|
React.useEffect(function () {
|
|
1759
|
-
var _a;
|
|
1760
1838
|
if (MenuContRef.current) {
|
|
1761
1839
|
// Adjust dropdown position to prevent overflow on the right.
|
|
1762
|
-
var MenuContRect =
|
|
1763
|
-
var RectRight = MenuContRect
|
|
1840
|
+
var MenuContRect = MenuContRef.current.getBoundingClientRect();
|
|
1841
|
+
var RectRight = MenuContRect.right;
|
|
1764
1842
|
var innerWindow = window.innerWidth;
|
|
1765
1843
|
if (RectRight > innerWindow)
|
|
1766
1844
|
setIsLeft(true);
|
|
@@ -1784,7 +1862,7 @@ function MenuItem(_a) {
|
|
|
1784
1862
|
React.createElement("div", { className: "ml-auto flex items-center" },
|
|
1785
1863
|
children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey" })),
|
|
1786
1864
|
children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] text-bia-coolgrey" }, caption)))),
|
|
1787
|
-
children && (React.createElement(
|
|
1865
|
+
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
1866
|
}
|
|
1789
1867
|
MenuItem.defaultProps = {
|
|
1790
1868
|
className: '',
|
|
@@ -2385,71 +2463,22 @@ var sizeConfig$6 = {
|
|
|
2385
2463
|
},
|
|
2386
2464
|
};
|
|
2387
2465
|
|
|
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
2466
|
var DropdownContainer = function (propsComp) {
|
|
2412
2467
|
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
2468
|
if (!open)
|
|
2414
2469
|
return null;
|
|
2415
|
-
var _j = React.useState({ minWidth: 'auto' }), positionStyle = _j[0], setPositionStyle = _j[1];
|
|
2416
2470
|
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
2417
2471
|
var sizeClass = containerSizeConfig[size] || containerSizeConfig['md'];
|
|
2418
2472
|
var containerClass = "".concat(sizeClass, " ").concat(radiusClass, " ").concat(className);
|
|
2419
2473
|
var dropdownRef = React.useRef(null);
|
|
2474
|
+
var positionStyle = usePopupPosition(anchorRef, dropdownRef)[0];
|
|
2420
2475
|
var handleClickDrpdownItem = function (e, val) {
|
|
2421
2476
|
onClickItem(e, val);
|
|
2422
2477
|
onClose();
|
|
2423
2478
|
};
|
|
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
2479
|
return (React.createElement(React.Fragment, null,
|
|
2451
2480
|
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) {
|
|
2481
|
+
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({ minWidth: anchorRef.current ? anchorRef.current.offsetWidth : undefined, zIndex: zIndex + 10 }, positionStyle) }, restProps), React.Children.map(children, function (child) {
|
|
2453
2482
|
return React.isValidElement(child)
|
|
2454
2483
|
? // Kirimkan handleItemClick sebagai props onClick ke setiap DropdownItem
|
|
2455
2484
|
React.cloneElement(child, {
|
|
@@ -2520,111 +2549,131 @@ var matchSearchTerm = function (content, term, variant) {
|
|
|
2520
2549
|
return lowerContent.includes(lowerTerm);
|
|
2521
2550
|
}
|
|
2522
2551
|
};
|
|
2523
|
-
function
|
|
2524
|
-
|
|
2525
|
-
|
|
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());
|
|
2552
|
+
var filterOptions = function (options, searchTerm) {
|
|
2553
|
+
return options === null || options === void 0 ? void 0 : options.filter(function (item) {
|
|
2554
|
+
return item.label.toLowerCase().includes(searchTerm.toLowerCase());
|
|
2554
2555
|
});
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
var
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
}
|
|
2556
|
+
};
|
|
2557
|
+
|
|
2558
|
+
var getItemLabel = function (value) {
|
|
2559
|
+
var _a;
|
|
2560
|
+
return typeof value === 'object' && value !== null && 'label' in value
|
|
2561
|
+
? (_a = value.label) !== null && _a !== void 0 ? _a : ''
|
|
2562
|
+
: String(value !== null && value !== void 0 ? value : '');
|
|
2563
|
+
};
|
|
2564
|
+
var processDropdownChildren = function (nodes, currentSearchTerm, includeAllIfNoSearch, searchVariant, handleDropdownItemClick) {
|
|
2565
|
+
if (searchVariant === void 0) { searchVariant = 'include'; }
|
|
2566
|
+
return React.Children.map(nodes, function (child) {
|
|
2567
|
+
if (!React.isValidElement(child) || child.type !== DropdownItem) {
|
|
2568
|
+
return child;
|
|
2569
|
+
}
|
|
2570
|
+
var itemProps = child.props;
|
|
2571
|
+
var itemContent = typeof itemProps.content === 'string' ? itemProps.content : '';
|
|
2572
|
+
var itemValue = itemProps.value;
|
|
2573
|
+
var isDisabled = itemProps.disabled;
|
|
2574
|
+
// Filtering Logic
|
|
2575
|
+
if (!includeAllIfNoSearch) {
|
|
2576
|
+
var itemValueStr = typeof itemValue === 'object'
|
|
2577
|
+
? itemValue.label
|
|
2578
|
+
: String(itemValue || '');
|
|
2579
|
+
if (currentSearchTerm &&
|
|
2580
|
+
!matchSearchTerm(itemValueStr, currentSearchTerm, searchVariant)) {
|
|
2581
|
+
return null;
|
|
2582
2582
|
}
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
}
|
|
2596
|
-
if (dropContOnClickItem) {
|
|
2597
|
-
dropContOnClickItem(e, itemValue !== undefined ? itemValue : itemContent);
|
|
2583
|
+
}
|
|
2584
|
+
// Process Nested Children
|
|
2585
|
+
var clonedChildren = itemProps.children
|
|
2586
|
+
? processDropdownChildren(itemProps.children, currentSearchTerm, includeAllIfNoSearch, searchVariant, handleDropdownItemClick)
|
|
2587
|
+
: null;
|
|
2588
|
+
// Clone and Inject Click Handler
|
|
2589
|
+
return React.cloneElement(child, {
|
|
2590
|
+
onClick: function (e) {
|
|
2591
|
+
if (!isDisabled) {
|
|
2592
|
+
if (itemValue === undefined &&
|
|
2593
|
+
typeof itemProps.content === 'string') {
|
|
2594
|
+
return handleDropdownItemClick(e, itemContent);
|
|
2598
2595
|
}
|
|
2599
|
-
if (
|
|
2600
|
-
|
|
2596
|
+
if (typeof itemValue === 'object' || itemValue !== undefined) {
|
|
2597
|
+
return handleDropdownItemClick(e, itemValue);
|
|
2601
2598
|
}
|
|
2602
|
-
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2599
|
+
}
|
|
2600
|
+
if (itemProps.onClickItem) {
|
|
2601
|
+
itemProps.onClickItem(e, itemValue !== undefined ? itemValue : itemContent);
|
|
2602
|
+
}
|
|
2603
|
+
},
|
|
2604
|
+
children: clonedChildren,
|
|
2605
2605
|
});
|
|
2606
|
-
};
|
|
2607
|
-
|
|
2606
|
+
});
|
|
2607
|
+
};
|
|
2608
|
+
var processRenderedChildren = function (children, searchTerm, searchVariant, handleDropdownItemClick) {
|
|
2608
2609
|
var renderedChildren = null;
|
|
2609
2610
|
var hasFilteredResults = false;
|
|
2610
2611
|
if (searchTerm) {
|
|
2611
|
-
|
|
2612
|
-
renderedChildren = processDropdownChildren(children, searchTerm, false);
|
|
2612
|
+
renderedChildren = processDropdownChildren(children, searchTerm, false, searchVariant, handleDropdownItemClick);
|
|
2613
2613
|
hasFilteredResults =
|
|
2614
2614
|
React.Children.toArray(renderedChildren).filter(Boolean).length > 0;
|
|
2615
2615
|
}
|
|
2616
2616
|
else {
|
|
2617
|
-
|
|
2618
|
-
renderedChildren = processDropdownChildren(children, '', true);
|
|
2617
|
+
renderedChildren = processDropdownChildren(children, '', true, searchVariant, handleDropdownItemClick);
|
|
2619
2618
|
hasFilteredResults =
|
|
2620
|
-
React.Children.toArray(renderedChildren).filter(Boolean).length > 0;
|
|
2619
|
+
React.Children.toArray(renderedChildren).filter(Boolean).length > 0;
|
|
2621
2620
|
}
|
|
2621
|
+
return { renderedChildren: renderedChildren, hasFilteredResults: hasFilteredResults };
|
|
2622
|
+
};
|
|
2623
|
+
|
|
2624
|
+
var useLiveSearch = function (_a) {
|
|
2625
|
+
var value = _a.value, setValue = _a.setValue, onChangeText = _a.onChangeText, dropContOnClickItem = _a.dropContOnClickItem;
|
|
2626
|
+
var _b = React.useState(false), isOpen = _b[0], setIsOpen = _b[1];
|
|
2627
|
+
var _c = React.useState(String(value.label || '')), searchTerm = _c[0], setSearchTerm = _c[1];
|
|
2628
|
+
React.useEffect(function () {
|
|
2629
|
+
if (!isOpen && searchTerm !== '') {
|
|
2630
|
+
setSearchTerm(getItemLabel(value));
|
|
2631
|
+
}
|
|
2632
|
+
}, [isOpen]);
|
|
2633
|
+
var handleInputChange = function (e) {
|
|
2634
|
+
var newSearchTerm = e.target.value;
|
|
2635
|
+
setSearchTerm(newSearchTerm);
|
|
2636
|
+
setIsOpen(true);
|
|
2637
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(e);
|
|
2638
|
+
};
|
|
2639
|
+
var handleDropdownItemClick = React.useCallback(function (event, clickedValue) {
|
|
2640
|
+
dropContOnClickItem === null || dropContOnClickItem === void 0 ? void 0 : dropContOnClickItem(event, clickedValue);
|
|
2641
|
+
var newLabel = getItemLabel(clickedValue);
|
|
2642
|
+
setSearchTerm(newLabel);
|
|
2643
|
+
setValue(clickedValue);
|
|
2644
|
+
setIsOpen(false);
|
|
2645
|
+
}, [setValue, dropContOnClickItem]);
|
|
2646
|
+
return {
|
|
2647
|
+
isOpen: isOpen,
|
|
2648
|
+
setIsOpen: setIsOpen,
|
|
2649
|
+
searchTerm: searchTerm,
|
|
2650
|
+
handleInputChange: handleInputChange,
|
|
2651
|
+
handleDropdownItemClick: handleDropdownItemClick,
|
|
2652
|
+
};
|
|
2653
|
+
};
|
|
2654
|
+
|
|
2655
|
+
function LiveSearch(_a) {
|
|
2656
|
+
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;
|
|
2657
|
+
var inputRef = React.useRef(null);
|
|
2658
|
+
var dropdownContRef = React.useRef(null);
|
|
2659
|
+
var _m = useLiveSearch({
|
|
2660
|
+
value: value,
|
|
2661
|
+
setValue: setValue,
|
|
2662
|
+
onChangeText: onChangeText,
|
|
2663
|
+
dropContOnClickItem: dropContProps.onClickItem
|
|
2664
|
+
}), isOpen = _m.isOpen, setIsOpen = _m.setIsOpen, searchTerm = _m.searchTerm, handleInputChange = _m.handleInputChange, handleDropdownItemClick = _m.handleDropdownItemClick;
|
|
2665
|
+
var _o = sizeConfig$6[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
|
|
2666
|
+
var dropContClassName = dropContProps.className; dropContProps.onClickItem; var restDropContProps = __rest(dropContProps, ["className", "onClickItem"]);
|
|
2667
|
+
var isValueExist = value && value.label !== undefined && value.label !== '';
|
|
2668
|
+
var filteredOptions = filterOptions(options || [], value.label);
|
|
2669
|
+
var _p = processRenderedChildren(children, searchTerm, searchVariant, handleDropdownItemClick), renderedChildren = _p.renderedChildren, hasFilteredResults = _p.hasFilteredResults;
|
|
2622
2670
|
return (React.createElement("div", { className: "bianic-livesearch field-group group/form flex w-full flex-col gap-y-2 " },
|
|
2623
|
-
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly },
|
|
2671
|
+
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly },
|
|
2672
|
+
label,
|
|
2673
|
+
" Test")),
|
|
2624
2674
|
React.createElement("div", { className: "group relative w-full" },
|
|
2625
2675
|
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
2676
|
onChangeText(e);
|
|
2627
|
-
setValue({ id: null, label: e.target.value });
|
|
2628
2677
|
handleInputChange(e);
|
|
2629
2678
|
}, type: "text", readOnly: readOnly, autoComplete: autoComplete }),
|
|
2630
2679
|
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass) },
|
|
@@ -2773,8 +2822,32 @@ var oneDayValue = 24 * 60 * 60 * 1000; // milliseconds in one day
|
|
|
2773
2822
|
var todayValue = Date.now() -
|
|
2774
2823
|
(Date.now() % oneDayValue) +
|
|
2775
2824
|
new Date().getTimezoneOffset() * 1000 * 60; // today in milliseconds
|
|
2825
|
+
// Supporting functions
|
|
2826
|
+
var checkDateEquals = function (date1, date2) {
|
|
2827
|
+
if (!date2 || !date1)
|
|
2828
|
+
return false;
|
|
2829
|
+
return (date1.getFullYear() === date2.getFullYear() &&
|
|
2830
|
+
date1.getMonth() === date2.getMonth() &&
|
|
2831
|
+
date1.getDate() === date2.getDate());
|
|
2832
|
+
};
|
|
2833
|
+
var checkIsValidDate = function (dateString) {
|
|
2834
|
+
// format check YYYY-MM-DD
|
|
2835
|
+
var regex = /^\d{4}-\d{2}-\d{2}$/;
|
|
2836
|
+
if (!regex.test(dateString)) {
|
|
2837
|
+
return false;
|
|
2838
|
+
}
|
|
2839
|
+
// Date validity check
|
|
2840
|
+
var parts = dateString.split('-');
|
|
2841
|
+
var year = parseInt(parts[0], 10);
|
|
2842
|
+
var month = parseInt(parts[1], 10);
|
|
2843
|
+
var day = parseInt(parts[2], 10);
|
|
2844
|
+
var date = new Date(Date.UTC(year, month - 1, day));
|
|
2845
|
+
return (date.getUTCFullYear() === year &&
|
|
2846
|
+
date.getUTCMonth() === month - 1 && // Check against 0-based month
|
|
2847
|
+
date.getUTCDate() === day);
|
|
2848
|
+
};
|
|
2776
2849
|
var PickerCalendar = function (_a) {
|
|
2777
|
-
var _b = _a.selectedDate, selectedDate = _b === void 0 ? null : _b, onDateChange = _a.onDateChange, ref = _a.ref;
|
|
2850
|
+
var _b = _a.selectedDate, selectedDate = _b === void 0 ? null : _b, onDateChange = _a.onDateChange, ref = _a.ref, minDate = _a.minDate, maxDate = _a.maxDate;
|
|
2778
2851
|
// Constants
|
|
2779
2852
|
var daysMap = [
|
|
2780
2853
|
'Monday',
|
|
@@ -2803,10 +2876,12 @@ var PickerCalendar = function (_a) {
|
|
|
2803
2876
|
// Mode Controller
|
|
2804
2877
|
var _c = React.useState(modeMap[0]), pickerMode = _c[0], setPickerMode = _c[1];
|
|
2805
2878
|
var _d = React.useState(''), prevMode = _d[0], setPrevMode = _d[1];
|
|
2879
|
+
var minDateValue = minDate && checkIsValidDate(minDate || '') ? new Date(minDate) : null;
|
|
2880
|
+
var maxDateValue = maxDate && checkIsValidDate(maxDate || '') ? new Date(maxDate) : null;
|
|
2806
2881
|
// styling constants and functions
|
|
2807
|
-
var chevronButtonStyle = 'text-bia-coolgrey';
|
|
2882
|
+
var chevronButtonStyle = 'text-bia-coolgrey disabled:text-bia-coolgrey-light-50';
|
|
2808
2883
|
var selectedDateStyle = function (date, dateSelected) {
|
|
2809
|
-
var isSelected = checkDateEquals(date, dateSelected);
|
|
2884
|
+
var isSelected = checkDateEquals(date, new Date(dateSelected));
|
|
2810
2885
|
var isToday = checkDateEquals(date, new Date(todayValue));
|
|
2811
2886
|
if (isSelected) {
|
|
2812
2887
|
return 'bg-bia-blue-dark-10 text-bia-white rounded-full border border-bia-blue-dark-10';
|
|
@@ -2818,30 +2893,14 @@ var PickerCalendar = function (_a) {
|
|
|
2818
2893
|
return 'hover:bg-bia-blue-pastel rounded-full';
|
|
2819
2894
|
}
|
|
2820
2895
|
};
|
|
2821
|
-
var
|
|
2822
|
-
if (
|
|
2823
|
-
return 'text-bia-black';
|
|
2824
|
-
}
|
|
2825
|
-
else {
|
|
2826
|
-
return 'text-bia-coolgrey';
|
|
2827
|
-
}
|
|
2828
|
-
};
|
|
2829
|
-
var selectedMonthStyle = function (month, monthSelected) {
|
|
2830
|
-
if (month === monthSelected) {
|
|
2896
|
+
var selectedStyle = function (match) {
|
|
2897
|
+
if (match) {
|
|
2831
2898
|
return 'bg-bia-blue-dark-10 text-bia-white rounded-full border border-bia-blue-dark-10';
|
|
2832
2899
|
}
|
|
2833
2900
|
else {
|
|
2834
|
-
return 'hover:bg-bia-blue-pastel rounded-full';
|
|
2901
|
+
return 'enabled:hover:bg-bia-blue-pastel rounded-full';
|
|
2835
2902
|
}
|
|
2836
2903
|
};
|
|
2837
|
-
// Supporting functions
|
|
2838
|
-
var checkDateEquals = function (date1, date2) {
|
|
2839
|
-
if (!date2 || !date1)
|
|
2840
|
-
return false;
|
|
2841
|
-
return (date1.getFullYear() === date2.getFullYear() &&
|
|
2842
|
-
date1.getMonth() === date2.getMonth() &&
|
|
2843
|
-
date1.getDate() === date2.getDate());
|
|
2844
|
-
};
|
|
2845
2904
|
// handler
|
|
2846
2905
|
var handleViewNextMonth = function () {
|
|
2847
2906
|
if (viewMonthValue === 11) {
|
|
@@ -2908,7 +2967,7 @@ var PickerCalendar = function (_a) {
|
|
|
2908
2967
|
setViewYearValue(date.getFullYear());
|
|
2909
2968
|
}
|
|
2910
2969
|
if (onDateChange) {
|
|
2911
|
-
onDateChange(date);
|
|
2970
|
+
onDateChange(dateToInputString$1(date));
|
|
2912
2971
|
}
|
|
2913
2972
|
};
|
|
2914
2973
|
var handlePickerMode = function (mode) {
|
|
@@ -2948,17 +3007,59 @@ var PickerCalendar = function (_a) {
|
|
|
2948
3007
|
var yearDisplayRange = getDecadeRange(viewDecadeValue);
|
|
2949
3008
|
// Variable display
|
|
2950
3009
|
var dateDisplay = (React.createElement("div", { className: "".concat(pickerMode === 'date' ? '' : 'hidden') },
|
|
2951
|
-
React.createElement("div", { className: "bianic-datepicker-calendar-days-grid-header grid grid-cols-7 gap-[3px] pb-1.5", style: { zIndex: 100 } }, daysMap.map(function (day) { return (React.createElement("div", { key: day, className: "bianic-datepicker-calendar-day flex h-[18px] w-[31px] items-center justify-center
|
|
2952
|
-
React.createElement(Text, { variant: "small-text" }, day.slice(0, 3)))); })),
|
|
2953
|
-
React.createElement("div", { className: "bianic-datepicker-calendar-days-grid-body grid grid-cols-7 gap-y-1.5" }, displayDays.map(function (date) {
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
3010
|
+
React.createElement("div", { className: "bianic-datepicker-calendar-days-grid-header grid grid-cols-7 gap-[3px] pb-1.5", style: { zIndex: 100 } }, daysMap.map(function (day) { return (React.createElement("div", { key: day, className: "bianic-datepicker-calendar-day flex h-[18px] w-[31px] items-center justify-center" },
|
|
3011
|
+
React.createElement(Text, { variant: "small-text", extended: "text-bia-coolgrey" }, day.slice(0, 3)))); })),
|
|
3012
|
+
React.createElement("div", { className: "bianic-datepicker-calendar-days-grid-body grid grid-cols-7 gap-y-1.5" }, displayDays.map(function (date) {
|
|
3013
|
+
var isOutOfRange = !!((minDateValue && date < minDateValue) ||
|
|
3014
|
+
(maxDateValue && date > maxDateValue));
|
|
3015
|
+
var isOutOfMonth = date.getMonth() !== viewMonthValue;
|
|
3016
|
+
var calendarDateStyle = isOutOfMonth
|
|
3017
|
+
? 'text-bia-coolgrey'
|
|
3018
|
+
: 'text-bia-black';
|
|
3019
|
+
var dateDisplayStyle = isOutOfRange
|
|
3020
|
+
? 'text-bia-coolgrey-light-50'
|
|
3021
|
+
: calendarDateStyle;
|
|
3022
|
+
return (React.createElement("button", { key: date.toString(), className: "bianic-datepicker-calendar-day flex h-[31px] w-[31px] items-center justify-center ".concat(isOutOfRange ? '' : selectedDateStyle(date, selectedDate)), disabled: isOutOfRange, onClick: function () {
|
|
3023
|
+
handleSetSelectedDate(date);
|
|
3024
|
+
} },
|
|
3025
|
+
React.createElement(Text, { variant: "small-text", extended: selectedDate &&
|
|
3026
|
+
date.getDate() === parseInt(selectedDate.slice(8, 10)) &&
|
|
3027
|
+
date.getMonth() + 1 === parseInt(selectedDate.slice(5, 7)) &&
|
|
3028
|
+
date.getFullYear() === parseInt(selectedDate.slice(0, 4))
|
|
3029
|
+
? 'text-bia-white'
|
|
3030
|
+
: dateDisplayStyle }, date.getDate())));
|
|
3031
|
+
}))));
|
|
3032
|
+
var monthDisplay = (React.createElement("div", { className: "bianic-datepicker-calendar-month-grid grid grid-cols-3 gap-y-1.5 ".concat(pickerMode === 'month' ? '' : 'hidden') }, monthMap.map(function (month, index) {
|
|
3033
|
+
var isOutOfRange = !!((minDateValue &&
|
|
3034
|
+
(minDateValue.getFullYear() < viewYearValue ||
|
|
3035
|
+
index <
|
|
3036
|
+
(minDateValue.getFullYear() === viewYearValue
|
|
3037
|
+
? minDateValue.getMonth()
|
|
3038
|
+
: 0))) ||
|
|
3039
|
+
(maxDateValue &&
|
|
3040
|
+
(maxDateValue.getFullYear() > viewYearValue ||
|
|
3041
|
+
index >
|
|
3042
|
+
(maxDateValue.getFullYear() === viewYearValue
|
|
3043
|
+
? maxDateValue.getMonth()
|
|
3044
|
+
: 11))));
|
|
3045
|
+
var monthDisplayStyle = isOutOfRange
|
|
3046
|
+
? 'text-bia-coolgrey-light-50'
|
|
3047
|
+
: 'text-bia-black';
|
|
3048
|
+
return (React.createElement("button", { className: "bianic-datepicker-calendar-month mx-[15px] flex h-[31px] items-center justify-center ".concat(selectedStyle(viewYearValue === new Number(selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.slice(0, 4)) && index === viewMonthValue)), key: index, disabled: isOutOfRange, onClick: function () { return handleSetMonth(index); } },
|
|
3049
|
+
React.createElement(Text, { variant: "small-text", extended: viewYearValue === new Number(selectedDate === null || selectedDate === void 0 ? void 0 : selectedDate.slice(0, 4)) &&
|
|
3050
|
+
index === viewMonthValue
|
|
3051
|
+
? 'text-bia-white'
|
|
3052
|
+
: monthDisplayStyle }, month.slice(0, 3))));
|
|
3053
|
+
})));
|
|
3054
|
+
var yearDisplay = (React.createElement("div", { className: "bianic-datepicker-calendar-year-grid grid grid-cols-4 gap-y-1.5 ".concat(pickerMode === 'year' ? '' : 'hidden') }, yearDisplayRange.map(function (year, index) {
|
|
3055
|
+
var isOutOfRange = !!((minDateValue && year < minDateValue.getFullYear()) ||
|
|
3056
|
+
(maxDateValue && year > maxDateValue.getFullYear()));
|
|
3057
|
+
var yearDisplayStyle = isOutOfRange
|
|
3058
|
+
? 'text-bia-coolgrey-light-50'
|
|
3059
|
+
: 'text-bia-black';
|
|
3060
|
+
return (React.createElement("button", { className: "bianic-datepicker-calendar-month mx-[6px] flex h-[31px] items-center justify-center ".concat(selectedStyle(year === viewYearValue), " ").concat(index === 0 || index === 11 ? 'text-bia-coolgrey' : 'text-bia-black'), key: index, disabled: isOutOfRange, onClick: function () { return handleSetYear(year); } },
|
|
3061
|
+
React.createElement(Text, { variant: "small-text", extended: year === viewYearValue ? 'text-bia-white' : yearDisplayStyle }, year)));
|
|
3062
|
+
})));
|
|
2962
3063
|
// useEffect to update displayDays when viewMonthValue or viewYearValue changes
|
|
2963
3064
|
React.useEffect(function () {
|
|
2964
3065
|
var tempDisplayDays = [];
|
|
@@ -2969,7 +3070,10 @@ var PickerCalendar = function (_a) {
|
|
|
2969
3070
|
}, [viewMonthValue, viewYearValue, selectedDate]);
|
|
2970
3071
|
return (React.createElement("div", { className: "bianic-datepicker-calendar flex flex-col gap-[15px] text-bia-black", ref: ref },
|
|
2971
3072
|
React.createElement("div", { className: "bianic-datepicker-calendar-controller flex w-full items-center justify-between" },
|
|
2972
|
-
React.createElement("button", { className: "bianic-datepicker-calendar-prev-button ".concat(chevronButtonStyle),
|
|
3073
|
+
React.createElement("button", { className: "bianic-datepicker-calendar-prev-button ".concat(chevronButtonStyle), disabled: minDateValue !== null &&
|
|
3074
|
+
yearDisplayRange.includes(minDateValue.getFullYear()) &&
|
|
3075
|
+
viewYearValue <= minDateValue.getFullYear() &&
|
|
3076
|
+
viewMonthValue <= minDateValue.getMonth(), onClick: function () { return handlePrevAction(); } },
|
|
2973
3077
|
React.createElement(TbChevronLeft, { size: 18 })),
|
|
2974
3078
|
React.createElement("div", { className: "bianic-datepicker-calendar-current-month gap flex items-center justify-center gap-1" },
|
|
2975
3079
|
React.createElement("button", { className: "".concat(pickerMode === 'date' ? '' : 'hidden'), onClick: function () { return handlePickerMode('month'); } },
|
|
@@ -2980,13 +3084,25 @@ var PickerCalendar = function (_a) {
|
|
|
2980
3084
|
React.createElement(Text, { variant: "normal-text" }, viewYearValue)),
|
|
2981
3085
|
React.createElement("button", { className: "".concat(pickerMode === 'year' ? '' : 'hidden') },
|
|
2982
3086
|
React.createElement(Text, { variant: "normal-text" }, "".concat(yearDisplayRange[1], " - ").concat(yearDisplayRange[10])))),
|
|
2983
|
-
React.createElement("button", { className: "bianic-datepicker-calendar-next-button ".concat(chevronButtonStyle),
|
|
3087
|
+
React.createElement("button", { className: "bianic-datepicker-calendar-next-button ".concat(chevronButtonStyle), disabled: maxDateValue !== null &&
|
|
3088
|
+
yearDisplayRange.includes(maxDateValue.getFullYear()) &&
|
|
3089
|
+
viewYearValue >= maxDateValue.getFullYear() &&
|
|
3090
|
+
viewMonthValue >= maxDateValue.getMonth(), onClick: function () { return handleNextAction(); } },
|
|
2984
3091
|
React.createElement(TbChevronRight, { size: 18 }))),
|
|
2985
3092
|
React.createElement("div", { className: "bianic-datepicker-calendar-days-grid flex flex-col " },
|
|
2986
3093
|
dateDisplay,
|
|
2987
3094
|
monthDisplay,
|
|
2988
3095
|
yearDisplay)));
|
|
2989
3096
|
};
|
|
3097
|
+
var dateToInputString$1 = function (dateObj) {
|
|
3098
|
+
if (!(dateObj instanceof Date) || isNaN(dateObj))
|
|
3099
|
+
return ''; // Return empty string for invalid dates
|
|
3100
|
+
// Use local time methods for consistent display/input
|
|
3101
|
+
var year = dateObj.getFullYear();
|
|
3102
|
+
var month = String(dateObj.getMonth() + 1).padStart(2, '0');
|
|
3103
|
+
var day = String(dateObj.getDate()).padStart(2, '0');
|
|
3104
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
3105
|
+
};
|
|
2990
3106
|
|
|
2991
3107
|
var monthMap = [
|
|
2992
3108
|
'January',
|
|
@@ -3002,124 +3118,84 @@ var monthMap = [
|
|
|
3002
3118
|
'November',
|
|
3003
3119
|
'December',
|
|
3004
3120
|
];
|
|
3005
|
-
function
|
|
3006
|
-
var value = _a.value,
|
|
3007
|
-
|
|
3008
|
-
var
|
|
3009
|
-
var wrapperRef = React.useRef(null);
|
|
3010
|
-
var pickerRef = React.useRef(null);
|
|
3011
|
-
var _c = useDetectOutsideClick(wrapperRef, false, pickerRef), isPickerOpen = _c[0], setIsPickerOpen = _c[1];
|
|
3012
|
-
return (React.createElement("div", { className: "bianic-datepicker-container relative", ref: wrapperRef },
|
|
3013
|
-
React.createElement("div", { className: "bianic-datepicker-field-container" },
|
|
3014
|
-
React.createElement(DateInput, { ref: inputRef, placeholder: placeholder, value: value, onChange: onChange, size: size, disabled: disabled, buttonAction: function () { return setIsPickerOpen(true); }, setIsActive: setIsPickerOpen, label: label, descText: descText, required: required })),
|
|
3015
|
-
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" },
|
|
3016
|
-
React.createElement(PickerCalendar, { selectedDate: new Date(value), onDateChange: onChange, ref: pickerRef })))));
|
|
3017
|
-
}
|
|
3018
|
-
var DateInput = function (_a) {
|
|
3019
|
-
var className = _a.className, value = _a.value; _a.isActive; var setIsActive = _a.setIsActive, label = _a.label, id = _a.id, _b = _a.size, size = _b === void 0 ? 'md' : _b, onChange = _a.onChange, _c = _a.required, required = _c === void 0 ? false : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, buttonAction = _a.buttonAction, readOnly = _a.readOnly, descText = _a.descText, props = __rest(_a, ["className", "value", "isActive", "setIsActive", "label", "id", "size", "onChange", "required", "disabled", "buttonAction", "readOnly", "descText"]);
|
|
3020
|
-
var editDateFormatter = function (date) {
|
|
3021
|
-
var localString = date.toLocaleDateString().split('/');
|
|
3022
|
-
return localString.reverse().join('-');
|
|
3023
|
-
};
|
|
3024
|
-
var displayDateFormatter = function (date) {
|
|
3025
|
-
return "".concat(date.getDate(), " ").concat(monthMap[date.getMonth()].slice(0, 3), " '").concat(date.getFullYear().toString().slice(2, 4));
|
|
3026
|
-
};
|
|
3027
|
-
// Convert Date to string for display
|
|
3028
|
-
var formattedValue = value instanceof Date ? displayDateFormatter(value) : value;
|
|
3029
|
-
var _e = React.useState(formattedValue), viewValue = _e[0], setViewValue = _e[1];
|
|
3030
|
-
React.useRef(null);
|
|
3031
|
-
var _f = React.useState(0); _f[0]; _f[1];
|
|
3121
|
+
var DateInputDisplay = function (_a) {
|
|
3122
|
+
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"]);
|
|
3123
|
+
var _e = React.useState(false), isEditing = _e[0], setIsEditing = _e[1];
|
|
3124
|
+
var _f = React.useState(value), dateString = _f[0], setDateString = _f[1];
|
|
3032
3125
|
var _g = styleConfig['text'], fieldStyle = _g.fieldStyle;
|
|
3033
3126
|
var _h = sizeConfig$c[size], iconSize = _h.iconSize, fieldSize = _h.fieldSize, iconPosition = _h.iconPosition;
|
|
3034
3127
|
var borderStyle = 'border border-bia-grey-dark-10 bg-primary-white';
|
|
3035
3128
|
var extendedInputClassName = "".concat(fieldStyle, " ").concat(fieldSize, " ").concat(borderStyle, " ").concat(className);
|
|
3036
|
-
var
|
|
3037
|
-
|
|
3038
|
-
var
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
var parsedYear = parseInt(year, 10);
|
|
3050
|
-
// 3. validate month digit
|
|
3051
|
-
if (!/^\d{1,2}$/.test(month)) {
|
|
3052
|
-
return [3, value];
|
|
3053
|
-
}
|
|
3054
|
-
// 4. validate month range
|
|
3055
|
-
var parsedMonth = parseInt(month, 10);
|
|
3056
|
-
if (parsedMonth < 1 || parsedMonth > 12) {
|
|
3057
|
-
return [4, value];
|
|
3058
|
-
}
|
|
3059
|
-
var formattedMonth = String(parsedMonth).padStart(2, '0');
|
|
3060
|
-
// 5. validate date digit
|
|
3061
|
-
if (!/^\d{1,2}$/.test(day)) {
|
|
3062
|
-
return [5, value];
|
|
3063
|
-
}
|
|
3064
|
-
// 6. validate date range
|
|
3065
|
-
var parsedDate = parseInt(day, 10);
|
|
3066
|
-
if (parsedDate < 1 || parsedDate > 31) {
|
|
3067
|
-
return [6, value];
|
|
3068
|
-
}
|
|
3069
|
-
var formattedDay = String(parsedDate).padStart(2, '0');
|
|
3070
|
-
// 7. validate date rightness
|
|
3071
|
-
var dateObject = new Date(parsedYear, parsedMonth - 1, parsedDate);
|
|
3072
|
-
if (dateObject.getFullYear() !== parsedYear ||
|
|
3073
|
-
dateObject.getMonth() !== parsedMonth - 1 ||
|
|
3074
|
-
dateObject.getDate() !== parsedDate) {
|
|
3075
|
-
return [7, value];
|
|
3076
|
-
}
|
|
3077
|
-
// If all checks pass, the date is valid and formatted
|
|
3078
|
-
var formattedDate = "".concat(year, "-").concat(formattedMonth, "-").concat(formattedDay);
|
|
3079
|
-
return [0, formattedDate];
|
|
3080
|
-
};
|
|
3081
|
-
// Update actual value on release
|
|
3082
|
-
var updateValue = function (newValue) {
|
|
3083
|
-
var date = new Date(newValue); // Create a Date object from the input
|
|
3084
|
-
if (onChange && !Number.isNaN(date.valueOf())) {
|
|
3085
|
-
onChange(date); // Update the value if it's a valid date
|
|
3129
|
+
var labelStatus = props.readOnly ? 'read-only:pointer-events-none' : '';
|
|
3130
|
+
var handleTextChange = function (event) {
|
|
3131
|
+
var rawValue = event.target.value;
|
|
3132
|
+
setDateString(rawValue); // Update the displayed text input immediately
|
|
3133
|
+
// --- Validation and Conversion Logic ---
|
|
3134
|
+
if (rawValue) {
|
|
3135
|
+
var newDate = new Date(rawValue);
|
|
3136
|
+
if (!isNaN(newDate.getTime())) {
|
|
3137
|
+
// If valid, update the Date object state
|
|
3138
|
+
if (setValue)
|
|
3139
|
+
setValue(rawValue);
|
|
3140
|
+
return;
|
|
3141
|
+
}
|
|
3086
3142
|
}
|
|
3143
|
+
// If the string is empty or invalid, set the Date object state to null
|
|
3144
|
+
if (setValue)
|
|
3145
|
+
setValue('');
|
|
3087
3146
|
};
|
|
3088
|
-
var
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
// The caret (^) matches the beginning of the string, and the dollar sign ($) matches the end.
|
|
3092
|
-
// This ensures the *entire* string matches the pattern.
|
|
3093
|
-
var regex = /^[0-9-]*$/;
|
|
3094
|
-
if (regex.test(value)) {
|
|
3095
|
-
setViewValue(value);
|
|
3096
|
-
}
|
|
3147
|
+
var handleBlur = function () {
|
|
3148
|
+
setIsEditing(false);
|
|
3149
|
+
setDateString(value);
|
|
3097
3150
|
};
|
|
3151
|
+
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 () {
|
|
3152
|
+
buttonAction && buttonAction();
|
|
3153
|
+
} },
|
|
3154
|
+
React.createElement(TbCalendar, { size: iconSize })) })) : (React.createElement(React.Fragment, null,
|
|
3155
|
+
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
|
|
3156
|
+
? displayDateFormatter(new Date(value))
|
|
3157
|
+
: nullDisplay || placeholder),
|
|
3158
|
+
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 text-bia-coolgrey ".concat(iconPosition) },
|
|
3159
|
+
React.createElement("button", { className: "bianic-datepicker-toggle-button", disabled: disabled, onClick: function () { return buttonAction && buttonAction(); } },
|
|
3160
|
+
React.createElement(TbCalendar, { size: iconSize })))));
|
|
3098
3161
|
React.useEffect(function () {
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
descText && (React.createElement("span", { className: "desc text-xs text-primary-cool" }, descText))));
|
|
3162
|
+
// Only update dateString if we are NOT currently editing.
|
|
3163
|
+
if (!isEditing)
|
|
3164
|
+
setDateString(value ? dateToInputString(new Date(value)) : '');
|
|
3165
|
+
}, [value, isEditing]);
|
|
3166
|
+
return (React.createElement("div", { className: "bianic-date-input-container bianic-fgc-container flex w-full flex-col gap-y-2 text-bia-black" },
|
|
3167
|
+
label && (React.createElement("label", { htmlFor: id, className: "bianic-text-input-label text-xs font-semibold ".concat(labelStatus) },
|
|
3168
|
+
label,
|
|
3169
|
+
required && React.createElement("span", { className: "p-1 text-bia-red" }, "*"))),
|
|
3170
|
+
React.createElement("div", { className: "relative w-full" }, input)));
|
|
3171
|
+
};
|
|
3172
|
+
var dateToInputString = function (dateObj) {
|
|
3173
|
+
if (!(dateObj instanceof Date) || isNaN(dateObj))
|
|
3174
|
+
return ''; // Return empty string for invalid dates
|
|
3175
|
+
// Use local time methods for consistent display/input
|
|
3176
|
+
var year = dateObj.getFullYear();
|
|
3177
|
+
var month = String(dateObj.getMonth() + 1).padStart(2, '0');
|
|
3178
|
+
var day = String(dateObj.getDate()).padStart(2, '0');
|
|
3179
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
3180
|
+
};
|
|
3181
|
+
var displayDateFormatter = function (date) {
|
|
3182
|
+
return "".concat(date.getDate(), " ").concat(monthMap[date.getMonth()].slice(0, 3), " '").concat(date.getFullYear().toString().slice(2, 4));
|
|
3121
3183
|
};
|
|
3122
3184
|
|
|
3185
|
+
function DatePicker(_a) {
|
|
3186
|
+
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;
|
|
3187
|
+
// State and Ref
|
|
3188
|
+
var inputRef = React.useRef(null);
|
|
3189
|
+
var wrapperRef = React.useRef(null);
|
|
3190
|
+
var pickerRef = React.useRef(null);
|
|
3191
|
+
var _c = useDetectOutsideClick(wrapperRef, false, pickerRef), isPickerOpen = _c[0], setIsPickerOpen = _c[1];
|
|
3192
|
+
return (React.createElement("div", { className: "bianic-datepicker-container relative ".concat(containerClassName), ref: wrapperRef },
|
|
3193
|
+
React.createElement("div", { className: "bianic-datepicker-field-container" },
|
|
3194
|
+
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 })),
|
|
3195
|
+
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" },
|
|
3196
|
+
React.createElement(PickerCalendar, { selectedDate: value, onDateChange: onChange, ref: pickerRef, minDate: minDate, maxDate: maxDate })))));
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3123
3199
|
var Node = function (_a) {
|
|
3124
3200
|
var className = _a.className, _b = _a.fill, fill = _b === void 0 ? 'currentColor' : _b, _c = _a.size, size = _c === void 0 ? 20 : _c;
|
|
3125
3201
|
return (React.createElement("svg", { className: className, width: size, height: size, viewBox: "0 0 24 24", fill: fill, stroke: fill, xmlns: "http://www.w3.org/2000/svg" },
|
|
@@ -3313,18 +3389,17 @@ var sizeConfig$3 = {
|
|
|
3313
3389
|
};
|
|
3314
3390
|
|
|
3315
3391
|
var InfoPanel = function (_a) {
|
|
3316
|
-
var variant = _a.variant, color = _a.color, className = _a.className,
|
|
3392
|
+
var variant = _a.variant, color = _a.color, className = _a.className, children = _a.children;
|
|
3317
3393
|
var sizeClass = sizeConfig$3[variant || 'container'];
|
|
3318
3394
|
var colorClass = colorConfig$1[color || 'yellow'];
|
|
3319
3395
|
var allClasses = "".concat(sizeClass, " ").concat(colorClass, " ").concat(className);
|
|
3320
|
-
return (React.createElement("div", { className: "flex items-center justify-center rounded-radius-md ".concat(allClasses) },
|
|
3321
|
-
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.")));
|
|
3396
|
+
return (React.createElement("div", { className: "flex items-center justify-center rounded-radius-md ".concat(allClasses) }, children));
|
|
3322
3397
|
};
|
|
3323
3398
|
InfoPanel.defaultProps = {
|
|
3324
3399
|
variant: 'container',
|
|
3325
3400
|
color: 'yellow',
|
|
3326
3401
|
className: '',
|
|
3327
|
-
|
|
3402
|
+
children: null,
|
|
3328
3403
|
};
|
|
3329
3404
|
|
|
3330
3405
|
function Modal(_a) {
|
|
@@ -3350,12 +3425,12 @@ function Modal(_a) {
|
|
|
3350
3425
|
if (open) {
|
|
3351
3426
|
return (
|
|
3352
3427
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
|
|
3353
|
-
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 },
|
|
3428
|
+
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 },
|
|
3354
3429
|
React.createElement("div", { className: "bianic-modal flex flex-col gap-[20px] rounded-[5px] bg-white p-[20px] ".concat(modalSize), onClick: onClick },
|
|
3355
3430
|
React.createElement("div", { className: "bianic-modal-header flex justify-between" },
|
|
3356
3431
|
React.createElement("div", { className: " text-wrap text-left font-humnst777 text-[18px] font-bold leading-[21.85px] text-primary-black" }, title),
|
|
3357
3432
|
React.createElement(Button, { variant: "subtle", radius: "full-rounded", iconLeft: React.createElement(TbX, { size: 14 }), size: "tn", onClick: function () { return onClose(); } })),
|
|
3358
|
-
React.createElement("div", { className: "bianic-modal-content flex w-full flex-col items-start gap-[20px]" }, rest.children))));
|
|
3433
|
+
React.createElement("div", { className: "bianic-modal-content flex w-full flex-col items-start gap-[20px]" }, rest.children))), document.body));
|
|
3359
3434
|
}
|
|
3360
3435
|
return null;
|
|
3361
3436
|
}
|
|
@@ -3411,7 +3486,7 @@ function PaginationBar(_a) {
|
|
|
3411
3486
|
return (React.createElement("div", { className: "flex ".concat(positionConfig[position], " gap-[5px]") },
|
|
3412
3487
|
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 }),
|
|
3413
3488
|
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 })); }),
|
|
3414
|
-
React.createElement(Button, { variant: "subtle-link", size:
|
|
3489
|
+
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 })));
|
|
3415
3490
|
}
|
|
3416
3491
|
|
|
3417
3492
|
var activeConfig = {
|
|
@@ -3729,7 +3804,7 @@ var configTab = {
|
|
|
3729
3804
|
};
|
|
3730
3805
|
|
|
3731
3806
|
function Tab(_a) {
|
|
3732
|
-
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"]);
|
|
3807
|
+
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"]);
|
|
3733
3808
|
var disabledKeyTab = disabled || active ? ' pointer-events-none' : '';
|
|
3734
3809
|
var cursor;
|
|
3735
3810
|
if (disabled) {
|
|
@@ -3750,8 +3825,9 @@ function Tab(_a) {
|
|
|
3750
3825
|
var activeKeyTab = active
|
|
3751
3826
|
? 'group-disabled:text-bia-coolgrey-disabled text-primary-black'
|
|
3752
3827
|
: 'text-bia-coolgrey group-hover:text-bia-coolgrey-hover group-active:text-bia-coolgrey-active group-disabled:text-bia-coolgrey-disabled';
|
|
3828
|
+
var buttonClassName = "".concat(horizontalButtonStyle, " ").concat(disabledKeyTab, " ").concat(fit, " ").concat(className ? className : '');
|
|
3753
3829
|
return (React.createElement("div", { className: "".concat(mode === 'horizontal' ? 'h-full' : 'w-full', " ").concat(cursor) },
|
|
3754
|
-
React.createElement("button", __assign({ type: "button",
|
|
3830
|
+
React.createElement("button", __assign({ type: "button", className: "flex items-stretch justify-between group relative outline-none ".concat(buttonClassName), disabled: disabled }, rest),
|
|
3755
3831
|
React.createElement("div", { className: "flex items-center justify-center ".concat(buttonContentStyle) },
|
|
3756
3832
|
React.createElement("div", { className: "flex items-center justify-center " },
|
|
3757
3833
|
React.createElement("div", { className: "flex items-center space-x-1 text-nowrap ".concat(activeKeyTab, " ").concat(configTab[size].text) },
|
|
@@ -4094,6 +4170,7 @@ exports.MenuItem = MenuItem;
|
|
|
4094
4170
|
exports.Modal = Modal;
|
|
4095
4171
|
exports.P = P;
|
|
4096
4172
|
exports.PaginationBar = PaginationBar;
|
|
4173
|
+
exports.PickerCalendar = PickerCalendar;
|
|
4097
4174
|
exports.Pills = Pills;
|
|
4098
4175
|
exports.Popover = Popover;
|
|
4099
4176
|
exports.ProgressBar = ProgressBar;
|