bianic-ui 1.13.1 → 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 CHANGED
@@ -1675,7 +1675,10 @@ var FileTree = function (_a) {
1675
1675
  }),
1676
1676
  isOpenContMenu && (React.createElement("div", { style: menuStyle, ref: popupRef, className: "bianic-filetree-contextmenu" }, React.isValidElement(contextMenu)
1677
1677
  ? // Kirimkan handleItemClick sebagai props onClick ke setiap MenuItem
1678
- React.cloneElement(contextMenu, { isWithOverlay: false })
1678
+ React.cloneElement(contextMenu, {
1679
+ isWithOverlay: false,
1680
+ onClickItem: function () { return setIsOpenContMenu(false); },
1681
+ })
1679
1682
  : contextMenu))));
1680
1683
  };
1681
1684
  var TreeItem = function (_a) {
@@ -1724,7 +1727,7 @@ var TreeItem = function (_a) {
1724
1727
  };
1725
1728
 
1726
1729
  var MenuContainer = React.forwardRef(function MenuContainer(propsComp, ref) {
1727
- var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.zIndex, zIndex = _f === void 0 ? 100 : _f, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex"]);
1730
+ var _a = propsComp.isTopFlat, isTopFlat = _a === void 0 ? false : _a, children = propsComp.children, _b = propsComp.open, open = _b === void 0 ? true : _b, _c = propsComp.onClose, onClose = _c === void 0 ? function () { } : _c, _d = propsComp.className, className = _d === void 0 ? '' : _d, _e = propsComp.isWithOverlay, isWithOverlay = _e === void 0 ? true : _e, _f = propsComp.zIndex, zIndex = _f === void 0 ? 100 : _f, _g = propsComp.onClickItem, onClickItem = _g === void 0 ? function () { } : _g, restProps = __rest(propsComp, ["isTopFlat", "children", "open", "onClose", "className", "isWithOverlay", "zIndex", "onClickItem"]);
1728
1731
  var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
1729
1732
  return (open && (React.createElement(React.Fragment, null,
1730
1733
  isWithOverlay && (React.createElement("div", { className: "bianic-menu-overlay fixed left-0 top-0 z-0 h-screen w-screen", onClick: function () { return onClose(); }, style: { zIndex: zIndex } })),
@@ -1736,6 +1739,7 @@ var MenuContainer = React.forwardRef(function MenuContainer(propsComp, ref) {
1736
1739
  React.cloneElement(child, {
1737
1740
  onClose: function () { return onClose(); },
1738
1741
  zIndex: zIndex + 10,
1742
+ inheritedOnClick: function () { return onClickItem(); },
1739
1743
  })
1740
1744
  : child;
1741
1745
  })))));
@@ -1745,9 +1749,9 @@ MenuContainer.defaultProps = {
1745
1749
  };
1746
1750
 
1747
1751
  function MenuItem(_a) {
1748
- var _b = _a.className, className = _b === void 0 ? '' : _b, label = _a.label, _c = _a.onClick, onClick = _c === void 0 ? function () { } : _c, _d = _a.caption, caption = _d === void 0 ? undefined : _d, _e = _a.isChecked, isChecked = _e === void 0 ? undefined : _e, _f = _a.onClose, onClose = _f === void 0 ? function () { } : _f, children = _a.children, _g = _a.zIndex, zIndex = _g === void 0 ? 100 : _g, props = __rest(_a, ["className", "label", "onClick", "caption", "isChecked", "onClose", "children", "zIndex"]);
1749
- var _h = React.useState(false), isHovered = _h[0], setIsHovered = _h[1];
1750
- var _j = React.useState(false), isLeft = _j[0], setIsLeft = _j[1];
1752
+ 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"]);
1753
+ var _j = React.useState(false), isHovered = _j[0], setIsHovered = _j[1];
1754
+ var _k = React.useState(false), isLeft = _k[0], setIsLeft = _k[1];
1751
1755
  var isWithChecked = isChecked !== undefined;
1752
1756
  var leftPadding = isWithChecked ? 'pl-[5px]' : 'pl-[10px]';
1753
1757
  var rightPadding = caption || children ? 'pr-[5px]' : 'pr-[10px]';
@@ -1772,6 +1776,7 @@ function MenuItem(_a) {
1772
1776
  var currentZIndex = zIndex + 10;
1773
1777
  return (React.createElement("div", { className: "group/main relative cursor-pointer first:rounded-t-radius-sm first:pt-[6px] last:rounded-b-radius-sm last:pb-[6px]", onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
1774
1778
  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) {
1779
+ inheritedOnClick();
1775
1780
  onClick(e);
1776
1781
  }, onKeyDown: function () { }, style: {
1777
1782
  zIndex: isHovered ? currentZIndex : currentZIndex + 15,
@@ -1781,7 +1786,7 @@ function MenuItem(_a) {
1781
1786
  React.createElement("div", { className: "ml-auto flex items-center" },
1782
1787
  children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey" })),
1783
1788
  children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] text-bia-coolgrey" }, caption)))),
1784
- children && (React.createElement(MenuContainer, { open: isHovered, onClose: onClose, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex + 10 }, children))));
1789
+ children && (React.createElement(MenuContainer, { open: isHovered, onClose: onClose, className: "absolute top-0 bg-primary-white shadow-[0px_3px_20px_0px_rgba(0,0,0,0.20)] group-first/main:top-[6px] ".concat(translateClass), ref: MenuContRef, zIndex: currentZIndex + 10, onClickItem: function () { return inheritedOnClick(); } }, children))));
1785
1790
  }
1786
1791
  MenuItem.defaultProps = {
1787
1792
  className: '',
@@ -2353,7 +2358,7 @@ function LiveSearch(_a) {
2353
2358
  setIsDropUp(false);
2354
2359
  }
2355
2360
  }, [isOpen]);
2356
- var filteredOptions = options.filter(function (item) {
2361
+ var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (item) {
2357
2362
  return item.label.toLowerCase().includes(value.label.toLowerCase());
2358
2363
  });
2359
2364
  var handleInputChange = function (e) {
@@ -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
@@ -1673,7 +1673,10 @@ var FileTree = function (_a) {
1673
1673
  }),
1674
1674
  isOpenContMenu && (React.createElement("div", { style: menuStyle, ref: popupRef, className: "bianic-filetree-contextmenu" }, React.isValidElement(contextMenu)
1675
1675
  ? // Kirimkan handleItemClick sebagai props onClick ke setiap MenuItem
1676
- cloneElement(contextMenu, { isWithOverlay: false })
1676
+ cloneElement(contextMenu, {
1677
+ isWithOverlay: false,
1678
+ onClickItem: function () { return setIsOpenContMenu(false); },
1679
+ })
1677
1680
  : contextMenu))));
1678
1681
  };
