carbon-react 102.16.0 → 102.19.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.
@@ -16,7 +16,7 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
16
16
  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
17
 
18
18
  const LabelStyle = _styledComponents.default.label`
19
- color: var(--colorsYin090);
19
+ color: var(--colorsUtilityYin090);
20
20
  display: block;
21
21
  font-weight: 600; //TODO: (tokens) use token var(--fontWeights500)
22
22
 
@@ -34,7 +34,7 @@ const LabelStyle = _styledComponents.default.label`
34
34
  ${({
35
35
  disabled
36
36
  }) => disabled && (0, _styledComponents.css)`
37
- color: var(--colorsYin030);
37
+ color: var(--colorsUtilityYin030);
38
38
  `}
39
39
  `;
40
40
  LabelStyle.propTypes = {
@@ -1,5 +1,5 @@
1
1
  export default BaseCarousel;
2
- declare function BaseCarousel({ children, className, enableSlideSelector, enablePreviousButton, enableNextButton, initialSlideIndex, onSlideChange, slideIndex, theme, ...props }: {
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
- &&::before {
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
- background: ${theme.colors.primary};
64
- color: ${theme.colors.white};
65
- opacity: ${disabled ? "0.1" : "1"};
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: ${theme.colors.secondary};
72
+ background-color: var(--colorsActionMajor600);
69
73
  cursor: ${disabled ? "default" : "pointer"};
70
74
 
71
75
  ${disabled && (0, _styledComponents.css)`
