carbon-react 119.4.2 → 119.5.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.
- package/esm/components/button-bar/button-bar.style.js +43 -5
- package/esm/components/button-minor/button-minor.component.d.ts +1 -1
- package/esm/components/button-minor/button-minor.component.js +20 -6
- package/esm/components/button-minor/button-minor.style.js +1 -1
- package/esm/components/icon/icon-config.js +4 -4
- package/lib/components/button-bar/button-bar.style.js +43 -5
- package/lib/components/button-minor/button-minor.component.d.ts +1 -1
- package/lib/components/button-minor/button-minor.component.js +22 -6
- package/lib/components/button-minor/button-minor.style.js +1 -1
- package/lib/components/icon/icon-config.js +4 -4
- package/package.json +1 -1
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { space } from "styled-system";
|
|
3
3
|
import BaseTheme from "../../style/themes/base";
|
|
4
|
+
import StyledButton from "../button/button.style";
|
|
4
5
|
import StyledIcon from "../icon/icon.style";
|
|
6
|
+
import StyledIconButton from "../icon-button/icon-button.style";
|
|
7
|
+
const commonHoverStyles = `
|
|
8
|
+
background-color: var(--colorsActionMajor600);
|
|
9
|
+
border-color: var(--colorsActionMajor600);
|
|
10
|
+
`;
|
|
5
11
|
const StyledButtonBar = styled.div`
|
|
6
12
|
${space}
|
|
7
|
-
|
|
8
13
|
${_ref => {
|
|
9
14
|
let {
|
|
10
15
|
fullWidth,
|
|
@@ -26,17 +31,14 @@ const StyledButtonBar = styled.div`
|
|
|
26
31
|
|
|
27
32
|
button {
|
|
28
33
|
margin: 0;
|
|
29
|
-
border: 2px solid var(--colorsActionMajor500);
|
|
30
34
|
|
|
31
35
|
:not(:first-child):not(:last-child) {
|
|
32
36
|
border-radius: var(--borderRadius000);
|
|
33
37
|
}
|
|
34
|
-
|
|
35
38
|
:first-child:not(:last-child) {
|
|
36
39
|
border-top-right-radius: var(--borderRadius000);
|
|
37
40
|
border-bottom-right-radius: var(--borderRadius000);
|
|
38
41
|
}
|
|
39
|
-
|
|
40
42
|
:last-child:not(:first-child) {
|
|
41
43
|
border-top-left-radius: var(--borderRadius000);
|
|
42
44
|
border-bottom-left-radius: var(--borderRadius000);
|
|
@@ -53,7 +55,6 @@ const StyledButtonBar = styled.div`
|
|
|
53
55
|
&:focus {
|
|
54
56
|
position: relative;
|
|
55
57
|
z-index: 2;
|
|
56
|
-
border-right-color: var(--colorsActionMajor500);
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
&:hover {
|
|
@@ -63,7 +64,9 @@ const StyledButtonBar = styled.div`
|
|
|
63
64
|
& + button {
|
|
64
65
|
border-left-color: var(--colorsActionMajor600);
|
|
65
66
|
}
|
|
67
|
+
|
|
66
68
|
& ${StyledIcon} {
|
|
69
|
+
${commonHoverStyles}
|
|
67
70
|
color: white;
|
|
68
71
|
}
|
|
69
72
|
}
|
|
@@ -72,6 +75,41 @@ const StyledButtonBar = styled.div`
|
|
|
72
75
|
color: var(--colorsActionMajor500);
|
|
73
76
|
}
|
|
74
77
|
}
|
|
78
|
+
|
|
79
|
+
[data-component="button"] {
|
|
80
|
+
:hover {
|
|
81
|
+
${commonHoverStyles}
|
|
82
|
+
& + ${StyledButton} {
|
|
83
|
+
border-left-color: var(--colorsActionMajor600);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
[data-component="button-minor"] {
|
|
89
|
+
& ${StyledIcon} {
|
|
90
|
+
color: var(--colorsActionMinor500);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[data-component="button-minor"] {
|
|
95
|
+
:hover {
|
|
96
|
+
color: var(--colorsActionMinorYang100);
|
|
97
|
+
background-color: var(--colorsActionMinor500);
|
|
98
|
+
border-color: var(--colorsActionMinor500);
|
|
99
|
+
|
|
100
|
+
& + ${StyledButton} {
|
|
101
|
+
border-left-color: var(--colorsActionMinor500);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
${StyledIconButton} {
|
|
107
|
+
border: 2px solid var(--colorsActionMajor500);
|
|
108
|
+
|
|
109
|
+
:focus {
|
|
110
|
+
border-right-color: var(--colorsActionMajor500);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
75
113
|
`;
|
|
76
114
|
}}
|
|
77
115
|
`;
|
|
@@ -5,7 +5,7 @@ export interface ButtonMinorProps extends ButtonProps {
|
|
|
5
5
|
isInPassword?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const ButtonMinor: {
|
|
8
|
-
({ buttonType, size,
|
|
8
|
+
({ buttonType: buttonTypeProp, size: sizeProp, iconPosition: iconPositionProp, fullWidth: fullWidthProp, ...rest }: ButtonMinorProps): React.JSX.Element;
|
|
9
9
|
displayName: string;
|
|
10
10
|
};
|
|
11
11
|
export default ButtonMinor;
|
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { useContext } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import StyledButtonMinor from "./button-minor.style";
|
|
5
|
+
import { ButtonBarContext } from "../button-bar/button-bar.component";
|
|
5
6
|
export const ButtonMinor = _ref => {
|
|
6
7
|
let {
|
|
7
|
-
buttonType = "secondary",
|
|
8
|
-
size = "medium",
|
|
9
|
-
|
|
8
|
+
buttonType: buttonTypeProp = "secondary",
|
|
9
|
+
size: sizeProp = "medium",
|
|
10
|
+
iconPosition: iconPositionProp = "before",
|
|
11
|
+
fullWidth: fullWidthProp = false,
|
|
10
12
|
...rest
|
|
11
13
|
} = _ref;
|
|
14
|
+
const {
|
|
15
|
+
buttonType: buttonTypeContext,
|
|
16
|
+
size: sizeContext,
|
|
17
|
+
iconPosition: iconPositionContext,
|
|
18
|
+
fullWidth: fullWidthContext
|
|
19
|
+
} = useContext(ButtonBarContext);
|
|
20
|
+
const buttonType = buttonTypeContext || buttonTypeProp;
|
|
21
|
+
const size = sizeContext || sizeProp;
|
|
22
|
+
const iconPosition = iconPositionContext || iconPositionProp;
|
|
23
|
+
const fullWidth = fullWidthContext || fullWidthProp;
|
|
12
24
|
return /*#__PURE__*/React.createElement(StyledButtonMinor, _extends({
|
|
25
|
+
"data-component": "button-minor",
|
|
13
26
|
size: size,
|
|
14
|
-
|
|
15
|
-
|
|
27
|
+
fullWidth: fullWidth,
|
|
28
|
+
iconPosition: iconPosition,
|
|
29
|
+
buttonType: buttonType
|
|
16
30
|
}, rest));
|
|
17
31
|
};
|
|
18
32
|
ButtonMinor.displayName = "ButtonMinor";
|
|
@@ -12,10 +12,10 @@ const dlsConfig = {
|
|
|
12
12
|
circle: "50%"
|
|
13
13
|
},
|
|
14
14
|
iconSize: {
|
|
15
|
-
small: "
|
|
16
|
-
medium: "
|
|
17
|
-
large: "
|
|
18
|
-
"extra-large": "
|
|
15
|
+
small: "var(--sizing250)",
|
|
16
|
+
medium: "var(--sizing300)",
|
|
17
|
+
large: "var(--sizing400)",
|
|
18
|
+
"extra-large": "var(--sizing600)"
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
export const ICON_TOOLTIP_POSITIONS = ["bottom", "left", "right", "top"];
|
|
@@ -7,13 +7,18 @@ exports.default = void 0;
|
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _styledSystem = require("styled-system");
|
|
9
9
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
10
|
+
var _button = _interopRequireDefault(require("../button/button.style"));
|
|
10
11
|
var _icon = _interopRequireDefault(require("../icon/icon.style"));
|
|
12
|
+
var _iconButton = _interopRequireDefault(require("../icon-button/icon-button.style"));
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
const commonHoverStyles = `
|
|
17
|
+
background-color: var(--colorsActionMajor600);
|
|
18
|
+
border-color: var(--colorsActionMajor600);
|
|
19
|
+
`;
|
|
14
20
|
const StyledButtonBar = _styledComponents.default.div`
|
|
15
21
|
${_styledSystem.space}
|
|
16
|
-
|
|
17
22
|
${_ref => {
|
|
18
23
|
let {
|
|
19
24
|
fullWidth,
|
|
@@ -35,17 +40,14 @@ const StyledButtonBar = _styledComponents.default.div`
|
|
|
35
40
|
|
|
36
41
|
button {
|
|
37
42
|
margin: 0;
|
|
38
|
-
border: 2px solid var(--colorsActionMajor500);
|
|
39
43
|
|
|
40
44
|
:not(:first-child):not(:last-child) {
|
|
41
45
|
border-radius: var(--borderRadius000);
|
|
42
46
|
}
|
|
43
|
-
|
|
44
47
|
:first-child:not(:last-child) {
|
|
45
48
|
border-top-right-radius: var(--borderRadius000);
|
|
46
49
|
border-bottom-right-radius: var(--borderRadius000);
|
|
47
50
|
}
|
|
48
|
-
|
|
49
51
|
:last-child:not(:first-child) {
|
|
50
52
|
border-top-left-radius: var(--borderRadius000);
|
|
51
53
|
border-bottom-left-radius: var(--borderRadius000);
|
|
@@ -62,7 +64,6 @@ const StyledButtonBar = _styledComponents.default.div`
|
|
|
62
64
|
&:focus {
|
|
63
65
|
position: relative;
|
|
64
66
|
z-index: 2;
|
|
65
|
-
border-right-color: var(--colorsActionMajor500);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
&:hover {
|
|
@@ -72,7 +73,9 @@ const StyledButtonBar = _styledComponents.default.div`
|
|
|
72
73
|
& + button {
|
|
73
74
|
border-left-color: var(--colorsActionMajor600);
|
|
74
75
|
}
|
|
76
|
+
|
|
75
77
|
& ${_icon.default} {
|
|
78
|
+
${commonHoverStyles}
|
|
76
79
|
color: white;
|
|
77
80
|
}
|
|
78
81
|
}
|
|
@@ -81,6 +84,41 @@ const StyledButtonBar = _styledComponents.default.div`
|
|
|
81
84
|
color: var(--colorsActionMajor500);
|
|
82
85
|
}
|
|
83
86
|
}
|
|
87
|
+
|
|
88
|
+
[data-component="button"] {
|
|
89
|
+
:hover {
|
|
90
|
+
${commonHoverStyles}
|
|
91
|
+
& + ${_button.default} {
|
|
92
|
+
border-left-color: var(--colorsActionMajor600);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
[data-component="button-minor"] {
|
|
98
|
+
& ${_icon.default} {
|
|
99
|
+
color: var(--colorsActionMinor500);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[data-component="button-minor"] {
|
|
104
|
+
:hover {
|
|
105
|
+
color: var(--colorsActionMinorYang100);
|
|
106
|
+
background-color: var(--colorsActionMinor500);
|
|
107
|
+
border-color: var(--colorsActionMinor500);
|
|
108
|
+
|
|
109
|
+
& + ${_button.default} {
|
|
110
|
+
border-left-color: var(--colorsActionMinor500);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
${_iconButton.default} {
|
|
116
|
+
border: 2px solid var(--colorsActionMajor500);
|
|
117
|
+
|
|
118
|
+
:focus {
|
|
119
|
+
border-right-color: var(--colorsActionMajor500);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
84
122
|
`;
|
|
85
123
|
}}
|
|
86
124
|
`;
|
|
@@ -5,7 +5,7 @@ export interface ButtonMinorProps extends ButtonProps {
|
|
|
5
5
|
isInPassword?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const ButtonMinor: {
|
|
8
|
-
({ buttonType, size,
|
|
8
|
+
({ buttonType: buttonTypeProp, size: sizeProp, iconPosition: iconPositionProp, fullWidth: fullWidthProp, ...rest }: ButtonMinorProps): React.JSX.Element;
|
|
9
9
|
displayName: string;
|
|
10
10
|
};
|
|
11
11
|
export default ButtonMinor;
|
|
@@ -4,22 +4,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.ButtonMinor = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _buttonMinor = _interopRequireDefault(require("./button-minor.style"));
|
|
10
|
+
var _buttonBar = require("../button-bar/button-bar.component");
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
14
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
12
15
|
const ButtonMinor = _ref => {
|
|
13
16
|
let {
|
|
14
|
-
buttonType = "secondary",
|
|
15
|
-
size = "medium",
|
|
16
|
-
|
|
17
|
+
buttonType: buttonTypeProp = "secondary",
|
|
18
|
+
size: sizeProp = "medium",
|
|
19
|
+
iconPosition: iconPositionProp = "before",
|
|
20
|
+
fullWidth: fullWidthProp = false,
|
|
17
21
|
...rest
|
|
18
22
|
} = _ref;
|
|
23
|
+
const {
|
|
24
|
+
buttonType: buttonTypeContext,
|
|
25
|
+
size: sizeContext,
|
|
26
|
+
iconPosition: iconPositionContext,
|
|
27
|
+
fullWidth: fullWidthContext
|
|
28
|
+
} = (0, _react.useContext)(_buttonBar.ButtonBarContext);
|
|
29
|
+
const buttonType = buttonTypeContext || buttonTypeProp;
|
|
30
|
+
const size = sizeContext || sizeProp;
|
|
31
|
+
const iconPosition = iconPositionContext || iconPositionProp;
|
|
32
|
+
const fullWidth = fullWidthContext || fullWidthProp;
|
|
19
33
|
return /*#__PURE__*/_react.default.createElement(_buttonMinor.default, _extends({
|
|
34
|
+
"data-component": "button-minor",
|
|
20
35
|
size: size,
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
fullWidth: fullWidth,
|
|
37
|
+
iconPosition: iconPosition,
|
|
38
|
+
buttonType: buttonType
|
|
23
39
|
}, rest));
|
|
24
40
|
};
|
|
25
41
|
exports.ButtonMinor = ButtonMinor;
|
|
@@ -101,7 +101,7 @@ const StyledButtonMinor = (0, _styledComponents.default)(_button.default)`
|
|
|
101
101
|
} = _ref4;
|
|
102
102
|
return (0, _styledComponents.css)`
|
|
103
103
|
${size === "small" && `
|
|
104
|
-
min-height:
|
|
104
|
+
min-height: var(--sizing400);
|
|
105
105
|
padding: var(--spacing000) var(--spacing100) var(--spacing000)
|
|
106
106
|
var(--spacing100);
|
|
107
107
|
`}
|
|
@@ -18,10 +18,10 @@ const dlsConfig = {
|
|
|
18
18
|
circle: "50%"
|
|
19
19
|
},
|
|
20
20
|
iconSize: {
|
|
21
|
-
small: "
|
|
22
|
-
medium: "
|
|
23
|
-
large: "
|
|
24
|
-
"extra-large": "
|
|
21
|
+
small: "var(--sizing250)",
|
|
22
|
+
medium: "var(--sizing300)",
|
|
23
|
+
large: "var(--sizing400)",
|
|
24
|
+
"extra-large": "var(--sizing600)"
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
const ICON_TOOLTIP_POSITIONS = ["bottom", "left", "right", "top"];
|