1679
1682
  var TreeItem = function (_a) {
@@ -1722,7 +1725,7 @@ var TreeItem = function (_a) {
1722
1725
  };
1723
1726
 
1724
1727
  var MenuContainer = forwardRef(function MenuContainer(propsComp, ref) {
1725
- 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"]);
1726
1729
  var radiusClass = "rounded-b-radius-sm ".concat(!isTopFlat && 'rounded-t-radius-sm');
1727
1730
  return (open && (React.createElement(React.Fragment, null,
1728
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 } })),
@@ -1734,6 +1737,7 @@ var MenuContainer = forwardRef(function MenuContainer(propsComp, ref) {
1734
1737
  cloneElement(child, {
1735
1738
  onClose: function () { return onClose(); },
1736
1739
  zIndex: zIndex + 10,
1740
+ inheritedOnClick: function () { return onClickItem(); },
1737
1741
  })
1738
1742
  : child;
1739
1743
  })))));
@@ -1743,9 +1747,9 @@ MenuContainer.defaultProps = {
1743
1747
  };
1744
1748
 
1745
1749
  function MenuItem(_a) {
1746
- 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"]);
1747
- var _h = useState(false), isHovered = _h[0], setIsHovered = _h[1];
1748
- var _j = useState(false), isLeft = _j[0], setIsLeft = _j[1];
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];
1749
1753
  var isWithChecked = isChecked !== undefined;
