bianic-ui 1.13.2 → 1.15.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 +364 -367
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Button/Button.d.ts +1 -15
- package/dist/cjs/types/components/Button/PropInterfaceButton.d.ts +2 -2
- 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/Dropdown/DropdownContNoAnchor.d.ts +14 -0
- package/dist/cjs/types/components/Forms/Dropdown/DropdownContainer.d.ts +7 -1
- package/dist/cjs/types/components/Forms/FormLabel.d.ts +18 -0
- package/dist/cjs/types/components/Forms/LiveSearch/PropsInterface.d.ts +1 -0
- package/dist/cjs/types/components/Forms/LiveSearch/index.d.ts +1 -1
- 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/index.d.ts +1 -0
- package/dist/cjs/types/stories/Button/Button.stories.d.ts +2 -2
- package/dist/cjs/types/stories/Form/Dropdown/DropdownContainer.stories.d.ts +6 -1
- package/dist/esm/index.js +365 -369
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Button/Button.d.ts +1 -15
- package/dist/esm/types/components/Button/PropInterfaceButton.d.ts +2 -2
- 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/Dropdown/DropdownContNoAnchor.d.ts +14 -0
- package/dist/esm/types/components/Forms/Dropdown/DropdownContainer.d.ts +7 -1
- package/dist/esm/types/components/Forms/FormLabel.d.ts +18 -0
- package/dist/esm/types/components/Forms/LiveSearch/PropsInterface.d.ts +1 -0
- package/dist/esm/types/components/Forms/LiveSearch/index.d.ts +1 -1
- 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/index.d.ts +1 -0
- package/dist/esm/types/stories/Button/Button.stories.d.ts +2 -2
- package/dist/esm/types/stories/Form/Dropdown/DropdownContainer.stories.d.ts +6 -1
- package/dist/index.d.ts +38 -22
- package/package.json +2 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
+
var reactDom = require('react-dom');
|
|
4
5
|
|
|
5
6
|
function Accordions(_a) {
|
|
6
7
|
var title = _a.title, content = _a.content;
|
|
@@ -273,12 +274,9 @@ var useDetectOutsideClick = function (ref, initialState, ignoreRef, event) {
|
|
|
273
274
|
// If the active element exists and is clicked outside of
|
|
274
275
|
if (ignoreRef &&
|
|
275
276
|
ignoreRef.current &&
|
|
276
|
-
ignoreRef.current.contains(event.target))
|
|
277
|
-
console.log('enter');
|
|
278
|
-
}
|
|
277
|
+
ignoreRef.current.contains(event.target)) ;
|
|
279
278
|
else if (ref.current !== null &&
|
|
280
279
|
!ref.current.contains(event.target)) {
|
|
281
|
-
console.log('close');
|
|
282
280
|
setIsActive(!isActive);
|
|
283
281
|
}
|
|
284
282
|
};
|
|
@@ -426,7 +424,7 @@ var radiusConfig$1 = {
|
|
|
426
424
|
tn: 'rounded-radius-full focus-visible:rounded-radius-full',
|
|
427
425
|
},
|
|
428
426
|
};
|
|
429
|
-
var sizeConfig$
|
|
427
|
+
var sizeConfig$d = {
|
|
430
428
|
lg: 'py-[10.5px] h-[48px] flex items-center justify-center gap-[10px] text-size-md ',
|
|
431
429
|
md: 'py-[9px] h-[40px] flex items-center justify-center gap-[5px] text-size-base ',
|
|
432
430
|
sm: 'py-[6px] h-[30px] flex items-center justify-center gap-[5px] text-size-sm ',
|
|
@@ -490,12 +488,12 @@ var variantUnion$1 = [
|
|
|
490
488
|
];
|
|
491
489
|
var radiusUnion = ['default', 'full-rounded'];
|
|
492
490
|
var sizeUnion$5 = ['md', 'lg', 'sm', 'tn'];
|
|
493
|
-
|
|
491
|
+
var Button = React.forwardRef(function (_a, ref) {
|
|
494
492
|
var label = _a.label, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.radius, radius = _d === void 0 ? 'default' : _d, _e = _a.size, size = _e === void 0 ? 'md' : _e, _f = _a.variant, variant = _f === void 0 ? 'default' : _f, _g = _a.iconLeft, iconLeft = _g === void 0 ? null : _g, _h = _a.iconRight, iconRight = _h === void 0 ? null : _h, _j = _a.left, left = _j === void 0 ? null : _j, _k = _a.right, right = _k === void 0 ? null : _k, minWidth = _a.minWidth, props = __rest(_a, ["label", "className", "disabled", "radius", "size", "variant", "iconLeft", "iconRight", "left", "right", "minWidth"]);
|
|
495
493
|
var validatedVariant = validUnion(variant, variantUnion$1);
|
|
496
494
|
var validatedSize = validUnion(size, sizeUnion$5);
|
|
497
495
|
var validatedRadius = validUnion(radius, radiusUnion);
|
|
498
|
-
var minWidthRules = minWidthConfig$1[
|
|
496
|
+
var minWidthRules = minWidthConfig$1[validatedSize];
|
|
499
497
|
if (minWidth !== undefined) {
|
|
500
498
|
minWidthRules = "min-w-[".concat(minWidth, "px]");
|
|
501
499
|
}
|
|
@@ -504,31 +502,31 @@ function Button(_a) {
|
|
|
504
502
|
}
|
|
505
503
|
var sizingRules;
|
|
506
504
|
if (variant.includes('link')) {
|
|
507
|
-
sizingRules = "".concat(sizeConfig$
|
|
505
|
+
sizingRules = "".concat(sizeConfig$d[validatedSize]);
|
|
508
506
|
}
|
|
509
507
|
else {
|
|
510
|
-
sizingRules = "".concat(sizeConfig$
|
|
508
|
+
sizingRules = "".concat(sizeConfig$d[validatedSize], " ").concat(sidePaddingConfig[validatedSize]);
|
|
511
509
|
}
|
|
512
510
|
var sizeClass = label || variant === 'form-group'
|
|
513
511
|
? " ".concat(minWidthRules, " ").concat(sizingRules)
|
|
514
512
|
: "".concat(iconOnlySizeConfig$1[validatedSize], " ").concat(variant.includes('link') ? '' : "".concat(sidePaddingConfig[validatedSize]));
|
|
515
|
-
var classString = "\n ".concat(variantConfig$2[validatedVariant], "
|
|
516
|
-
return (React.createElement("button", __assign({ type: "button", className: "bianic-button bianic-fgc-target flex items-center justify-center font-semibold ".concat(classString), disabled: disabled }, props),
|
|
513
|
+
var classString = "\n ".concat(variantConfig$2[validatedVariant], "\n ").concat(sizeClass, "\n ").concat(radiusConfig$1[validatedRadius][validatedSize], "\n ").concat(className, "\n ");
|
|
514
|
+
return (React.createElement("button", __assign({ ref: ref, type: "button", className: "bianic-button bianic-fgc-target flex items-center justify-center font-semibold ".concat(classString), disabled: disabled }, props),
|
|
517
515
|
childrenElement(iconLeft || left),
|
|
518
516
|
childrenElement(label),
|
|
519
517
|
childrenElement(iconRight || right)));
|
|
520
|
-
}
|
|
518
|
+
});
|
|
521
519
|
Button.defaultProps = {
|
|
522
|
-
label:
|
|
520
|
+
label: undefined,
|
|
523
521
|
className: '',
|
|
524
522
|
disabled: false,
|
|
525
523
|
radius: 'default',
|
|
526
524
|
size: 'md',
|
|
527
525
|
variant: 'default',
|
|
528
|
-
iconLeft:
|
|
529
|
-
iconRight:
|
|
530
|
-
left:
|
|
531
|
-
right:
|
|
526
|
+
iconLeft: undefined,
|
|
527
|
+
iconRight: undefined,
|
|
528
|
+
left: undefined,
|
|
529
|
+
right: undefined,
|
|
532
530
|
};
|
|
533
531
|
|
|
534
532
|
var AvatarConfig = {
|
|
@@ -1489,7 +1487,7 @@ Breadcrumb.defaultProps = {
|
|
|
1489
1487
|
selected: false,
|
|
1490
1488
|
};
|
|
1491
1489
|
|
|
1492
|
-
var colorConfig$
|
|
1490
|
+
var colorConfig$2 = {
|
|
1493
1491
|
green: {
|
|
1494
1492
|
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
1493
|
active: 'bg-bia-verdantgreen-dark-40 text-primary-white',
|
|
@@ -1503,7 +1501,7 @@ var colorConfig$1 = {
|
|
|
1503
1501
|
var ButtonApp = function (_a) {
|
|
1504
1502
|
_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
1503
|
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$
|
|
1504
|
+
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
1505
|
};
|
|
1508
1506
|
|
|
1509
1507
|
var textColorConfig = {
|
|
@@ -1793,7 +1791,147 @@ MenuItem.defaultProps = {
|
|
|
1793
1791
|
onClick: function () { },
|
|
1794
1792
|
};
|
|
1795
1793
|
|
|
1796
|
-
var
|
|
1794
|
+
var classConfig$1 = {
|
|
1795
|
+
top: {
|
|
1796
|
+
tooltipContainer: 'bottom-[calc(100%+5px)] left-1/2 -translate-x-1/2',
|
|
1797
|
+
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
1798
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
1799
|
+
},
|
|
1800
|
+
right: {
|
|
1801
|
+
tooltipContainer: 'left-[calc(100%+5px)] top-1/2 -translate-y-1/2',
|
|
1802
|
+
triangleContainer: '-left-[4px] bottom-0 flex items-center w-auto h-full',
|
|
1803
|
+
triangleShape: 'border-t-[8px] border-t-transparent border-r-[5px] border-r-primary-black border-b-[8px] border-b-transparent',
|
|
1804
|
+
},
|
|
1805
|
+
bottom: {
|
|
1806
|
+
tooltipContainer: 'top-[calc(100%+5px)] left-1/2 -translate-x-1/2',
|
|
1807
|
+
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
1808
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
1809
|
+
},
|
|
1810
|
+
left: {
|
|
1811
|
+
tooltipContainer: 'right-[calc(100%+5px)] top-1/2 -translate-y-1/2',
|
|
1812
|
+
triangleContainer: '-right-[4px] bottom-0 flex items-center w-auto h-full',
|
|
1813
|
+
triangleShape: 'border-t-[8px] border-t-transparent border-l-[5px] border-l-primary-black border-b-[8px] border-b-transparent',
|
|
1814
|
+
},
|
|
1815
|
+
'top-right': {
|
|
1816
|
+
tooltipContainer: 'bottom-[calc(100%+5px)] right-0',
|
|
1817
|
+
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
1818
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
1819
|
+
},
|
|
1820
|
+
'top-left': {
|
|
1821
|
+
tooltipContainer: 'bottom-[calc(100%+5px)] left-0',
|
|
1822
|
+
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
1823
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
1824
|
+
},
|
|
1825
|
+
'bottom-right': {
|
|
1826
|
+
tooltipContainer: 'top-[calc(100%+5px)] right-0',
|
|
1827
|
+
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
1828
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
1829
|
+
},
|
|
1830
|
+
'bottom-left': {
|
|
1831
|
+
tooltipContainer: 'top-[calc(100%+5px)] left-0',
|
|
1832
|
+
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
1833
|
+
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
1834
|
+
},
|
|
1835
|
+
};
|
|
1836
|
+
|
|
1837
|
+
function Tooltip(props) {
|
|
1838
|
+
var children = props.children, content = props.content, delay = props.delay, _a = props.direction, direction = _a === void 0 ? 'top' : _a, _b = props.maxWidth, maxWidth = _b === void 0 ? undefined : _b;
|
|
1839
|
+
var timeout;
|
|
1840
|
+
var _c = React.useState(false), active = _c[0], setActive = _c[1];
|
|
1841
|
+
var showTip = function () {
|
|
1842
|
+
timeout = setTimeout(function () {
|
|
1843
|
+
setActive(true);
|
|
1844
|
+
}, delay || 400);
|
|
1845
|
+
};
|
|
1846
|
+
var hideTip = function () {
|
|
1847
|
+
clearInterval(timeout);
|
|
1848
|
+
setActive(false);
|
|
1849
|
+
};
|
|
1850
|
+
var _d = classConfig$1[direction], tooltipContainer = _d.tooltipContainer; _d.triangleContainer; _d.triangleShape;
|
|
1851
|
+
var tooltipContainerRef = React.useRef(null);
|
|
1852
|
+
var _e = React.useState({
|
|
1853
|
+
maxWidth: maxWidth + 'px',
|
|
1854
|
+
whiteSpace: 'nowrap',
|
|
1855
|
+
}), tooltipContainerStyle = _e[0], setTooltipContainerStyle = _e[1];
|
|
1856
|
+
var tooltipContainerElement = tooltipContainerRef === null || tooltipContainerRef === void 0 ? void 0 : tooltipContainerRef.current;
|
|
1857
|
+
var scrollWidth = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.scrollWidth; // Mendapatkan lebar konten aktual
|
|
1858
|
+
var offsetWidth = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.offsetWidth;
|
|
1859
|
+
var offsetHeight = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.offsetHeight;
|
|
1860
|
+
React.useEffect(function () {
|
|
1861
|
+
if (scrollWidth && offsetWidth) {
|
|
1862
|
+
var maxWidthNumber = Number(maxWidth);
|
|
1863
|
+
var isMultiLine = offsetHeight > 23; // 23 pixels is the approximate height of one line of text
|
|
1864
|
+
// Tooltip Width and Whitespace Determination Rules:
|
|
1865
|
+
// 1. Default Condition:
|
|
1866
|
+
// - width: fit-content
|
|
1867
|
+
// - whiteSpace: nowrap
|
|
1868
|
+
// 2. When maxWidth is Set:
|
|
1869
|
+
// * Text Exceeds maxWidth:
|
|
1870
|
+
// - width: maxWidth
|
|
1871
|
+
// - whiteSpace: normal
|
|
1872
|
+
// * Text Equals maxWidth (Multi-line):
|
|
1873
|
+
// - width: maxWidth
|
|
1874
|
+
// - whiteSpace: normal
|
|
1875
|
+
// * Text Less Than maxWidth:
|
|
1876
|
+
// - width: fit-content
|
|
1877
|
+
// - whiteSpace: nowrap
|
|
1878
|
+
var newWidth_1 = 'fit-content';
|
|
1879
|
+
var newWhiteSpace_1 = 'nowrap';
|
|
1880
|
+
if (scrollWidth > maxWidthNumber ||
|
|
1881
|
+
(offsetWidth === maxWidthNumber && isMultiLine)) {
|
|
1882
|
+
newWidth_1 = maxWidthNumber + 'px';
|
|
1883
|
+
newWhiteSpace_1 = 'normal';
|
|
1884
|
+
}
|
|
1885
|
+
setTooltipContainerStyle(function (prev) { return (__assign(__assign({}, prev), { width: newWidth_1, whiteSpace: newWhiteSpace_1 })); });
|
|
1886
|
+
}
|
|
1887
|
+
}, [content, maxWidth, scrollWidth, offsetHeight]);
|
|
1888
|
+
return (React.createElement("div", { className: "tooltip-wrapper relative inline-flex h-fit w-fit flex-col", onMouseEnter: showTip, onMouseLeave: hideTip },
|
|
1889
|
+
children,
|
|
1890
|
+
active && (React.createElement("div", { className: "tooltip-container break-word absolute z-50 inline-block break-all rounded-[4px] bg-primary-black px-[7px] py-[4px] text-size-sm text-primary-white ".concat(tooltipContainer), style: tooltipContainerStyle, ref: tooltipContainerRef }, content))));
|
|
1891
|
+
}
|
|
1892
|
+
Tooltip.defaultProps = {
|
|
1893
|
+
delay: 400,
|
|
1894
|
+
direction: 'top',
|
|
1895
|
+
maxWidth: '300',
|
|
1896
|
+
};
|
|
1897
|
+
Tooltip.defaultProps = {};
|
|
1898
|
+
|
|
1899
|
+
var FormLabel = function (_a) {
|
|
1900
|
+
var children = _a.children, className = _a.className, htmlFor = _a.htmlFor, readOnly = _a.readOnly, required = _a.required;
|
|
1901
|
+
var labelClass = readOnly ? 'pointer-events-none' : '';
|
|
1902
|
+
return (React.createElement(Tooltip, { content: "Required", delay: 2000, direction: "right" },
|
|
1903
|
+
React.createElement("label", { htmlFor: htmlFor, className: "bianic-form-label group/formlabel text-xs font-semibold ".concat(labelClass, " ").concat(className) },
|
|
1904
|
+
children,
|
|
1905
|
+
required && (React.createElement("span", { className: "p-1 text-bia-coolgrey group-hover/form:text-bia-red group-hover/formlabel:text-bia-red" }, "*")))));
|
|
1906
|
+
};
|
|
1907
|
+
FormLabel.defaultProps = {
|
|
1908
|
+
className: '',
|
|
1909
|
+
htmlFor: undefined,
|
|
1910
|
+
required: false,
|
|
1911
|
+
readOnly: false,
|
|
1912
|
+
};
|
|
1913
|
+
|
|
1914
|
+
function PasswordIcon(_a) {
|
|
1915
|
+
var isShow = _a.isShow, _b = _a.showHandler, showHandler = _b === void 0 ? function () { } : _b, iconSize = _a.iconSize, disabled = _a.disabled;
|
|
1916
|
+
var iconColor = disabled ? '#8b8ba6' : '#5E5EEA';
|
|
1917
|
+
if (isShow) {
|
|
1918
|
+
return (React.createElement(TbEye, { onClick: function () { return showHandler(false); }, style: {
|
|
1919
|
+
fontSize: iconSize,
|
|
1920
|
+
color: iconColor,
|
|
1921
|
+
} }));
|
|
1922
|
+
}
|
|
1923
|
+
return (React.createElement(TbEyeOff, { onClick: function () { return showHandler(true); }, style: { fontSize: iconSize, color: iconColor } }));
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
function ValidationIcon(_a) {
|
|
1927
|
+
var isValid = _a.isValid, iconSize = _a.iconSize;
|
|
1928
|
+
if (isValid) {
|
|
1929
|
+
return (React.createElement(TbCheck, { className: "text-bia-green", style: { fontSize: iconSize } }));
|
|
1930
|
+
}
|
|
1931
|
+
return React.createElement(TbX, { className: "text-bia-red", style: { fontSize: iconSize } });
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
var sizeConfig$c = {
|
|
1797
1935
|
md: {
|
|
1798
1936
|
fieldSize: 'text-size-base p-2.5 font-[350] h-10',
|
|
1799
1937
|
iconPosition: 'right-[10px]',
|
|
@@ -1828,34 +1966,14 @@ var styleConfig = {
|
|
|
1828
1966
|
},
|
|
1829
1967
|
};
|
|
1830
1968
|
|
|
1831
|
-
function ValidationIcon(_a) {
|
|
1832
|
-
var isValid = _a.isValid, iconSize = _a.iconSize;
|
|
1833
|
-
if (isValid) {
|
|
1834
|
-
return (React.createElement(TbCheck, { className: "text-bia-green", style: { fontSize: iconSize } }));
|
|
1835
|
-
}
|
|
1836
|
-
return React.createElement(TbX, { className: "text-bia-red", style: { fontSize: iconSize } });
|
|
1837
|
-
}
|
|
1838
|
-
|
|
1839
|
-
function PasswordIcon(_a) {
|
|
1840
|
-
var isShow = _a.isShow, _b = _a.showHandler, showHandler = _b === void 0 ? function () { } : _b, iconSize = _a.iconSize, disabled = _a.disabled;
|
|
1841
|
-
var iconColor = disabled ? '#8b8ba6' : '#5E5EEA';
|
|
1842
|
-
if (isShow) {
|
|
1843
|
-
return (React.createElement(TbEye, { onClick: function () { return showHandler(false); }, style: {
|
|
1844
|
-
fontSize: iconSize,
|
|
1845
|
-
color: iconColor,
|
|
1846
|
-
} }));
|
|
1847
|
-
}
|
|
1848
|
-
return (React.createElement(TbEyeOff, { onClick: function () { return showHandler(true); }, style: { fontSize: iconSize, color: iconColor } }));
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
1969
|
function TextInput(_a) {
|
|
1852
1970
|
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"]);
|
|
1853
1971
|
var isTransparent = variant.includes('transparent');
|
|
1854
1972
|
var _r = React.useState(false), isShow = _r[0], setIsShow = _r[1];
|
|
1855
1973
|
var _s = styleConfig[variant], fieldStyle = _s.fieldStyle, iconStyle = _s.iconStyle;
|
|
1856
1974
|
var _t = isTransparent
|
|
1857
|
-
? __assign(__assign({}, sizeConfig$
|
|
1858
|
-
" pe-[".concat(9 + sizeConfig$
|
|
1975
|
+
? __assign(__assign({}, sizeConfig$c[size]), { iconPosition: "right-0 ", fieldSize: sizeConfig$c[size].fieldSize +
|
|
1976
|
+
" pe-[".concat(9 + sizeConfig$c[size].iconSize, "px]") }) : sizeConfig$c[size], iconSize = _t.iconSize, fieldSize = _t.fieldSize, iconPosition = _t.iconPosition;
|
|
1859
1977
|
var borderStyle = isTransparent
|
|
1860
1978
|
? 'border-transparent bg-transparent' // customize border rule for transparent variant
|
|
1861
1979
|
: 'border border-bia-grey-dark-10 bg-primary-white';
|
|
@@ -1888,11 +2006,8 @@ function TextInput(_a) {
|
|
|
1888
2006
|
if (variant === 'date')
|
|
1889
2007
|
iconElement = React.createElement(TbCalendar, { className: "text-bia-coolgrey", size: 18 });
|
|
1890
2008
|
var extendedInputClassName = "".concat(fieldStyle, " ").concat(fieldSize, " ").concat(bottomBorderColor, " ").concat(inputClassName, " ").concat(borderStyle);
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
label && (React.createElement("label", { htmlFor: id, className: "bianic-text-input-label text-xs font-semibold ".concat(labelStatus) },
|
|
1894
|
-
label,
|
|
1895
|
-
required && React.createElement("span", { className: "p-1 text-bia-red" }, "*"))),
|
|
2009
|
+
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" },
|
|
2010
|
+
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
1896
2011
|
React.createElement("div", { className: "relative w-full" },
|
|
1897
2012
|
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)),
|
|
1898
2013
|
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(actionElement ? '' : iconStyle, " ").concat(iconPosition, " ").concat(iconSizing) }, iconElement)),
|
|
@@ -1921,7 +2036,7 @@ TextInput.defaultProps = {
|
|
|
1921
2036
|
};
|
|
1922
2037
|
|
|
1923
2038
|
// Desc: Radio button size configuration
|
|
1924
|
-
var sizeConfig$
|
|
2039
|
+
var sizeConfig$b = {
|
|
1925
2040
|
md: {
|
|
1926
2041
|
checkSize: 'w-[22px] h-[22px]',
|
|
1927
2042
|
labelSize: 'text-size-base',
|
|
@@ -1936,7 +2051,7 @@ var sizeUnion$4 = ['md', 'sm'];
|
|
|
1936
2051
|
function Radio(_a) {
|
|
1937
2052
|
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;
|
|
1938
2053
|
var validatedSize = validUnion(size, sizeUnion$4);
|
|
1939
|
-
var _f = sizeConfig$
|
|
2054
|
+
var _f = sizeConfig$b[validatedSize], checkSize = _f.checkSize, labelSize = _f.labelSize;
|
|
1940
2055
|
return (React.createElement("div", { className: "flex items-center" },
|
|
1941
2056
|
React.createElement("div", { className: "bg-white rounded-full flex flex-shrink-0 justify-center items-center relative ".concat(checkSize) },
|
|
1942
2057
|
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 }),
|
|
@@ -1952,15 +2067,6 @@ Radio.defaultProps = {
|
|
|
1952
2067
|
checked: false,
|
|
1953
2068
|
};
|
|
1954
2069
|
|
|
1955
|
-
var sizeConfig$9 = {
|
|
1956
|
-
md: {
|
|
1957
|
-
inputClass: 'text-size-base font-[350] min-h-10',
|
|
1958
|
-
},
|
|
1959
|
-
sm: {
|
|
1960
|
-
inputClass: 'text-size-sm min-h-[30px]',
|
|
1961
|
-
},
|
|
1962
|
-
};
|
|
1963
|
-
|
|
1964
2070
|
var ResizeIcon = function (_a) {
|
|
1965
2071
|
var className = _a.className;
|
|
1966
2072
|
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) },
|
|
@@ -1972,16 +2078,23 @@ var ResizeIcon = function (_a) {
|
|
|
1972
2078
|
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" })));
|
|
1973
2079
|
};
|
|
1974
2080
|
|
|
2081
|
+
var sizeConfig$a = {
|
|
2082
|
+
md: {
|
|
2083
|
+
inputClass: 'text-size-base font-[350] min-h-10',
|
|
2084
|
+
},
|
|
2085
|
+
sm: {
|
|
2086
|
+
inputClass: 'text-size-sm min-h-[30px]',
|
|
2087
|
+
},
|
|
2088
|
+
};
|
|
2089
|
+
|
|
1975
2090
|
function TextArea(_a) {
|
|
1976
2091
|
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"]);
|
|
1977
2092
|
var inputRow = rows !== null && rows !== void 0 ? rows : 4;
|
|
1978
|
-
var inputClass = sizeConfig$
|
|
2093
|
+
var inputClass = sizeConfig$a[size].inputClass;
|
|
1979
2094
|
var remainWords = maxLength ? maxLength - (value ? value.length : 0) : 0;
|
|
1980
|
-
return (React.createElement("div", { className: "field-group flex w-full flex-col" },
|
|
1981
|
-
React.createElement(
|
|
1982
|
-
|
|
1983
|
-
required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
|
|
1984
|
-
React.createElement("div", { className: "relative h-full w-full min-w-[250px]" },
|
|
2095
|
+
return (React.createElement("div", { className: "field-group group/form flex w-full flex-col gap-y-2" },
|
|
2096
|
+
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
2097
|
+
React.createElement("div", { className: "relative h-fit w-full min-w-[250px]" },
|
|
1985
2098
|
React.createElement(ResizeIcon, { className: "absolute bottom-[11px] right-[5px]" }),
|
|
1986
2099
|
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))),
|
|
1987
2100
|
React.createElement("div", { className: "desc flex justify-between gap-1 text-xs text-primary-cool" },
|
|
@@ -2005,7 +2118,7 @@ TextArea.defaultProps = {
|
|
|
2005
2118
|
value: '',
|
|
2006
2119
|
};
|
|
2007
2120
|
|
|
2008
|
-
var sizeConfig$
|
|
2121
|
+
var sizeConfig$9 = {
|
|
2009
2122
|
md: {
|
|
2010
2123
|
checkClass: 'w-[22px] h-[22px]',
|
|
2011
2124
|
labelClass: 'text-size-base font-[350]',
|
|
@@ -2019,7 +2132,7 @@ var sizeConfig$8 = {
|
|
|
2019
2132
|
var sizeUnion$3 = ['md', 'sm'];
|
|
2020
2133
|
function Checkbox(_a) {
|
|
2021
2134
|
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"]);
|
|
2022
|
-
var _e = sizeConfig$
|
|
2135
|
+
var _e = sizeConfig$9[validUnion(size, sizeUnion$3)], checkClass = _e.checkClass, labelClass = _e.labelClass;
|
|
2023
2136
|
return (React.createElement("div", { className: "flex items-center" },
|
|
2024
2137
|
React.createElement("div", { className: "relative flex flex-shrink-0 items-center justify-center rounded-full bg-white ".concat(checkClass) },
|
|
2025
2138
|
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)),
|
|
@@ -2037,7 +2150,7 @@ Checkbox.defaultProps = {
|
|
|
2037
2150
|
onChange: function () { },
|
|
2038
2151
|
};
|
|
2039
2152
|
|
|
2040
|
-
var sizeConfig$
|
|
2153
|
+
var sizeConfig$8 = {
|
|
2041
2154
|
md: {
|
|
2042
2155
|
searchSize: 'text-size-base p-2.5 font-[350] h-10',
|
|
2043
2156
|
iconSize: 'right-[10px] text-[18px]',
|
|
@@ -2048,7 +2161,7 @@ var sizeConfig$7 = {
|
|
|
2048
2161
|
},
|
|
2049
2162
|
};
|
|
2050
2163
|
|
|
2051
|
-
var sizeConfig$
|
|
2164
|
+
var sizeConfig$7 = {
|
|
2052
2165
|
md: {
|
|
2053
2166
|
container: 'text-size-base font-[350] py-[3px] first:pt-[8px] last:pb-[8px]',
|
|
2054
2167
|
item: 'min-h-[34px] p-2.5',
|
|
@@ -2066,7 +2179,7 @@ function CustomDropdownItem(_a) {
|
|
|
2066
2179
|
var _f = React.useState(false), isHoveredSubMenu = _f[0], setIsHoveredSubMenu = _f[1];
|
|
2067
2180
|
var isOpenDropdown = isHovered || isHoveredSubMenu;
|
|
2068
2181
|
var selectedClass = isSelected ? 'font-semibold' : 'font-normal';
|
|
2069
|
-
var _g = sizeConfig$
|
|
2182
|
+
var _g = sizeConfig$7[size], containerClass = _g.container, item = _g.item;
|
|
2070
2183
|
var itemClass = "".concat(item, " ").concat(selectedClass, " ").concat(className);
|
|
2071
2184
|
var isExistSubDropdown = options.length !== 0;
|
|
2072
2185
|
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 () { } },
|
|
@@ -2093,7 +2206,7 @@ function DefaultDropdownItem(_a) {
|
|
|
2093
2206
|
var _g = React.useState(false), isHoveredSubMenu = _g[0], setIsHoveredSubMenu = _g[1];
|
|
2094
2207
|
var isOpenDropdown = isHovered || isHoveredSubMenu;
|
|
2095
2208
|
var selectedClass = isSelected ? 'font-semibold' : 'font-normal';
|
|
2096
|
-
var _h = sizeConfig$
|
|
2209
|
+
var _h = sizeConfig$7[size], containerClass = _h.container, item = _h.item;
|
|
2097
2210
|
var itemClass = "".concat(item, " ").concat(selectedClass, " ").concat(className);
|
|
2098
2211
|
var isExistSubDropdown = options.length !== 0;
|
|
2099
2212
|
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 () { } },
|
|
@@ -2128,7 +2241,77 @@ var fontConfig = {
|
|
|
2128
2241
|
md: 'text-[14px] font-[350]',
|
|
2129
2242
|
};
|
|
2130
2243
|
|
|
2131
|
-
var
|
|
2244
|
+
var getDropdownStyle = function (anchorRef, dropdownRef) {
|
|
2245
|
+
if (!anchorRef.current || !dropdownRef.current) {
|
|
2246
|
+
return { minWidth: 'auto' };
|
|
2247
|
+
}
|
|
2248
|
+
var anchorRect = anchorRef.current.getBoundingClientRect();
|
|
2249
|
+
var dropdownHeight = dropdownRef.current.offsetHeight;
|
|
2250
|
+
var spaceToBottom = window.innerHeight - anchorRect.bottom;
|
|
2251
|
+
var spaceToTop = anchorRect.top;
|
|
2252
|
+
var style = {
|
|
2253
|
+
left: "".concat(anchorRect.left + window.scrollX, "px"),
|
|
2254
|
+
minWidth: "".concat(anchorRect.width, "px"),
|
|
2255
|
+
};
|
|
2256
|
+
// If space below is less than dropdown height,
|
|
2257
|
+
// AND space above is more than space below
|
|
2258
|
+
// then flip up
|
|
2259
|
+
if (spaceToBottom < dropdownHeight && spaceToTop > spaceToBottom) {
|
|
2260
|
+
var topPositionForFlip = anchorRect.top + window.scrollY - dropdownHeight;
|
|
2261
|
+
style.top = "".concat(topPositionForFlip, "px");
|
|
2262
|
+
}
|
|
2263
|
+
else {
|
|
2264
|
+
style.top = "".concat(anchorRect.bottom + window.scrollY, "px");
|
|
2265
|
+
}
|
|
2266
|
+
return style;
|
|
2267
|
+
};
|
|
2268
|
+
var DropdownContainer = function (propsComp) {
|
|
2269
|
+
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"]);
|
|
2270
|
+
if (!open)
|
|
2271
|
+
return null;
|
|
2272
|
+
var _j = React.useState({ minWidth: 'auto' }), positionStyle = _j[0], setPositionStyle = _j[1];
|
|
2273
|
+
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
2274
|
+
var sizeClass = containerSizeConfig[size] || containerSizeConfig['md'];
|
|
2275
|
+
var containerClass = "".concat(sizeClass, " ").concat(radiusClass, " ").concat(className);
|
|
2276
|
+
var dropdownRef = React.useRef(null);
|
|
2277
|
+
var handleClickDrpdownItem = function (e, val) {
|
|
2278
|
+
onClickItem(e, val);
|
|
2279
|
+
onClose();
|
|
2280
|
+
};
|
|
2281
|
+
React.useLayoutEffect(function () {
|
|
2282
|
+
if (!(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current))
|
|
2283
|
+
return;
|
|
2284
|
+
var newStyle = getDropdownStyle(anchorRef, dropdownRef);
|
|
2285
|
+
setPositionStyle(newStyle);
|
|
2286
|
+
var handleScrollOrResize = function () {
|
|
2287
|
+
setPositionStyle(getDropdownStyle(anchorRef, dropdownRef));
|
|
2288
|
+
};
|
|
2289
|
+
window.addEventListener('scroll', handleScrollOrResize);
|
|
2290
|
+
window.addEventListener('resize', handleScrollOrResize);
|
|
2291
|
+
return function () {
|
|
2292
|
+
window.removeEventListener('scroll', handleScrollOrResize);
|
|
2293
|
+
window.removeEventListener('resize', handleScrollOrResize);
|
|
2294
|
+
};
|
|
2295
|
+
}, [anchorRef]);
|
|
2296
|
+
return (React.createElement(React.Fragment, null,
|
|
2297
|
+
isWithOverlay && (React.createElement("div", { className: "bianic-dropdown-overlay fixed left-0 top-0 h-screen w-screen", style: { zIndex: zIndex }, onClick: function () { return onClose(); } })),
|
|
2298
|
+
reactDom.createPortal(React.createElement("div", __assign({ ref: dropdownRef, className: "absolute 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) {
|
|
2299
|
+
return React.isValidElement(child)
|
|
2300
|
+
? // Kirimkan handleItemClick sebagai props onClick ke setiap DropdownItem
|
|
2301
|
+
React.cloneElement(child, {
|
|
2302
|
+
onClose: function () { return onClose(); },
|
|
2303
|
+
size: size,
|
|
2304
|
+
onClickItem: function (e, val) { return handleClickDrpdownItem(e, val); },
|
|
2305
|
+
zIndex: zIndex + 10,
|
|
2306
|
+
})
|
|
2307
|
+
: child;
|
|
2308
|
+
})), document.body)));
|
|
2309
|
+
};
|
|
2310
|
+
DropdownContainer.defaultProps = {
|
|
2311
|
+
isTopFlat: false,
|
|
2312
|
+
};
|
|
2313
|
+
|
|
2314
|
+
var DropdownContNoAnchor = React.forwardRef(function DropdownContNoAnchor(propsComp, ref) {
|
|
2132
2315
|
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, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "size", "onClickItem", "zIndex"]);
|
|
2133
2316
|
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
2134
2317
|
var sizeClass = containerSizeConfig[size] || containerSizeConfig['md'];
|
|
@@ -2153,7 +2336,7 @@ var DropdownContainer = React.forwardRef(function DropdownContainer(propsComp, r
|
|
|
2153
2336
|
: child;
|
|
2154
2337
|
})))));
|
|
2155
2338
|
});
|
|
2156
|
-
|
|
2339
|
+
DropdownContNoAnchor.defaultProps = {
|
|
2157
2340
|
isTopFlat: false,
|
|
2158
2341
|
};
|
|
2159
2342
|
|
|
@@ -2191,7 +2374,7 @@ function DropdownItem(_a) {
|
|
|
2191
2374
|
}, onKeyDown: function () { }, disabled: disabled, type: "button" }, props),
|
|
2192
2375
|
content,
|
|
2193
2376
|
React.createElement("div", { className: "ml-auto flex items-center" }, children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey", size: chevronSize })))),
|
|
2194
|
-
children && (React.createElement(
|
|
2377
|
+
children && (React.createElement(DropdownContNoAnchor, { 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), onClose: onClose, open: isHovered, onClickItem: function (e, value) { return onClickItem(e, value); }, size: size, ref: DropdownContRef, zIndex: currentZIndex + 10 }, children))));
|
|
2195
2378
|
}
|
|
2196
2379
|
DropdownItem.defaultProps = {
|
|
2197
2380
|
className: '',
|
|
@@ -2202,11 +2385,9 @@ var sizeUnion$2 = ['md', 'sm'];
|
|
|
2202
2385
|
function SelectInput(_a) {
|
|
2203
2386
|
var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, id = _a.id, label = _a.label, _d = _a.options, options = _d === void 0 ? [] : _d, _e = _a.required, required = _e === void 0 ? false : _e, selected = _a.selected, setSelected = _a.setSelected, _f = _a.onClickDropdown, onClickDropdown = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.dropContProps, _h = _g === void 0 ? {} : _g, _j = _h.className, dropContClassName = _j === void 0 ? '' : _j, restDropContProps = __rest(_h, ["className"]), props = __rest(_a, ["descText", "disabled", "size", "id", "label", "options", "required", "selected", "setSelected", "onClickDropdown", "children", "dropContProps"]);
|
|
2204
2387
|
var _k = React.useState(false), isOpen = _k[0], setIsOpen = _k[1];
|
|
2205
|
-
var _l = React.useState(false), isDropUp = _l[0], setIsDropUp = _l[1];
|
|
2206
2388
|
var validatedSize = validUnion(size, sizeUnion$2);
|
|
2207
|
-
var
|
|
2389
|
+
var _l = sizeConfig$8[validatedSize], searchSize = _l.searchSize, iconSize = _l.iconSize;
|
|
2208
2390
|
var inputRef = React.useRef(null);
|
|
2209
|
-
var dropdownContRef = React.useRef(null);
|
|
2210
2391
|
var handleOutsideClick = function (e) {
|
|
2211
2392
|
if (inputRef.current && !inputRef.current.contains(e.target)) {
|
|
2212
2393
|
setIsOpen(false);
|
|
@@ -2218,22 +2399,6 @@ function SelectInput(_a) {
|
|
|
2218
2399
|
document.removeEventListener('mousedown', handleOutsideClick);
|
|
2219
2400
|
};
|
|
2220
2401
|
});
|
|
2221
|
-
React.useEffect(function () {
|
|
2222
|
-
var _a, _b;
|
|
2223
|
-
if (inputRef.current) {
|
|
2224
|
-
// Adjust dropdown position to prevent show up out of screen
|
|
2225
|
-
var windowHeight = window.innerHeight;
|
|
2226
|
-
var inputRect = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
2227
|
-
var inputBottom = inputRect === null || inputRect === void 0 ? void 0 : inputRect.bottom;
|
|
2228
|
-
var diff = windowHeight - inputBottom;
|
|
2229
|
-
var dropdownRect = (_b = dropdownContRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
2230
|
-
var dropdownHeight = (dropdownRect === null || dropdownRect === void 0 ? void 0 : dropdownRect.height) || 0;
|
|
2231
|
-
if (dropdownHeight >= diff)
|
|
2232
|
-
setIsDropUp(true);
|
|
2233
|
-
else
|
|
2234
|
-
setIsDropUp(false);
|
|
2235
|
-
}
|
|
2236
|
-
}, [isOpen]);
|
|
2237
2402
|
var isObjectOptionItem = false;
|
|
2238
2403
|
if (options.every(function (item) { return typeof item === 'object' && item !== null; }))
|
|
2239
2404
|
isObjectOptionItem = true;
|
|
@@ -2253,7 +2418,6 @@ function SelectInput(_a) {
|
|
|
2253
2418
|
optionsElement.style.maxHeight = "".concat(Math.max(0, maxHeight), "px");
|
|
2254
2419
|
}
|
|
2255
2420
|
}, [isOpen]);
|
|
2256
|
-
var dropdownPosition = isDropUp ? 'bottom-full' : 'top-full';
|
|
2257
2421
|
return (React.createElement("div", { className: "field-group flex w-full flex-col", ref: inputRef },
|
|
2258
2422
|
React.createElement("label", { htmlFor: id, className: "label pb-2 text-xs font-semibold" },
|
|
2259
2423
|
childrenElement(label),
|
|
@@ -2273,7 +2437,7 @@ function SelectInput(_a) {
|
|
|
2273
2437
|
setIsOpen(false);
|
|
2274
2438
|
} }));
|
|
2275
2439
|
}))),
|
|
2276
|
-
children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true,
|
|
2440
|
+
children && isOpen && (React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, anchorRef: inputRef, className: "bianic-livesearch-dropdown absolute z-10 mt-1 w-full overflow-hidden rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none ".concat(dropContClassName) }, restDropContProps), React.Children.map(children, function (child) {
|
|
2277
2441
|
if (React.isValidElement(child)) {
|
|
2278
2442
|
return React.cloneElement(child, {
|
|
2279
2443
|
isSelected: selected && selected.id === child.props.value.id,
|
|
@@ -2298,7 +2462,7 @@ SelectInput.defaultProps = {
|
|
|
2298
2462
|
setSelected: function () { },
|
|
2299
2463
|
};
|
|
2300
2464
|
|
|
2301
|
-
var sizeConfig$
|
|
2465
|
+
var sizeConfig$6 = {
|
|
2302
2466
|
md: {
|
|
2303
2467
|
iconClass: 'right-[10px]',
|
|
2304
2468
|
iconSize: '18',
|
|
@@ -2313,16 +2477,29 @@ var sizeConfig$5 = {
|
|
|
2313
2477
|
},
|
|
2314
2478
|
};
|
|
2315
2479
|
|
|
2480
|
+
var matchSearchTerm = function (content, term, variant) {
|
|
2481
|
+
var lowerContent = content.toLowerCase();
|
|
2482
|
+
var lowerTerm = term.toLowerCase();
|
|
2483
|
+
switch (variant) {
|
|
2484
|
+
case 'startsWith':
|
|
2485
|
+
return lowerContent.startsWith(lowerTerm);
|
|
2486
|
+
case 'endsWith':
|
|
2487
|
+
return lowerContent.endsWith(lowerTerm);
|
|
2488
|
+
case 'include':
|
|
2489
|
+
return lowerContent.includes(lowerTerm);
|
|
2490
|
+
default:
|
|
2491
|
+
return lowerContent.includes(lowerTerm);
|
|
2492
|
+
}
|
|
2493
|
+
};
|
|
2316
2494
|
function LiveSearch(_a) {
|
|
2317
|
-
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;
|
|
2318
|
-
var
|
|
2319
|
-
var
|
|
2320
|
-
var
|
|
2495
|
+
var descText = _a.descText, _b = _a.disabled, disabled = _b === void 0 ? false : _b, id = _a.id, _c = _a.size, size = _c === void 0 ? 'md' : _c, label = _a.label, placeholder = _a.placeholder, _d = _a.required, required = _d === void 0 ? false : _d, options = _a.options, setValue = _a.setValue, value = _a.value, _e = _a.readOnly, readOnly = _e === void 0 ? false : _e, _f = _a.onChangeText, onChangeText = _f === void 0 ? function () { } : _f, _g = _a.onClickDropdown, onClickDropdown = _g === void 0 ? function () { } : _g, _h = _a.autoComplete, autoComplete = _h === void 0 ? 'off' : _h, _j = _a.children, children = _j === void 0 ? undefined : _j, _k = _a.dropContProps, dropContProps = _k === void 0 ? { className: undefined } : _k, _l = _a.searchVariant, searchVariant = _l === void 0 ? 'include' : _l;
|
|
2496
|
+
var _m = React.useState(false), isOpen = _m[0], setIsOpen = _m[1];
|
|
2497
|
+
var _o = React.useState(value.label || ''), searchTerm = _o[0], setSearchTerm = _o[1];
|
|
2498
|
+
var _p = sizeConfig$6[size], iconClass = _p.iconClass, iconSize = _p.iconSize, inputClass = _p.inputClass;
|
|
2321
2499
|
var dropContClassName = dropContProps.className, restDropContProps = __rest(dropContProps, ["className"]);
|
|
2322
2500
|
var isValueExist = value && value.label !== undefined && value.label !== '';
|
|
2323
2501
|
var inputRef = React.useRef(null);
|
|
2324
2502
|
var dropdownContRef = React.useRef(null);
|
|
2325
|
-
var _p = React.useState(false), isDropUp = _p[0], setIsDropUp = _p[1];
|
|
2326
2503
|
var handleOutsideClick = function (e) {
|
|
2327
2504
|
if (inputRef.current && !inputRef.current.contains(e.target)) {
|
|
2328
2505
|
setIsOpen(false);
|
|
@@ -2342,22 +2519,6 @@ function LiveSearch(_a) {
|
|
|
2342
2519
|
setSearchTerm(value.label || '');
|
|
2343
2520
|
}
|
|
2344
2521
|
}, [value.label, searchTerm]);
|
|
2345
|
-
React.useEffect(function () {
|
|
2346
|
-
var _a, _b;
|
|
2347
|
-
if (inputRef.current) {
|
|
2348
|
-
// Adjust dropdown position to prevent show up out of screen
|
|
2349
|
-
var windowHeight = window.innerHeight;
|
|
2350
|
-
var inputRect = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
2351
|
-
var inputBottom = inputRect === null || inputRect === void 0 ? void 0 : inputRect.bottom;
|
|
2352
|
-
var diff = windowHeight - inputBottom;
|
|
2353
|
-
var dropdownRect = (_b = dropdownContRef.current) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
2354
|
-
var dropdownHeight = (dropdownRect === null || dropdownRect === void 0 ? void 0 : dropdownRect.height) || 0;
|
|
2355
|
-
if (dropdownHeight >= diff)
|
|
2356
|
-
setIsDropUp(true);
|
|
2357
|
-
else
|
|
2358
|
-
setIsDropUp(false);
|
|
2359
|
-
}
|
|
2360
|
-
}, [isOpen]);
|
|
2361
2522
|
var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (item) {
|
|
2362
2523
|
return item.label.toLowerCase().includes(value.label.toLowerCase());
|
|
2363
2524
|
});
|
|
@@ -2375,36 +2536,38 @@ function LiveSearch(_a) {
|
|
|
2375
2536
|
var processDropdownChildren = function (nodes, currentSearchTerm, includeAllIfNoSearch) {
|
|
2376
2537
|
return React.Children.map(nodes, function (child) {
|
|
2377
2538
|
if (!React.isValidElement(child) || child.type !== DropdownItem) {
|
|
2378
|
-
return child;
|
|
2539
|
+
return child;
|
|
2379
2540
|
}
|
|
2380
|
-
var itemProps = child.props;
|
|
2541
|
+
var itemProps = child.props;
|
|
2542
|
+
// Assume content is a string for filtering; otherwise, filtering won't work well
|
|
2543
|
+
var itemContent = typeof itemProps.content === 'string' ? itemProps.content : '';
|
|
2381
2544
|
var itemValue = itemProps.value;
|
|
2382
2545
|
var isDisabled = itemProps.disabled;
|
|
2383
|
-
//
|
|
2384
|
-
if (
|
|
2385
|
-
|
|
2386
|
-
|
|
2546
|
+
// 2. Filtering Logic (Uses Global Search Variant)
|
|
2547
|
+
if (!includeAllIfNoSearch) {
|
|
2548
|
+
// Use the matchSearchTerm utility with the selected searchVariant
|
|
2549
|
+
if (currentSearchTerm && !matchSearchTerm(itemValue, currentSearchTerm, searchVariant)) {
|
|
2550
|
+
return null; // Item does not match the search criteria
|
|
2551
|
+
}
|
|
2387
2552
|
}
|
|
2388
|
-
//
|
|
2389
|
-
// If includeAllIfNoSearch is false (when searchTerm is present), filtering has been done above.
|
|
2390
|
-
// Clone its children recursively if any
|
|
2553
|
+
// 3. Process Nested Children (Recursion)
|
|
2391
2554
|
var clonedChildren = itemProps.children
|
|
2392
|
-
? processDropdownChildren(itemProps.children, currentSearchTerm)
|
|
2555
|
+
? processDropdownChildren(itemProps.children, currentSearchTerm, includeAllIfNoSearch)
|
|
2393
2556
|
: null;
|
|
2394
|
-
// Clone
|
|
2557
|
+
// 4. Clone and Inject Click Handler
|
|
2395
2558
|
return React.cloneElement(child, {
|
|
2396
2559
|
onClick: function (e) {
|
|
2397
2560
|
if (!isDisabled) {
|
|
2398
2561
|
handleDropdownItemClick({
|
|
2399
|
-
id: itemValue,
|
|
2400
|
-
label: itemValue
|
|
2562
|
+
id: itemValue !== undefined ? itemValue : itemContent,
|
|
2563
|
+
label: itemValue !== undefined ? itemValue : itemContent
|
|
2401
2564
|
});
|
|
2402
2565
|
}
|
|
2403
|
-
if (
|
|
2404
|
-
|
|
2566
|
+
if (itemProps.onClick) {
|
|
2567
|
+
itemProps.onClick(e);
|
|
2405
2568
|
}
|
|
2406
2569
|
},
|
|
2407
|
-
children: clonedChildren
|
|
2570
|
+
children: clonedChildren
|
|
2408
2571
|
});
|
|
2409
2572
|
});
|
|
2410
2573
|
};
|
|
@@ -2413,23 +2576,20 @@ function LiveSearch(_a) {
|
|
|
2413
2576
|
var hasFilteredResults = false;
|
|
2414
2577
|
if (searchTerm) {
|
|
2415
2578
|
// If there's a searchTerm, filter children
|
|
2416
|
-
renderedChildren = processDropdownChildren(children, searchTerm);
|
|
2579
|
+
renderedChildren = processDropdownChildren(children, searchTerm, false);
|
|
2417
2580
|
hasFilteredResults =
|
|
2418
2581
|
React.Children.toArray(renderedChildren).filter(Boolean).length > 0;
|
|
2419
2582
|
}
|
|
2420
2583
|
else {
|
|
2421
2584
|
// If searchTerm is empty, display all children without filtering (but with onClick injected)
|
|
2422
|
-
renderedChildren = processDropdownChildren(children, '');
|
|
2585
|
+
renderedChildren = processDropdownChildren(children, '', true);
|
|
2423
2586
|
hasFilteredResults =
|
|
2424
2587
|
React.Children.toArray(renderedChildren).filter(Boolean).length > 0; // Should always be true if there are initial children
|
|
2425
2588
|
}
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
React.createElement("label", { htmlFor: id, className: "bianic-livesearch-label text-xs font-semibold read-only:pointer-events-none" },
|
|
2429
|
-
label,
|
|
2430
|
-
required && React.createElement("span", { className: "p-1 text-bia-red" }, "*")),
|
|
2589
|
+
return (React.createElement("div", { className: "bianic-livesearch field-group group/form flex w-full flex-col gap-y-2 " },
|
|
2590
|
+
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
2431
2591
|
React.createElement("div", { className: "group relative w-full" },
|
|
2432
|
-
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) {
|
|
2592
|
+
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) {
|
|
2433
2593
|
onChangeText(e);
|
|
2434
2594
|
setValue({ id: null, label: e.target.value });
|
|
2435
2595
|
handleInputChange(e);
|
|
@@ -2448,11 +2608,11 @@ function LiveSearch(_a) {
|
|
|
2448
2608
|
setIsOpen(false);
|
|
2449
2609
|
} }));
|
|
2450
2610
|
}))),
|
|
2451
|
-
children &&
|
|
2611
|
+
children && React.createElement(DropdownContainer, __assign({ open: isOpen, onClose: function () { return setIsOpen(false); }, size: size, isTopFlat: true, zIndex: 10, className: "bianic-livesearch-dropdown absolute w-full overflow-hidden bg-white shadow-lg ".concat(dropContClassName), ref: dropdownContRef, anchorRef: inputRef }, restDropContProps), hasFilteredResults
|
|
2452
2612
|
? renderedChildren
|
|
2453
2613
|
: // If no results and searchTerm is present
|
|
2454
|
-
searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))
|
|
2455
|
-
React.createElement("span", { className: "desc text-xs text-primary-cool" }, descText)));
|
|
2614
|
+
searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") })))),
|
|
2615
|
+
descText && (React.createElement("span", { className: "desc text-xs text-primary-cool" }, descText))));
|
|
2456
2616
|
}
|
|
2457
2617
|
LiveSearch.defaultProps = {
|
|
2458
2618
|
descText: '',
|
|
@@ -2468,7 +2628,7 @@ LiveSearch.defaultProps = {
|
|
|
2468
2628
|
readonly: false,
|
|
2469
2629
|
};
|
|
2470
2630
|
|
|
2471
|
-
var sizeConfig$
|
|
2631
|
+
var sizeConfig$5 = {
|
|
2472
2632
|
md: {
|
|
2473
2633
|
containerSize: 'w-[42px] h-[22px]',
|
|
2474
2634
|
checkSize: 'p-2',
|
|
@@ -2483,7 +2643,7 @@ var sizeConfig$4 = {
|
|
|
2483
2643
|
|
|
2484
2644
|
function Toggle(_a) {
|
|
2485
2645
|
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;
|
|
2486
|
-
var _h = sizeConfig$
|
|
2646
|
+
var _h = sizeConfig$5[size], containerSize = _h.containerSize, checkSize = _h.checkSize, labelClass = _h.labelClass;
|
|
2487
2647
|
return (React.createElement("div", { className: "flex items-center" },
|
|
2488
2648
|
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 },
|
|
2489
2649
|
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" }),
|
|
@@ -2509,7 +2669,7 @@ var roundedConfig = {
|
|
|
2509
2669
|
sm: 'first:rounded-l-radius-sm last:rounded-r-radius-sm',
|
|
2510
2670
|
tn: 'first:rounded-l-radius-tn last:rounded-r-radius-tn',
|
|
2511
2671
|
};
|
|
2512
|
-
var sizeConfig$
|
|
2672
|
+
var sizeConfig$4 = {
|
|
2513
2673
|
lg: 'text-size-md leading-[23.94px] px-[13px] py-[11px] ',
|
|
2514
2674
|
md: 'text-size-base leading-[21px] px-[11px] py-[8.5px] ',
|
|
2515
2675
|
sm: 'text-size-sm leading-[15.96px] px-[7px] py-[6px] ',
|
|
@@ -2532,8 +2692,8 @@ function SegmentButtonItem(_a) {
|
|
|
2532
2692
|
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;
|
|
2533
2693
|
var isSelected = selected ? 'selected' : 'notSelected';
|
|
2534
2694
|
var sizingStyle = isfitContent
|
|
2535
|
-
? "".concat(sizeConfig$
|
|
2536
|
-
: "".concat(sizeConfig$
|
|
2695
|
+
? "".concat(sizeConfig$4[size], " ").concat(minHeightConfig[size])
|
|
2696
|
+
: "".concat(sizeConfig$4[size], " ").concat(minWidthConfig[size], " ").concat(minHeightConfig[size]);
|
|
2537
2697
|
var radiusStyle = "".concat(roundedConfig[size]);
|
|
2538
2698
|
var selectedStyle = "".concat(isSelectedConfig[isSelected]);
|
|
2539
2699
|
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));
|
|
@@ -2581,7 +2741,7 @@ var todayValue = Date.now() -
|
|
|
2581
2741
|
(Date.now() % oneDayValue) +
|
|
2582
2742
|
new Date().getTimezoneOffset() * 1000 * 60; // today in milliseconds
|
|
2583
2743
|
var PickerCalendar = function (_a) {
|
|
2584
|
-
var
|
|
2744
|
+
var _b = _a.selectedDate, selectedDate = _b === void 0 ? null : _b, onDateChange = _a.onDateChange, ref = _a.ref;
|
|
2585
2745
|
// Constants
|
|
2586
2746
|
var daysMap = [
|
|
2587
2747
|
'Monday',
|
|
@@ -2608,8 +2768,8 @@ var PickerCalendar = function (_a) {
|
|
|
2608
2768
|
];
|
|
2609
2769
|
var modeMap = ['date', 'year', 'month'];
|
|
2610
2770
|
// Mode Controller
|
|
2611
|
-
var
|
|
2612
|
-
var
|
|
2771
|
+
var _c = React.useState(modeMap[0]), pickerMode = _c[0], setPickerMode = _c[1];
|
|
2772
|
+
var _d = React.useState(''), prevMode = _d[0], setPrevMode = _d[1];
|
|
2613
2773
|
// styling constants and functions
|
|
2614
2774
|
var chevronButtonStyle = 'text-bia-coolgrey';
|
|
2615
2775
|
var selectedDateStyle = function (date, dateSelected) {
|
|
@@ -2725,9 +2885,9 @@ var PickerCalendar = function (_a) {
|
|
|
2725
2885
|
});
|
|
2726
2886
|
};
|
|
2727
2887
|
// View Date Logic
|
|
2728
|
-
var
|
|
2729
|
-
var
|
|
2730
|
-
var
|
|
2888
|
+
var _e = React.useState(new Date(selectedDate || todayValue).getMonth()), viewMonthValue = _e[0], setViewMonthValue = _e[1]; // get the month of the selected date
|
|
2889
|
+
var _f = React.useState(new Date(selectedDate || todayValue).getFullYear()), viewYearValue = _f[0], setViewYearValue = _f[1]; // get the year of the selected date
|
|
2890
|
+
var _g = React.useState(new Date(selectedDate || todayValue).getFullYear()), viewDecadeValue = _g[0], setViewDecadeValue = _g[1]; // get the year for decaderange
|
|
2731
2891
|
// Month view logic
|
|
2732
2892
|
var monthStartDay = new Date("".concat(viewYearValue, "-").concat(viewMonthValue + 1, "-01")).getDay() === 0
|
|
2733
2893
|
? 6
|
|
@@ -2739,7 +2899,7 @@ var PickerCalendar = function (_a) {
|
|
|
2739
2899
|
var viewLastDate = new Date(viewFirstDate);
|
|
2740
2900
|
viewLastDate.setDate(viewLastDate.getDate() + monthCalenderView - 1); // get the last date of the view
|
|
2741
2901
|
// Generate the view days array
|
|
2742
|
-
var
|
|
2902
|
+
var _h = React.useState([]), displayDays = _h[0], setDisplayDays = _h[1];
|
|
2743
2903
|
function getDecadeRange(year) {
|
|
2744
2904
|
// Calculate the start of the decade
|
|
2745
2905
|
var startOfDecade = Math.floor(year / 10) * 10;
|
|
@@ -2755,13 +2915,13 @@ var PickerCalendar = function (_a) {
|
|
|
2755
2915
|
var yearDisplayRange = getDecadeRange(viewDecadeValue);
|
|
2756
2916
|
// Variable display
|
|
2757
2917
|
var dateDisplay = (React.createElement("div", { className: "".concat(pickerMode === 'date' ? '' : 'hidden') },
|
|
2758
|
-
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" },
|
|
2918
|
+
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" },
|
|
2759
2919
|
React.createElement(Text, { variant: "small-text" }, day.slice(0, 3)))); })),
|
|
2760
2920
|
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 () {
|
|
2761
2921
|
// Handle date selection logic here
|
|
2762
2922
|
handleSetSelectedDate(date);
|
|
2763
2923
|
} },
|
|
2764
|
-
React.createElement(Text, { variant: "small-text" }, date.getDate()))); }))));
|
|
2924
|
+
React.createElement(Text, { variant: "small-text", extended: checkDateEquals(date, selectedDate) ? 'text-bia-white' : '' }, date.getDate()))); }))));
|
|
2765
2925
|
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); } },
|
|
2766
2926
|
React.createElement(Text, { variant: "small-text" }, month.slice(0, 3)))); })));
|
|
2767
2927
|
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); } },
|
|
@@ -2810,20 +2970,20 @@ var monthMap = [
|
|
|
2810
2970
|
'December',
|
|
2811
2971
|
];
|
|
2812
2972
|
function DatePicker(_a) {
|
|
2813
|
-
var value = _a.value, onChange = _a.onChange;
|
|
2973
|
+
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;
|
|
2814
2974
|
// State and Ref
|
|
2815
2975
|
var inputRef = React.useRef(null);
|
|
2816
2976
|
var wrapperRef = React.useRef(null);
|
|
2817
2977
|
var pickerRef = React.useRef(null);
|
|
2818
|
-
var
|
|
2978
|
+
var _c = useDetectOutsideClick(wrapperRef, false, pickerRef), isPickerOpen = _c[0], setIsPickerOpen = _c[1];
|
|
2819
2979
|
return (React.createElement("div", { className: "bianic-datepicker-container relative", ref: wrapperRef },
|
|
2820
2980
|
React.createElement("div", { className: "bianic-datepicker-field-container" },
|
|
2821
|
-
React.createElement(DateInput, { ref: inputRef, placeholder:
|
|
2981
|
+
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 })),
|
|
2822
2982
|
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" },
|
|
2823
2983
|
React.createElement(PickerCalendar, { selectedDate: new Date(value), onDateChange: onChange, ref: pickerRef })))));
|
|
2824
2984
|
}
|
|
2825
2985
|
var DateInput = function (_a) {
|
|
2826
|
-
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"]);
|
|
2986
|
+
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"]);
|
|
2827
2987
|
var editDateFormatter = function (date) {
|
|
2828
2988
|
var localString = date.toLocaleDateString().split('/');
|
|
2829
2989
|
return localString.reverse().join('-');
|
|
@@ -2833,41 +2993,13 @@ var DateInput = function (_a) {
|
|
|
2833
2993
|
};
|
|
2834
2994
|
// Convert Date to string for display
|
|
2835
2995
|
var formattedValue = value instanceof Date ? displayDateFormatter(value) : value;
|
|
2836
|
-
var
|
|
2996
|
+
var _e = React.useState(formattedValue), viewValue = _e[0], setViewValue = _e[1];
|
|
2837
2997
|
React.useRef(null);
|
|
2838
|
-
var
|
|
2839
|
-
var
|
|
2840
|
-
var
|
|
2998
|
+
var _f = React.useState(0); _f[0]; _f[1];
|
|
2999
|
+
var _g = styleConfig['text'], fieldStyle = _g.fieldStyle;
|
|
3000
|
+
var _h = sizeConfig$c[size], iconSize = _h.iconSize, fieldSize = _h.fieldSize, iconPosition = _h.iconPosition;
|
|
2841
3001
|
var borderStyle = 'border border-bia-grey-dark-10 bg-primary-white';
|
|
2842
3002
|
var extendedInputClassName = "".concat(fieldStyle, " ").concat(fieldSize, " ").concat(borderStyle, " ").concat(className);
|
|
2843
|
-
var labelStatus = props.readOnly ? 'read-only:pointer-events-none' : '';
|
|
2844
|
-
// Don't remove this, it will be used later
|
|
2845
|
-
// Helper function to format the cleaned input with specific group sizes
|
|
2846
|
-
// const formatInput = (cleanedValue: string, separator: string = '-') => {
|
|
2847
|
-
// let formattedValue = ''
|
|
2848
|
-
// // Define the group lengths: 4, 2, 2
|
|
2849
|
-
// const groupLengths = [4, 2, 2]
|
|
2850
|
-
// let currentIndex = 0
|
|
2851
|
-
// for (let i = 0; i < groupLengths.length; i++) {
|
|
2852
|
-
// const groupLength = groupLengths[i]
|
|
2853
|
-
// const nextSegment = cleanedValue.substring(
|
|
2854
|
-
// currentIndex,
|
|
2855
|
-
// currentIndex + groupLength
|
|
2856
|
-
// )
|
|
2857
|
-
// if (nextSegment.length > 0) {
|
|
2858
|
-
// formattedValue += nextSegment
|
|
2859
|
-
// currentIndex += groupLength
|
|
2860
|
-
// // Add separator if there are more groups to follow and we have enough characters
|
|
2861
|
-
// if (i < groupLengths.length - 1 && currentIndex < cleanedValue.length) {
|
|
2862
|
-
// formattedValue += separator
|
|
2863
|
-
// }
|
|
2864
|
-
// } else {
|
|
2865
|
-
// // Stop if there are no more characters for the current group
|
|
2866
|
-
// break
|
|
2867
|
-
// }
|
|
2868
|
-
// }
|
|
2869
|
-
// return formattedValue
|
|
2870
|
-
// }
|
|
2871
3003
|
var validateAndFormatDate = function (value) {
|
|
2872
3004
|
// 1. validate separator
|
|
2873
3005
|
var splittedDate = value.split('-');
|
|
@@ -2920,56 +3052,6 @@ var DateInput = function (_a) {
|
|
|
2920
3052
|
onChange(date); // Update the value if it's a valid date
|
|
2921
3053
|
}
|
|
2922
3054
|
};
|
|
2923
|
-
// Handle input change will develop later don't remove
|
|
2924
|
-
// const handleChange = (event) => {
|
|
2925
|
-
// const inputElement = event.target
|
|
2926
|
-
// const rawValue = inputElement.value
|
|
2927
|
-
// const currentCursorPos = inputElement.selectionStart
|
|
2928
|
-
// const cleaned = cleanInput(rawValue)
|
|
2929
|
-
// // Max total digits for XXXX-XX-XX is 4 + 2 + 2 = 8
|
|
2930
|
-
// const maxDigits = 8
|
|
2931
|
-
// const truncatedCleaned = cleaned.substring(0, maxDigits)
|
|
2932
|
-
// const formatted = formatInput(truncatedCleaned)
|
|
2933
|
-
// // --- Cursor Position Adjustment Logic ---
|
|
2934
|
-
// let newCursorPos = currentCursorPos
|
|
2935
|
-
// const prevFormattedLength = viewValue.length // Length of the string *before* update
|
|
2936
|
-
// const currentFormattedLength = formatted.length // Length of the string *after* update
|
|
2937
|
-
// // If text was added and formatted length increased
|
|
2938
|
-
// if (currentFormattedLength > prevFormattedLength) {
|
|
2939
|
-
// // Count how many separators are now *before* the cursor in the new string
|
|
2940
|
-
// // We'll compare the raw cursor position with the formatted string to adjust
|
|
2941
|
-
// let separatorCountBeforeCursor = 0
|
|
2942
|
-
// let originalCleanedValue = cleanInput(viewValue) // Clean value before this change
|
|
2943
|
-
// // If a character was inserted, estimate new cursor position
|
|
2944
|
-
// if (cleaned.length > originalCleanedValue.length) {
|
|
2945
|
-
// // Count separators in the *new* formatted string up to the currentCursorPos
|
|
2946
|
-
// for (let i = 0; i < currentCursorPos; i++) {
|
|
2947
|
-
// if (formatted.charAt(i) === '-') {
|
|
2948
|
-
// separatorCountBeforeCursor++
|
|
2949
|
-
// }
|
|
2950
|
-
// }
|
|
2951
|
-
// newCursorPos = currentCursorPos + separatorCountBeforeCursor
|
|
2952
|
-
// } else {
|
|
2953
|
-
// // If characters were deleted (backspace/delete)
|
|
2954
|
-
// newCursorPos = currentCursorPos
|
|
2955
|
-
// // More sophisticated logic for backspace/delete on separators can go here.
|
|
2956
|
-
// // For example, if you backspace a digit and it causes a separator to disappear,
|
|
2957
|
-
// // the cursor might need to jump back an extra position.
|
|
2958
|
-
// // This basic setup often works acceptably for most cases.
|
|
2959
|
-
// }
|
|
2960
|
-
// } else {
|
|
2961
|
-
// // If text was deleted or no change in length
|
|
2962
|
-
// newCursorPos = currentCursorPos
|
|
2963
|
-
// }
|
|
2964
|
-
// const handleKeyDown = (event) => {
|
|
2965
|
-
// if (event.key === 'Enter') {
|
|
2966
|
-
// // Prevent default form submission if the input is inside a <form>
|
|
2967
|
-
// // event.preventDefault();
|
|
2968
|
-
// }
|
|
2969
|
-
// }
|
|
2970
|
-
// setViewValue(formatted)
|
|
2971
|
-
// setLastCursorPos(newCursorPos)
|
|
2972
|
-
// }
|
|
2973
3055
|
var handleChange = function (event) {
|
|
2974
3056
|
var value = event.target.value;
|
|
2975
3057
|
// Regular expression to allow only numbers (0-9) and hyphens (-)
|
|
@@ -2980,25 +3062,16 @@ var DateInput = function (_a) {
|
|
|
2980
3062
|
setViewValue(value);
|
|
2981
3063
|
}
|
|
2982
3064
|
};
|
|
2983
|
-
// Will Develop later
|
|
2984
|
-
// useEffect to set cursor position after render
|
|
2985
|
-
// useEffect(() => {
|
|
2986
|
-
// if (inputRef.current) {
|
|
2987
|
-
// inputRef.current.setSelectionRange(lastCursorPos, lastCursorPos)
|
|
2988
|
-
// }
|
|
2989
|
-
// }, [viewValue, lastCursorPos]) // Re-run when viewValue or lastCursorPos changes
|
|
2990
3065
|
React.useEffect(function () {
|
|
2991
3066
|
setViewValue(formattedValue);
|
|
2992
3067
|
}, [value]);
|
|
2993
|
-
return (React.createElement("div", { className: "bianic-date-input-container bianic-fgc-container flex w-full flex-col gap-y-2 text-bia-black" },
|
|
2994
|
-
label && (React.createElement(
|
|
2995
|
-
label,
|
|
2996
|
-
required && React.createElement("span", { className: "p-1 text-bia-red" }, "*"))),
|
|
3068
|
+
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 " },
|
|
3069
|
+
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
2997
3070
|
React.createElement("div", { className: "relative w-full" },
|
|
2998
|
-
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
|
|
3071
|
+
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 () {
|
|
2999
3072
|
setIsActive && setIsActive(true);
|
|
3000
3073
|
setViewValue(editDateFormatter(value));
|
|
3001
|
-
},
|
|
3074
|
+
}, onBlur: function () {
|
|
3002
3075
|
var _a = validateAndFormatDate(viewValue), status = _a[0], validatedValue = _a[1];
|
|
3003
3076
|
setViewValue(displayDateFormatter(value));
|
|
3004
3077
|
if (status !== 0) ;
|
|
@@ -3006,11 +3079,12 @@ var DateInput = function (_a) {
|
|
|
3006
3079
|
updateValue(validatedValue);
|
|
3007
3080
|
}
|
|
3008
3081
|
}, maxLength: 10 })),
|
|
3009
|
-
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 text-
|
|
3010
|
-
React.createElement("button", { className: "bianic-datepicker-toggle-button", onClick: function () {
|
|
3082
|
+
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 text-bia-coolgrey ".concat(iconPosition) },
|
|
3083
|
+
React.createElement("button", { className: "bianic-datepicker-toggle-button", disabled: disabled, onClick: function () {
|
|
3011
3084
|
buttonAction && buttonAction();
|
|
3012
3085
|
} },
|
|
3013
|
-
React.createElement(TbCalendar,
|
|
3086
|
+
React.createElement(TbCalendar, { size: iconSize })))),
|
|
3087
|
+
descText && (React.createElement("span", { className: "desc text-xs text-primary-cool" }, descText))));
|
|
3014
3088
|
};
|
|
3015
3089
|
|
|
3016
3090
|
var Node = function (_a) {
|
|
@@ -3193,6 +3267,33 @@ var Neutral = function (_a) {
|
|
|
3193
3267
|
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" })));
|
|
3194
3268
|
};
|
|
3195
3269
|
|
|
3270
|
+
var colorConfig$1 = {
|
|
3271
|
+
yellow: 'bg-bia-yellow-light-80',
|
|
3272
|
+
blue: 'bg-bia-sky-light-90',
|
|
3273
|
+
grey: 'bg-bia-grey-light-80',
|
|
3274
|
+
white: 'bg-bia-white border border-bia-grey',
|
|
3275
|
+
};
|
|
3276
|
+
var sizeConfig$3 = {
|
|
3277
|
+
container: 'min-h-fit p-5 text-wrap',
|
|
3278
|
+
'form-sm': 'h-[30px] whitespace-nowrap px-2.5',
|
|
3279
|
+
'form-md': 'h-10 whitespace-nowrap px-2.5',
|
|
3280
|
+
};
|
|
3281
|
+
|
|
3282
|
+
var InfoPanel = function (_a) {
|
|
3283
|
+
var variant = _a.variant, color = _a.color, className = _a.className, textClassName = _a.textClassName;
|
|
3284
|
+
var sizeClass = sizeConfig$3[variant || 'container'];
|
|
3285
|
+
var colorClass = colorConfig$1[color || 'yellow'];
|
|
3286
|
+
var allClasses = "".concat(sizeClass, " ").concat(colorClass, " ").concat(className);
|
|
3287
|
+
return (React.createElement("div", { className: "flex items-center justify-center rounded-radius-md ".concat(allClasses) },
|
|
3288
|
+
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.")));
|
|
3289
|
+
};
|
|
3290
|
+
InfoPanel.defaultProps = {
|
|
3291
|
+
variant: 'container',
|
|
3292
|
+
color: 'yellow',
|
|
3293
|
+
className: '',
|
|
3294
|
+
textClassName: '',
|
|
3295
|
+
};
|
|
3296
|
+
|
|
3196
3297
|
function Modal(_a) {
|
|
3197
3298
|
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"]);
|
|
3198
3299
|
var modalSize;
|
|
@@ -3318,7 +3419,7 @@ Pills.defaultProps = {
|
|
|
3318
3419
|
iconRight: null,
|
|
3319
3420
|
};
|
|
3320
3421
|
|
|
3321
|
-
var classConfig
|
|
3422
|
+
var classConfig = {
|
|
3322
3423
|
top: {
|
|
3323
3424
|
tooltipContainer: 'bottom-[calc(100%+10px)] left-1/2 -translate-x-1/2',
|
|
3324
3425
|
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
@@ -3365,7 +3466,7 @@ function Popover(_a) {
|
|
|
3365
3466
|
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;
|
|
3366
3467
|
var wrapperRef = React.useRef(null);
|
|
3367
3468
|
var _e = useDetectOutsideClick(wrapperRef, false), isOpen = _e[0], setIsOpen = _e[1];
|
|
3368
|
-
var _f = classConfig
|
|
3469
|
+
var _f = classConfig[direction], tooltipContainer = _f.tooltipContainer, triangleContainer = _f.triangleContainer, triangleShape = _f.triangleShape;
|
|
3369
3470
|
return (React.createElement("div", { className: "Bianic-popover-Wrapper relative block h-fit w-fit", role: "button", ref: wrapperRef, onClick: function () { return setIsOpen(true); } },
|
|
3370
3471
|
children,
|
|
3371
3472
|
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) },
|
|
@@ -3853,111 +3954,6 @@ TagLabel.defaultProps = {
|
|
|
3853
3954
|
isDark: false,
|
|
3854
3955
|
};
|
|
3855
3956
|
|
|
3856
|
-
var classConfig = {
|
|
3857
|
-
top: {
|
|
3858
|
-
tooltipContainer: 'bottom-[calc(100%+5px)] left-1/2 -translate-x-1/2',
|
|
3859
|
-
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
3860
|
-
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
3861
|
-
},
|
|
3862
|
-
right: {
|
|
3863
|
-
tooltipContainer: 'left-[calc(100%+5px)] top-1/2 -translate-y-1/2',
|
|
3864
|
-
triangleContainer: '-left-[4px] bottom-0 flex items-center w-auto h-full',
|
|
3865
|
-
triangleShape: 'border-t-[8px] border-t-transparent border-r-[5px] border-r-primary-black border-b-[8px] border-b-transparent',
|
|
3866
|
-
},
|
|
3867
|
-
bottom: {
|
|
3868
|
-
tooltipContainer: 'top-[calc(100%+5px)] left-1/2 -translate-x-1/2',
|
|
3869
|
-
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
3870
|
-
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
3871
|
-
},
|
|
3872
|
-
left: {
|
|
3873
|
-
tooltipContainer: 'right-[calc(100%+5px)] top-1/2 -translate-y-1/2',
|
|
3874
|
-
triangleContainer: '-right-[4px] bottom-0 flex items-center w-auto h-full',
|
|
3875
|
-
triangleShape: 'border-t-[8px] border-t-transparent border-l-[5px] border-l-primary-black border-b-[8px] border-b-transparent',
|
|
3876
|
-
},
|
|
3877
|
-
'top-right': {
|
|
3878
|
-
tooltipContainer: 'bottom-[calc(100%+5px)] right-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
|
-
'top-left': {
|
|
3883
|
-
tooltipContainer: 'bottom-[calc(100%+5px)] left-0',
|
|
3884
|
-
triangleContainer: 'left-0 -bottom-[4px] flex justify-center w-full h-auto',
|
|
3885
|
-
triangleShape: 'border-l-[8px] border-l-transparent border-t-[5px] border-t-primary-black border-r-[8px] border-r-transparent',
|
|
3886
|
-
},
|
|
3887
|
-
'bottom-right': {
|
|
3888
|
-
tooltipContainer: 'top-[calc(100%+5px)] right-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
|
-
'bottom-left': {
|
|
3893
|
-
tooltipContainer: 'top-[calc(100%+5px)] left-0',
|
|
3894
|
-
triangleContainer: 'left-0 -top-[4px] flex justify-center w-full h-auto',
|
|
3895
|
-
triangleShape: 'border-l-[8px] border-l-transparent border-b-[5px] border-b-primary-black border-r-[8px] border-r-transparent',
|
|
3896
|
-
},
|
|
3897
|
-
};
|
|
3898
|
-
|
|
3899
|
-
function Tooltip(props) {
|
|
3900
|
-
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;
|
|
3901
|
-
var timeout;
|
|
3902
|
-
var _c = React.useState(false), active = _c[0], setActive = _c[1];
|
|
3903
|
-
var showTip = function () {
|
|
3904
|
-
timeout = setTimeout(function () {
|
|
3905
|
-
setActive(true);
|
|
3906
|
-
}, delay || 400);
|
|
3907
|
-
};
|
|
3908
|
-
var hideTip = function () {
|
|
3909
|
-
clearInterval(timeout);
|
|
3910
|
-
setActive(false);
|
|
3911
|
-
};
|
|
3912
|
-
var _d = classConfig[direction], tooltipContainer = _d.tooltipContainer; _d.triangleContainer; _d.triangleShape;
|
|
3913
|
-
var tooltipContainerRef = React.useRef(null);
|
|
3914
|
-
var _e = React.useState({
|
|
3915
|
-
maxWidth: maxWidth + 'px',
|
|
3916
|
-
whiteSpace: 'nowrap',
|
|
3917
|
-
}), tooltipContainerStyle = _e[0], setTooltipContainerStyle = _e[1];
|
|
3918
|
-
var tooltipContainerElement = tooltipContainerRef === null || tooltipContainerRef === void 0 ? void 0 : tooltipContainerRef.current;
|
|
3919
|
-
var scrollWidth = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.scrollWidth; // Mendapatkan lebar konten aktual
|
|
3920
|
-
var offsetWidth = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.offsetWidth;
|
|
3921
|
-
var offsetHeight = tooltipContainerElement === null || tooltipContainerElement === void 0 ? void 0 : tooltipContainerElement.offsetHeight;
|
|
3922
|
-
React.useEffect(function () {
|
|
3923
|
-
if (scrollWidth && offsetWidth) {
|
|
3924
|
-
var maxWidthNumber = Number(maxWidth);
|
|
3925
|
-
var isMultiLine = offsetHeight > 23; // 23 pixels is the approximate height of one line of text
|
|
3926
|
-
// Tooltip Width and Whitespace Determination Rules:
|
|
3927
|
-
// 1. Default Condition:
|
|
3928
|
-
// - width: fit-content
|
|
3929
|
-
// - whiteSpace: nowrap
|
|
3930
|
-
// 2. When maxWidth is Set:
|
|
3931
|
-
// * Text Exceeds maxWidth:
|
|
3932
|
-
// - width: maxWidth
|
|
3933
|
-
// - whiteSpace: normal
|
|
3934
|
-
// * Text Equals maxWidth (Multi-line):
|
|
3935
|
-
// - width: maxWidth
|
|
3936
|
-
// - whiteSpace: normal
|
|
3937
|
-
// * Text Less Than maxWidth:
|
|
3938
|
-
// - width: fit-content
|
|
3939
|
-
// - whiteSpace: nowrap
|
|
3940
|
-
var newWidth_1 = 'fit-content';
|
|
3941
|
-
var newWhiteSpace_1 = 'nowrap';
|
|
3942
|
-
if (scrollWidth > maxWidthNumber ||
|
|
3943
|
-
(offsetWidth === maxWidthNumber && isMultiLine)) {
|
|
3944
|
-
newWidth_1 = maxWidthNumber + 'px';
|
|
3945
|
-
newWhiteSpace_1 = 'normal';
|
|
3946
|
-
}
|
|
3947
|
-
setTooltipContainerStyle(function (prev) { return (__assign(__assign({}, prev), { width: newWidth_1, whiteSpace: newWhiteSpace_1 })); });
|
|
3948
|
-
}
|
|
3949
|
-
}, [content, maxWidth, scrollWidth, offsetHeight]);
|
|
3950
|
-
return (React.createElement("div", { className: "tooltip-wrapper relative inline-flex h-fit w-fit flex-col", onMouseEnter: showTip, onMouseLeave: hideTip },
|
|
3951
|
-
children,
|
|
3952
|
-
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))));
|
|
3953
|
-
}
|
|
3954
|
-
Tooltip.defaultProps = {
|
|
3955
|
-
delay: 400,
|
|
3956
|
-
direction: 'top',
|
|
3957
|
-
maxWidth: '300',
|
|
3958
|
-
};
|
|
3959
|
-
Tooltip.defaultProps = {};
|
|
3960
|
-
|
|
3961
3957
|
var colorConfigs = {
|
|
3962
3958
|
default: 'bg-bia-black',
|
|
3963
3959
|
info: 'bg-bia-teal',
|
|
@@ -3978,7 +3974,7 @@ function Toaster(_a) {
|
|
|
3978
3974
|
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]" },
|
|
3979
3975
|
icon && React.createElement("div", { className: "bianic-toaster-icon-area" }, icon),
|
|
3980
3976
|
React.createElement("div", { className: "bianic-toaster-description-area text-[12px] font-normal leading-[134%]" }, children)));
|
|
3981
|
-
return (React.createElement("div", { className: "bianic-toaster flex
|
|
3977
|
+
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) },
|
|
3982
3978
|
React.createElement("span", { className: "mr-[10px] flex min-w-[3px] rounded-r-[10px] bg-bia-white/50" }),
|
|
3983
3979
|
content,
|
|
3984
3980
|
React.createElement("div", { className: "flex items-start pr-[11px] pt-[1px]" },
|
|
@@ -4057,6 +4053,7 @@ exports.FormGroup = FormGroup;
|
|
|
4057
4053
|
exports.FormGroupButton = FormGroupButton;
|
|
4058
4054
|
exports.FormGroupLabel = FormGroupLabel;
|
|
4059
4055
|
exports.Heading = Heading;
|
|
4056
|
+
exports.InfoPanel = InfoPanel;
|
|
4060
4057
|
exports.Link = Link;
|
|
4061
4058
|
exports.LiveSearch = LiveSearch;
|
|
4062
4059
|
exports.MenuContainer = MenuContainer;
|