72
- background-color: ${theme.colors.primary};
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 ${theme.colors.focus};
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
- background: ${theme.carousel.activeSelectorBackground};
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
- ${theme && (0, _styledComponents.css)`
31
- transition: 0.5s;
32
- min-width: 80%;
33
- transform: scale(0.9);
34
- opacity: 0.3;
35
- margin: 30px 0;
36
- box-shadow: ${theme.shadows.depth2};
37
-
38
- ${id === selectedIndex && (0, _styledComponents.css)`
39
- transform: scale(1);
40
- opacity: 1;
41
-
42
- ${onClick && (0, _styledComponents.css)`
43
- :hover {
44
- transition: all 0.2s ease-in;
45
- transform: scale(1.02);
46
- cursor: pointer;
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
- exports.SlideStyle = SlideStyle;
54
- SlideStyle.defaultProps = {
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);
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
-
10
- var _themes = require("../../../style/themes");
8
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
11
9
 
12
10
  var _button = _interopRequireDefault(require("../../button/button.style"));
13
11
 
@@ -15,44 +13,32 @@ var _icon = _interopRequireDefault(require("../../icon/icon.style"));
15
13
 
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
15
 
18
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
19
-
20
- 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; }
21
-
22
16
  const StyledListActionButtonWrapper = _styledComponents.default.div`
23
- ${({
24
- theme
25
- }) => (0, _styledComponents.css)`
26
- padding-top: ${theme.space[1]}px;
27
- padding-bottom: ${theme.space[1]}px;
28
- border-top: 1px solid ${theme.disabled.border};
29
- box-shadow: 0 0px 0 0 rgba(0, 0, 0, 0), 0 -8px 8px 0 rgba(0, 0, 0, 0.03);
30
-
31
- ${_icon.default} {
32
- color: ${theme.text.color};
33
- }
34
-
35
- ${_button.default} {
36
- background: transparent;
37
- border: none;
38
- color: ${theme.text.color};
39
- justify-content: left;
40
- padding-left: ${theme.space[2]}px;
41
- padding-right: ${theme.space[2]}px;
42
- width: 100%;
43
-
44
- :hover {
45
- background-color: ${theme.select.selected};
46
-
47
- ${_icon.default} {
48
- color: ${theme.text.color};
49
- }
17
+ padding-top: var(--spacing100);
18
+ padding-bottom: var(--spacing100);
19
+ border-top: 1px solid var(--colorsUtilityDisabled600);
20
+ box-shadow: 0 0px 0 0 rgba(0, 0, 0, 0), 0 -8px 8px 0 rgba(0, 0, 0, 0.03);
21
+
22
+ ${_icon.default} {
23
+ color: var(--colorsUtilityYin090);
24
+ }
25
+
26
+ ${_button.default} {
27
+ background: transparent;
28
+ border: none;
29
+ color: var(--colorsUtilityYin090);
30
+ justify-content: left;
31
+ padding-left: var(--spacing200);
32
+ padding-right: var(--spacing200);
33
+ width: 100%;
34
+
35
+ :hover {
36
+ background-color: var(--colorsUtilityMajor025);
37
+ ${_icon.default} {
38
+ color: var(--colorsUtilityYin090);
50
39
  }
51
40
  }
52
- `}
41
+ }
53
42
  `;
54
- StyledListActionButtonWrapper.defaultProps = {
55
- theme: _themes.baseTheme
56
- };
57
43
  var _default = StyledListActionButtonWrapper;
58
44
  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; }
@@ -26,10 +24,9 @@ const StyledOption = _styledComponents.default.li`
26
24
  user-select: none;
27
25
 
28
26
  ${({
29
- isHighlighted,
30
- theme
27
+ isHighlighted
31
28
  }) => isHighlighted && (0, _styledComponents.css)`
32
- background-color: ${theme.select.selected};
29
+ background-color: var(--colorsUtilityMajor200);
33
30
  `}
34
31
 
35
32
  ${({
@@ -37,20 +34,12 @@ const StyledOption = _styledComponents.default.li`
37
34
  }) => hidden && "display: none;"}
38
35
 
39
36
  :hover {
40
- ${({
41
- theme
42
- }) => (0, _styledComponents.css)`
43
- background-color: ${theme.select.selected};
44
- `}
37
+ background-color: var(--colorsUtilityMajor200);
45
38
  }
46
39
  `;
47
40
  StyledOption.propTypes = {
48
41
  id: _propTypes.default.any,
49
- isHighlighted: _propTypes.default.bool,
50
- theme: _propTypes.default.object
51
- };
52
- StyledOption.defaultProps = {
53
- theme: _base.default
42
+ isHighlighted: _propTypes.default.bool
54
43
  };
55
44
  var _default = StyledOption;
56
45
  exports.default = _default;
@@ -7,12 +7,8 @@ exports.default = void 0;
7
7
 
8
8
  var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
 
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
10
  var _icon = _interopRequireDefault(require("../../icon/icon.style"));
13
11
 
14
- var _base = _interopRequireDefault(require("../../../style/themes/base"));
15
-
16
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
13
 
18
14
  const StyledOptionGroupHeader = _styledComponents.default.div`
@@ -30,30 +26,18 @@ const StyledOptionGroupHeader = _styledComponents.default.div`
30
26
  line-height: 18px;
31
27
  text-align: left;
32
28
  margin: 0;
33
- color: ${({
34
- theme
35
- }) => theme.select.optionHeader};
29
+ color: var(--colorsYin055);
36
30
  }
37
31
 
38
32
  ${_icon.default} {
39
33
  margin-right: 4px;
40
34
  margin-left: -5px;
41
- color: ${({
42
- theme
43
- }) => theme.select.optionHeader};
35
+ color: var(--colorsYin055);
44
36
 
45
37
  &:hover {
46
- color: ${({
47
- theme
48
- }) => theme.select.optionHeader};
38
+ color: var(--colorsYin055);
49
39
  }
50
40
  }
51
41
  `;
52
- StyledOptionGroupHeader.propTypes = {
53
- theme: _propTypes.default.object
54
- };
55
- StyledOptionGroupHeader.defaultProps = {
56
- theme: _base.default
57
- };
58
42
  var _default = StyledOptionGroupHeader;
59
43
  exports.default = _default;
@@ -7,10 +7,6 @@ exports.default = 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; }
@@ -23,16 +19,13 @@ const StyledOptionRow = _styledComponents.default.tr`
23
19
  }) => hidden && "display: none;"}
