pixelize-design-library 1.1.55 → 1.1.56
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.
|
@@ -2,4 +2,4 @@ import React from "react";
|
|
|
2
2
|
import { ButtonGroupIconProps } from "./ButtonGoupIconProps";
|
|
3
3
|
export default function ButtonGroupIcon({ leftIcon, rightIcon, onLeftIconClick, onRightIconClick, buttonText, onButtonClick, onButtongroupClick, size, variant, color, buttonGroupStyle, buttonGroupLeftIconStyle, buttonGroupRightIconStyle, buttonStyle, onBlurLeftIcon, onBlurRightIcon, dropdownOptions, // New prop for dropdown options
|
|
4
4
|
onDropdownOptionClick, // New prop to handle option clicks
|
|
5
|
-
rightIconDropdown, menulistStyle, menuItemStyle, isLoading, }: ButtonGroupIconProps): React.JSX.Element;
|
|
5
|
+
rightIconDropdown, menulistStyle, menuItemStyle, isLoading, divider, }: ButtonGroupIconProps): React.JSX.Element;
|
|
@@ -27,11 +27,12 @@ var react_1 = __importStar(require("react"));
|
|
|
27
27
|
var react_2 = require("@chakra-ui/react");
|
|
28
28
|
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
29
29
|
function ButtonGroupIcon(_a) {
|
|
30
|
+
var _b, _c;
|
|
30
31
|
var leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, onLeftIconClick = _a.onLeftIconClick, onRightIconClick = _a.onRightIconClick, buttonText = _a.buttonText, onButtonClick = _a.onButtonClick, onButtongroupClick = _a.onButtongroupClick, size = _a.size, variant = _a.variant, color = _a.color, buttonGroupStyle = _a.buttonGroupStyle, buttonGroupLeftIconStyle = _a.buttonGroupLeftIconStyle, buttonGroupRightIconStyle = _a.buttonGroupRightIconStyle, buttonStyle = _a.buttonStyle, onBlurLeftIcon = _a.onBlurLeftIcon, onBlurRightIcon = _a.onBlurRightIcon, dropdownOptions = _a.dropdownOptions, // New prop for dropdown options
|
|
31
32
|
onDropdownOptionClick = _a.onDropdownOptionClick, // New prop to handle option clicks
|
|
32
|
-
rightIconDropdown = _a.rightIconDropdown, menulistStyle = _a.menulistStyle, menuItemStyle = _a.menuItemStyle, isLoading = _a.isLoading;
|
|
33
|
+
rightIconDropdown = _a.rightIconDropdown, menulistStyle = _a.menulistStyle, menuItemStyle = _a.menuItemStyle, isLoading = _a.isLoading, _d = _a.divider, divider = _d === void 0 ? true : _d;
|
|
33
34
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
34
|
-
var
|
|
35
|
+
var _e = (0, react_1.useState)(false), isDropdownOpen = _e[0], setIsDropdownOpen = _e[1];
|
|
35
36
|
var handleRightIconClick = function () {
|
|
36
37
|
setIsDropdownOpen(!isDropdownOpen);
|
|
37
38
|
if (onRightIconClick) {
|
|
@@ -57,7 +58,7 @@ function ButtonGroupIcon(_a) {
|
|
|
57
58
|
"&:hover": {
|
|
58
59
|
backgroundColor: theme.colors.primary[400],
|
|
59
60
|
},
|
|
60
|
-
} }, buttonText),
|
|
61
|
+
}, borderLeft: "1px solid ".concat((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[300]), borderRight: "1px solid ".concat((_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[300]) }, buttonText),
|
|
61
62
|
rightIcon && rightIconDropdown ? (react_1.default.createElement(react_2.Menu, { isOpen: isDropdownOpen, onClose: function () { return setIsDropdownOpen(false); } },
|
|
62
63
|
react_1.default.createElement(react_2.MenuButton, { as: react_2.IconButton, "aria-label": "Right icon button", icon: rightIcon, onClick: handleRightIconClick, onBlur: onBlurRightIcon, style: buttonGroupRightIconStyle, sx: {
|
|
63
64
|
backgroundColor: theme.colors.primary[500],
|
|
@@ -66,9 +67,16 @@ function ButtonGroupIcon(_a) {
|
|
|
66
67
|
},
|
|
67
68
|
} }),
|
|
68
69
|
react_1.default.createElement(react_2.Box, { sx: { zIndex: 99 } },
|
|
69
|
-
react_1.default.createElement(react_2.MenuList, { style: menulistStyle }, dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map(function (option, index) {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
react_1.default.createElement(react_2.MenuList, { style: menulistStyle }, dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.map(function (option, index) {
|
|
71
|
+
var _a;
|
|
72
|
+
return (react_1.default.createElement(react_2.MenuItem, { key: index, onClick: function (event) { return handleMenuClick(event, option); }, style: menuItemStyle, borderBottom: divider ? "1px solid ".concat((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.gray[300]) : undefined, sx: {
|
|
73
|
+
"&:last-child": {
|
|
74
|
+
borderBottom: "none",
|
|
75
|
+
},
|
|
76
|
+
} }, option === null || option === void 0 ? void 0 :
|
|
77
|
+
option.image,
|
|
78
|
+
option.label));
|
|
79
|
+
}))))) : (rightIcon && (react_1.default.createElement(react_2.IconButton, { "aria-label": "Right icon button", icon: rightIcon, onClick: onRightIconClick, onBlur: onBlurRightIcon, style: buttonGroupRightIconStyle, sx: {
|
|
72
80
|
backgroundColor: theme.colors.primary[500],
|
|
73
81
|
"&:hover": {
|
|
74
82
|
backgroundColor: theme.colors.primary[400],
|