bianic-ui 1.13.1 → 1.14.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 +251 -299
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Forms/DatePicker/DatePicker.d.ts +10 -3
- package/dist/cjs/types/components/Forms/DatePicker/PickerCalendar.d.ts +1 -1
- package/dist/cjs/types/components/Forms/DatePicker/index.d.ts +1 -0
- package/dist/cjs/types/components/Forms/FormLabel.d.ts +18 -0
- package/dist/cjs/types/components/InfoPanel/config.d.ts +12 -0
- package/dist/cjs/types/components/InfoPanel/index.d.ts +17 -0
- package/dist/cjs/types/components/Menu/MenuContainer.d.ts +1 -0
- package/dist/cjs/types/components/Menu/MenuItem.d.ts +2 -1
- package/dist/cjs/types/components/index.d.ts +1 -0
- package/dist/esm/index.js +251 -300
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Forms/DatePicker/DatePicker.d.ts +10 -3
- package/dist/esm/types/components/Forms/DatePicker/PickerCalendar.d.ts +1 -1
- package/dist/esm/types/components/Forms/DatePicker/index.d.ts +1 -0
- package/dist/esm/types/components/Forms/FormLabel.d.ts +18 -0
- package/dist/esm/types/components/InfoPanel/config.d.ts +12 -0
- package/dist/esm/types/components/InfoPanel/index.d.ts +17 -0
- package/dist/esm/types/components/Menu/MenuContainer.d.ts +1 -0
- package/dist/esm/types/components/Menu/MenuItem.d.ts +2 -1
- package/dist/esm/types/components/index.d.ts +1 -0
- package/dist/index.d.ts +30 -5
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -273,12 +273,9 @@ var useDetectOutsideClick = function (ref, initialState, ignoreRef, event) {
|
|
|
273
273
|
// If the active element exists and is clicked outside of
|
|
274
274
|
if (ignoreRef &&
|
|
275
275
|
ignoreRef.current &&
|
|
276
|
-
ignoreRef.current.contains(event.target))
|
|
277
|
-
console.log('enter');
|
|
278
|
-
}
|
|
276
|
+
ignoreRef.current.contains(event.target)) ;
|
|
279
277
|
else if (ref.current !== null &&
|
|
280
278
|
!ref.current.contains(event.target)) {
|
|
281
|
-
console.log('close');
|
|
282
279
|
setIsActive(!isActive);
|
|
283
280
|
}
|
|
284
281
|
};
|
|
@@ -426,7 +423,7 @@ var radiusConfig$1 = {
|
|
|
426
423
|
tn: 'rounded-radius-full focus-visible:rounded-radius-full',
|
|
427
424
|
},
|
|
428
425
|
};
|
|
429
|
-
var sizeConfig$
|
|
426
|
+
var sizeConfig$d = {
|
|
430
427
|
lg: 'py-[10.5px] h-[48px] flex items-center justify-center gap-[10px] text-size-md ',
|
|
431
428
|
md: 'py-[9px] h-[40px] flex items-center justify-center gap-[5px] text-size-base ',
|
|
432
429
|
sm: 'py-[6px] h-[30px] flex items-center justify-center gap-[5px] text-size-sm ',
|
|
@@ -504,10 +501,10 @@ function Button(_a) {
|
|
|
504
501
|
}
|
|
505
502
|
var sizingRules;
|
|
506
503
|
if (variant.includes('link')) {
|
|
507
|
-
sizingRules = "".concat(sizeConfig$
|
|
504
|
+
sizingRules = "".concat(sizeConfig$d[validatedSize]);
|
|
508
505
|
}
|
|
509
506
|
else {
|
|
510
|
-
sizingRules = "".concat(sizeConfig$
|
|
507
|
+
sizingRules = "".concat(sizeConfig$d[validatedSize], " ").concat(sidePaddingConfig[validatedSize]);
|
|
511
508
|
}
|
|
512
509
|
var sizeClass = label || variant === 'form-group'
|
|
513
510
|
? " ".concat(minWidthRules, " ").concat(sizingRules)
|
|
@@ -1489,7 +1486,7 @@ Breadcrumb.defaultProps = {
|
|
|
1489
1486
|
selected: false,
|
|
1490
1487
|
};
|
|
1491
1488
|
|
|
1492
|
-
var colorConfig$
|
|
1489
|
+
var colorConfig$2 = {
|
|
1493
1490
|
green: {
|
|
1494
1491
|
default: 'bg-bia-verdantgreen-dark-20 hover:bg-bia-verdantgreen-dark-10 active:bg-bia-verdantgreen-dark-40 text-primary-white disabled:bg-bia-verdantgreen-dark-20 disabled:text-primary-white/50 disabled:cursor-default',
|
|
1495
1492
|
active: 'bg-bia-verdantgreen-dark-40 text-primary-white',
|
|
@@ -1503,7 +1500,7 @@ var colorConfig$1 = {
|
|
|
1503
1500
|
var ButtonApp = function (_a) {
|
|
1504
1501
|
_a.icon; _a.isNotified; var _c = _a.isActive, isActive = _c === void 0 ? false : _c, disabled = _a.disabled, _d = _a.color, color = _d === void 0 ? 'green' : _d, label = _a.label, extended = _a.extended, rest = __rest(_a, ["icon", "isNotified", "isActive", "disabled", "color", "label", "extended"]);
|
|
1505
1502
|
var buttonState = isActive ? 'active' : 'default';
|
|
1506
|
-
return (React.createElement("button", __assign({ className: "button-app flex items-center justify-center px-[10px] pb-[8.3px] pt-[8.5px] font-arial text-size-tiny ".concat(colorConfig$
|
|
1503
|
+
return (React.createElement("button", __assign({ className: "button-app flex items-center justify-center px-[10px] pb-[8.3px] pt-[8.5px] font-arial text-size-tiny ".concat(colorConfig$2[color][buttonState], " ").concat(extended), type: "button", disabled: disabled }, rest), label));
|
|
1507
1504
|
};
|
|
1508
1505
|
|
|
1509
1506
|
var textColorConfig = {
|
|
@@ -1675,7 +1672,10 @@ var FileTree = function (_a) {
|
|
|
1675
1672
|
}),
|
|
1676
1673
|
isOpenContMenu && (React.createElement("div", { style: menuStyle, ref: popupRef, className: "bianic-filetree-contextmenu" }, React.isValidElement(contextMenu)
|
|
1677
1674
|
? // Kirimkan handleItemClick sebagai props onClick ke setiap MenuItem
|
|
1678
|
-
React.cloneElement(contextMenu, {
|
|
1675
|
+
React.cloneElement(contextMenu, {
|
|
1676
|
+
isWithOverlay: false,
|
|
1677
|
+
onClickItem: function () { return setIsOpenContMenu(false); },
|
|
1678
|
+
})
|
|
1679
1679
|
: contextMenu))));
|
|
1680
1680
|
};
|
|
1681
1681
|
var TreeItem = function (_a) {
|
|
@@ -1724,7 +1724,7 @@ var TreeItem = function (_a) {
|
|
|
1724
1724
|
};
|
|
1725
1725
|
|
|
1726
1726
|
var MenuContainer = React.forwardRef(function MenuContainer(propsComp, ref) {
|
|
1727
|
-
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, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex"]);
|
|
1727
|
+
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"]);
|
|
1728
1728
|
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
1729
1729
|
return (open && (React.createElement(React.Fragment, null,
|
|
1730
1730
|
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 } })),
|
|
@@ -1736,6 +1736,7 @@ var MenuContainer = React.forwardRef(function MenuContainer(propsComp, ref) {
|
|
|
1736
1736
|
React.cloneElement(child, {
|
|
1737
1737
|
onClose: function () { return onClose(); },
|
|
1738
1738
|
zIndex: zIndex + 10,
|
|
1739
|
+
inheritedOnClick: function () { return onClickItem(); },
|
|
1739
1740
|
})
|
|
1740
1741
|
: child;
|
|
1741
1742
|
})))));
|
|
@@ -1745,9 +1746,9 @@ MenuContainer.defaultProps = {
|
|
|
1745
1746
|
};
|
|
1746
1747
|
|
|
1747
1748
|
function MenuItem(_a) {
|
|
1748
|
-
var _b = _a.className, className = _b === void 0 ? '' : _b, label = _a.label, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.caption, caption = _d === void 0 ? undefined : _d, _e = _a.isChecked, isChecked = _e === void 0 ? undefined : _e, _f = _a.onClose, onClose = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, props = __rest(_a, ["className", "label", "onClick", "caption", "isChecked", "onClose", "children", "zIndex"]);
|
|
1749
|
-
var
|
|
1750
|
-
var
|
|
1749
|
+
var _b = _a.className, className = _b === void 0 ? '' : _b, label = _a.label, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.caption, caption = _d === void 0 ? undefined : _d, _e = _a.isChecked, isChecked = _e === void 0 ? undefined : _e, _f = _a.onClose, onClose = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, _h = _a.inheritedOnClick, inheritedOnClick = _h === void 0 ? function () { } : _h, props = __rest(_a, ["className", "label", "onClick", "caption", "isChecked", "onClose", "children", "zIndex", "inheritedOnClick"]);
|
|
1750
|
+
var _j = React.useState(false), isHovered = _j[0], setIsHovered = _j[1];
|
|
1751
|
+
var _k = React.useState(false), isLeft = _k[0], setIsLeft = _k[1];
|
|
1751
1752
|
var isWithChecked = isChecked !== undefined;
|
|
1752
1753
|
var leftPadding = isWithChecked ? 'pl-[5px]' : 'pl-[10px]';
|
|
1753
1754
|
var rightPadding = caption || children ? 'pr-[5px]' : 'pr-[10px]';
|
|
@@ -1772,6 +1773,7 @@ function MenuItem(_a) {
|
|
|
1772
1773
|
var currentZIndex = zIndex + 10;
|
|
1773
1774
|
return (React.createElement("div", { className: "group/main relative cursor-pointer first:rounded-t-radius-sm first:pt-[6px] last:rounded-b-radius-sm last:pb-[6px]", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
|
|
1774
1775
|
React.createElement("div", __assign({ className: "relative flex items-center py-[5px] hover:bg-bia-blue-pastel ".concat(itemClass), role: "button", tabIndex: 0, onClick: function (e) {
|
|
1776
|
+
inheritedOnClick();
|
|
1775
1777
|
onClick(e);
|
|
1776
1778
|
}, onKeyDown: function () { }, style: {
|
|
1777
1779
|
zIndex: isHovered ? currentZIndex : currentZIndex + 15,
|
|
@@ -1781,14 +1783,154 @@ function MenuItem(_a) {
|
|
|
1781
1783
|
React.createElement("div", { className: "ml-auto flex items-center" },
|
|
1782
1784
|
children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey" })),
|
|
1783
1785
|
children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] text-bia-coolgrey" }, caption)))),
|
|
1784
|
-
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 }, children))));
|
|
1786
|
+
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))));
|
|
1785
1787
|
}
|
|
1786
1788
|
MenuItem.defaultProps = {
|
|
1787
1789
|
className: '',
|
|
1788
1790
|
onClick: function () { },
|
|
1789
1791
|
};
|
|
1790
1792
|
|
|
1791
|
-
var
|
|
1793
|
+
var classConfig$1 = {
|
|
1794
|
+
top: {
|
|
1795
|
+
tooltipContainer: 'bottom-[calc(100%+5px)] left-1/2 -translate-x-1/2',
|
|
1796
|
+
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
1797
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
1798
|
+
},
|
|
1799
|
+
right: {
|
|
1800
|
+
tooltipContainer: 'left-[calc(100%+5px)] top-1/2 -translate-y-1/2',
|
|
1801
|
+
triangleContainer: '-left-[4px] bottom-0 flex items-center w-auto h-full',
|
|
1802
|
+
triangleShape: 'border-t-[8px] border-t-transparent border-r-[5px] border-r-primary-black border-b-[8px] border-b-transparent',
|
|
1803
|
+
},
|
|
1804
|
+
bottom: {
|
|
1805
|
+
tooltipContainer: 'top-[calc(100%+5px)] left-1/2 -translate-x-1/2',
|
|
1806
|
+
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
1807
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
1808
|
+
},
|
|
1809
|
+
left: {
|
|
1810
|
+
tooltipContainer: 'right-[calc(100%+5px)] top-1/2 -translate-y-1/2',
|
|
1811
|
+
triangleContainer: '-right-[4px] bottom-0 flex items-center w-auto h-full',
|
|
1812
|
+
triangleShape: 'border-t-[8px] border-t-transparent border-l-[5px] border-l-primary-black border-b-[8px] border-b-transparent',
|
|
1813
|
+
},
|
|
1814
|
+
'top-right': {
|
|
1815
|
+
tooltipContainer: 'bottom-[calc(100%+5px)] right-0',
|
|
1816
|
+
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
1817
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
1818
|
+
},
|
|
1819
|
+
'top-left': {
|
|
1820
|
+
tooltipContainer: 'bottom-[calc(100%+5px)] left-0',
|
|
1821
|
+
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
1822
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
1823
|
+
},
|
|
1824
|
+
'bottom-right': {
|
|
1825
|
+
tooltipContainer: 'top-[calc(100%+5px)] right-0',
|
|
1826
|
+
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
1827
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
1828
|
+
},
|
|
1829
|
+
'bottom-left': {
|
|
1830
|
+
tooltipContainer: 'top-[calc(100%+5px)] left-0',
|
|
1831
|
+
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
1832
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
1833
|
+
},
|
|
1834
|
+
};
|
|
1835
|
+
|
|
1836
|
+
function Tooltip(props) {
|
|
1837
|
+
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;
|
|
1838
|
+
var timeout;
|
|
1839
|
+
var _c = React.useState(false), active = _c[0], setActive = _c[1];
|
|
1840
|
+
var showTip = function () {
|
|
1841
|
+
timeout = setTimeout(function () {
|
|
1842
|
+
setActive(true);
|
|
1843
|
+
}, delay || 400);
|
|
1844
|
+
};
|
|
1845
|
+
var hideTip = function () {
|
|
1846
|
+
clearInterval(timeout);
|
|
1847
|
+
setActive(false);
|
|
1848
|
+
};
|
|
1849
|
+
var _d = classConfig$1[direction], tooltipContainer = _d.tooltipContainer; _d.triangleContainer; _d.triangleShape;
|
|
1850
|
+
var tooltipContainerRef = React.useRef(null);
|
|
1851
|
+
var _e = React.useState({
|
|
1852
|
+
maxWidth: maxWidth + 'px',
|
|
1853
|
+
whiteSpace: 'nowrap',
|
|
1854
|
+
}), tooltipContainerStyle = _e[0], setTooltipContainerStyle = _e[1];
|
|
1855
|
+
var tooltipContainerElement = tooltipContainerRef === null || tooltipContainerRef === void 0 ? void 0 : tooltipContainerRef.current;
|
|
1856
|
+
var scrollWidth = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.scrollWidth; // Mendapatkan lebar konten aktual
|
|
1857
|
+
var offsetWidth = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.offsetWidth;
|
|
1858
|
+
var offsetHeight = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.offsetHeight;
|
|
1859
|
+
React.useEffect(function () {
|
|
1860
|
+
if (scrollWidth && offsetWidth) {
|
|
1861
|
+
var maxWidthNumber = Number(maxWidth);
|
|
1862
|
+
var isMultiLine = offsetHeight > 23; // 23 pixels is the approximate height of one line of text
|
|
1863
|
+
// Tooltip Width and Whitespace Determination Rules:
|
|
1864
|
+
// 1. Default Condition:
|
|
1865
|
+
// - width: fit-content
|
|
1866
|
+
// - whiteSpace: nowrap
|
|
1867
|
+
// 2. When maxWidth is Set:
|
|
1868
|
+
// * Text Exceeds maxWidth:
|
|
1869
|
+
// - width: maxWidth
|
|
1870
|
+
// - whiteSpace: normal
|
|
1871
|
+
// * Text Equals maxWidth (Multi-line):
|
|
1872
|
+
// - width: maxWidth
|
|
1873
|
+
// - whiteSpace: normal
|
|
1874
|
+
// * Text Less Than maxWidth:
|
|
1875
|
+
// - width: fit-content
|
|
1876
|
+
// - whiteSpace: nowrap
|
|
1877
|
+
var newWidth_1 = 'fit-content';
|
|
1878
|
+
var newWhiteSpace_1 = 'nowrap';
|
|
1879
|
+
if (scrollWidth > maxWidthNumber ||
|
|
1880
|
+
(offsetWidth === maxWidthNumber && isMultiLine)) {
|
|
1881
|
+
newWidth_1 = maxWidthNumber + 'px';
|
|
1882
|
+
newWhiteSpace_1 = 'normal';
|
|
1883
|
+
}
|
|
1884
|
+
setTooltipContainerStyle(function (prev) { return (__assign(__assign({}, prev), { width: newWidth_1, whiteSpace: newWhiteSpace_1 })); });
|
|
1885
|
+
}
|
|
1886
|
+
}, [content, maxWidth, scrollWidth, offsetHeight]);
|
|
1887
|
+
return (React.createElement("div", { className: "tooltip-wrapper relative inline-flex h-fit w-fit flex-col", onMouseEnter: showTip, onMouseLeave: hideTip },
|
|
1888
|
+
children,
|
|
1889
|
+
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))));
|
|
1890
|
+
}
|
|
1891
|
+
Tooltip.defaultProps = {
|
|
1892
|
+
delay: 400,
|
|
1893
|
+
direction: 'top',
|
|
1894
|
+
maxWidth: '300',
|
|
1895
|
+
};
|
|
1896
|
+
Tooltip.defaultProps = {};
|
|
1897
|
+
|
|
1898
|
+
var FormLabel = function (_a) {
|
|
1899
|
+
var children = _a.children, className = _a.className, htmlFor = _a.htmlFor, readOnly = _a.readOnly, required = _a.required;
|
|
1900
|
+
var labelClass = readOnly ? 'pointer-events-none' : '';
|
|
1901
|
+
return (React.createElement(Tooltip, { content: "Required", delay: 2000, direction: "right" },
|
|
1902
|
+
React.createElement("label", { htmlFor: htmlFor, className: "bianic-form-label group/formlabel text-xs font-semibold ".concat(labelClass, " ").concat(className) },
|
|
1903
|
+
children,
|
|
1904
|
+
required && (React.createElement("span", { className: "p-1 text-bia-coolgrey group-hover/form:text-bia-red group-hover/formlabel:text-bia-red" }, "*")))));
|
|
1905
|
+
};
|
|
1906
|
+
FormLabel.defaultProps = {
|
|
1907
|
+
className: '',
|
|
1908
|
+
htmlFor: undefined,
|
|
1909
|
+
required: false,
|
|
1910
|
+
readOnly: false,
|
|
1911
|
+
};
|
|
1912
|
+
|
|
1913
|
+
function PasswordIcon(_a) {
|
|
1914
|
+
var isShow = _a.isShow, _b = _a.showHandler, showHandler = _b === void 0 ? function () { } : _b, iconSize = _a.iconSize, disabled = _a.disabled;
|
|
1915
|
+
var iconColor = disabled ? '#8b8ba6' : '#5E5EEA';
|
|
1916
|
+
if (isShow) {
|
|
1917
|
+
return (React.createElement(TbEye, { onClick: function () { return showHandler(false); }, style: {
|
|
1918
|
+
fontSize: iconSize,
|
|
1919
|
+
color: iconColor,
|
|
1920
|
+
} }));
|
|
1921
|
+
}
|
|
1922
|
+
return (React.createElement(TbEyeOff, { onClick: function () { return showHandler(true); }, style: { fontSize: iconSize, color: iconColor } }));
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
function ValidationIcon(_a) {
|
|
1926
|
+
var isValid = _a.isValid, iconSize = _a.iconSize;
|
|
1927
|
+
if (isValid) {
|
|
1928
|
+
return (React.createElement(TbCheck, { className: "text-bia-green", style: { fontSize: iconSize } }));
|
|
1929
|
+
}
|
|
1930
|
+
return React.createElement(TbX, { className: "text-bia-red", style: { fontSize: iconSize } });
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
var sizeConfig$c = {
|
|
1792
1934
|
md: {
|
|
1793
1935
|
fieldSize: 'text-size-base p-2.5 font-[350] h-10',
|
|
1794
1936
|
iconPosition: 'right-[10px]',
|
|
@@ -1823,34 +1965,14 @@ var styleConfig = {
|
|
|
1823
1965
|
},
|
|
1824
1966
|
};
|
|
1825
1967
|
|
|
1826
|
-
function ValidationIcon(_a) {
|
|
1827
|
-
var isValid = _a.isValid, iconSize = _a.iconSize;
|
|
1828
|
-
if (isValid) {
|
|
1829
|
-
return (React.createElement(TbCheck, { className: "text-bia-green", style: { fontSize: iconSize } }));
|
|
1830
|
-
}
|
|
1831
|
-
return React.createElement(TbX, { className: "text-bia-red", style: { fontSize: iconSize } });
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
|
-
function PasswordIcon(_a) {
|
|
1835
|
-
var isShow = _a.isShow, _b = _a.showHandler, showHandler = _b === void 0 ? function () { } : _b, iconSize = _a.iconSize, disabled = _a.disabled;
|
|
1836
|
-
var iconColor = disabled ? '#8b8ba6' : '#5E5EEA';
|
|
1837
|
-
if (isShow) {
|
|
1838
|
-
return (React.createElement(TbEye, { onClick: function () { return showHandler(false); }, style: {
|
|
1839
|
-
fontSize: iconSize,
|
|
1840
|
-
color: iconColor,
|
|
1841
|
-
} }));
|
|
1842
|
-
}
|
|
1843
|
-
return (React.createElement(TbEyeOff, { onClick: function () { return showHandler(true); }, style: { fontSize: iconSize, color: iconColor } }));
|
|
1844
|
-
}
|
|
1845
|
-
|
|
1846
1968
|
function TextInput(_a) {
|
|
1847
1969
|
var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, icon = _a.icon, _c = _a.id, id = _c === void 0 ? '' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.isValid, isValid = _e === void 0 ? null : _e, label = _a.label, _f = _a.placeholder, placeholder = _f === void 0 ? '' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.required, required = _h === void 0 ? false : _h, _j = _a.variant, variant = _j === void 0 ? 'text' : _j, _k = _a.value, value = _k === void 0 ? undefined : _k, _l = _a.onChange, onChange = _l === void 0 ? function () { } : _l, _m = _a.maxLength, maxLength = _m === void 0 ? undefined : _m, _o = _a.inputClassName, inputClassName = _o === void 0 ? '' : _o; _a.isFlatRight; var actionElement = _a.actionElement, _q = _a.autoComplete, autoComplete = _q === void 0 ? 'off' : _q, ref = _a.ref, props = __rest(_a, ["descText", "disabled", "icon", "id", "size", "isValid", "label", "placeholder", "readOnly", "required", "variant", "value", "onChange", "maxLength", "inputClassName", "isFlatRight", "actionElement", "autoComplete", "ref"]);
|
|
1848
1970
|
var isTransparent = variant.includes('transparent');
|
|
1849
1971
|
var _r = React.useState(false), isShow = _r[0], setIsShow = _r[1];
|
|
1850
1972
|
var _s = styleConfig[variant], fieldStyle = _s.fieldStyle, iconStyle = _s.iconStyle;
|
|
1851
1973
|
var _t = isTransparent
|
|
1852
|
-
? __assign(__assign({}, sizeConfig$
|
|
1853
|
-
" pe-[".concat(9 + sizeConfig$
|
|
1974
|
+
? __assign(__assign({}, sizeConfig$c[size]), { iconPosition: "right-0 ", fieldSize: sizeConfig$c[size].fieldSize +
|
|
1975
|
+
" pe-[".concat(9 + sizeConfig$c[size].iconSize, "px]") }) : sizeConfig$c[size], iconSize = _t.iconSize, fieldSize = _t.fieldSize, iconPosition = _t.iconPosition;
|
|
1854
1976
|
var borderStyle = isTransparent
|
|
1855
1977
|
? 'border-transparent bg-transparent' // customize border rule for transparent variant
|
|
1856
1978
|
: 'border border-bia-grey-dark-10 bg-primary-white';
|
|
@@ -1883,11 +2005,8 @@ function TextInput(_a) {
|
|
|
1883
2005
|
if (variant === 'date')
|
|
1884
2006
|
iconElement = React.createElement(TbCalendar, { className: "text-bia-coolgrey", size: 18 });
|
|
1885
2007
|
var extendedInputClassName = "".concat(fieldStyle, " ").concat(fieldSize, " ").concat(bottomBorderColor, " ").concat(inputClassName, " ").concat(borderStyle);
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
label && (React.createElement("label", { htmlFor: id, className: "bianic-text-input-label text-xs font-semibold ".concat(labelStatus) },
|
|
1889
|
-
label,
|
|
1890
|
-
required && React.createElement("span", { className: "p-1 text-bia-red" }, "*"))),
|
|
2008
|
+
return (React.createElement("div", { className: "bianic-text-input-container bianic-fgc-container group/form flex w-full flex-col gap-y-2 text-bia-black" },
|
|
2009
|
+
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
1891
2010
|
React.createElement("div", { className: "relative w-full" },
|
|
1892
2011
|
React.createElement("input", __assign({ className: "bianic-text-input bianic-fgc-target w-full rounded read-only:pointer-events-none read-only:border-bia-grey-light-50 hover:rounded-b-none 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), disabled: disabled, id: id, placeholder: placeholder || label, readOnly: readOnly, required: required, type: typeVariant, value: value, onChange: function (e) { return onChange(e); }, maxLength: maxLength, autoComplete: autoComplete, ref: ref }, props)),
|
|
1893
2012
|
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(actionElement ? '' : iconStyle, " ").concat(iconPosition, " ").concat(iconSizing) }, iconElement)),
|
|
@@ -1916,7 +2035,7 @@ TextInput.defaultProps = {
|
|
|
1916
2035
|
};
|
|
1917
2036
|
|
|
1918
2037
|
// Desc: Radio button size configuration
|
|
1919
|
-
var sizeConfig$
|
|
2038
|
+
var sizeConfig$b = {
|
|
1920
2039
|
md: {
|
|
1921
2040
|
checkSize: 'w-[22px] h-[22px]',
|
|
1922
2041
|
labelSize: 'text-size-base',
|
|
@@ -1931,7 +2050,7 @@ var sizeUnion$4 = ['md', 'sm'];
|
|
|
1931
2050
|
function Radio(_a) {
|
|
1932
2051
|
var label = _a.label, _b = _a.size, size = _b === void 0 ? 'md' : _b, id = _a.id, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, _e = _a.checked, checked = _e === void 0 ? false : _e;
|
|
1933
2052
|
var validatedSize = validUnion(size, sizeUnion$4);
|
|
1934
|
-
var _f = sizeConfig$
|
|
2053
|
+
var _f = sizeConfig$b[validatedSize], checkSize = _f.checkSize, labelSize = _f.labelSize;
|
|
1935
2054
|
return (React.createElement("div", { className: "flex items-center" },
|
|
1936
2055
|
React.createElement("div", { className: "bg-white rounded-full flex flex-shrink-0 justify-center items-center relative ".concat(checkSize) },
|
|
1937
2056
|
React.createElement("input", { id: id, "aria-labelledby": "label1", type: "radio", className: "peer checkbox box-content appearance-none focus:opacity-100 focus:ring-1 focus:ring-offset-2 checked:disabled:border-bia-blue-disabled focus:ring-bia-blue focus:outline-none rounded-full border-bia-coolgrey-light-50 checked:border-bia-blue hover:border-bia-blue-hover disabled:border-bia-grey-dark-10 border-2 absolute cursor-pointer w-full h-full", onClick: function (e) { return onClick(e); }, checked: checked, disabled: disabled }),
|
|
@@ -1947,15 +2066,6 @@ Radio.defaultProps = {
|
|
|
1947
2066
|
checked: false,
|
|
1948
2067
|
};
|
|
1949
2068
|
|
|
1950
|
-
var sizeConfig$9 = {
|
|
1951
|
-
md: {
|
|
1952
|
-
inputClass: 'text-size-base font-[350] min-h-10',
|
|
1953
|
-
},
|
|
1954
|
-
sm: {
|
|
1955
|
-
inputClass: 'text-size-sm min-h-[30px]',
|
|
1956
|
-
},
|
|
1957
|
-
};
|
|
1958
|
-
|
|
1959
2069
|
var ResizeIcon = function (_a) {
|
|
1960
2070
|
var className = _a.className;
|
|
1961
2071
|
return (React.createElement("svg", { width: "9", height: "9", viewBox: "0 0 9 9", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "bianic-resize-icon ".concat(className) },
|
|
@@ -1967,16 +2077,23 @@ var ResizeIcon = function (_a) {
|
|
|
1967
2077
|
React.createElement("line", { y1: "-0.5", x2: "3.77124", y2: "-0.5", transform: "matrix(0.707106 -0.707108 0.707106 0.707108 6.33398 9)", stroke: "black", "stroke-opacity": "0.1" })));
|
|
1968
2078
|
};
|
|
1969
2079
|
|
|
2080
|
+
var sizeConfig$a = {
|
|
2081
|
+
md: {
|
|
2082
|
+
inputClass: 'text-size-base font-[350] min-h-10',
|
|
2083
|
+
},
|
|
2084
|
+
sm: {
|
|
2085
|
+
inputClass: 'text-size-sm min-h-[30px]',
|
|
2086
|
+
},
|
|
2087
|
+
};
|
|
2088
|
+
|
|
1970
2089
|
function TextArea(_a) {
|
|
1971
2090
|
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, _d = _a.placeholder, placeholder = _d === void 0 ? '' : _d, required = _a.required, rows = _a.rows, _e = _a.maxLength, maxLength = _e === void 0 ? undefined : _e, value = _a.value, _f = _a.readOnly, readOnly = _f === void 0 ? false : _f, _g = _a.autoComplete, autoComplete = _g === void 0 ? 'off' : _g, props = __rest(_a, ["descText", "disabled", "id", "size", "label", "placeholder", "required", "rows", "maxLength", "value", "readOnly", "autoComplete"]);
|
|
1972
2091
|
var inputRow = rows !== null && rows !== void 0 ? rows : 4;
|
|
1973
|
-
var inputClass = sizeConfig$
|
|
2092
|
+
var inputClass = sizeConfig$a[size].inputClass;
|
|
1974
2093
|
var remainWords = maxLength ? maxLength - (value ? value.length : 0) : 0;
|
|
1975
|
-
return (React.createElement("div", { className: "field-group flex w-full flex-col" },
|
|
1976
|
-
React.createElement(
|
|
1977
|
-
|
|
1978
|
-
required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
|
|
1979
|
-
React.createElement("div", { className: "relative h-full w-full min-w-[250px]" },
|
|
2094
|
+
return (React.createElement("div", { className: "field-group group/form flex w-full flex-col gap-y-2" },
|
|
2095
|
+
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
2096
|
+
React.createElement("div", { className: "relative h-fit w-full min-w-[250px]" },
|
|
1980
2097
|
React.createElement(ResizeIcon, { className: "absolute bottom-[11px] right-[5px]" }),
|
|
1981
2098
|
React.createElement("textarea", __assign({ className: "field bianic-text-area w-full rounded border border-bia-grey-dark-10 bg-primary-white p-2.5 read-only:pointer-events-none 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:bg-bia-grey-light-80 disabled:text-bia-grey-active ".concat(inputClass), rows: inputRow, id: id, placeholder: placeholder, disabled: disabled, maxLength: maxLength, value: value, autoComplete: autoComplete, readOnly: readOnly }, props))),
|
|
1982
2099
|
React.createElement("div", { className: "desc flex justify-between gap-1 text-xs text-primary-cool" },
|
|
@@ -2000,7 +2117,7 @@ TextArea.defaultProps = {
|
|
|
2000
2117
|
value: '',
|
|
2001
2118
|
};
|
|
2002
2119
|
|
|
2003
|
-
var sizeConfig$
|
|
2120
|
+
var sizeConfig$9 = {
|
|
2004
2121
|
md: {
|
|
2005
2122
|
checkClass: 'w-[22px] h-[22px]',
|
|
2006
2123
|
labelClass: 'text-size-base font-[350]',
|
|
@@ -2014,7 +2131,7 @@ var sizeConfig$8 = {
|
|
|
2014
2131
|
var sizeUnion$3 = ['md', 'sm'];
|
|
2015
2132
|
function Checkbox(_a) {
|
|
2016
2133
|
var _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, _d = _a.onChange, onChange = _d === void 0 ? function () { } : _d, props = __rest(_a, ["disabled", "id", "size", "label", "onChange"]);
|
|
2017
|
-
var _e = sizeConfig$
|
|
2134
|
+
var _e = sizeConfig$9[validUnion(size, sizeUnion$3)], checkClass = _e.checkClass, labelClass = _e.labelClass;
|
|
2018
2135
|
return (React.createElement("div", { className: "flex items-center" },
|
|
2019
2136
|
React.createElement("div", { className: "relative flex flex-shrink-0 items-center justify-center rounded-full bg-white ".concat(checkClass) },
|
|
2020
2137
|
React.createElement("input", __assign({ id: id, type: "checkbox", className: "checkbox peer absolute box-content h-full w-full cursor-pointer appearance-none rounded-full border-2 border-bia-coolgrey-light-50 checked:border-bia-blue hover:border-bia-blue-hover focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-bia-blue focus-visible:ring-offset-2 disabled:border-bia-coolgrey-light-50 disabled:checked:border-bia-blue-light-50", onChange: function (e) { return onChange(e); }, disabled: disabled }, props)),
|
|
@@ -2032,7 +2149,7 @@ Checkbox.defaultProps = {
|
|
|
2032
2149
|
onChange: function () { },
|
|
2033
2150
|
};
|
|
2034
2151
|
|
|
2035
|
-
var sizeConfig$
|
|
2152
|
+
var sizeConfig$8 = {
|
|
2036
2153
|
md: {
|
|
2037
2154
|
searchSize: 'text-size-base p-2.5 font-[350] h-10',
|
|
2038
2155
|
iconSize: 'right-[10px] text-[18px]',
|
|
@@ -2043,7 +2160,7 @@ var sizeConfig$7 = {
|
|
|
2043
2160
|
},
|
|
2044
2161
|
};
|
|
2045
2162
|
|
|
2046
|
-
var sizeConfig$
|
|
2163
|
+
var sizeConfig$7 = {
|
|
2047
2164
|
md: {
|
|
2048
2165
|
container: 'text-size-base font-[350] py-[3px] first:pt-[8px] last:pb-[8px]',
|
|
2049
2166
|
item: 'min-h-[34px] p-2.5',
|
|
@@ -2061,7 +2178,7 @@ function CustomDropdownItem(_a) {
|
|
|
2061
2178
|
var _f = React.useState(false), isHoveredSubMenu = _f[0], setIsHoveredSubMenu = _f[1];
|
|
2062
2179
|
var isOpenDropdown = isHovered || isHoveredSubMenu;
|
|
2063
2180
|
var selectedClass = isSelected ? 'font-semibold' : 'font-normal';
|
|
2064
|
-
var _g = sizeConfig$
|
|
2181
|
+
var _g = sizeConfig$7[size], containerClass = _g.container, item = _g.item;
|
|
2065
2182
|
var itemClass = "".concat(item, " ").concat(selectedClass, " ").concat(className);
|
|
2066
2183
|
var isExistSubDropdown = options.length !== 0;
|
|
2067
2184
|
return (React.createElement("div", { className: "relative w-full focus-visible:outline-bia-blue-light-50 ".concat(containerClass), tabIndex: 0, role: "button", onClick: function (e) { return onClick(e); }, onMouseEnter: function () { return setisHovered(true); }, onMouseLeave: function () { return setisHovered(false); }, onKeyDown: function () { } },
|
|
@@ -2088,7 +2205,7 @@ function DefaultDropdownItem(_a) {
|
|
|
2088
2205
|
var _g = React.useState(false), isHoveredSubMenu = _g[0], setIsHoveredSubMenu = _g[1];
|
|
2089
2206
|
var isOpenDropdown = isHovered || isHoveredSubMenu;
|
|
2090
2207
|
var selectedClass = isSelected ? 'font-semibold' : 'font-normal';
|
|
2091
|
-
var _h = sizeConfig$
|
|
2208
|
+
var _h = sizeConfig$7[size], containerClass = _h.container, item = _h.item;
|
|
2092
2209
|
var itemClass = "".concat(item, " ").concat(selectedClass, " ").concat(className);
|
|
2093
2210
|
var isExistSubDropdown = options.length !== 0;
|
|
2094
2211
|
return (React.createElement("div", { className: "relative w-full focus-visible:outline-bia-blue-light-50 ".concat(containerClass), tabIndex: 0, role: "button", onClick: function (e) { return onClick(e); }, onMouseEnter: function () { return setisHovered(true); }, onMouseLeave: function () { return setisHovered(false); }, onKeyDown: function () { } },
|
|
@@ -2199,7 +2316,7 @@ function SelectInput(_a) {
|
|
|
2199
2316
|
var _k = React.useState(false), isOpen = _k[0], setIsOpen = _k[1];
|
|
2200
2317
|
var _l = React.useState(false), isDropUp = _l[0], setIsDropUp = _l[1];
|
|
2201
2318
|
var validatedSize = validUnion(size, sizeUnion$2);
|
|
2202
|
-
var _m = sizeConfig$
|
|
2319
|
+
var _m = sizeConfig$8[validatedSize], searchSize = _m.searchSize, iconSize = _m.iconSize;
|
|
2203
2320
|
var inputRef = React.useRef(null);
|
|
2204
2321
|
var dropdownContRef = React.useRef(null);
|
|
2205
2322
|
var handleOutsideClick = function (e) {
|
|
@@ -2293,7 +2410,7 @@ SelectInput.defaultProps = {
|
|
|
2293
2410
|
setSelected: function () { },
|
|
2294
2411
|
};
|
|
2295
2412
|
|
|
2296
|
-
var sizeConfig$
|
|
2413
|
+
var sizeConfig$6 = {
|
|
2297
2414
|
md: {
|
|
2298
2415
|
iconClass: 'right-[10px]',
|
|
2299
2416
|
iconSize: '18',
|
|
@@ -2312,7 +2429,7 @@ function LiveSearch(_a) {
|
|
|
2312
2429
|
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;
|
|
2313
2430
|
var _l = React.useState(false), isOpen = _l[0], setIsOpen = _l[1];
|
|
2314
2431
|
var _m = React.useState(value.label || ''), searchTerm = _m[0], setSearchTerm = _m[1];
|
|
2315
|
-
var _o = sizeConfig$
|
|
2432
|
+
var _o = sizeConfig$6[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
|
|
2316
2433
|
var dropContClassName = dropContProps.className, restDropContProps = __rest(dropContProps, ["className"]);
|
|
2317
2434
|
var isValueExist = value && value.label !== undefined && value.label !== '';
|
|
2318
2435
|
var inputRef = React.useRef(null);
|
|
@@ -2353,7 +2470,7 @@ function LiveSearch(_a) {
|
|
|
2353
2470
|
setIsDropUp(false);
|
|
2354
2471
|
}
|
|
2355
2472
|
}, [isOpen]);
|
|
2356
|
-
var filteredOptions = options.filter(function (item) {
|
|
2473
|
+
var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (item) {
|
|
2357
2474
|
return item.label.toLowerCase().includes(value.label.toLowerCase());
|
|
2358
2475
|
});
|
|
2359
2476
|
var handleInputChange = function (e) {
|
|
@@ -2419,10 +2536,8 @@ function LiveSearch(_a) {
|
|
|
2419
2536
|
React.Children.toArray(renderedChildren).filter(Boolean).length > 0; // Should always be true if there are initial children
|
|
2420
2537
|
}
|
|
2421
2538
|
var dropdownPosition = isDropUp ? 'bottom-full' : 'top-full';
|
|
2422
|
-
return (React.createElement("div", { className: "bianic-livesearch field-group flex w-full flex-col gap-y-2", ref: inputRef },
|
|
2423
|
-
React.createElement(
|
|
2424
|
-
label,
|
|
2425
|
-
required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
|
|
2539
|
+
return (React.createElement("div", { className: "bianic-livesearch field-group group/form flex w-full flex-col gap-y-2 ", ref: inputRef },
|
|
2540
|
+
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
2426
2541
|
React.createElement("div", { className: "group relative w-full" },
|
|
2427
2542
|
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, onChange: function (e) {
|
|
2428
2543
|
onChangeText(e);
|
|
@@ -2447,7 +2562,7 @@ function LiveSearch(_a) {
|
|
|
2447
2562
|
? renderedChildren
|
|
2448
2563
|
: // If no results and searchTerm is present
|
|
2449
2564
|
searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))),
|
|
2450
|
-
React.createElement("span", { className: "desc text-xs text-primary-cool" }, descText)));
|
|
2565
|
+
descText && (React.createElement("span", { className: "desc text-xs text-primary-cool" }, descText))));
|
|
2451
2566
|
}
|
|
2452
2567
|
LiveSearch.defaultProps = {
|
|
2453
2568
|
descText: '',
|
|
@@ -2463,7 +2578,7 @@ LiveSearch.defaultProps = {
|
|
|
2463
2578
|
readonly: false,
|
|
2464
2579
|
};
|
|
2465
2580
|
|
|
2466
|
-
var sizeConfig$
|
|
2581
|
+
var sizeConfig$5 = {
|
|
2467
2582
|
md: {
|
|
2468
2583
|
containerSize: 'w-[42px] h-[22px]',
|
|
2469
2584
|
checkSize: 'p-2',
|
|
@@ -2478,7 +2593,7 @@ var sizeConfig$4 = {
|
|
|
2478
2593
|
|
|
2479
2594
|
function Toggle(_a) {
|
|
2480
2595
|
var _b = _a.label, label = _b === void 0 ? '' : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, _d = _a.onClick, onClick = _d === void 0 ? function () { } : _d, _e = _a.checked, checked = _e === void 0 ? false : _e, _f = _a.id, id = _f === void 0 ? '' : _f, _g = _a.disabled, disabled = _g === void 0 ? false : _g;
|
|
2481
|
-
var _h = sizeConfig$
|
|
2596
|
+
var _h = sizeConfig$5[size], containerSize = _h.containerSize, checkSize = _h.checkSize, labelClass = _h.labelClass;
|
|
2482
2597
|
return (React.createElement("div", { className: "flex items-center" },
|
|
2483
2598
|
React.createElement("div", { className: "".concat(containerSize, " rounded-full py-[2px] flex flex-shrink-0 ").concat(checked ? 'justify-end' : 'justify-start', " items-center relative cursor-pointer"), onClick: onClick, onKeyDown: function () { }, role: "checkbox", tabIndex: 0, "aria-checked": checked },
|
|
2484
2599
|
React.createElement("input", { id: id, checked: checked, disabled: disabled, className: "".concat(checkSize, " peer checkbox appearance-none opacity-100 focus:ring-1 focus:ring-offset-2 focus:ring-bia-blue focus:outline-none rounded-full border-bia-grey checked:border-bia-blue bg-primary-white checked:bg-bia-blue checked:hover:bg-bia-blue-hover cursor-pointer hover:border-bia-blue-hover peer-hover:border-bia-blue-hover disabled:bg-bia-grey-light-80 disabled:checked:bg-bia-blue-light-50 disabled:border-none border-2 absolute w-full h-full"), type: "checkbox" }),
|
|
@@ -2504,7 +2619,7 @@ var roundedConfig = {
|
|
|
2504
2619
|
sm: 'first:rounded-l-radius-sm last:rounded-r-radius-sm',
|
|
2505
2620
|
tn: 'first:rounded-l-radius-tn last:rounded-r-radius-tn',
|
|
2506
2621
|
};
|
|
2507
|
-
var sizeConfig$
|
|
2622
|
+
var sizeConfig$4 = {
|
|
2508
2623
|
lg: 'text-size-md leading-[23.94px] px-[13px] py-[11px] ',
|
|
2509
2624
|
md: 'text-size-base leading-[21px] px-[11px] py-[8.5px] ',
|
|
2510
2625
|
sm: 'text-size-sm leading-[15.96px] px-[7px] py-[6px] ',
|
|
@@ -2527,8 +2642,8 @@ function SegmentButtonItem(_a) {
|
|
|
2527
2642
|
var className = _a.className, _b = _a.selected, selected = _b === void 0 ? false : _b, size = _a.size, children = _a.children, disabled = _a.disabled, _c = _a.isfitContent, isfitContent = _c === void 0 ? false : _c, onClick = _a.onClick;
|
|
2528
2643
|
var isSelected = selected ? 'selected' : 'notSelected';
|
|
2529
2644
|
var sizingStyle = isfitContent
|
|
2530
|
-
? "".concat(sizeConfig$
|
|
2531
|
-
: "".concat(sizeConfig$
|
|
2645
|
+
? "".concat(sizeConfig$4[size], " ").concat(minHeightConfig[size])
|
|
2646
|
+
: "".concat(sizeConfig$4[size], " ").concat(minWidthConfig[size], " ").concat(minHeightConfig[size]);
|
|
2532
2647
|
var radiusStyle = "".concat(roundedConfig[size]);
|
|
2533
2648
|
var selectedStyle = "".concat(isSelectedConfig[isSelected]);
|
|
2534
2649
|
return (React.createElement("button", { type: "button", onClick: onClick, disabled: disabled, className: "group:last:border-l-0 flex items-center justify-center border-[1px] border-l-0 border-bia-grey-dark-10 first:border-l-[1px] focus-visible:z-50 focus-visible:outline focus-visible:outline-[3px] focus-visible:-outline-offset-1 focus-visible:outline-bia-blue-light-50 disabled:cursor-not-allowed disabled:bg-bia-grey-light-80 disabled:text-bia-grey-dark-10 ".concat(selectedStyle, " ").concat(radiusStyle, " ").concat(sizingStyle, " ").concat(className) }, children));
|
|
@@ -2576,7 +2691,7 @@ var todayValue = Date.now() -
|
|
|
2576
2691
|
(Date.now() % oneDayValue) +
|
|
2577
2692
|
new Date().getTimezoneOffset() * 1000 * 60; // today in milliseconds
|
|
2578
2693
|
var PickerCalendar = function (_a) {
|
|
2579
|
-
var
|
|
2694
|
+
var _b = _a.selectedDate, selectedDate = _b === void 0 ? null : _b, onDateChange = _a.onDateChange, ref = _a.ref;
|
|
2580
2695
|
// Constants
|
|
2581
2696
|
var daysMap = [
|
|
2582
2697
|
'Monday',
|
|
@@ -2603,8 +2718,8 @@ var PickerCalendar = function (_a) {
|
|
|
2603
2718
|
];
|
|
2604
2719
|
var modeMap = ['date', 'year', 'month'];
|
|
2605
2720
|
// Mode Controller
|
|
2606
|
-
var
|
|
2607
|
-
var
|
|
2721
|
+
var _c = React.useState(modeMap[0]), pickerMode = _c[0], setPickerMode = _c[1];
|
|
2722
|
+
var _d = React.useState(''), prevMode = _d[0], setPrevMode = _d[1];
|
|
2608
2723
|
// styling constants and functions
|
|
2609
2724
|
var chevronButtonStyle = 'text-bia-coolgrey';
|
|
2610
2725
|
var selectedDateStyle = function (date, dateSelected) {
|
|
@@ -2720,9 +2835,9 @@ var PickerCalendar = function (_a) {
|
|
|
2720
2835
|
});
|
|
2721
2836
|
};
|
|
2722
2837
|
// View Date Logic
|
|
2723
|
-
var
|
|
2724
|
-
var
|
|
2725
|
-
var
|
|
2838
|
+
var _e = React.useState(new Date(selectedDate || todayValue).getMonth()), viewMonthValue = _e[0], setViewMonthValue = _e[1]; // get the month of the selected date
|
|
2839
|
+
var _f = React.useState(new Date(selectedDate || todayValue).getFullYear()), viewYearValue = _f[0], setViewYearValue = _f[1]; // get the year of the selected date
|
|
2840
|
+
var _g = React.useState(new Date(selectedDate || todayValue).getFullYear()), viewDecadeValue = _g[0], setViewDecadeValue = _g[1]; // get the year for decaderange
|
|
2726
2841
|
// Month view logic
|
|
2727
2842
|
var monthStartDay = new Date("".concat(viewYearValue, "-").concat(viewMonthValue + 1, "-01")).getDay() === 0
|
|
2728
2843
|
? 6
|
|
@@ -2734,7 +2849,7 @@ var PickerCalendar = function (_a) {
|
|
|
2734
2849
|
var viewLastDate = new Date(viewFirstDate);
|
|
2735
2850
|
viewLastDate.setDate(viewLastDate.getDate() + monthCalenderView - 1); // get the last date of the view
|
|
2736
2851
|
// Generate the view days array
|
|
2737
|
-
var
|
|
2852
|
+
var _h = React.useState([]), displayDays = _h[0], setDisplayDays = _h[1];
|
|
2738
2853
|
function getDecadeRange(year) {
|
|
2739
2854
|
// Calculate the start of the decade
|
|
2740
2855
|
var startOfDecade = Math.floor(year / 10) * 10;
|
|
@@ -2750,13 +2865,13 @@ var PickerCalendar = function (_a) {
|
|
|
2750
2865
|
var yearDisplayRange = getDecadeRange(viewDecadeValue);
|
|
2751
2866
|
// Variable display
|
|
2752
2867
|
var dateDisplay = (React.createElement("div", { className: "".concat(pickerMode === 'date' ? '' : 'hidden') },
|
|
2753
|
-
React.createElement("div", { className: "bianic-datepicker-calendar-days-grid-header grid grid-cols-7 gap-[3px] pb-1.5" }, daysMap.map(function (day) { return (React.createElement("div", { key: day, className: "bianic-datepicker-calendar-day flex h-[18px] w-[31px] items-center justify-center text-bia-coolgrey" },
|
|
2868
|
+
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 text-bia-coolgrey" },
|
|
2754
2869
|
React.createElement(Text, { variant: "small-text" }, day.slice(0, 3)))); })),
|
|
2755
2870
|
React.createElement("div", { className: "bianic-datepicker-calendar-days-grid-body grid grid-cols-7 gap-y-1.5" }, displayDays.map(function (date) { return (React.createElement("button", { key: date.toString(), className: "bianic-datepicker-calendar-day flex h-[31px] w-[31px] items-center justify-center ".concat(datesColorStyle(date, viewMonthValue), " ").concat(selectedDateStyle(date, selectedDate)), onClick: function () {
|
|
2756
2871
|
// Handle date selection logic here
|
|
2757
2872
|
handleSetSelectedDate(date);
|
|
2758
2873
|
} },
|
|
2759
|
-
React.createElement(Text, { variant: "small-text" }, date.getDate()))); }))));
|
|
2874
|
+
React.createElement(Text, { variant: "small-text", extended: checkDateEquals(date, selectedDate) ? 'text-bia-white' : '' }, date.getDate()))); }))));
|
|
2760
2875
|
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) { return (React.createElement("button", { className: "bianic-datepicker-calendar-month mx-[15px] flex h-[31px] items-center justify-center ".concat(selectedMonthStyle(index, viewMonthValue)), key: index, onClick: function () { return handleSetMonth(index); } },
|
|
2761
2876
|
React.createElement(Text, { variant: "small-text" }, month.slice(0, 3)))); })));
|
|
2762
2877
|
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) { return (React.createElement("button", { className: "bianic-datepicker-calendar-month mx-[6px] flex h-[31px] items-center justify-center ".concat(selectedMonthStyle(year, viewYearValue), " ").concat(index === 0 || index === 11 ? 'text-bia-coolgrey' : 'text-bia-black'), key: index, onClick: function () { return handleSetYear(year); } },
|
|
@@ -2805,20 +2920,20 @@ var monthMap = [
|
|
|
2805
2920
|
'December',
|
|
2806
2921
|
];
|
|
2807
2922
|
function DatePicker(_a) {
|
|
2808
|
-
var value = _a.value, onChange = _a.onChange;
|
|
2923
|
+
var value = _a.value, onChange = _a.onChange, size = _a.size, disabled = _a.disabled, _b = _a.placeholder, placeholder = _b === void 0 ? '"YYYY-MM-DD"' : _b, label = _a.label, descText = _a.descText, required = _a.required;
|
|
2809
2924
|
// State and Ref
|
|
2810
2925
|
var inputRef = React.useRef(null);
|
|
2811
2926
|
var wrapperRef = React.useRef(null);
|
|
2812
2927
|
var pickerRef = React.useRef(null);
|
|
2813
|
-
var
|
|
2928
|
+
var _c = useDetectOutsideClick(wrapperRef, false, pickerRef), isPickerOpen = _c[0], setIsPickerOpen = _c[1];
|
|
2814
2929
|
return (React.createElement("div", { className: "bianic-datepicker-container relative", ref: wrapperRef },
|
|
2815
2930
|
React.createElement("div", { className: "bianic-datepicker-field-container" },
|
|
2816
|
-
React.createElement(DateInput, { ref: inputRef, placeholder:
|
|
2931
|
+
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 })),
|
|
2817
2932
|
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" },
|
|
2818
2933
|
React.createElement(PickerCalendar, { selectedDate: new Date(value), onDateChange: onChange, ref: pickerRef })))));
|
|
2819
2934
|
}
|
|
2820
2935
|
var DateInput = function (_a) {
|
|
2821
|
-
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, buttonAction = _a.buttonAction, props = __rest(_a, ["className", "value", "isActive", "setIsActive", "label", "id", "size", "onChange", "required", "buttonAction"]);
|
|
2936
|
+
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"]);
|
|
2822
2937
|
var editDateFormatter = function (date) {
|
|
2823
2938
|
var localString = date.toLocaleDateString().split('/');
|
|
2824
2939
|
return localString.reverse().join('-');
|
|
@@ -2828,41 +2943,13 @@ var DateInput = function (_a) {
|
|
|
2828
2943
|
};
|
|
2829
2944
|
// Convert Date to string for display
|
|
2830
2945
|
var formattedValue = value instanceof Date ? displayDateFormatter(value) : value;
|
|
2831
|
-
var
|
|
2946
|
+
var _e = React.useState(formattedValue), viewValue = _e[0], setViewValue = _e[1];
|
|
2832
2947
|
React.useRef(null);
|
|
2833
|
-
var
|
|
2834
|
-
var
|
|
2835
|
-
var
|
|
2948
|
+
var _f = React.useState(0); _f[0]; _f[1];
|
|
2949
|
+
var _g = styleConfig['text'], fieldStyle = _g.fieldStyle;
|
|
2950
|
+
var _h = sizeConfig$c[size], iconSize = _h.iconSize, fieldSize = _h.fieldSize, iconPosition = _h.iconPosition;
|
|
2836
2951
|
var borderStyle = 'border border-bia-grey-dark-10 bg-primary-white';
|
|
2837
2952
|
var extendedInputClassName = "".concat(fieldStyle, " ").concat(fieldSize, " ").concat(borderStyle, " ").concat(className);
|
|
2838
|
-
var labelStatus = props.readOnly ? 'read-only:pointer-events-none' : '';
|
|
2839
|
-
// Don't remove this, it will be used later
|
|
2840
|
-
// Helper function to format the cleaned input with specific group sizes
|
|
2841
|
-
// const formatInput = (cleanedValue: string, separator: string = '-') => {
|
|
2842
|
-
// let formattedValue = ''
|
|
2843
|
-
// // Define the group lengths: 4, 2, 2
|
|
2844
|
-
// const groupLengths = [4, 2, 2]
|
|
2845
|
-
// let currentIndex = 0
|
|
2846
|
-
// for (let i = 0; i < groupLengths.length; i++) {
|
|
2847
|
-
// const groupLength = groupLengths[i]
|
|
2848
|
-
// const nextSegment = cleanedValue.substring(
|
|
2849
|
-
// currentIndex,
|
|
2850
|
-
// currentIndex + groupLength
|
|
2851
|
-
// )
|
|
2852
|
-
// if (nextSegment.length > 0) {
|
|
2853
|
-
// formattedValue += nextSegment
|
|
2854
|
-
// currentIndex += groupLength
|
|
2855
|
-
// // Add separator if there are more groups to follow and we have enough characters
|
|
2856
|
-
// if (i < groupLengths.length - 1 && currentIndex < cleanedValue.length) {
|
|
2857
|
-
// formattedValue += separator
|
|
2858
|
-
// }
|
|
2859
|
-
// } else {
|
|
2860
|
-
// // Stop if there are no more characters for the current group
|
|
2861
|
-
// break
|
|
2862
|
-
// }
|
|
2863
|
-
// }
|
|
2864
|
-
// return formattedValue
|
|
2865
|
-
// }
|
|
2866
2953
|
var validateAndFormatDate = function (value) {
|
|
2867
2954
|
// 1. validate separator
|
|
2868
2955
|
var splittedDate = value.split('-');
|
|
@@ -2915,56 +3002,6 @@ var DateInput = function (_a) {
|
|
|
2915
3002
|
onChange(date); // Update the value if it's a valid date
|
|
2916
3003
|
}
|
|
2917
3004
|
};
|
|
2918
|
-
// Handle input change will develop later don't remove
|
|
2919
|
-
// const handleChange = (event) => {
|
|
2920
|
-
// const inputElement = event.target
|
|
2921
|
-
// const rawValue = inputElement.value
|
|
2922
|
-
// const currentCursorPos = inputElement.selectionStart
|
|
2923
|
-
// const cleaned = cleanInput(rawValue)
|
|
2924
|
-
// // Max total digits for XXXX-XX-XX is 4 + 2 + 2 = 8
|
|
2925
|
-
// const maxDigits = 8
|
|
2926
|
-
// const truncatedCleaned = cleaned.substring(0, maxDigits)
|
|
2927
|
-
// const formatted = formatInput(truncatedCleaned)
|
|
2928
|
-
// // --- Cursor Position Adjustment Logic ---
|
|
2929
|
-
// let newCursorPos = currentCursorPos
|
|
2930
|
-
// const prevFormattedLength = viewValue.length // Length of the string *before* update
|
|
2931
|
-
// const currentFormattedLength = formatted.length // Length of the string *after* update
|
|
2932
|
-
// // If text was added and formatted length increased
|
|
2933
|
-
// if (currentFormattedLength > prevFormattedLength) {
|
|
2934
|
-
// // Count how many separators are now *before* the cursor in the new string
|
|
2935
|
-
// // We'll compare the raw cursor position with the formatted string to adjust
|
|
2936
|
-
// let separatorCountBeforeCursor = 0
|
|
2937
|
-
// let originalCleanedValue = cleanInput(viewValue) // Clean value before this change
|
|
2938
|
-
// // If a character was inserted, estimate new cursor position
|
|
2939
|
-
// if (cleaned.length > originalCleanedValue.length) {
|
|
2940
|
-
// // Count separators in the *new* formatted string up to the currentCursorPos
|
|
2941
|
-
// for (let i = 0; i < currentCursorPos; i++) {
|
|
2942
|
-
// if (formatted.charAt(i) === '-') {
|
|
2943
|
-
// separatorCountBeforeCursor++
|
|
2944
|
-
// }
|
|
2945
|
-
// }
|
|
2946
|
-
// newCursorPos = currentCursorPos + separatorCountBeforeCursor
|
|
2947
|
-
// } else {
|
|
2948
|
-
// // If characters were deleted (backspace/delete)
|
|
2949
|
-
// newCursorPos = currentCursorPos
|
|
2950
|
-
// // More sophisticated logic for backspace/delete on separators can go here.
|
|
2951
|
-
// // For example, if you backspace a digit and it causes a separator to disappear,
|
|
2952
|
-
// // the cursor might need to jump back an extra position.
|
|
2953
|
-
// // This basic setup often works acceptably for most cases.
|
|
2954
|
-
// }
|
|
2955
|
-
// } else {
|
|
2956
|
-
// // If text was deleted or no change in length
|
|
2957
|
-
// newCursorPos = currentCursorPos
|
|
2958
|
-
// }
|
|
2959
|
-
// const handleKeyDown = (event) => {
|
|
2960
|
-
// if (event.key === 'Enter') {
|
|
2961
|
-
// // Prevent default form submission if the input is inside a <form>
|
|
2962
|
-
// // event.preventDefault();
|
|
2963
|
-
// }
|
|
2964
|
-
// }
|
|
2965
|
-
// setViewValue(formatted)
|
|
2966
|
-
// setLastCursorPos(newCursorPos)
|
|
2967
|
-
// }
|
|
2968
3005
|
var handleChange = function (event) {
|
|
2969
3006
|
var value = event.target.value;
|
|
2970
3007
|
// Regular expression to allow only numbers (0-9) and hyphens (-)
|
|
@@ -2975,25 +3012,16 @@ var DateInput = function (_a) {
|
|
|
2975
3012
|
setViewValue(value);
|
|
2976
3013
|
}
|
|
2977
3014
|
};
|
|
2978
|
-
// Will Develop later
|
|
2979
|
-
// useEffect to set cursor position after render
|
|
2980
|
-
// useEffect(() => {
|
|
2981
|
-
// if (inputRef.current) {
|
|
2982
|
-
// inputRef.current.setSelectionRange(lastCursorPos, lastCursorPos)
|
|
2983
|
-
// }
|
|
2984
|
-
// }, [viewValue, lastCursorPos]) // Re-run when viewValue or lastCursorPos changes
|
|
2985
3015
|
React.useEffect(function () {
|
|
2986
3016
|
setViewValue(formattedValue);
|
|
2987
3017
|
}, [value]);
|
|
2988
|
-
return (React.createElement("div", { className: "bianic-date-input-container bianic-fgc-container flex w-full flex-col gap-y-2 text-bia-black" },
|
|
2989
|
-
label && (React.createElement(
|
|
2990
|
-
label,
|
|
2991
|
-
required && React.createElement("span", { className: "p-1 text-bia-red" }, "*"))),
|
|
3018
|
+
return (React.createElement("div", { className: "bianic-date-input-container bianic-fgc-container group/form flex w-full flex-col gap-y-2 text-bia-black " },
|
|
3019
|
+
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
2992
3020
|
React.createElement("div", { className: "relative w-full" },
|
|
2993
|
-
React.createElement("input", __assign({}, props, { type: "text", className: "bianic-text-input bianic-fgc-target w-full rounded read-only:pointer-events-none read-only:border-bia-grey-light-50 hover:rounded-b-none 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
|
|
3021
|
+
React.createElement("input", __assign({}, props, { type: "text", className: "bianic-text-input bianic-fgc-target w-full rounded read-only:pointer-events-none read-only:border-bia-grey-light-50 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), id: id, value: viewValue, disabled: disabled, onChange: handleChange, required: required, onFocus: function () {
|
|
2994
3022
|
setIsActive && setIsActive(true);
|
|
2995
3023
|
setViewValue(editDateFormatter(value));
|
|
2996
|
-
},
|
|
3024
|
+
}, onBlur: function () {
|
|
2997
3025
|
var _a = validateAndFormatDate(viewValue), status = _a[0], validatedValue = _a[1];
|
|
2998
3026
|
setViewValue(displayDateFormatter(value));
|
|
2999
3027
|
if (status !== 0) ;
|
|
@@ -3001,11 +3029,12 @@ var DateInput = function (_a) {
|
|
|
3001
3029
|
updateValue(validatedValue);
|
|
3002
3030
|
}
|
|
3003
3031
|
}, maxLength: 10 })),
|
|
3004
|
-
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 text-
|
|
3005
|
-
React.createElement("button", { className: "bianic-datepicker-toggle-button", onClick: function () {
|
|
3032
|
+
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 text-bia-coolgrey ".concat(iconPosition) },
|
|
3033
|
+
React.createElement("button", { className: "bianic-datepicker-toggle-button", disabled: disabled, onClick: function () {
|
|
3006
3034
|
buttonAction && buttonAction();
|
|
3007
3035
|
} },
|
|
3008
|
-
React.createElement(TbCalendar,
|
|
3036
|
+
React.createElement(TbCalendar, { size: iconSize })))),
|
|
3037
|
+
descText && (React.createElement("span", { className: "desc text-xs text-primary-cool" }, descText))));
|
|
3009
3038
|
};
|
|
3010
3039
|
|
|
3011
3040
|
var Node = function (_a) {
|
|
@@ -3188,6 +3217,33 @@ var Neutral = function (_a) {
|
|
|
3188
3217
|
React.createElement("path", { d: "M12 20C14.1217 20 16.1566 19.1571 17.6569 17.6569C19.1571 16.1566 20 14.1217 20 12C20 9.87827 19.1571 7.84344 17.6569 6.34315C16.1566 4.84285 14.1217 4 12 4C9.87827 4 7.84344 4.84285 6.34315 6.34315C4.84285 7.84344 4 9.87827 4 12C4 14.1217 4.84285 16.1566 6.34315 17.6569C7.84344 19.1571 9.87827 20 12 20ZM12 22C6.477 22 2 17.523 2 12C2 6.477 6.477 2 12 2C17.523 2 22 6.477 22 12C22 17.523 17.523 22 12 22Z", fill: "#2F2F2F" })));
|
|
3189
3218
|
};
|
|
3190
3219
|
|
|
3220
|
+
var colorConfig$1 = {
|
|
3221
|
+
yellow: 'bg-bia-yellow-light-80',
|
|
3222
|
+
blue: 'bg-bia-sky-light-90',
|
|
3223
|
+
grey: 'bg-bia-grey-light-80',
|
|
3224
|
+
white: 'bg-bia-white border border-bia-grey',
|
|
3225
|
+
};
|
|
3226
|
+
var sizeConfig$3 = {
|
|
3227
|
+
container: 'min-h-fit p-5 text-wrap',
|
|
3228
|
+
'form-sm': 'h-[30px] whitespace-nowrap px-2.5',
|
|
3229
|
+
'form-md': 'h-10 whitespace-nowrap px-2.5',
|
|
3230
|
+
};
|
|
3231
|
+
|
|
3232
|
+
var InfoPanel = function (_a) {
|
|
3233
|
+
var variant = _a.variant, color = _a.color, className = _a.className, textClassName = _a.textClassName;
|
|
3234
|
+
var sizeClass = sizeConfig$3[variant || 'container'];
|
|
3235
|
+
var colorClass = colorConfig$1[color || 'yellow'];
|
|
3236
|
+
var allClasses = "".concat(sizeClass, " ").concat(colorClass, " ").concat(className);
|
|
3237
|
+
return (React.createElement("div", { className: "flex items-center justify-center rounded-radius-md ".concat(allClasses) },
|
|
3238
|
+
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.")));
|
|
3239
|
+
};
|
|
3240
|
+
InfoPanel.defaultProps = {
|
|
3241
|
+
variant: 'container',
|
|
3242
|
+
color: 'yellow',
|
|
3243
|
+
className: '',
|
|
3244
|
+
textClassName: '',
|
|
3245
|
+
};
|
|
3246
|
+
|
|
3191
3247
|
function Modal(_a) {
|
|
3192
3248
|
var _b = _a.size, size = _b === void 0 ? 'sm' : _b, title = _a.title, open = _a.open, _c = _a.zIndex, zIndex = _c === void 0 ? 100 : _c, onClose = _a.onClose, onClick = _a.onClick, rest = __rest(_a, ["size", "title", "open", "zIndex", "onClose", "onClick"]);
|
|
3193
3249
|
var modalSize;
|
|
@@ -3313,7 +3369,7 @@ Pills.defaultProps = {
|
|
|
3313
3369
|
iconRight: null,
|
|
3314
3370
|
};
|
|
3315
3371
|
|
|
3316
|
-
var classConfig
|
|
3372
|
+
var classConfig = {
|
|
3317
3373
|
top: {
|
|
3318
3374
|
tooltipContainer: 'bottom-[calc(100%+10px)] left-1/2 -translate-x-1/2',
|
|
3319
3375
|
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
@@ -3360,7 +3416,7 @@ function Popover(_a) {
|
|
|
3360
3416
|
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;
|
|
3361
3417
|
var wrapperRef = React.useRef(null);
|
|
3362
3418
|
var _e = useDetectOutsideClick(wrapperRef, false), isOpen = _e[0], setIsOpen = _e[1];
|
|
3363
|
-
var _f = classConfig
|
|
3419
|
+
var _f = classConfig[direction], tooltipContainer = _f.tooltipContainer, triangleContainer = _f.triangleContainer, triangleShape = _f.triangleShape;
|
|
3364
3420
|
return (React.createElement("div", { className: "Bianic-popover-Wrapper relative block h-fit w-fit", role: "button", ref: wrapperRef, onClick: function () { return setIsOpen(true); } },
|
|
3365
3421
|
children,
|
|
3366
3422
|
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) },
|
|
@@ -3848,111 +3904,6 @@ TagLabel.defaultProps = {
|
|
|
3848
3904
|
isDark: false,
|
|
3849
3905
|
};
|
|
3850
3906
|
|
|
3851
|
-
var classConfig = {
|
|
3852
|
-
top: {
|
|
3853
|
-
tooltipContainer: 'bottom-[calc(100%+5px)] left-1/2 -translate-x-1/2',
|
|
3854
|
-
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
3855
|
-
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
3856
|
-
},
|
|
3857
|
-
right: {
|
|
3858
|
-
tooltipContainer: 'left-[calc(100%+5px)] top-1/2 -translate-y-1/2',
|
|
3859
|
-
triangleContainer: '-left-[4px] bottom-0 flex items-center w-auto h-full',
|
|
3860
|
-
triangleShape: 'border-t-[8px] border-t-transparent border-r-[5px] border-r-primary-black border-b-[8px] border-b-transparent',
|
|
3861
|
-
},
|
|
3862
|
-
bottom: {
|
|
3863
|
-
tooltipContainer: 'top-[calc(100%+5px)] left-1/2 -translate-x-1/2',
|
|
3864
|
-
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
3865
|
-
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
3866
|
-
},
|
|
3867
|
-
left: {
|
|
3868
|
-
tooltipContainer: 'right-[calc(100%+5px)] top-1/2 -translate-y-1/2',
|
|
3869
|
-
triangleContainer: '-right-[4px] bottom-0 flex items-center w-auto h-full',
|
|
3870
|
-
triangleShape: 'border-t-[8px] border-t-transparent border-l-[5px] border-l-primary-black border-b-[8px] border-b-transparent',
|
|
3871
|
-
},
|
|
3872
|
-
'top-right': {
|
|
3873
|
-
tooltipContainer: 'bottom-[calc(100%+5px)] right-0',
|
|
3874
|
-
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
3875
|
-
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
3876
|
-
},
|
|
3877
|
-
'top-left': {
|
|
3878
|
-
tooltipContainer: 'bottom-[calc(100%+5px)] left-0',
|
|
3879
|
-
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
3880
|
-
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
3881
|
-
},
|
|
3882
|
-
'bottom-right': {
|
|
3883
|
-
tooltipContainer: 'top-[calc(100%+5px)] right-0',
|
|
3884
|
-
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
3885
|
-
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
3886
|
-
},
|
|
3887
|
-
'bottom-left': {
|
|
3888
|
-
tooltipContainer: 'top-[calc(100%+5px)] left-0',
|
|
3889
|
-
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
3890
|
-
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
3891
|
-
},
|
|
3892
|
-
};
|
|
3893
|
-
|
|
3894
|
-
function Tooltip(props) {
|
|
3895
|
-
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;
|
|
3896
|
-
var timeout;
|
|
3897
|
-
var _c = React.useState(false), active = _c[0], setActive = _c[1];
|
|
3898
|
-
var showTip = function () {
|
|
3899
|
-
timeout = setTimeout(function () {
|
|
3900
|
-
setActive(true);
|
|
3901
|
-
}, delay || 400);
|
|
3902
|
-
};
|
|
3903
|
-
var hideTip = function () {
|
|
3904
|
-
clearInterval(timeout);
|
|
3905
|
-
setActive(false);
|
|
3906
|
-
};
|
|
3907
|
-
var _d = classConfig[direction], tooltipContainer = _d.tooltipContainer; _d.triangleContainer; _d.triangleShape;
|
|
3908
|
-
var tooltipContainerRef = React.useRef(null);
|
|
3909
|
-
var _e = React.useState({
|
|
3910
|
-
maxWidth: maxWidth + 'px',
|
|
3911
|
-
whiteSpace: 'nowrap',
|
|
3912
|
-
}), tooltipContainerStyle = _e[0], setTooltipContainerStyle = _e[1];
|
|
3913
|
-
var tooltipContainerElement = tooltipContainerRef === null || tooltipContainerRef === void 0 ? void 0 : tooltipContainerRef.current;
|
|
3914
|
-
var scrollWidth = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.scrollWidth; // Mendapatkan lebar konten aktual
|
|
3915
|
-
var offsetWidth = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.offsetWidth;
|
|
3916
|
-
var offsetHeight = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.offsetHeight;
|
|
3917
|
-
React.useEffect(function () {
|
|
3918
|
-
if (scrollWidth && offsetWidth) {
|
|
3919
|
-
var maxWidthNumber = Number(maxWidth);
|
|
3920
|
-
var isMultiLine = offsetHeight > 23; // 23 pixels is the approximate height of one line of text
|
|
3921
|
-
// Tooltip Width and Whitespace Determination Rules:
|
|
3922
|
-
// 1. Default Condition:
|
|
3923
|
-
// - width: fit-content
|
|
3924
|
-
// - whiteSpace: nowrap
|
|
3925
|
-
// 2. When maxWidth is Set:
|
|
3926
|
-
// * Text Exceeds maxWidth:
|
|
3927
|
-
// - width: maxWidth
|
|
3928
|
-
// - whiteSpace: normal
|
|
3929
|
-
// * Text Equals maxWidth (Multi-line):
|
|
3930
|
-
// - width: maxWidth
|
|
3931
|
-
// - whiteSpace: normal
|
|
3932
|
-
// * Text Less Than maxWidth:
|
|
3933
|
-
// - width: fit-content
|
|
3934
|
-
// - whiteSpace: nowrap
|
|
3935
|
-
var newWidth_1 = 'fit-content';
|
|
3936
|
-
var newWhiteSpace_1 = 'nowrap';
|
|
3937
|
-
if (scrollWidth > maxWidthNumber ||
|
|
3938
|
-
(offsetWidth === maxWidthNumber && isMultiLine)) {
|
|
3939
|
-
newWidth_1 = maxWidthNumber + 'px';
|
|
3940
|
-
newWhiteSpace_1 = 'normal';
|
|
3941
|
-
}
|
|
3942
|
-
setTooltipContainerStyle(function (prev) { return (__assign(__assign({}, prev), { width: newWidth_1, whiteSpace: newWhiteSpace_1 })); });
|
|
3943
|
-
}
|
|
3944
|
-
}, [content, maxWidth, scrollWidth, offsetHeight]);
|
|
3945
|
-
return (React.createElement("div", { className: "tooltip-wrapper relative inline-flex h-fit w-fit flex-col", onMouseEnter: showTip, onMouseLeave: hideTip },
|
|
3946
|
-
children,
|
|
3947
|
-
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))));
|
|
3948
|
-
}
|
|
3949
|
-
Tooltip.defaultProps = {
|
|
3950
|
-
delay: 400,
|
|
3951
|
-
direction: 'top',
|
|
3952
|
-
maxWidth: '300',
|
|
3953
|
-
};
|
|
3954
|
-
Tooltip.defaultProps = {};
|
|
3955
|
-
|
|
3956
3907
|
var colorConfigs = {
|
|
3957
3908
|
default: 'bg-bia-black',
|
|
3958
3909
|
info: 'bg-bia-teal',
|
|
@@ -3973,7 +3924,7 @@ function Toaster(_a) {
|
|
|
3973
3924
|
React.createElement("div", { className: "bianic-toaster-description-area text-[12px] font-normal leading-[134%]" }, children))) : (React.createElement("div", { className: "bianic-toaster-content-area flex flex-row gap-[5px]" },
|
|
3974
3925
|
icon && React.createElement("div", { className: "bianic-toaster-icon-area" }, icon),
|
|
3975
3926
|
React.createElement("div", { className: "bianic-toaster-description-area text-[12px] font-normal leading-[134%]" }, children)));
|
|
3976
|
-
return (React.createElement("div", { className: "bianic-toaster flex
|
|
3927
|
+
return (React.createElement("div", { className: "bianic-toaster flex w-[300px] flex-row gap-[5px] rounded-[5px] py-[10px] shadow-[0px_3px_20px_0px_rgba(0,0,0,0.10)] ".concat(colorStyles) },
|
|
3977
3928
|
React.createElement("span", { className: "mr-[10px] flex min-w-[3px] rounded-r-[10px] bg-bia-white/50" }),
|
|
3978
3929
|
content,
|
|
3979
3930
|
React.createElement("div", { className: "flex items-start pr-[11px] pt-[1px]" },
|
|
@@ -4052,6 +4003,7 @@ exports.FormGroup = FormGroup;
|
|
|
4052
4003
|
exports.FormGroupButton = FormGroupButton;
|
|
4053
4004
|
exports.FormGroupLabel = FormGroupLabel;
|
|
4054
4005
|
exports.Heading = Heading;
|
|
4006
|
+
exports.InfoPanel = InfoPanel;
|
|
4055
4007
|
exports.Link = Link;
|
|
4056
4008
|
exports.LiveSearch = LiveSearch;
|
|
4057
4009
|
exports.MenuContainer = MenuContainer;
|