carbon-react 102.14.0 → 102.17.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/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/carousel/carousel.component.d.ts +1 -3
- package/lib/components/carousel/carousel.component.js +1 -8
- package/lib/components/carousel/carousel.style.js +20 -47
- package/lib/components/carousel/slide/slide.style.js +21 -29
- 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
|
@@ -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,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default BaseCarousel;
|
|
2
|
-
declare function BaseCarousel({ children, className, enableSlideSelector, enablePreviousButton, enableNextButton, initialSlideIndex, onSlideChange, slideIndex,
|
|
2
|
+
declare function BaseCarousel({ children, className, enableSlideSelector, enablePreviousButton, enableNextButton, initialSlideIndex, onSlideChange, slideIndex, ...props }: {
|
|
3
3
|
[x: string]: any;
|
|
4
4
|
children: any;
|
|
5
5
|
className: any;
|
|
@@ -9,7 +9,6 @@ declare function BaseCarousel({ children, className, enableSlideSelector, enable
|
|
|
9
9
|
initialSlideIndex?: number | undefined;
|
|
10
10
|
onSlideChange: any;
|
|
11
11
|
slideIndex: any;
|
|
12
|
-
theme?: import("../../style/themes/base").ThemeObject | undefined;
|
|
13
12
|
}): JSX.Element;
|
|
14
13
|
declare namespace BaseCarousel {
|
|
15
14
|
namespace propTypes {
|
|
@@ -21,7 +20,6 @@ declare namespace BaseCarousel {
|
|
|
21
20
|
const enablePreviousButton: PropTypes.Requireable<boolean>;
|
|
22
21
|
const enableNextButton: PropTypes.Requireable<boolean>;
|
|
23
22
|
const onSlideChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
|
-
const theme: PropTypes.Requireable<object>;
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
export const Carousel: React.ForwardRefExoticComponent<{
|
|
@@ -27,8 +27,6 @@ var _carousel = require("./carousel.style");
|
|
|
27
27
|
|
|
28
28
|
var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
|
|
29
29
|
|
|
30
|
-
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
31
|
-
|
|
32
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
31
|
|
|
34
32
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -49,7 +47,6 @@ const BaseCarousel = ({
|
|
|
49
47
|
initialSlideIndex = 0,
|
|
50
48
|
onSlideChange,
|
|
51
49
|
slideIndex,
|
|
52
|
-
theme = _base.default,
|
|
53
50
|
...props
|
|
54
51
|
}) => {
|
|
55
52
|
const [selectedSlideIndex, setSelectedSlideIndex] = (0, _react.useState)(Number(slideIndex) || Number(initialSlideIndex));
|
|
@@ -106,7 +103,6 @@ const BaseCarousel = ({
|
|
|
106
103
|
key: `slide-${(0, _guid.default)()}`,
|
|
107
104
|
id: key,
|
|
108
105
|
selectedIndex: selectedSlideIndex,
|
|
109
|
-
theme,
|
|
110
106
|
...element.props
|
|
111
107
|
});
|
|
112
108
|
});
|
|
@@ -200,10 +196,7 @@ BaseCarousel.propTypes = {
|
|
|
200
196
|
enableNextButton: _propTypes.default.bool,
|
|
201
197
|
|
|
202
198
|
/** Action to be called on slide change */
|
|
203
|
-
onSlideChange: _propTypes.default.func
|
|
204
|
-
|
|
205
|
-
/** theme is used only to support legacy code */
|
|
206
|
-
theme: _propTypes.default.object
|
|
199
|
+
onSlideChange: _propTypes.default.func
|
|
207
200
|
};
|
|
208
201
|
const Carousel = (0, _styledComponents.withTheme)(BaseCarousel);
|
|
209
202
|
exports.Carousel = Carousel;
|
|
@@ -11,8 +11,6 @@ var _icon = _interopRequireDefault(require("../icon"));
|
|
|
11
11
|
|
|
12
12
|
var _slide = require("./slide.config");
|
|
13
13
|
|
|
14
|
-
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
15
|
-
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
15
|
|
|
18
16
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -37,7 +35,8 @@ const CarouselNextButtonWrapperStyle = (0, _styledComponents.default)(CarouselNa
|
|
|
37
35
|
exports.CarouselNextButtonWrapperStyle = CarouselNextButtonWrapperStyle;
|
|
38
36
|
const CarouselStyledIcon = (0, _styledComponents.default)(_icon.default)`
|
|
39
37
|
cursor: pointer;
|
|
40
|
-
|
|
38
|
+
color: var(--colorsActionMajorYang100);
|
|
39
|
+
&::before {
|
|
41
40
|
font-size: 16px;
|
|
42
41
|
}
|
|
43
42
|
`;
|
|
@@ -54,22 +53,27 @@ const CarouselButtonStyle = _styledComponents.default.button.attrs({
|
|
|
54
53
|
type: "button"
|
|
55
54
|
})`
|
|
56
55
|
${({
|
|
57
|
-
theme,
|
|
58
56
|
disabled
|
|
59
57
|
}) => (0, _styledComponents.css)`
|
|
60
58
|
border: none;
|
|
61
59
|
width: 40px;
|
|
62
60
|
height: 64px;
|
|
63
|
-
|
|
64
|
-
color:
|
|
65
|
-
|
|
61
|
+
border-width: var(--borderWidth200);
|
|
62
|
+
border-color: var(--colorsActionMajorTransparent);
|
|
63
|
+
background-color: ${disabled ? "var(--colorsActionDisabled500)" : "var(--colorsActionMajor500)"};
|
|
64
|
+
|
|
65
|
+
${disabled && (0, _styledComponents.css)`
|
|
66
|
+
${CarouselStyledIcon} {
|
|
67
|
+
color: var(--colorsActionMajorYin030);
|
|
68
|
+
}
|
|
69
|
+
`}
|
|
66
70
|
|
|
67
71
|
&:hover {
|
|
68
|
-
background-color:
|
|
72
|
+
background-color: var(--colorsActionMajor600);
|
|
69
73
|
cursor: ${disabled ? "default" : "pointer"};
|
|
70
74
|
|
|
71
75
|
${disabled && (0, _styledComponents.css)`
|
|
72
|
-
background-color:
|
|
76
|
+
background-color: var(--colorsActionDisabled500);
|
|
73
77
|
cursor: default;
|
|
74
78
|
|
|
75
79
|
${CarouselStyledIcon} {
|
|
@@ -83,7 +87,7 @@ const CarouselButtonStyle = _styledComponents.default.button.attrs({
|
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
&:focus {
|
|
86
|
-
outline: 2px solid
|
|
90
|
+
outline: 2px solid var(--colorsSemanticFocus500);
|
|
87
91
|
|
|
88
92
|
::-moz-focus-inner {
|
|
89
93
|
border: 0;
|
|
@@ -104,9 +108,7 @@ const CarouselSelectorLabelStyle = _styledComponents.default.label`
|
|
|
104
108
|
display: inline-block;
|
|
105
109
|
width: 10px;
|
|
106
110
|
height: 10px;
|
|
107
|
-
background:
|
|
108
|
-
theme
|
|
109
|
-
}) => theme.carousel.inactiveSelectorBackground};
|
|
111
|
+
background: var(--colorsActionMinor200);
|
|
110
112
|
margin: 0px 4px;
|
|
111
113
|
|
|
112
114
|
&:hover {
|
|
@@ -115,20 +117,18 @@ const CarouselSelectorLabelStyle = _styledComponents.default.label`
|
|
|
115
117
|
`;
|
|
116
118
|
exports.CarouselSelectorLabelStyle = CarouselSelectorLabelStyle;
|
|
117
119
|
const CarouselSelectorWrapperStyle = _styledComponents.default.div`
|
|
118
|
-
${(
|
|
119
|
-
theme
|
|
120
|
-
}) => (0, _styledComponents.css)`
|
|
120
|
+
${(0, _styledComponents.css)`
|
|
121
121
|
height: 20px;
|
|
122
122
|
margin-top: 25px;
|
|
123
123
|
text-align: center;
|
|
124
124
|
|
|
125
125
|
${CarouselSelectorInputStyle}:checked {
|
|
126
126
|
+ ${CarouselSelectorLabelStyle} {
|
|
127
|
-
|
|
128
|
-
border-color: transparent;
|
|
127
|
+
width: 10px;
|
|
129
128
|
height: 10px;
|
|
129
|
+
background: var(--colorsActionMinor400);
|
|
130
|
+
border-color: transparent;
|
|
130
131
|
position: relative;
|
|
131
|
-
width: 10px;
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
`}
|
|
@@ -158,31 +158,4 @@ const CarouselWrapperStyle = _styledComponents.default.div`
|
|
|
158
158
|
${_slide.slideAnimation};
|
|
159
159
|
${_slide.fadeAnimation};
|
|
160
160
|
`;
|
|
161
|
-
exports.CarouselWrapperStyle = CarouselWrapperStyle;
|
|
162
|
-
CarouselNavigationStyle.defaultProps = {
|
|
163
|
-
theme: _base.default
|
|
164
|
-
};
|
|
165
|
-
CarouselButtonStyle.defaultProps = {
|
|
166
|
-
theme: _base.default
|
|
167
|
-
};
|
|
168
|
-
CarouselStyledIcon.defaultProps = {
|
|
169
|
-
theme: _base.default
|
|
170
|
-
};
|
|
171
|
-
CarouselSelectorWrapperStyle.defaultProps = {
|
|
172
|
-
theme: _base.default
|
|
173
|
-
};
|
|
174
|
-
CarouselSelectorLabelStyle.defaultProps = {
|
|
175
|
-
theme: _base.default
|
|
176
|
-
};
|
|
177
|
-
CarouselStyledIconLeft.defaultProps = {
|
|
178
|
-
theme: _base.default
|
|
179
|
-
};
|
|
180
|
-
CarouselStyledIconRight.defaultProps = {
|
|
181
|
-
theme: _base.default
|
|
182
|
-
};
|
|
183
|
-
CarouselPreviousButtonWrapperStyle.defaultProps = {
|
|
184
|
-
theme: _base.default
|
|
185
|
-
};
|
|
186
|
-
CarouselNextButtonWrapperStyle.defaultProps = {
|
|
187
|
-
theme: _base.default
|
|
188
|
-
};
|
|
161
|
+
exports.CarouselWrapperStyle = CarouselWrapperStyle;
|
|
@@ -7,17 +7,12 @@ exports.SlideStyle = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
10
|
-
var _base = _interopRequireDefault(require("../../../style/themes/base"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
15
11
|
|
|
16
12
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
|
|
17
13
|
|
|
18
14
|
const SlideStyle = _styledComponents.default.div`
|
|
19
15
|
${({
|
|
20
|
-
theme,
|
|
21
16
|
onClick,
|
|
22
17
|
id,
|
|
23
18
|
selectedIndex
|
|
@@ -27,30 +22,27 @@ const SlideStyle = _styledComponents.default.div`
|
|
|
27
22
|
width: 100%;
|
|
28
23
|
z-index: 10;
|
|
29
24
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
`}
|
|
25
|
+
transition: 0.5s;
|
|
26
|
+
min-width: 80%;
|
|
27
|
+
transform: scale(0.9);
|
|
28
|
+
opacity: 0.3;
|
|
29
|
+
margin: 30px 0;
|
|
30
|
+
box-shadow: var(--boxShadow200);
|
|
31
|
+
background-color: var(--colorsComponentsNavigationYang100);
|
|
32
|
+
|
|
33
|
+
${id === selectedIndex && (0, _styledComponents.css)`
|
|
34
|
+
transform: scale(1);
|
|
35
|
+
opacity: 1;
|
|
36
|
+
|
|
37
|
+
${onClick && (0, _styledComponents.css)`
|
|
38
|
+
:hover {
|
|
39
|
+
transition: all 0.2s ease-in;
|
|
40
|
+
transform: scale(1.02);
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
}
|
|
49
43
|
`}
|
|
50
44
|
`}
|
|
51
45
|
`}
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
SlideStyle
|
|
55
|
-
theme: _base.default
|
|
56
|
-
}; // eslint-disable-next-line import/prefer-default-export
|
|
46
|
+
`; // eslint-disable-next-line import/prefer-default-export
|
|
47
|
+
|
|
48
|
+
exports.SlideStyle = SlideStyle;
|
|
@@ -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,
|