24
20
 
25
21
  ${({
26
- isHighlighted,
27
- theme
22
+ isHighlighted
28
23
  }) => isHighlighted && (0, _styledComponents.css)`
29
- background-color: ${theme.select.selected};
24
+ background-color: var(--colorsUtilityMajor200);
30
25
  `}
31
26
 
32
27
  :hover {
33
- background-color: ${({
34
- theme
35
- }) => theme.select.selected};
28
+ background-color: var(--colorsUtilityMajor200);
36
29
  }
37
30
 
38
31
  td {
@@ -44,8 +37,5 @@ const StyledOptionRow = _styledComponents.default.tr`
44
37
  }
45
38
  }
46
39
  `;
47
- StyledOptionRow.defaultProps = {
48
- theme: _base.default
49
- };
50
40
  var _default = StyledOptionRow;
51
41
  exports.default = _default;
@@ -13,7 +13,8 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
13
13
 
14
14
  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; }
15
15
 
16
- const overhang = 4;
16
+ const overhang = 4; // TODO (design-tokens): no elovation/zindex tokens yet
17
+
17
18
  const StyledPopoverContainer = _styledComponents.default.div`
18
19
  position: absolute;
19
20
  z-index: ${({
@@ -72,9 +73,7 @@ const StyledSelectLoaderContainer = _styledComponents.default.li`
72
73
  `;
73
74
  exports.StyledSelectLoaderContainer = StyledSelectLoaderContainer;
74
75
  const StyledSelectListTable = _styledComponents.default.table`
75
- background-color: ${({
76
- theme
77
- }) => theme.colors.white};
76
+ background-color: var(--colorsUtilityYang100);
78
77
  border-collapse: collapse;
79
78
  border-radius: 0px;
80
79
  border-spacing: 0;
@@ -88,29 +87,21 @@ const StyledSelectListTable = _styledComponents.default.table`
88
87
  width: 100%;
89
88
  table-layout: fixed;
90
89
  }
91
- `;
90
+ `; // TODO (design-tokens): to match current style for border bottom colorsUtilityMajor100
91
+
92
92
  exports.StyledSelectListTable = StyledSelectListTable;
93
- StyledSelectListTable.defaultProps = {
94
- theme: _themes.baseTheme
95
- };
96
93
  const StyledSelectListTableHeader = _styledComponents.default.thead`
