@wireapp/react-ui-kit 9.64.1 → 9.65.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,4 +1,5 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { ButtonVariant } from '../Button';
|
|
2
3
|
interface ButtonGroupProps {
|
|
3
4
|
children: ReactNode;
|
|
4
5
|
}
|
|
@@ -6,6 +7,7 @@ declare const ButtonGroup: {
|
|
|
6
7
|
({ children }: ButtonGroupProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
8
|
Button: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
8
9
|
icon?: ReactNode;
|
|
10
|
+
variant?: ButtonVariant;
|
|
9
11
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
10
12
|
};
|
|
11
13
|
export { ButtonGroup };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../../src/Inputs/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAAc,SAAS,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["../../../src/Inputs/ButtonGroup/ButtonGroup.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAAc,SAAS,EAAC,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAsB,aAAa,EAAC,MAAM,WAAW,CAAC;AAkC7D,UAAU,gBAAgB;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB;AACD,QAAA,MAAM,WAAW;mBAAgB,gBAAgB;;eAPxC,SAAS;kBACN,aAAa;;CAUxB,CAAC;AA2BF,OAAO,EAAC,WAAW,EAAC,CAAC"}
|
|
@@ -21,24 +21,19 @@ const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
23
|
const react_1 = require("react");
|
|
24
|
-
const
|
|
24
|
+
const Button_1 = require("../Button");
|
|
25
|
+
const Button_styles_1 = require("../Button/Button.styles");
|
|
25
26
|
const buttonGroupStyle = () => ({
|
|
26
27
|
display: 'flex',
|
|
27
28
|
alignItems: 'center',
|
|
28
29
|
});
|
|
29
|
-
const
|
|
30
|
+
const groupedButtonStyle = (theme, props) => ({
|
|
30
31
|
height: '32px',
|
|
31
32
|
borderRadius: '12px',
|
|
32
33
|
padding: '0 12px',
|
|
33
|
-
background: Identity_1.COLOR_V2.WHITE,
|
|
34
|
-
border: `1px solid ${Identity_1.COLOR_V2.GRAY_40}`,
|
|
35
34
|
cursor: 'pointer',
|
|
36
35
|
display: 'flex',
|
|
37
36
|
alignItems: 'center',
|
|
38
|
-
backgroundColor: disabled ? Identity_1.COLOR_V2.GRAY_20 : Identity_1.COLOR_V2.WHITE,
|
|
39
|
-
svg: {
|
|
40
|
-
fill: disabled ? Identity_1.COLOR_V2.GRAY_70 : Identity_1.COLOR_V2.BLACK,
|
|
41
|
-
},
|
|
42
37
|
'&:not(:last-child)': {
|
|
43
38
|
borderTopRightRadius: '0',
|
|
44
39
|
borderBottomRightRadius: '0',
|
|
@@ -50,29 +45,12 @@ const buttonStyle = (_, { disabled = false }) => ({
|
|
|
50
45
|
'&:first-child:last-child': {
|
|
51
46
|
borderRadius: '0',
|
|
52
47
|
},
|
|
53
|
-
...(
|
|
54
|
-
'&:hover, &:focus': {
|
|
55
|
-
backgroundColor: Identity_1.COLOR_V2.GRAY_20,
|
|
56
|
-
},
|
|
57
|
-
'&:hover': {
|
|
58
|
-
borderColor: Identity_1.COLOR_V2.GRAY_50,
|
|
59
|
-
},
|
|
60
|
-
'&:focus': {
|
|
61
|
-
borderColor: Identity_1.COLOR_V2.GRAY_60,
|
|
62
|
-
},
|
|
63
|
-
'&:active': {
|
|
64
|
-
backgroundColor: Identity_1.COLOR_V2.BLUE_LIGHT_50,
|
|
65
|
-
borderColor: Identity_1.COLOR_V2.BLUE_LIGHT_300,
|
|
66
|
-
svg: {
|
|
67
|
-
fill: Identity_1.COLOR_V2.BLUE,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
}),
|
|
48
|
+
...(0, Button_styles_1.buttonStyle)(theme, props),
|
|
71
49
|
});
|
|
72
50
|
const ButtonGroup = ({ children }) => ((0, jsx_runtime_1.jsx)("div", { css: (theme) => buttonGroupStyle(theme), role: "group", "aria-label": "Button Group", children: children }));
|
|
73
51
|
exports.ButtonGroup = ButtonGroup;
|
|
74
|
-
const
|
|
75
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
52
|
+
const GroupedButton = (0, react_1.forwardRef)(({ children, icon, ...props }, ref) => {
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)(Button_1.Button, { ref: ref, css: (theme) => groupedButtonStyle(theme, props), ...props, children: [icon, children && ((0, jsx_runtime_1.jsx)("span", { css: (theme) => ({
|
|
76
54
|
marginLeft: !!icon && '6px',
|
|
77
55
|
fontSize: theme.fontSizes.small,
|
|
78
56
|
fontWeight: 'bold',
|
|
@@ -80,5 +58,5 @@ const Button = (0, react_1.forwardRef)(({ children, icon, ...props }, ref) => {
|
|
|
80
58
|
letterSpacing: '0.25px',
|
|
81
59
|
}), children: children }))] }));
|
|
82
60
|
});
|
|
83
|
-
|
|
84
|
-
ButtonGroup.Button =
|
|
61
|
+
GroupedButton.displayName = 'Button';
|
|
62
|
+
ButtonGroup.Button = GroupedButton;
|
package/package.json
CHANGED