bianic-ui 1.13.0 → 1.13.2
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 +18 -12
- package/dist/cjs/lib.css +1 -1
- package/dist/cjs/types/components/Menu/MenuContainer.d.ts +1 -0
- package/dist/cjs/types/components/Menu/MenuItem.d.ts +2 -1
- package/dist/esm/index.js +18 -12
- package/dist/esm/lib.css +1 -1
- package/dist/esm/types/components/Menu/MenuContainer.d.ts +1 -0
- package/dist/esm/types/components/Menu/MenuItem.d.ts +2 -1
- package/dist/index.d.ts +3 -1
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ interface MenuContainerProps extends ComponentPropsWithRef<'div'> {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
isWithOverlay?: boolean;
|
|
9
9
|
zIndex?: number;
|
|
10
|
+
onClickItem?: () => void;
|
|
10
11
|
}
|
|
11
12
|
declare const MenuContainer: React.ForwardRefExoticComponent<Omit<MenuContainerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
13
|
export default MenuContainer;
|
|
@@ -2,6 +2,7 @@ import React, { ComponentPropsWithoutRef } from 'react';
|
|
|
2
2
|
export interface MenuItemProps extends ComponentPropsWithoutRef<'div'> {
|
|
3
3
|
className?: string;
|
|
4
4
|
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
5
|
+
inheritedOnClick?: () => void;
|
|
5
6
|
label: string;
|
|
6
7
|
isChecked?: boolean | undefined;
|
|
7
8
|
caption?: string | undefined;
|
|
@@ -9,7 +10,7 @@ export interface MenuItemProps extends ComponentPropsWithoutRef<'div'> {
|
|
|
9
10
|
onClose?: () => void;
|
|
10
11
|
zIndex?: number;
|
|
11
12
|
}
|
|
12
|
-
declare function MenuItem({ className, label, onClick, caption, isChecked, onClose, children, zIndex, ...props }: MenuItemProps): React.JSX.Element;
|
|
13
|
+
declare function MenuItem({ className, label, onClick, caption, isChecked, onClose, children, zIndex, inheritedOnClick, ...props }: MenuItemProps): React.JSX.Element;
|
|
13
14
|
declare namespace MenuItem {
|
|
14
15
|
var defaultProps: {
|
|
15
16
|
className: string;
|
package/dist/esm/index.js
CHANGED
|
@@ -1521,10 +1521,11 @@ var ContextualButton = function (_a) {
|
|
|
1521
1521
|
: 'text-primary-white'
|
|
1522
1522
|
: textColorConfig[variant];
|
|
1523
1523
|
var stateColor = stateColorConfig[isSelected ? 'selected' : 'default'];
|
|
1524
|
-
return (React.createElement("button", __assign({ className: "contextual-button box-border flex flex-row items-center rounded-radius-sm border border-transparent p-[1px] outline-none ".concat(stateColor, " ").concat(textColor) }, props, { disabled: disabled }),
|
|
1524
|
+
return (React.createElement("button", __assign({ className: "bianic-contextual-button box-border flex flex-row items-center rounded-radius-sm border border-transparent p-[1px] outline-none ".concat(stateColor, " ").concat(textColor) }, props, { disabled: disabled }),
|
|
1525
1525
|
icon,
|
|
1526
|
-
label && (React.createElement("div", { className: "label max-h-[46px] px-[5px] text-[12px] leading-none" },
|
|
1527
|
-
|
|
1526
|
+
label && (React.createElement("div", { className: "label flex max-h-[46px] items-center px-[5px] text-[12px] leading-none" },
|
|
1527
|
+
React.createElement("span", { className: "mr-0.5" }, label),
|
|
1528
|
+
actionElement))));
|
|
1528
1529
|
};
|
|
1529
1530
|
|
|
1530
1531
|
function Color() {
|
|
@@ -1655,7 +1656,7 @@ var FileTree = function (_a) {
|
|
|
1655
1656
|
var _b = useDetectOutsideClick(popupRef, false), isOpenContMenu = _b[0], setIsOpenContMenu = _b[1];
|
|
1656
1657
|
var _c = useState({ x: 0, y: 0 }), contMenuPosition = _c[0], setContMenuPosition = _c[1];
|
|
1657
1658
|
var menuStyle = {
|
|
1658
|
-
position: '
|
|
1659
|
+
position: 'fixed',
|
|
1659
1660
|
top: "".concat(contMenuPosition.y, "px"),
|
|
1660
1661
|
left: "".concat(contMenuPosition.x, "px"),
|
|
1661
1662
|
// Pastikan z-index cukup tinggi agar muncul di atas elemen lain
|
|
@@ -1670,9 +1671,12 @@ var FileTree = function (_a) {
|
|
|
1670
1671
|
var label = _a.label, nodes = _a.nodes, props = __rest(_a, ["label", "nodes"]);
|
|
1671
1672
|
return (React.createElement(TreeItem, __assign({ label: label, nodes: nodes, key: index, color: color, chevronColor: chevronColor, handleRightClick: handleRightClick, onMouseDownTreeItem: onMouseDown }, props)));
|
|
1672
1673
|
}),
|
|
1673
|
-
isOpenContMenu && (React.createElement("div", { style: menuStyle, ref: popupRef, className: "bianic-filetree-contextmenu
|
|
1674
|
+
isOpenContMenu && (React.createElement("div", { style: menuStyle, ref: popupRef, className: "bianic-filetree-contextmenu" }, React.isValidElement(contextMenu)
|
|
1674
1675
|
? // Kirimkan handleItemClick sebagai props onClick ke setiap MenuItem
|
|
1675
|
-
cloneElement(contextMenu, {
|
|
1676
|
+
cloneElement(contextMenu, {
|
|
1677
|
+
isWithOverlay: false,
|
|
1678
|
+
onClickItem: function () { return setIsOpenContMenu(false); },
|
|
1679
|
+
})
|
|
1676
1680
|
: contextMenu))));
|
|
1677
1681
|
};
|
|
1678
1682
|
var TreeItem = function (_a) {
|
|
@@ -1721,7 +1725,7 @@ var TreeItem = function (_a) {
|
|
|
1721
1725
|
};
|
|
1722
1726
|
|
|
1723
1727
|
var MenuContainer = forwardRef(function MenuContainer(propsComp, ref) {
|
|
1724
|
-
var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.zIndex, zIndex = _f === void 0 ? 100 : _f, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex"]);
|
|
1728
|
+
var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.zIndex, zIndex = _f === void 0 ? 100 : _f, _g = propsComp.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex", "onClickItem"]);
|
|
1725
1729
|
var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
|
|
1726
1730
|
return (open && (React.createElement(React.Fragment, null,
|
|
1727
1731
|
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 } })),
|
|
@@ -1733,6 +1737,7 @@ var MenuContainer = forwardRef(function MenuContainer(propsComp, ref) {
|
|
|
1733
1737
|
cloneElement(child, {
|
|
1734
1738
|
onClose: function () { return onClose(); },
|
|
1735
1739
|
zIndex: zIndex + 10,
|
|
1740
|
+
inheritedOnClick: function () { return onClickItem(); },
|
|
1736
1741
|
})
|
|
1737
1742
|
: child;
|
|
1738
1743
|
})))));
|
|
@@ -1742,9 +1747,9 @@ MenuContainer.defaultProps = {
|
|
|
1742
1747
|
};
|
|
1743
1748
|
|
|
1744
1749
|
function MenuItem(_a) {
|
|
1745
|
-
var _b = _a.className, className = _b === void 0 ? '' : _b, label = _a.label, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.caption, caption = _d === void 0 ? undefined : _d, _e = _a.isChecked, isChecked = _e === void 0 ? undefined : _e, _f = _a.onClose, onClose = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, props = __rest(_a, ["className", "label", "onClick", "caption", "isChecked", "onClose", "children", "zIndex"]);
|
|
1746
|
-
var
|
|
1747
|
-
var
|
|
1750
|
+
var _b = _a.className, className = _b === void 0 ? '' : _b, label = _a.label, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.caption, caption = _d === void 0 ? undefined : _d, _e = _a.isChecked, isChecked = _e === void 0 ? undefined : _e, _f = _a.onClose, onClose = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, _h = _a.inheritedOnClick, inheritedOnClick = _h === void 0 ? function () { } : _h, props = __rest(_a, ["className", "label", "onClick", "caption", "isChecked", "onClose", "children", "zIndex", "inheritedOnClick"]);
|
|
1751
|
+
var _j = useState(false), isHovered = _j[0], setIsHovered = _j[1];
|
|
1752
|
+
var _k = useState(false), isLeft = _k[0], setIsLeft = _k[1];
|
|
1748
1753
|
var isWithChecked = isChecked !== undefined;
|
|
1749
1754
|
var leftPadding = isWithChecked ? 'pl-[5px]' : 'pl-[10px]';
|
|
1750
1755
|
var rightPadding = caption || children ? 'pr-[5px]' : 'pr-[10px]';
|
|
@@ -1769,6 +1774,7 @@ function MenuItem(_a) {
|
|
|
1769
1774
|
var currentZIndex = zIndex + 10;
|
|
1770
1775
|
return (React.createElement("div", { className: "group/main relative cursor-pointer first:rounded-t-radius-sm first:pt-[6px] last:rounded-b-radius-sm last:pb-[6px]", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
|
|
1771
1776
|
React.createElement("div", __assign({ className: "relative flex items-center py-[5px] hover:bg-bia-blue-pastel ".concat(itemClass), role: "button", tabIndex: 0, onClick: function (e) {
|
|
1777
|
+
inheritedOnClick();
|
|
1772
1778
|
onClick(e);
|
|
1773
1779
|
}, onKeyDown: function () { }, style: {
|
|
1774
1780
|
zIndex: isHovered ? currentZIndex : currentZIndex + 15,
|
|
@@ -1778,7 +1784,7 @@ function MenuItem(_a) {
|
|
|
1778
1784
|
React.createElement("div", { className: "ml-auto flex items-center" },
|
|
1779
1785
|
children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey" })),
|
|
1780
1786
|
children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] text-bia-coolgrey" }, caption)))),
|
|
1781
|
-
children && (React.createElement(MenuContainer, { open: isHovered, onClose: onClose, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex + 10 }, children))));
|
|
1787
|
+
children && (React.createElement(MenuContainer, { open: isHovered, onClose: onClose, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex + 10, onClickItem: function () { return inheritedOnClick(); } }, children))));
|
|
1782
1788
|
}
|
|
1783
1789
|
MenuItem.defaultProps = {
|
|
1784
1790
|
className: '',
|
|
@@ -2350,7 +2356,7 @@ function LiveSearch(_a) {
|
|
|
2350
2356
|
setIsDropUp(false);
|
|
2351
2357
|
}
|
|
2352
2358
|
}, [isOpen]);
|
|
2353
|
-
var filteredOptions = options.filter(function (item) {
|
|
2359
|
+
var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (item) {
|
|
2354
2360
|
return item.label.toLowerCase().includes(value.label.toLowerCase());
|
|
2355
2361
|
});
|
|
2356
2362
|
var handleInputChange = function (e) {
|