bianic-ui 2.3.1 → 2.5.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 +31 -21
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Forms/LiveSearch/utils/dropdownUtils.d.ts +1 -0
- package/dist/cjs/types/components/Menu/MenuContainer.d.ts +2 -1
- package/dist/cjs/types/components/Notification/index.d.ts +8 -0
- package/dist/cjs/types/components/index.d.ts +1 -0
- package/dist/esm/index.js +31 -22
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Forms/LiveSearch/utils/dropdownUtils.d.ts +1 -0
- package/dist/esm/types/components/Menu/MenuContainer.d.ts +2 -1
- package/dist/esm/types/components/Notification/index.d.ts +8 -0
- package/dist/esm/types/components/index.d.ts +1 -0
- package/dist/index.d.ts +9 -2
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -1989,9 +1989,9 @@ var usePopupPosition = function (anchorRef, popupRef, position) {
|
|
|
1989
1989
|
};
|
|
1990
1990
|
|
|
1991
1991
|
var MenuElement = React.forwardRef(function (_a, ref) {
|
|
1992
|
-
var isTopFlat = _a.isTopFlat, children = _a.children, className = _a.className, zIndex = _a.zIndex, menuRef = _a.menuRef, onClose = _a.onClose, onClickItem = _a.onClickItem, style = _a.style, restProps = __rest(_a, ["isTopFlat", "children", "className", "zIndex", "menuRef", "onClose", "onClickItem", "style"]);
|
|
1992
|
+
var isTopFlat = _a.isTopFlat, children = _a.children, className = _a.className, zIndex = _a.zIndex, menuRef = _a.menuRef, onClose = _a.onClose, onClickItem = _a.onClickItem, style = _a.style, onContextMenu = _a.onContextMenu, restProps = __rest(_a, ["isTopFlat", "children", "className", "zIndex", "menuRef", "onClose", "onClickItem", "style", "onContextMenu"]);
|
|
1993
1993
|
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
1994
|
-
return (React.createElement("div", __assign({ ref: menuRef, className: "w-fit bg-bia-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] ".concat(radiusClass, " ").concat(className), style: style }, restProps), React.Children.map(children, function (child) {
|
|
1994
|
+
return (React.createElement("div", __assign({ ref: menuRef, className: "w-fit bg-bia-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] ".concat(radiusClass, " ").concat(className), style: style, onContextMenu: onContextMenu }, restProps), React.Children.map(children, function (child) {
|
|
1995
1995
|
return React.isValidElement(child)
|
|
1996
1996
|
? React.cloneElement(child, {
|
|
1997
1997
|
onClose: function () { return onClose(); },
|
|
@@ -2002,7 +2002,7 @@ var MenuElement = React.forwardRef(function (_a, ref) {
|
|
|
2002
2002
|
})));
|
|
2003
2003
|
});
|
|
2004
2004
|
var MenuContainer = function (props) {
|
|
2005
|
-
var _a = props.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = props.children, _b = props.open, open = _b === void 0 ? true : _b, _c = props.onClose, onClose = _c === void 0 ? function () { } : _c, _d = props.className, className = _d === void 0 ? '' : _d, _e = props.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = props.zIndex, zIndex = _f === void 0 ? 100 : _f, _g = props.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, anchorRef = props.anchorRef, matchAnchorWidth = props.matchAnchorWidth, restProps = __rest(props, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex", "onClickItem", "anchorRef", "matchAnchorWidth"]);
|
|
2005
|
+
var _a = props.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = props.children, _b = props.open, open = _b === void 0 ? true : _b, _c = props.onClose, onClose = _c === void 0 ? function () { } : _c, _d = props.className, className = _d === void 0 ? '' : _d, _e = props.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = props.zIndex, zIndex = _f === void 0 ? 100 : _f, _g = props.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, anchorRef = props.anchorRef, matchAnchorWidth = props.matchAnchorWidth, onContextMenu = props.onContextMenu, restProps = __rest(props, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex", "onClickItem", "anchorRef", "matchAnchorWidth", "onContextMenu"]);
|
|
2006
2006
|
if (!open)
|
|
2007
2007
|
return null;
|
|
2008
2008
|
var MenuContainerRef = React.useRef(null);
|
|
@@ -2030,9 +2030,13 @@ var MenuContainer = function (props) {
|
|
|
2030
2030
|
}
|
|
2031
2031
|
return __assign(__assign({ zIndex: zIndex + 10 }, widthStyle), positionStyle);
|
|
2032
2032
|
}, [positionStyle]);
|
|
2033
|
-
var menuElement = (React.createElement(MenuElement, __assign({ isTopFlat: isTopFlat, children: children, className: className, zIndex: zIndex, menuRef: MenuContainerRef, onClose: onClose, onClickItem: onClickItem, style: newStyle
|
|
2033
|
+
var menuElement = (React.createElement(MenuElement, __assign({ isTopFlat: isTopFlat, children: children, className: className, zIndex: zIndex, menuRef: MenuContainerRef, onClose: onClose, onClickItem: onClickItem, style: newStyle, onContextMenu: function (e) {
|
|
2034
|
+
return onContextMenu ? onContextMenu(e) : e.preventDefault();
|
|
2035
|
+
} }, restProps)));
|
|
2034
2036
|
return (React.createElement(React.Fragment, null,
|
|
2035
|
-
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 }
|
|
2037
|
+
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 }, onContextMenu: function (e) {
|
|
2038
|
+
return onContextMenu ? onContextMenu(e) : e.preventDefault();
|
|
2039
|
+
} })),
|
|
2036
2040
|
(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current)
|
|
2037
2041
|
? reactDom.createPortal(menuElement, document.body)
|
|
2038
2042
|
: menuElement));
|
|
@@ -2297,7 +2301,7 @@ var TextInput = React.forwardRef(function (_a, ref) {
|
|
|
2297
2301
|
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" },
|
|
2298
2302
|
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
2299
2303
|
React.createElement("div", { className: "relative w-full ".concat(disabledClass) },
|
|
2300
|
-
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:cursor-not-allowed 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)),
|
|
2304
|
+
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:cursor-not-allowed 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, style: { paddingRight: "".concat(10 + Number(iconSize), "px") } }, props)),
|
|
2301
2305
|
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(actionElement ? '' : iconStyle, " ").concat(iconPosition, " ").concat(iconSizing) }, iconElement)),
|
|
2302
2306
|
(descText || maxLength) && (React.createElement("div", { className: "bianic-text-input-desc flex justify-between gap-1 whitespace-nowrap text-xs ".concat(descColor) },
|
|
2303
2307
|
React.createElement("span", null, descText),
|
|
@@ -2569,7 +2573,7 @@ function SelectInput(_a) {
|
|
|
2569
2573
|
}
|
|
2570
2574
|
return child;
|
|
2571
2575
|
})))),
|
|
2572
|
-
descText && (React.createElement("span", { className: "bianic-livesearch-desc bianic-text-input-desc
|
|
2576
|
+
descText && (React.createElement("span", { className: "bianic-livesearch-desc bianic-text-input-desc text-xs ".concat(descColor) }, descText))));
|
|
2573
2577
|
}
|
|
2574
2578
|
SelectInput.defaultProps = {
|
|
2575
2579
|
descText: '',
|
|
@@ -2727,11 +2731,7 @@ function DropdownItem(_a) {
|
|
|
2727
2731
|
: 'right-0 translate-x-full';
|
|
2728
2732
|
var currentZIndex = zIndex + 10;
|
|
2729
2733
|
return (React.createElement("div", { className: "bianic-dropdown-item group/main relative cursor-pointer first:rounded-t-radius-sm first:pt-[5px] last:rounded-b-radius-sm last:pb-[5px]", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
|
|
2730
|
-
React.createElement("button", __assign({ className: "relative flex w-full !min-w-fit items-center justify-start whitespace-nowrap px-[15px] py-[5px] text-left text-bia-black disabled:cursor-not-allowed disabled:text-bia-coolgrey-light-50 hover:[&:not(:disabled)]:bg-bia-blue-pastel ".concat(itemClass), style: {
|
|
2731
|
-
zIndex: isHovered ? currentZIndex : currentZIndex + 15,
|
|
2732
|
-
}, onClick: function (e) {
|
|
2733
|
-
onClickItem(e, value);
|
|
2734
|
-
}, onKeyDown: function () { }, disabled: disabled, type: "button" }, props),
|
|
2734
|
+
React.createElement("button", __assign({ className: "relative flex w-full !min-w-fit items-center justify-start whitespace-nowrap px-[15px] py-[5px] text-left text-bia-black disabled:cursor-not-allowed disabled:text-bia-coolgrey-light-50 hover:[&:not(:disabled)]:bg-bia-blue-pastel ".concat(itemClass), style: { zIndex: currentZIndex + 15 }, onClick: function (e) { return onClickItem(e, value); }, onKeyDown: function () { }, disabled: disabled, type: "button" }, props),
|
|
2735
2735
|
content,
|
|
2736
2736
|
React.createElement("div", { className: "ml-auto flex items-center" }, children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey", size: chevronSize })))),
|
|
2737
2737
|
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))));
|
|
@@ -2761,11 +2761,12 @@ var filterOptions = function (options, searchTerm) {
|
|
|
2761
2761
|
});
|
|
2762
2762
|
};
|
|
2763
2763
|
|
|
2764
|
+
var isObjectWithLabel = function (value) {
|
|
2765
|
+
return typeof value === 'object' && value !== null && 'label' in value;
|
|
2766
|
+
};
|
|
2764
2767
|
var getItemLabel = function (value) {
|
|
2765
2768
|
var _a;
|
|
2766
|
-
return
|
|
2767
|
-
? (_a = value.label) !== null && _a !== void 0 ? _a : ''
|
|
2768
|
-
: String(value !== null && value !== void 0 ? value : '');
|
|
2769
|
+
return isObjectWithLabel(value) ? (_a = value.label) !== null && _a !== void 0 ? _a : '' : String(value !== null && value !== void 0 ? value : '');
|
|
2769
2770
|
};
|
|
2770
2771
|
var processDropdownChildren = function (nodes, currentSearchTerm, includeAllIfNoSearch, searchVariant, handleDropdownItemClick) {
|
|
2771
2772
|
if (searchVariant === void 0) { searchVariant = 'include'; }
|
|
@@ -2869,7 +2870,7 @@ function LiveSearch(_a) {
|
|
|
2869
2870
|
}), isOpen = _m.isOpen, setIsOpen = _m.setIsOpen, searchTerm = _m.searchTerm, handleInputChange = _m.handleInputChange, handleDropdownItemClick = _m.handleDropdownItemClick;
|
|
2870
2871
|
var _o = sizeConfig$6[size], iconClass = _o.iconClass, iconSize = _o.iconSize, inputClass = _o.inputClass;
|
|
2871
2872
|
var _p = dropContProps || {}, dropContClassName = _p.className; _p.onClickItem; _p.anchorRef; var restDropContProps = __rest(_p, ["className", "onClickItem", "anchorRef"]);
|
|
2872
|
-
var
|
|
2873
|
+
var isSearchTermExist = searchTerm && searchTerm !== '';
|
|
2873
2874
|
var descColor = 'text-primary-cool';
|
|
2874
2875
|
var isExistValidation = isValid !== null && isValid !== undefined;
|
|
2875
2876
|
if (!disabled && isExistValidation && isValid)
|
|
@@ -2882,13 +2883,13 @@ function LiveSearch(_a) {
|
|
|
2882
2883
|
return (React.createElement("div", { className: "bianic-livesearch bianic-fgc-container bianic-text-input-container field-group group/form flex w-full flex-col gap-y-2" },
|
|
2883
2884
|
label && (React.createElement(FormLabel, { htmlFor: id, required: required, readOnly: readOnly }, label)),
|
|
2884
2885
|
React.createElement("div", { className: "group relative w-full ".concat(disabledClass) },
|
|
2885
|
-
React.createElement("input", { className: "bianic-livesearch-input bianic-fgc-target field peer w-full rounded border border-bia-grey-dark-10 bg-primary-white text-bia-black read-only:pointer-events-none read-only:border-bia-grey-light-50 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-80 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) {
|
|
2886
|
+
React.createElement("input", { className: "bianic-livesearch-input bianic-fgc-target field peer w-full rounded border border-bia-grey-dark-10 bg-primary-white text-bia-black read-only:pointer-events-none read-only:border-bia-grey-light-50 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-80 disabled:text-bia-coolgrey ".concat(inputClass), style: { paddingRight: "".concat(10 + Number(iconSize), "px") }, onClick: function () { return setIsOpen(!isOpen); }, value: searchTerm, required: required, disabled: disabled, id: id, placeholder: placeholder, ref: inputRef, onChange: function (e) {
|
|
2886
2887
|
onChangeText(e);
|
|
2887
2888
|
handleInputChange(e);
|
|
2888
2889
|
}, type: "text", readOnly: readOnly, autoComplete: autoComplete }),
|
|
2889
2890
|
React.createElement("div", { className: "absolute inset-y-0 flex items-center pl-3 ".concat(iconClass) },
|
|
2890
|
-
!
|
|
2891
|
-
|
|
2891
|
+
!isSearchTermExist && (React.createElement(TbZoom, { className: "text-primary-black", style: { fontSize: iconSize } })),
|
|
2892
|
+
isSearchTermExist && (React.createElement("button", { onClick: function () { return setValue({ id: null, label: '' }); }, className: "flex h-full w-full items-center disabled:cursor-not-allowed", disabled: disabled },
|
|
2892
2893
|
React.createElement(TbX, { className: "text-primary-black", style: { fontSize: iconSize } })))),
|
|
2893
2894
|
children === undefined && isOpen && (React.createElement("div", { className: "border-grey-100 absolute z-10 max-h-60 w-full overflow-y-auto rounded-b-md border bg-primary-white shadow-lg", onClick: onClickDropdown }, filteredOptions.map(function (option) {
|
|
2894
2895
|
var isSelected = value && value.id && option.id === value.id;
|
|
@@ -2904,7 +2905,7 @@ function LiveSearch(_a) {
|
|
|
2904
2905
|
? renderedChildren
|
|
2905
2906
|
: // If no results and searchTerm is present
|
|
2906
2907
|
searchTerm.length > 0 && (React.createElement(DropdownItem, { content: React.createElement("div", { className: "px-4 py-2 text-gray-500" }, "Tidak ada hasil ditemukan.") }))))),
|
|
2907
|
-
descText && (React.createElement("span", { className: "bianic-livesearch-desc bianic-text-input-desc
|
|
2908
|
+
descText && (React.createElement("span", { className: "bianic-livesearch-desc bianic-text-input-desc text-xs ".concat(descColor) }, descText))));
|
|
2908
2909
|
}
|
|
2909
2910
|
LiveSearch.defaultProps = {
|
|
2910
2911
|
descText: '',
|
|
@@ -3691,7 +3692,7 @@ function Modal(_a) {
|
|
|
3691
3692
|
if (open) {
|
|
3692
3693
|
return (
|
|
3693
3694
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
|
|
3694
|
-
reactDom.createPortal(React.createElement("div", { className: "bianic-modal-wrapper fixed inset-0 flex items-center justify-center bg-bia-black-transparent-75", style: { zIndex: !zIndex && isNaN(zIndex) ? 'auto' : zIndex }, id: "wrapper",
|
|
3695
|
+
reactDom.createPortal(React.createElement("div", { className: "bianic-modal-wrapper fixed inset-0 flex items-center justify-center bg-bia-black-transparent-75", style: { zIndex: !zIndex && isNaN(zIndex) ? 'auto' : zIndex }, id: "wrapper", onPointerDown: handleClose },
|
|
3695
3696
|
React.createElement("div", { className: "bianic-modal flex flex-col gap-[20px] rounded-[5px] bg-white p-[20px] ".concat(modalSize), onClick: onClick },
|
|
3696
3697
|
React.createElement("div", { className: "bianic-modal-header flex justify-between" },
|
|
3697
3698
|
React.createElement("div", { className: " text-wrap text-left font-humnst777 text-[18px] font-bold leading-[21.85px] text-primary-black" }, title),
|
|
@@ -3701,6 +3702,14 @@ function Modal(_a) {
|
|
|
3701
3702
|
return null;
|
|
3702
3703
|
}
|
|
3703
3704
|
|
|
3705
|
+
var Notification = function (props) {
|
|
3706
|
+
var children = props.children, _a = props.color, color = _a === void 0 ? 'red' : _a, _b = props.isVisible, isVisible = _b === void 0 ? true : _b;
|
|
3707
|
+
var bgColor = color === 'red' ? 'bg-bia-red' : 'bg-bia-white';
|
|
3708
|
+
return (React.createElement("div", { className: "relative" },
|
|
3709
|
+
React.createElement("div", { className: "absolute -right-[3px] -top-[3px] h-1.5 w-1.5 rounded-radius-full ".concat(bgColor), style: { display: isVisible ? 'block' : 'none' } }),
|
|
3710
|
+
children));
|
|
3711
|
+
};
|
|
3712
|
+
|
|
3704
3713
|
var sizeConfig$2 = {
|
|
3705
3714
|
md: 'min-w-[38px] h-[40px] text-[14px] font-semibold',
|
|
3706
3715
|
sm: 'min-w-[29px] h-[30px] text-[12px] font-normal',
|
|
@@ -4508,6 +4517,7 @@ exports.LiveSearch = LiveSearch;
|
|
|
4508
4517
|
exports.MenuContainer = MenuContainer;
|
|
4509
4518
|
exports.MenuItem = MenuItem;
|
|
4510
4519
|
exports.Modal = Modal;
|
|
4520
|
+
exports.Notification = Notification;
|
|
4511
4521
|
exports.P = P;
|
|
4512
4522
|
exports.PaginationBar = PaginationBar;
|
|
4513
4523
|
exports.PickerCalendar = PickerCalendar;
|