carbon-react 102.16.1 → 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.
|
@@ -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;
|