carbon-react 102.13.2 → 102.16.1
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/lib/__internal__/input/input-presentation.style.d.ts +0 -1
- package/lib/__internal__/input/input-presentation.style.js +13 -22
- package/lib/__internal__/input/input-sizes.style.d.ts +0 -15
- package/lib/__internal__/input/input-sizes.style.js +6 -15
- package/lib/__internal__/input/input.style.js +7 -20
- package/lib/__internal__/input-icon-toggle/input-icon-toggle.style.js +2 -2
- package/lib/components/card/card-column/card-column.style.js +2 -6
- package/lib/components/card/card-footer/card-footer.style.js +2 -3
- package/lib/components/card/card-row/card-row.style.js +1 -3
- package/lib/components/card/card.style.js +5 -12
- package/lib/components/drawer/drawer.component.js +28 -14
- package/lib/components/pill/pill.style.config.d.ts +8 -3
- package/lib/components/pill/pill.style.config.js +16 -20
- package/lib/components/pill/pill.style.js +21 -22
- package/lib/style/themes/base/base-theme.config.d.ts +1 -1
- package/lib/style/themes/base/base-theme.config.js +0 -1
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export const StyledInputPresentationContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
2
|
export default InputPresentationStyle;
|
|
3
3
|
declare const InputPresentationStyle: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
-
theme: any;
|
|
5
4
|
error: any;
|
|
6
5
|
warning: any;
|
|
7
6
|
info: any;
|
|
@@ -9,8 +9,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
13
|
-
|
|
14
12
|
var _inputSizes = _interopRequireDefault(require("./input-sizes.style"));
|
|
15
13
|
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -30,9 +28,7 @@ exports.StyledInputPresentationContainer = StyledInputPresentationContainer;
|
|
|
30
28
|
const InputPresentationStyle = _styledComponents.default.div`
|
|
31
29
|
align-items: stretch;
|
|
32
30
|
background: #fff;
|
|
33
|
-
border: 1px solid
|
|
34
|
-
theme
|
|
35
|
-
}) => theme.colors.border};
|
|
31
|
+
border: 1px solid var(--colorsUtilityMajor300);
|
|
36
32
|
box-sizing: border-box;
|
|
37
33
|
cursor: text;
|
|
38
34
|
display: flex;
|
|
@@ -50,21 +46,19 @@ const InputPresentationStyle = _styledComponents.default.div`
|
|
|
50
46
|
}) => _inputSizes.default[size].horizontalPadding};
|
|
51
47
|
|
|
52
48
|
${({
|
|
53
|
-
disabled
|
|
54
|
-
theme
|
|
49
|
+
disabled
|
|
55
50
|
}) => disabled && (0, _styledComponents.css)`
|
|
56
|
-
background:
|
|
57
|
-
border-color:
|
|
51
|
+
background: var(--colorsUtilityDisabled400);
|
|
52
|
+
border-color: var(--colorsUtilityDisabled600);
|
|
58
53
|
cursor: not-allowed;
|
|
59
54
|
`}
|
|
60
55
|
|
|
61
56
|
${({
|
|
62
57
|
hasFocus,
|
|
63
|
-
theme,
|
|
64
58
|
disabled
|
|
65
59
|
}) => hasFocus && !disabled && (0, _styledComponents.css)`
|
|
66
|
-
|
|
67
|
-
outline: 3px solid
|
|
60
|
+
& {
|
|
61
|
+
outline: 3px solid var(--colorsSemanticFocus500);
|
|
68
62
|
z-index: 2;
|
|
69
63
|
}
|
|
70
64
|
`}
|
|
@@ -72,11 +66,10 @@ const InputPresentationStyle = _styledComponents.default.div`
|
|
|
72
66
|
${stylingForValidations}
|
|
73
67
|
|
|
74
68
|
${({
|
|
75
|
-
readOnly
|
|
76
|
-
theme
|
|
69
|
+
readOnly
|
|
77
70
|
}) => readOnly && (0, _styledComponents.css)`
|
|
78
|
-
background-color:
|
|
79
|
-
border-color:
|
|
71
|
+
background-color: var(--colorsUtilityReadOnly400);
|
|
72
|
+
border-color: var(--colorsUtilityReadOnly600);
|
|
80
73
|
`}
|
|
81
74
|
|
|
82
75
|
${({
|
|
@@ -92,7 +85,6 @@ const InputPresentationStyle = _styledComponents.default.div`
|
|
|
92
85
|
`;
|
|
93
86
|
|
|
94
87
|
function stylingForValidations({
|
|
95
|
-
theme,
|
|
96
88
|
error,
|
|
97
89
|
warning,
|
|
98
90
|
info,
|
|
@@ -105,11 +97,11 @@ function stylingForValidations({
|
|
|
105
97
|
}
|
|
106
98
|
|
|
107
99
|
if (error) {
|
|
108
|
-
validationColor =
|
|
100
|
+
validationColor = "var(--colorsSemanticNegative500)";
|
|
109
101
|
} else if (warning) {
|
|
110
|
-
validationColor =
|
|
102
|
+
validationColor = "var(--colorsSemanticCaution500)";
|
|
111
103
|
} else if (info) {
|
|
112
|
-
validationColor =
|
|
104
|
+
validationColor = "var(--colorsSemanticInfo500)";
|
|
113
105
|
} else {
|
|
114
106
|
return "";
|
|
115
107
|
}
|
|
@@ -122,8 +114,7 @@ function stylingForValidations({
|
|
|
122
114
|
}
|
|
123
115
|
|
|
124
116
|
InputPresentationStyle.defaultProps = {
|
|
125
|
-
size: "medium"
|
|
126
|
-
theme: _base.default
|
|
117
|
+
size: "medium"
|
|
127
118
|
};
|
|
128
119
|
InputPresentationStyle.propTypes = {
|
|
129
120
|
align: _propTypes.default.string,
|
|
@@ -1,34 +1,19 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
2
|
namespace small {
|
|
3
3
|
const height: string;
|
|
4
|
-
const verticalPadding: string;
|
|
5
4
|
const horizontalPadding: string;
|
|
6
|
-
const tooltipVerticalOffset: number;
|
|
7
|
-
const tooltipHorizontalOffset: number;
|
|
8
5
|
}
|
|
9
6
|
namespace medium {
|
|
10
7
|
const height_1: string;
|
|
11
8
|
export { height_1 as height };
|
|
12
|
-
const verticalPadding_1: string;
|
|
13
|
-
export { verticalPadding_1 as verticalPadding };
|
|
14
9
|
const horizontalPadding_1: string;
|
|
15
10
|
export { horizontalPadding_1 as horizontalPadding };
|
|
16
|
-
const tooltipVerticalOffset_1: number;
|
|
17
|
-
export { tooltipVerticalOffset_1 as tooltipVerticalOffset };
|
|
18
|
-
const tooltipHorizontalOffset_1: number;
|
|
19
|
-
export { tooltipHorizontalOffset_1 as tooltipHorizontalOffset };
|
|
20
11
|
}
|
|
21
12
|
namespace large {
|
|
22
13
|
const height_2: string;
|
|
23
14
|
export { height_2 as height };
|
|
24
|
-
const verticalPadding_2: string;
|
|
25
|
-
export { verticalPadding_2 as verticalPadding };
|
|
26
15
|
const horizontalPadding_2: string;
|
|
27
16
|
export { horizontalPadding_2 as horizontalPadding };
|
|
28
|
-
const tooltipVerticalOffset_2: number;
|
|
29
|
-
export { tooltipVerticalOffset_2 as tooltipVerticalOffset };
|
|
30
|
-
const tooltipHorizontalOffset_2: number;
|
|
31
|
-
export { tooltipHorizontalOffset_2 as tooltipHorizontalOffset };
|
|
32
17
|
}
|
|
33
18
|
}
|
|
34
19
|
export default _default;
|
|
@@ -6,25 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _default = {
|
|
8
8
|
small: {
|
|
9
|
-
height: "
|
|
10
|
-
|
|
11
|
-
horizontalPadding: "8px",
|
|
12
|
-
tooltipVerticalOffset: 3,
|
|
13
|
-
tooltipHorizontalOffset: 1
|
|
9
|
+
height: "var(--sizing400)",
|
|
10
|
+
horizontalPadding: "var(--spacing100)"
|
|
14
11
|
},
|
|
15
12
|
medium: {
|
|
16
|
-
height: "
|
|
17
|
-
|
|
18
|
-
horizontalPadding: "11px",
|
|
19
|
-
tooltipVerticalOffset: 6,
|
|
20
|
-
tooltipHorizontalOffset: 4
|
|
13
|
+
height: "var(--sizing500)",
|
|
14
|
+
horizontalPadding: "var(--spacing150)"
|
|
21
15
|
},
|
|
22
16
|
large: {
|
|
23
|
-
height: "
|
|
24
|
-
|
|
25
|
-
horizontalPadding: "13px",
|
|
26
|
-
tooltipVerticalOffset: 10,
|
|
27
|
-
tooltipHorizontalOffset: 6
|
|
17
|
+
height: "var(--sizing600)",
|
|
18
|
+
horizontalPadding: "var(--spacing200)"
|
|
28
19
|
}
|
|
29
20
|
};
|
|
30
21
|
exports.default = _default;
|
|
@@ -9,8 +9,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
13
|
-
|
|
14
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
13
|
|
|
16
14
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -20,13 +18,9 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
20
18
|
const StyledInput = _styledComponents.default.input`
|
|
21
19
|
background: transparent;
|
|
22
20
|
border: none;
|
|
23
|
-
color:
|
|
24
|
-
theme
|
|
25
|
-
}) => theme.text.color};
|
|
21
|
+
color: var(--colorsUtilityYin090);
|
|
26
22
|
flex-grow: 1;
|
|
27
|
-
font-size:
|
|
28
|
-
theme
|
|
29
|
-
}) => theme.text.size};
|
|
23
|
+
font-size: var(--fontSizes100);
|
|
30
24
|
outline: none;
|
|
31
25
|
padding: 0;
|
|
32
26
|
margin: 0;
|
|
@@ -44,29 +38,22 @@ const StyledInput = _styledComponents.default.input`
|
|
|
44
38
|
`}
|
|
45
39
|
|
|
46
40
|
&::placeholder {
|
|
47
|
-
color:
|
|
48
|
-
theme
|
|
49
|
-
}) => theme.text.placeholder};
|
|
41
|
+
color: var(--colorsUtilityYin030);
|
|
50
42
|
}
|
|
51
43
|
|
|
52
44
|
${({
|
|
53
|
-
disabled
|
|
54
|
-
theme
|
|
45
|
+
disabled
|
|
55
46
|
}) => disabled && (0, _styledComponents.css)`
|
|
56
|
-
color:
|
|
47
|
+
color: var(--colorsUtilityYin030);
|
|
57
48
|
cursor: not-allowed;
|
|
58
49
|
`}
|
|
59
50
|
|
|
60
51
|
${({
|
|
61
|
-
readOnly
|
|
62
|
-
theme
|
|
52
|
+
readOnly
|
|
63
53
|
}) => readOnly && (0, _styledComponents.css)`
|
|
64
|
-
color:
|
|
54
|
+
color: var(--colorsActionMinorYin090);
|
|
65
55
|
`}
|
|
66
56
|
`;
|
|
67
|
-
StyledInput.defaultProps = {
|
|
68
|
-
theme: _base.default
|
|
69
|
-
};
|
|
70
57
|
StyledInput.propTypes = {
|
|
71
58
|
disabled: _propTypes.default.bool
|
|
72
59
|
};
|
|
@@ -39,8 +39,8 @@ const InputIconToggleStyle = _styledComponents.default.span.attrs(({
|
|
|
39
39
|
${({
|
|
40
40
|
size
|
|
41
41
|
}) => (0, _styledComponents.css)`
|
|
42
|
-
margin-right:
|
|
43
|
-
margin-left:
|
|
42
|
+
margin-right: calc(-1 * ${_inputSizes.default[size].horizontalPadding});
|
|
43
|
+
margin-left: calc(-1 * ${_inputSizes.default[size].horizontalPadding});
|
|
44
44
|
width: ${_inputSizes.default[size].height};
|
|
45
45
|
`}
|
|
46
46
|
|
|
@@ -9,8 +9,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var _base = _interopRequireDefault(require("../../../style/themes/base"));
|
|
13
|
-
|
|
14
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
13
|
|
|
16
14
|
const StyledCardColumn = _styledComponents.default.div`
|
|
@@ -20,12 +18,10 @@ const StyledCardColumn = _styledComponents.default.div`
|
|
|
20
18
|
}) => align};
|
|
21
19
|
`;
|
|
22
20
|
StyledCardColumn.propTypes = {
|
|
23
|
-
align: _propTypes.default.oneOf(["center", "left", "right"])
|
|
24
|
-
theme: _propTypes.default.object
|
|
21
|
+
align: _propTypes.default.oneOf(["center", "left", "right"])
|
|
25
22
|
};
|
|
26
23
|
StyledCardColumn.defaultProps = {
|
|
27
|
-
align: "center"
|
|
28
|
-
theme: _base.default
|
|
24
|
+
align: "center"
|
|
29
25
|
};
|
|
30
26
|
var _default = StyledCardColumn;
|
|
31
27
|
exports.default = _default;
|
|
@@ -38,11 +38,10 @@ const StyledCardFooter = _styledComponents.default.div`
|
|
|
38
38
|
|
|
39
39
|
${({
|
|
40
40
|
spacing,
|
|
41
|
-
theme,
|
|
42
41
|
variant
|
|
43
42
|
}) => (0, _styledComponents.css)`
|
|
44
|
-
background-color: ${variant === "transparent" ? "transparent" :
|
|
45
|
-
border-top:
|
|
43
|
+
background-color: ${variant === "transparent" ? "transparent" : "var(--colorsUtilityMajor025)"};
|
|
44
|
+
border-top: var(--colorsUtilityMajor100);
|
|
46
45
|
border-top-width: 1px;
|
|
47
46
|
border-top-style: solid;
|
|
48
47
|
font-size: 14px;
|
|
@@ -13,8 +13,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
|
|
14
14
|
var _base = _interopRequireDefault(require("../../../style/themes/base"));
|
|
15
15
|
|
|
16
|
-
var _card = require("../card.config");
|
|
17
|
-
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
17
|
|
|
20
18
|
const StyledCardRow = _styledComponents.default.div`
|
|
@@ -22,7 +20,7 @@ const StyledCardRow = _styledComponents.default.div`
|
|
|
22
20
|
display: flex;
|
|
23
21
|
`;
|
|
24
22
|
StyledCardRow.propTypes = {
|
|
25
|
-
|
|
23
|
+
theme: _propTypes.default.object
|
|
26
24
|
};
|
|
27
25
|
StyledCardRow.defaultProps = {
|
|
28
26
|
theme: _base.default
|
|
@@ -31,13 +31,12 @@ const StyledCard = _styledComponents.default.div`
|
|
|
31
31
|
cardWidth,
|
|
32
32
|
interactive,
|
|
33
33
|
draggable,
|
|
34
|
-
spacing
|
|
35
|
-
theme
|
|
34
|
+
spacing
|
|
36
35
|
}) => (0, _styledComponents.css)`
|
|
37
|
-
background-color:
|
|
36
|
+
background-color: var(--colorsUtilityYang100);
|
|
38
37
|
border: none;
|
|
39
|
-
box-shadow:
|
|
40
|
-
color:
|
|
38
|
+
box-shadow: var(--boxShadow050);
|
|
39
|
+
color: var(--colorsUtilityYin090);
|
|
41
40
|
margin: 25px;
|
|
42
41
|
padding: ${paddingSizes[spacing]};
|
|
43
42
|
transition: all 0.3s ease-in-out;
|
|
@@ -51,7 +50,7 @@ const StyledCard = _styledComponents.default.div`
|
|
|
51
50
|
|
|
52
51
|
:hover,
|
|
53
52
|
:focus {
|
|
54
|
-
box-shadow:
|
|
53
|
+
box-shadow: var(--boxShadow100);
|
|
55
54
|
}
|
|
56
55
|
`}
|
|
57
56
|
|
|
@@ -59,11 +58,6 @@ const StyledCard = _styledComponents.default.div`
|
|
|
59
58
|
cursor: move;
|
|
60
59
|
`}
|
|
61
60
|
|
|
62
|
-
/* Fix for IE specific box-shadow display */
|
|
63
|
-
@media all and (-ms-high-contrast: none) {
|
|
64
|
-
box-shadow: ${theme.shadows.cardsIE};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
61
|
::-moz-focus-inner {
|
|
68
62
|
border: 0;
|
|
69
63
|
}
|
|
@@ -75,7 +69,6 @@ StyledCard.defaultProps = {
|
|
|
75
69
|
theme: _base.default
|
|
76
70
|
};
|
|
77
71
|
StyledCard.propTypes = {
|
|
78
|
-
border: _propTypes.default.bool,
|
|
79
72
|
cardWidth: _propTypes.default.string,
|
|
80
73
|
interactive: _propTypes.default.bool,
|
|
81
74
|
draggable: _propTypes.default.bool,
|
|
@@ -55,21 +55,8 @@ const Drawer = ({
|
|
|
55
55
|
const isControlled = (0, _react.useRef)(expanded !== undefined);
|
|
56
56
|
const [isOpening, setIsOpening] = (0, _react.useState)(false);
|
|
57
57
|
const [isClosing, setIsClosing] = (0, _react.useState)(false);
|
|
58
|
-
const [isExpanded, setIsExpanded] = (0, _react.useState)(defaultExpanded);
|
|
58
|
+
const [isExpanded, setIsExpanded] = (0, _react.useState)(isControlled.current ? expanded : defaultExpanded);
|
|
59
59
|
const timer = (0, _react.useRef)();
|
|
60
|
-
(0, _react.useEffect)(() => {
|
|
61
|
-
const message = "Drawer should not switch from uncontrolled to controlled" + " (or vice versa). Decide between using a controlled or uncontrolled Drawer element" + " for the lifetime of the component";
|
|
62
|
-
(0, _invariant.default)(isControlled.current === (expanded !== undefined), message);
|
|
63
|
-
|
|
64
|
-
if (expanded !== undefined) {
|
|
65
|
-
setIsExpanded(expanded);
|
|
66
|
-
}
|
|
67
|
-
}, [expanded]);
|
|
68
|
-
(0, _react.useEffect)(() => {
|
|
69
|
-
return function cleanup() {
|
|
70
|
-
clearTimeout(timer.current);
|
|
71
|
-
};
|
|
72
|
-
}, []);
|
|
73
60
|
const getAnimationDuration = (0, _react.useCallback)(() => {
|
|
74
61
|
if (animationDuration.indexOf("ms") !== -1) {
|
|
75
62
|
const animationTime = animationDuration.substring(0, animationDuration.length - 2);
|
|
@@ -101,6 +88,33 @@ const Drawer = ({
|
|
|
101
88
|
}, timeout);
|
|
102
89
|
}
|
|
103
90
|
}, [getAnimationDuration, isExpanded]);
|
|
91
|
+
|
|
92
|
+
function usePrevious(arg) {
|
|
93
|
+
const ref = (0, _react.useRef)();
|
|
94
|
+
(0, _react.useEffect)(() => {
|
|
95
|
+
ref.current = arg;
|
|
96
|
+
});
|
|
97
|
+
return ref.current;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const previousValue = usePrevious(expanded);
|
|
101
|
+
(0, _react.useEffect)(() => {
|
|
102
|
+
const message = "Drawer should not switch from uncontrolled to controlled" + " (or vice versa). Decide between using a controlled or uncontrolled Drawer element" + " for the lifetime of the component";
|
|
103
|
+
(0, _invariant.default)(isControlled.current === (expanded !== undefined), message);
|
|
104
|
+
|
|
105
|
+
if (isControlled.current && previousValue !== expanded) {
|
|
106
|
+
setIsExpanded(expanded);
|
|
107
|
+
|
|
108
|
+
if (!showControls && ![expanded, previousValue].includes(undefined)) {
|
|
109
|
+
toggleAnimation();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}, [expanded, toggleAnimation, previousValue, showControls]);
|
|
113
|
+
(0, _react.useEffect)(() => {
|
|
114
|
+
return function cleanup() {
|
|
115
|
+
clearTimeout(timer.current);
|
|
116
|
+
};
|
|
117
|
+
}, []);
|
|
104
118
|
const toggleDrawer = (0, _react.useCallback)(ev => {
|
|
105
119
|
setIsExpanded(!isExpanded);
|
|
106
120
|
if (onChange) onChange(ev, !isExpanded);
|
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
declare function _default(
|
|
1
|
+
declare function _default(): {
|
|
2
2
|
status: {
|
|
3
3
|
neutral: {
|
|
4
4
|
varietyColor: string;
|
|
5
5
|
buttonFocus: string;
|
|
6
|
+
content: string;
|
|
6
7
|
};
|
|
7
8
|
negative: {
|
|
8
9
|
varietyColor: string;
|
|
9
10
|
buttonFocus: string;
|
|
11
|
+
content: string;
|
|
10
12
|
};
|
|
11
13
|
warning: {
|
|
12
14
|
varietyColor: string;
|
|
13
15
|
buttonFocus: string;
|
|
16
|
+
content: string;
|
|
14
17
|
};
|
|
15
18
|
positive: {
|
|
16
19
|
varietyColor: string;
|
|
17
20
|
buttonFocus: string;
|
|
21
|
+
content: string;
|
|
18
22
|
};
|
|
19
23
|
};
|
|
20
24
|
tag: {
|
|
21
25
|
primary: {
|
|
22
|
-
varietyColor:
|
|
23
|
-
buttonFocus:
|
|
26
|
+
varietyColor: string;
|
|
27
|
+
buttonFocus: string;
|
|
28
|
+
content: string;
|
|
24
29
|
};
|
|
25
30
|
};
|
|
26
31
|
};
|
|
@@ -5,39 +5,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
const {
|
|
13
|
-
colors,
|
|
14
|
-
pill
|
|
15
|
-
} = _base.default;
|
|
16
|
-
|
|
17
|
-
var _default = theme => {
|
|
8
|
+
var _default = () => {
|
|
18
9
|
return {
|
|
19
10
|
status: {
|
|
20
11
|
neutral: {
|
|
21
|
-
varietyColor:
|
|
22
|
-
buttonFocus:
|
|
12
|
+
varietyColor: "var(--colorsSemanticNeutral500)",
|
|
13
|
+
buttonFocus: "var(--colorsSemanticNeutral600)",
|
|
14
|
+
content: "var(--colorsSemanticNeutralYang100)"
|
|
23
15
|
},
|
|
24
16
|
negative: {
|
|
25
|
-
varietyColor:
|
|
26
|
-
buttonFocus:
|
|
17
|
+
varietyColor: "var(--colorsSemanticNegative500)",
|
|
18
|
+
buttonFocus: "var(--colorsSemanticNegative600)",
|
|
19
|
+
content: "var(--colorsSemanticNegativeYang100)"
|
|
27
20
|
},
|
|
28
21
|
warning: {
|
|
29
|
-
varietyColor:
|
|
30
|
-
buttonFocus:
|
|
22
|
+
varietyColor: "var(--colorsSemanticCaution400)",
|
|
23
|
+
buttonFocus: "var(--colorsSemanticCaution600)",
|
|
24
|
+
content: "var(--colorsSemanticCautionYin090)"
|
|
31
25
|
},
|
|
32
26
|
positive: {
|
|
33
|
-
varietyColor:
|
|
34
|
-
buttonFocus:
|
|
27
|
+
varietyColor: "var(--colorsSemanticPositive500)",
|
|
28
|
+
buttonFocus: "var(--colorsSemanticPositive600)",
|
|
29
|
+
content: "var(--colorsSemanticPositiveYang100)"
|
|
35
30
|
}
|
|
36
31
|
},
|
|
37
32
|
tag: {
|
|
38
33
|
primary: {
|
|
39
|
-
varietyColor:
|
|
40
|
-
buttonFocus:
|
|
34
|
+
varietyColor: "var(--colorsActionMajor500)",
|
|
35
|
+
buttonFocus: "var(--colorsActionMajor600)",
|
|
36
|
+
content: "var(--colorsActionMajorYang100)"
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
39
|
};
|
|
@@ -49,10 +49,6 @@ const PillStyle = _styledComponents.default.span`
|
|
|
49
49
|
size
|
|
50
50
|
}) => {
|
|
51
51
|
const isStatus = pillRole === "status";
|
|
52
|
-
const {
|
|
53
|
-
colors,
|
|
54
|
-
text
|
|
55
|
-
} = _themes.baseTheme;
|
|
56
52
|
const variety = isStatus ? colorVariant : "primary";
|
|
57
53
|
let pillColor;
|
|
58
54
|
let buttonFocusColor;
|
|
@@ -62,16 +58,17 @@ const PillStyle = _styledComponents.default.span`
|
|
|
62
58
|
if (borderColor) {
|
|
63
59
|
pillColor = (0, _color.toColor)(theme, borderColor);
|
|
64
60
|
buttonFocusColor = (0, _polished.shade)(0.2, pillColor);
|
|
61
|
+
contentColor = (0, _polished.meetsContrastGuidelines)(pillColor, theme.compatibility.colorsUtilityYin090).AAA ? "var(--colorsUtilityYin090)" : "var(--colorsUtilityYang100)";
|
|
65
62
|
} else {
|
|
66
63
|
const {
|
|
67
64
|
varietyColor,
|
|
68
|
-
buttonFocus
|
|
65
|
+
buttonFocus,
|
|
66
|
+
content
|
|
69
67
|
} = (0, _pillStyle.default)(theme)[pillRole][variety];
|
|
70
68
|
pillColor = varietyColor;
|
|
71
69
|
buttonFocusColor = buttonFocus;
|
|
70
|
+
contentColor = content;
|
|
72
71
|
}
|
|
73
|
-
|
|
74
|
-
contentColor = (0, _polished.meetsContrastGuidelines)(pillColor, text.color).AAA ? text.color : colors.white;
|
|
75
72
|
} catch (e) {
|
|
76
73
|
// eslint-disable-next-line no-console
|
|
77
74
|
console.error(e);
|
|
@@ -90,10 +87,14 @@ const PillStyle = _styledComponents.default.span`
|
|
|
90
87
|
border: 2px solid ${pillColor};
|
|
91
88
|
height: auto;
|
|
92
89
|
white-space: nowrap;
|
|
90
|
+
color: ${contentColor};
|
|
93
91
|
|
|
94
92
|
${inFill && (0, _styledComponents.css)`
|
|
95
93
|
background-color: ${pillColor};
|
|
96
|
-
|
|
94
|
+
`}
|
|
95
|
+
|
|
96
|
+
${!inFill && (0, _styledComponents.css)`
|
|
97
|
+
color: var(--colorsUtilityYin090);
|
|
97
98
|
`}
|
|
98
99
|
|
|
99
100
|
${size === "S" && (0, _styledComponents.css)`
|
|
@@ -134,21 +135,9 @@ const PillStyle = _styledComponents.default.span`
|
|
|
134
135
|
margin: 0;
|
|
135
136
|
line-height: 16px;
|
|
136
137
|
|
|
137
|
-
${inFill && (0, _styledComponents.css)`
|
|
138
|
-
color: ${contentColor};
|
|
139
|
-
${_icon.default} {
|
|
140
|
-
color: ${contentColor};
|
|
141
|
-
}
|
|
142
|
-
`}
|
|
143
|
-
|
|
144
|
-
${!inFill && (0, _styledComponents.css)`
|
|
145
|
-
background-color: transparent;
|
|
146
|
-
color: ${text.color};
|
|
147
|
-
`}
|
|
148
|
-
|
|
149
138
|
&:focus {
|
|
150
139
|
outline: none;
|
|
151
|
-
box-shadow: 0 0 0 3px
|
|
140
|
+
box-shadow: 0 0 0 3px var(--colorsSemanticFocus500);
|
|
152
141
|
background-color: ${buttonFocusColor};
|
|
153
142
|
& {
|
|
154
143
|
color: ${contentColor};
|
|
@@ -175,12 +164,19 @@ const PillStyle = _styledComponents.default.span`
|
|
|
175
164
|
padding: 0 4px;
|
|
176
165
|
height: unset;
|
|
177
166
|
width: unset;
|
|
167
|
+
color: ${contentColor};
|
|
178
168
|
|
|
179
169
|
&:hover,
|
|
180
170
|
&:focus {
|
|
181
171
|
color: ${contentColor};
|
|
182
172
|
}
|
|
183
173
|
}
|
|
174
|
+
|
|
175
|
+
${!inFill && (0, _styledComponents.css)`
|
|
176
|
+
${_icon.default} {
|
|
177
|
+
color: var(--colorsUtilityYin090);
|
|
178
|
+
}
|
|
179
|
+
`}
|
|
184
180
|
}
|
|
185
181
|
|
|
186
182
|
${size === "S" && (0, _styledComponents.css)`
|
|
@@ -293,7 +289,10 @@ PillStyle.propTypes = {
|
|
|
293
289
|
inFill: _propTypes.default.bool,
|
|
294
290
|
colorVariant: _propTypes.default.oneOf(["neutral", "negative", "positive", "warning"]),
|
|
295
291
|
isDeletable: _propTypes.default.func,
|
|
296
|
-
size: _propTypes.default.oneOf(["S", "M", "L", "XL"])
|
|
292
|
+
size: _propTypes.default.oneOf(["S", "M", "L", "XL"]),
|
|
293
|
+
pillRole: _propTypes.default.oneOf(["tag", "status"]),
|
|
294
|
+
borderColor: _propTypes.default.string,
|
|
295
|
+
theme: _propTypes.default.object
|
|
297
296
|
};
|
|
298
297
|
var _default = PillStyle;
|
|
299
298
|
exports.default = _default;
|
|
@@ -361,7 +361,6 @@ declare function _default(palette: any): {
|
|
|
361
361
|
colorsActionMajor600: any;
|
|
362
362
|
colorsActionDisabled500: any;
|
|
363
363
|
colorsSemanticFocus500: any;
|
|
364
|
-
colorsSemanticPositive500: any;
|
|
365
364
|
colorsSemanticNegative500: any;
|
|
366
365
|
colorsSemanticNegative600: any;
|
|
367
366
|
colorsSemanticCaution500: any;
|
|
@@ -471,6 +470,7 @@ declare function _default(palette: any): {
|
|
|
471
470
|
colorsSemanticNeutralYang100: string;
|
|
472
471
|
colorsSemanticFocus250: string;
|
|
473
472
|
colorsSemanticFocusTransparent: string;
|
|
473
|
+
colorsSemanticPositive500: string;
|
|
474
474
|
colorsSemanticPositive600: string;
|
|
475
475
|
colorsSemanticPositiveTransparent: string;
|
|
476
476
|
colorsSemanticPositiveYin030: string;
|
|
@@ -384,7 +384,6 @@ var _default = palette => {
|
|
|
384
384
|
colorsActionMajor600: this.colors.secondary,
|
|
385
385
|
colorsActionDisabled500: this.disabled.background,
|
|
386
386
|
colorsSemanticFocus500: this.colors.focus,
|
|
387
|
-
colorsSemanticPositive500: this.colors.success,
|
|
388
387
|
colorsSemanticNegative500: this.colors.error,
|
|
389
388
|
colorsSemanticNegative600: this.colors.destructive.hover,
|
|
390
389
|
colorsSemanticCaution500: this.colors.warning,
|