1750
1754
  var leftPadding = isWithChecked ? 'pl-[5px]' : 'pl-[10px]';
1751
1755
  var rightPadding = caption || children ? 'pr-[5px]' : 'pr-[10px]';
@@ -1770,6 +1774,7 @@ function MenuItem(_a) {
1770
1774
  var currentZIndex = zIndex + 10;
1771
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); } },
1772
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();
1773
1778
  onClick(e);
1774
1779
  }, onKeyDown: function () { }, style: {
1775
1780
  zIndex: isHovered ? currentZIndex : currentZIndex + 15,
@@ -1779,7 +1784,7 @@ function MenuItem(_a) {
1779
1784
  React.createElement("div", { className: "ml-auto flex items-center" },
1780
1785
  children && (React.createElement(TbChevronRight, { className: "ml-[10px] text-bia-coolgrey" })),
1781
1786
  children === undefined && caption && (React.createElement("span", { className: "ml-[30px] whitespace-nowrap text-[11px] text-bia-coolgrey" }, caption)))),
1782
- 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))));
1783
1788
  }
1784
1789
  MenuItem.defaultProps = {
1785
1790
  className: '',
@@ -2351,7 +2356,7 @@ function LiveSearch(_a) {
2351
2356
  setIsDropUp(false);
2352
2357
  }
2353
2358
  }, [isOpen]);
2354
- var filteredOptions = options.filter(function (item) {
2359
+ var filteredOptions = options === null || options === void 0 ? void 0 : options.filter(function (item) {
2355
2360
  return item.label.toLowerCase().includes(value.label.toLowerCase());
2356
2361
  });
2357
2362
  var handleInputChange = function (e) {
@@ -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/index.d.ts CHANGED
@@ -175,12 +175,14 @@ interface MenuContainerProps extends ComponentPropsWithRef<'div'> {
175
175
  className?: string;
176
176
  isWithOverlay?: boolean;
177
177
  zIndex?: number;
178
+ onClickItem?: () => void;
178
179
  }
179
180
  declare const MenuContainer: React$1.ForwardRefExoticComponent<Omit<MenuContainerProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
180
181
 
181
182
  interface MenuItemProps extends ComponentPropsWithoutRef<'div'> {
182
183
  className?: string;
183
184
  onClick?: (event: React$1.MouseEvent<HTMLDivElement>) => void;
185
+ inheritedOnClick?: () => void;
184
186
  label: string;
185
187
  isChecked?: boolean | undefined;
186
188
  caption?: string | undefined;
@@ -188,7 +190,7 @@ interface MenuItemProps extends ComponentPropsWithoutRef<'div'> {
188
190
  onClose?: () => void;
189
191
  zIndex?: number;
190
192
  }
191
- declare function MenuItem({ className, label, onClick, caption, isChecked, onClose, children, zIndex, ...props }: MenuItemProps): React$1.JSX.Element;
193
+ declare function MenuItem({ className, label, onClick, caption, isChecked, onClose, children, zIndex, inheritedOnClick, ...props }: MenuItemProps): React$1.JSX.Element;
192
194
  declare namespace MenuItem {
193
195
  var defaultProps: {
194
196
  className: string;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "@biaenergi:registry": "https://gitlab.com/api/v4/projects/50905269/packages/npm/"
5
5
  },
6
- "version": "1.13.1",
6
+ "version": "1.13.2",
7
7
  "description": "Design Language System develop by BIAENERGI",
8
8
  "scripts": {
9
9
  "rollup": "rollup -c",