97
94
  th {
98
95
  position: sticky;
99
96
  top: 0;
100
- padding: ${({
101
- theme
102
- }) => 2 * theme.spacing}px;
103
- border-bottom: 1px solid ${({
104
- theme
105
- }) => theme.select.tableHeaderBorder};
97
+ padding: var(--spacing200);
98
+ border-bottom: 1px solid var(--colorsUtilityMajor050);
106
99
  background-color: white;
107
100
  text-align: left;
108
101
  font-weight: 900;
109
102
  font-size: 12px;
110
103
  text-transform: uppercase;
111
- color: ${({
112
- theme
113
- }) => theme.tileSelect.descriptionColor};
104
+ color: var(--colorsYin055);
114
105
  :after {
115
106
  content: "";
116
107
  display: block;
@@ -118,12 +109,8 @@ const StyledSelectListTableHeader = _styledComponents.default.thead`
118
109
  bottom: -8px;
119
110
  left: 0px;
120
111
  background-image: linear-gradient(
121
- ${({
122
- theme
123
- }) => theme.colors.black},
124
- ${({
125
- theme
126
- }) => theme.colors.white}
112
+ var(--colorsComponentsNavigationYin100),
113
+ var(--colorsYang100)
127
114
  );
128
115
  opacity: 0.03;
129
116
  height: 8px;
@@ -139,7 +126,4 @@ const StyledSelectListTableBody = _styledComponents.default.tbody`
139
126
  table-layout: fixed;
140
127
  max-height: 132px;
141
128
  `;
142
- exports.StyledSelectListTableBody = StyledSelectListTableBody;
143
- StyledSelectListTableHeader.defaultProps = {
144
- theme: _themes.baseTheme
145
- };
129
+ exports.StyledSelectListTableBody = StyledSelectListTableBody;
@@ -27,7 +27,6 @@ const StyledSelect = _styledComponents.default.div`
27
27
  ${({
28
28
  hasTextCursor,
29
29
  disabled,
30
- theme,
31
30
  readOnly,
32
31
  transparent
33
32
  }) => (0, _styledComponents.css)`
@@ -40,13 +39,13 @@ const StyledSelect = _styledComponents.default.div`
40
39
 
41
40
  ${disabled && (0, _styledComponents.css)`
42
41
  cursor: not-allowed;
43
- color: ${theme.disabled.disabled};
42
+ color: var(--colorsUtilityYin030);
44
43
  text-shadow: none;
45
44
  `}
46
45
 
47
46
  ${readOnly && (0, _styledComponents.css)`
48
47
  cursor: ${hasTextCursor ? "text" : "default"};
49
- color: ${theme.readOnly.textboxText};
48
+ color: var(--colorsYin065);
50
49
  text-shadow: none;
51
50
  `}
52
51
  }
@@ -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 _loader = _interopRequireDefault(require("../../loader/loader.style"));
15
13
 
16
14
  var _loaderSquare = _interopRequireDefault(require("../../loader/loader-square.style"));
@@ -24,11 +22,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
24
22
  const SwitchSliderPanel = _styledComponents.default.div`
25
23
  ${({
26
24
  isLoading,
27
- size,
28
- theme
25
+ size
29
26
  }) => (0, _styledComponents.css)`
30
27
  border: 0;
31
- color: ${theme.colors.white};
28
+ color: var(--colorsActionMinorYang100);
32
29
  margin: auto;
33
30
  margin-top: ${size === "large" ? "12px" : "5px"};
34
31
 
@@ -37,20 +34,42 @@ const SwitchSliderPanel = _styledComponents.default.div`
37
34
  }
38
35
 
39
36
  &[type="off"] {
40
- color: ${theme.text.color};
37
+ color: var(--colorsActionMinor500);
41
38
  margin-right: 6px;
42
39
  }
43
40
 
44
41
  ${isLoading && (0, _styledComponents.css)`
42
+ &[type="off"],
43
+ &[type="on"] {
44
+ margin: 0;
45
+ width: 100%;
46
+ box-sizing: border-box;
47
+ padding: 2px 8px;
48
+ }
49
+
50
+ &[type="off"] {
51
+ ${_loaderSquare.default} {
52
+ background-color: var(--colorsSemanticNeutral500);
53
+ }
54
+ }
55
+
56
+ &[type="on"] {
57
+ ${_loaderSquare.default} {
58
+ background-color: var(--colorsActionMinorYang100);
59
+ }
60
+ }
61
+
45
62
  ${_loader.default} {
46
63
  {
47
- padding: 0 3px 3px 0;
64
+ display: flex;
65
+ justify-content: center;
66
+ align-items: center;
67
+ width: 100%;
68
+ height: 100%;
48
69
 
49
70
  ${_loaderSquare.default} {
50
- height: 5px;
51
- margin-bottom: 2px;
52
- margin-right: 2px;
53
- width: 5px;
71
+ height: ${size === "large" ? "var(--sizing200)" : "var(--sizing150)"};
72
+ width: ${size === "large" ? "var(--sizing200)" : "var(--sizing150)"};
54
73
  }
55
74
  }
56
75
  }
@@ -59,11 +78,7 @@ const SwitchSliderPanel = _styledComponents.default.div`
59
78
  `;
60
79
  SwitchSliderPanel.propTypes = {
61
80
  isLoading: _propTypes.default.bool,
62
- size: _propTypes.default.string,
63
- theme: _propTypes.default.object
64
- };
65
- SwitchSliderPanel.defaultProps = {
66
- theme: _base.default
81
+ size: _propTypes.default.string
67
82
  };
68
83
  var _default = SwitchSliderPanel;
69
84
  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
  var _switchSliderPanel = _interopRequireDefault(require("./switch-slider-panel.style"));
15
13
 
16
14
  var _validationIcon = _interopRequireDefault(require("../../../__internal__/validations/validation-icon.style"));
@@ -24,14 +22,12 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
24
22
  const StyledSwitchSlider = _styledComponents.default.span`
25
23
  ${({
26
24
  checked,
25
+ isLoading,
27
26
  disabled,
28
27
  size,
29
- theme,
30
28
  error,
31
- warning,
32
- info
29
+ warning
33
30
  }) => (0, _styledComponents.css)`
34
- background-color: ${theme.switch.off};
35
31
  display: flex;
36
32
  font-size: 12px;
37
33
  font-weight: bold;
@@ -44,21 +40,13 @@ const StyledSwitchSlider = _styledComponents.default.span`
44
40
  width: 60px;
45
41
  z-index: 2;
46
42
  border-radius: 90px;
47
-
48
- ${info && !disabled && (0, _styledComponents.css)`
49
- box-shadow: inset 0px 0px 0px 1px ${theme.colors.info};
50
- `}
51
- ${warning && !disabled && (0, _styledComponents.css)`
52
- box-shadow: inset 0px 0px 0px 1px ${theme.colors.warning};
53
- `}
54
- ${error && !disabled && (0, _styledComponents.css)`
55
- box-shadow: inset 0px 0px 0px 2px ${theme.colors.error};
56
- `}
43
+ border-style: solid;
44
+ border-color: var(--colorsActionMinor400);
45
+ border-width: var(--borderWidth200);
57
46
 
58
47
  &::before {
59
- background-color: ${theme.colors.white};
48
+ background-color: var(--colorsActionMinor400);
60
49
  bottom: 4px;
61
- box-shadow: ${theme.shadows.cards};
62
50
  content: "";
63
51
  height: 16px;
64
52
  position: absolute;
@@ -70,28 +58,36 @@ const StyledSwitchSlider = _styledComponents.default.span`
70
58
  }
71
59
 
72
60
  ${checked && `
73
- background-color: ${theme.switch.on};
61
+ background-color: var(--colorsActionMinor500);
62
+ border-color: var(--colorsActionMinorTransparent);
74
63
 
75
64
  &::before {
76
65
  transform: translateX(36px);
66
+ background-color: var(--colorsActionMinorYang100);
77
67
  }
68
+
78
69
  `}
79
70
 
80
- ${disabled && (0, _styledComponents.css)`
81
- background-color: ${theme.switch.offDisabled};
71
+ ${disabled && !isLoading && (0, _styledComponents.css)`
72
+ border-color: var(--colorsActionDisabled600);
82
73
 
83
74
  &::before {
84
- opacity: 0.8;
75
+ background-color: var(--colorsActionDisabled600);
85
76
  }
86
77
 
87
78
  ${_switchSliderPanel.default} {
88
- color: ${theme.switch.disabledFontColor};
79
+ color: var(--colorsUtilityYin030);
89
80
  }
90
81
 
91
82
  ${checked && `
92
- background-color: ${theme.switch.onDisabled};
83
+ background-color: var(--colorsActionDisabled500);
84
+ border-color: var(--colorsActionMinorTransparent);
93
85
 
94
- ${_switchSliderPanel.default} { color: ${theme.colors.white}; }
86
+ &::before {
87
+ background-color: var(--colorsActionMinorYang100);
88
+ }
89
+
90
+ ${_switchSliderPanel.default} { color: var(--colorsUtilityYin030); }
95
91
  `}
96
92
  `}
97
93
 
@@ -107,6 +103,20 @@ const StyledSwitchSlider = _styledComponents.default.span`
107
103
  }
108
104
  `}
109
105
 
106
+ ${isLoading && (0, _styledComponents.css)`
107
+ &::before {
108
+ display: none;
109
+ }
110
+ `}
111
+
112
+ ${warning && !disabled && (0, _styledComponents.css)`
113
+ border-color: var(--colorsSemanticCaution500);
114
+ `}
115
+
116
+ ${error && !disabled && (0, _styledComponents.css)`
117
+ border-color: var(--colorsSemanticNegative500);
118
+ `}
119
+
110
120
  ${_validationIcon.default} {
111
121
  position: absolute;
112
122
  right: -30px;
@@ -118,10 +128,9 @@ StyledSwitchSlider.propTypes = {
118
128
  checked: _propTypes.default.bool,
119
129
  disabled: _propTypes.default.bool,
120
130
  size: _propTypes.default.string,
121
- theme: _propTypes.default.object
122
- };
123
- StyledSwitchSlider.defaultProps = {
124
- theme: _base.default
131
+ isLoading: _propTypes.default.bool,
132
+ error: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
133
+ warning: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool])
125
134
  };
126
135
  var _default = StyledSwitchSlider;
127
136
  exports.default = _default;
@@ -35,13 +35,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
35
35
 
36
36
  const StyledSwitch = _styledComponents.default.div`
37
37
  ${({
38
- checked,
39
38
  fieldHelpInline,
40
39
  labelInline,
41
- labelSpacing,
42
40
  reverse,
43
- size,
44
- theme
41
+ size
45
42
  }) => (0, _styledComponents.css)`
46
43
  ${_styledSystem.margin}
47
44
  ${_formField.FieldLineStyle} {
@@ -60,11 +57,7 @@ const StyledSwitch = _styledComponents.default.div`
60
57
 
61
58
  ${_hiddenCheckableInput.default}:not([disabled]) {
62
59
  &:focus + ${_switchSlider.default} {
63
- outline: solid 3px ${theme.colors.focus};
64
- }
65
-
66
- &:hover + ${_switchSlider.default} {
67
- background-color: ${checked ? theme.switch.onHover : theme.switch.offHover};
60
+ outline: solid 3px var(--colorsSemanticFocus500);
68
61
  }
69
62
  }
70
63
 
@@ -128,10 +121,9 @@ const StyledSwitch = _styledComponents.default.div`
128
121
  margin-top: 0;
129
122
  }
130
123
 
131
- ${!fieldHelpInline && `
124
+ ${!fieldHelpInline && (0, _styledComponents.css)`
132
125
  ${_fieldHelp.default} {
133
126
  margin-left: 60px;
134
- padding-left: ${labelSpacing * theme.spacing}px;
135
127
  }
136
128
  `}
137
129
  `}
@@ -173,10 +165,9 @@ const StyledSwitch = _styledComponents.default.div`
173
165
  padding-bottom: 10px;
174
166
  }
175
167
 
176
- ${!fieldHelpInline && reverse && `
168
+ ${!fieldHelpInline && reverse && (0, _styledComponents.css)`
177
169
  ${_fieldHelp.default} {
178
170
  margin-left: 78px;
179
- padding-left: ${labelSpacing * theme.spacing}px;
180
171
  }
181
172
  `}
182
173
  `}
@@ -188,8 +179,7 @@ StyledSwitch.propTypes = {
188
179
  fieldHelpInline: _propTypes.default.bool,
189
180
  labelInline: _propTypes.default.bool,
190
181
  reverse: _propTypes.default.bool,
191
- size: _propTypes.default.string,
192
- theme: _propTypes.default.object
182
+ size: _propTypes.default.string
193
183
  };
194
184
  StyledSwitch.defaultProps = {
195
185
  theme: _base.default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "102.16.0",
3
+ "version": "102.19.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {