@loomhq/lens 10.24.1 → 10.25.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.
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const IconButtonBox: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, IconButtonBoxProps, object>;
|
|
3
|
-
declare const IconButton: ({ altText, icon, onClick, iconColor, isDisabled, size, ...props }: IconButtonProps & React.ComponentProps<typeof IconButtonBox>) => JSX.Element;
|
|
3
|
+
declare const IconButton: ({ altText, icon, onClick, iconColor, isActive, isDisabled, size, ...props }: IconButtonProps & React.ComponentProps<typeof IconButtonBox>) => JSX.Element;
|
|
4
4
|
declare type IconButtonProps = {
|
|
5
5
|
altText: string;
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
onClick?: React.ReactEventHandler;
|
|
8
8
|
iconColor?: string;
|
|
9
|
+
isActive?: boolean;
|
|
9
10
|
isDisabled?: boolean;
|
|
10
11
|
size?: 'small' | 'medium';
|
|
11
12
|
};
|
|
12
13
|
declare type IconButtonBoxProps = {
|
|
13
14
|
size?: 'small' | 'medium';
|
|
15
|
+
isActive?: boolean;
|
|
14
16
|
};
|
|
15
17
|
export default IconButton;
|
|
@@ -24,7 +24,7 @@ const sizeStyles = {
|
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
export const IconButtonBox = styled.button `
|
|
27
|
-
background-color: transparent;
|
|
27
|
+
background-color: ${props => props.isActive ? getColorValue('backgroundActive') : 'transparent'};
|
|
28
28
|
border: none;
|
|
29
29
|
appearance: none;
|
|
30
30
|
cursor: pointer;
|
|
@@ -42,7 +42,7 @@ export const IconButtonBox = styled.button `
|
|
|
42
42
|
|
|
43
43
|
&:hover {
|
|
44
44
|
transition: 0.3s background-color;
|
|
45
|
-
background-color: ${getColorValue('backgroundHover')};
|
|
45
|
+
background-color: ${props => getColorValue(props.isActive ? 'backgroundActive' : 'backgroundHover')};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
&:active {
|
|
@@ -74,8 +74,8 @@ export const IconButtonBox = styled.button `
|
|
|
74
74
|
}
|
|
75
75
|
`;
|
|
76
76
|
const IconButton = (_a) => {
|
|
77
|
-
var { altText, icon, onClick, iconColor = 'body', isDisabled, size = 'medium' } = _a, props = __rest(_a, ["altText", "icon", "onClick", "iconColor", "isDisabled", "size"]);
|
|
78
|
-
return (React.createElement(IconButtonBox, Object.assign({ "aria-label": altText, onClick: onClick, disabled: isDisabled, size: size }, props),
|
|
77
|
+
var { altText, icon, onClick, iconColor = 'body', isActive, isDisabled, size = 'medium' } = _a, props = __rest(_a, ["altText", "icon", "onClick", "iconColor", "isActive", "isDisabled", "size"]);
|
|
78
|
+
return (React.createElement(IconButtonBox, Object.assign({ "aria-label": altText, onClick: onClick, isActive: isActive, disabled: isDisabled, size: size }, props),
|
|
79
79
|
React.createElement(Icon, { icon: icon, size: sizeStyles[size].iconSize, color: isDisabled ? 'disabledContent' : iconColor })));
|
|
80
80
|
};
|
|
81
81
|
export default IconButton;
|