carbon-react 104.25.0 → 104.27.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.
@@ -18,7 +18,7 @@ const StyledAdvancedColorPickerCell = _styledComponents.default.button.attrs({
18
18
  display: block;
19
19
  width: 25px;
20
20
  height: 25px;
21
- border: 1px solid #516562;
21
+ border: 1px solid var(--colorsUtilityYin090);
22
22
  ${({
23
23
  color
24
24
  }) => color && (0, _styledComponents.css)`
@@ -37,7 +37,7 @@ const StyledAdvancedColorPickerCell = _styledComponents.default.button.attrs({
37
37
  }
38
38
 
39
39
  &:focus {
40
- outline: solid 3px #ffb500;
40
+ outline: solid 3px var(--colorsSemanticFocus500);
41
41
  }
42
42
 
43
43
  &::-moz-focus-inner {
@@ -49,7 +49,7 @@ const StyledAdvancedColorPickerPreview = _styledComponents.default.div`
49
49
  width: 25px;
50
50
  height: 25px;
51
51
  margin-bottom: 15px;
52
- border: 1px solid #516562;
52
+ border: 1px solid var(--colorsUtilityYin090);
53
53
 
54
54
  ${({
55
55
  color
@@ -82,7 +82,7 @@ const DialogStyle = (0, _styledComponents.default)(_dialog2.default)`
82
82
  ${_simpleColorPicker.StyledColorOptions} {
83
83
  max-width: 285px;
84
84
  ${_simpleColor.default} {
85
- border: 1px solid #3c514e;
85
+ border: 1px solid var(--colorsUtilityYin090);
86
86
  margin-right: -1px;
87
87
  margin-bottom: -1px;
88
88
  transition: all 0.2s ease;
@@ -101,5 +101,9 @@ const DialogStyle = (0, _styledComponents.default)(_dialog2.default)`
101
101
  top: 20px;
102
102
  right: 13px;
103
103
  }
104
+
105
+ [data-component="icon"] {
106
+ color: var(--colorsActionMinorYin065);
107
+ }
104
108
  `;
105
109
  exports.DialogStyle = DialogStyle;
@@ -7,14 +7,10 @@ exports.StyledGroupButton = exports.StyledPicklistGroup = exports.StyledPicklist
7
7
 
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
9
 
10
- var _base = _interopRequireDefault(require("../../../style/themes/base"));
11
-
12
10
  var _button = require("../../button");
13
11
 
14
12
  var _picklistItem = require("../picklist-item/picklist-item.style");
15
13
 
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
14
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
19
15
 
20
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; }
@@ -22,8 +18,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
22
18
  const StyledGroupWrapper = _styledComponents.default.li`
23
19
  ${({
24
20
  highlighted,
25
- type,
26
- theme
21
+ type
27
22
  }) => (0, _styledComponents.css)`
28
23
  &:not(:first-of-type) {
29
24
  margin-top: 16px;
@@ -31,8 +26,7 @@ const StyledGroupWrapper = _styledComponents.default.li`
31
26
 
32
27
  ${highlighted && (0, _styledComponents.css)`
33
28
  ${_picklistItem.StyledButton} {
34
- background: ${type === "add" ? theme.colors.secondary : theme.colors.destructive.hover};
35
- }
29
+ background: ${type === "add" ? "var(--colorsActionMajor600)" : "var(--colorsSemanticNegative600)"}
36
30
  `}
37
31
  `}
38
32
  `;
@@ -50,8 +44,7 @@ const StyledPicklistGroup = _styledComponents.default.li`
50
44
  exports.StyledPicklistGroup = StyledPicklistGroup;
51
45
  const StyledGroupButton = (0, _styledComponents.default)(_button.ButtonWithForwardRef)`
52
46
  ${({
53
- iconType,
54
- theme
47
+ iconType
55
48
  }) => (0, _styledComponents.css)`
56
49
  padding: 0;
57
50
  margin-right: 0;
@@ -62,16 +55,9 @@ const StyledGroupButton = (0, _styledComponents.default)(_button.ButtonWithForwa
62
55
 
63
56
  &:focus {
64
57
  > span {
65
- color: ${theme.colors.white};
58
+ color: var(--colorsActionMajorYang100);
66
59
  }
67
- background: ${iconType === "add" ? theme.colors.secondary : theme.colors.destructive.hover};
68
- }
60
+ background: ${iconType === "add" ? "var(--colorsActionMajor600)" : "var(--colorsSemanticNegative600)"}
69
61
  `}
70
62
  `;
71
- exports.StyledGroupButton = StyledGroupButton;
72
- StyledGroupWrapper.defaultProps = {
73
- theme: _base.default
74
- };
75
- StyledGroupButton.defaultProps = {
76
- theme: _base.default
77
- };
63
+ exports.StyledGroupButton = StyledGroupButton;
@@ -7,8 +7,6 @@ exports.StyledLockIcon = exports.StyledButton = exports.StyledPicklistItem = voi
7
7
 
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
9
 
10
- var _base = _interopRequireDefault(require("../../../style/themes/base"));
11
-
12
10
  var _button = require("../../button");
13
11
 
14
12
  var _icon = _interopRequireDefault(require("../../icon"));
@@ -23,26 +21,24 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
23
21
 
24
22
  const StyledPicklistItem = _styledComponents.default.li`
25
23
  ${({
26
- locked,
27
- theme
24
+ locked
28
25
  }) => (0, _styledComponents.css)`
29
26
  display: flex;
30
27
  align-items: center;
31
28
  width: 100%;
32
29
 
33
- background-color: ${locked ? theme.picklist.locked : theme.colors.white};
30
+ background-color: ${locked ? "var(--colorsUtilityMajor025)" : "var(--colorsUtilityYang100)"};
34
31
 
35
32
  ${!locked && (0, _styledComponents.css)`
36
- box-shadow: 0 2px 4px 0 rgba(0, 20, 29, 0.15),
37
- 0 3px 3px 0 rgba(0, 20, 29, 0.2);
33
+ box-shadow: var(--boxShadow050);
38
34
  `}
39
35
 
40
36
  ${locked && (0, _styledComponents.css)`
41
- border: 1px solid ${theme.picklist.lockedContent};
42
- color: ${theme.picklist.lockedText};
37
+ border: 1px solid var(--colorsUtilityMajor200);
38
+ color: var(--colorsUtilityYin065);
43
39
 
44
40
  ${_icon2.default} {
45
- color: ${theme.picklist.lockedContent};
41
+ color: var(--colorsUtilityMajor200);
46
42
  }
47
43
  `}
48
44
 
@@ -54,8 +50,7 @@ const StyledPicklistItem = _styledComponents.default.li`
54
50
  exports.StyledPicklistItem = StyledPicklistItem;
55
51
  const StyledButton = (0, _styledComponents.default)(_button.ButtonWithForwardRef)`
56
52
  ${({
57
- iconType,
58
- theme
53
+ iconType
59
54
  }) => (0, _styledComponents.css)`
60
55
  padding: 0;
61
56
  margin-right: 0;
@@ -64,11 +59,7 @@ const StyledButton = (0, _styledComponents.default)(_button.ButtonWithForwardRef
64
59
  min-width: 40px;
65
60
 
66
61
  &:focus {
67
- > span {
68
- color: ${theme.colors.white};
69
- }
70
- background: ${iconType === "add" ? theme.colors.secondary : theme.colors.destructive.hover};
71
- }
62
+ background: ${iconType === "add" ? "var(--colorsActionMajor600)" : "var(--colorsSemanticNegative600)"};
72
63
  `}
73
64
  `;
74
65
  exports.StyledButton = StyledButton;
@@ -77,10 +68,4 @@ const StyledLockIcon = (0, _styledComponents.default)(_icon.default)`
77
68
  height: 40px;
78
69
  min-width: 40px;
79
70
  `;
80
- exports.StyledLockIcon = StyledLockIcon;
81
- StyledPicklistItem.defaultProps = {
82
- theme: _base.default
83
- };
84
- StyledButton.defaultProps = {
85
- theme: _base.default
86
- };
71
+ exports.StyledLockIcon = StyledLockIcon;
@@ -63,10 +63,12 @@ const Search = ({
63
63
  const [searchValue, setSearchValue] = (0, _react.useState)(initialValue);
64
64
  const [isFocused, setIsFocused] = (0, _react.useState)(false);
65
65
  const [searchIsActive, setSearchIsActive] = (0, _react.useState)(initialValue.length >= threshold);
66
+ (0, _react.useEffect)(() => {
67
+ setSearchIsActive(!isControlled ? searchValue.length >= threshold : value.length >= threshold);
68
+ }, [isControlled, searchValue, threshold, value]);
66
69
  const [iconType, iconTabIndex] = (0, _react.useMemo)(() => {
67
70
  const isSearchValueEmpty = !isControlled ? searchValue.length === 0 : value.length === 0;
68
71
  const isFocusedOrActive = isFocused || searchIsActive || (inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === document.activeElement;
69
- setSearchIsActive(!isControlled ? searchValue.length >= threshold : value.length >= threshold);
70
72
 
71
73
  if (!isSearchValueEmpty) {
72
74
  return ["cross", 0];
@@ -89,8 +91,12 @@ const Search = ({
89
91
  }
90
92
  };
91
93
 
92
- const handleOnFocus = () => {
94
+ const handleFocus = e => {
93
95
  setIsFocused(true);
96
+
97
+ if (onFocus) {
98
+ onFocus(e);
99
+ }
94
100
  };
95
101
 
96
102
  let buttonProps = {};
@@ -130,14 +136,22 @@ const Search = ({
130
136
  ev.preventDefault();
131
137
  };
132
138
 
133
- const handleBlur = () => {
139
+ const handleBlur = e => {
134
140
  setIsFocused(false);
141
+
142
+ if (onBlur) {
143
+ onBlur(e);
144
+ }
135
145
  };
136
146
 
137
147
  const handleKeyDown = ev => {
138
148
  if (_events.default.isAlphabetKey(ev) || _events.default.isNumberKey(ev)) {
139
149
  ev.stopPropagation();
140
150
  }
151
+
152
+ if (onKeyDown) {
153
+ onKeyDown(ev);
154
+ }
141
155
  };
142
156
 
143
157
  const assignInput = input => {
@@ -156,11 +170,6 @@ const Search = ({
156
170
  mb: 0
157
171
  }, (0, _utils.filterStyledSystemMarginProps)(rest), (0, _tags.default)("search", rest), {
158
172
  id: id,
159
- onFocus: handleOnFocus,
160
- onClick: handleOnFocus,
161
- onBlur: handleBlur,
162
- onChange: handleChange,
163
- onKeyDown: handleKeyDown,
164
173
  name: name
165
174
  }, rest), /*#__PURE__*/_react.default.createElement(_textbox.default, {
166
175
  placeholder: placeholder,
@@ -170,10 +179,10 @@ const Search = ({
170
179
  iconOnClick: handleIconClick,
171
180
  iconOnMouseDown: handleMouseDown,
172
181
  "aria-label": ariaLabel,
173
- onFocus: onFocus,
174
- onBlur: onBlur,
175
- onChange: onChange,
176
- onKeyDown: onKeyDown,
182
+ onFocus: handleFocus,
183
+ onBlur: handleBlur,
184
+ onChange: handleChange,
185
+ onKeyDown: handleKeyDown,
177
186
  inputRef: assignInput,
178
187
  tabIndex: tabIndex
179
188
  }), searchButton && /*#__PURE__*/_react.default.createElement(_search.StyledSearchButton, null, Boolean(isFocused || (!isControlled ? searchValue.length : value.length)) && /*#__PURE__*/_react.default.createElement(_button.default, _extends({
@@ -10,8 +10,8 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
12
  const StyledSimpleColor = _styledComponents.default.div`
13
- width: 56px;
14
- height: 56px;
13
+ width: var(--sizing700);
14
+ height: var(--sizing700);
15
15
  margin-right: 2px;
16
16
  margin-bottom: 2px;
17
17
 
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
 
10
- var _base = _interopRequireDefault(require("../../../style/themes/base"));
11
-
12
10
  var _input = require("../../../__internal__/input");
13
11
 
14
12
  var _colorSampleBox = _interopRequireDefault(require("../color-sample-box/color-sample-box.style"));
@@ -18,8 +16,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
18
16
  const StyledSimpleColorInput = (0, _styledComponents.default)(_input.Input)`
19
17
  position: absolute;
20
18
  opacity: 0;
21
- height: 56px;
22
- width: 56px;
19
+ height: var(--sizing700);
20
+ width: var(--sizing700);
23
21
  margin: 0;
24
22
 
25
23
  &:hover {
@@ -31,16 +29,10 @@ const StyledSimpleColorInput = (0, _styledComponents.default)(_input.Input)`
31
29
  }
32
30
 
33
31
  &:focus + ${_colorSampleBox.default} {
34
- box-shadow: inset 0px 0px 0px 3px ${({
35
- theme
36
- }) => theme.colors.white};
37
- border: 2px solid ${({
38
- theme
39
- }) => theme.colors.focus};
32
+ box-shadow: inset 0px 0px 0px var(--borderWidth200)
33
+ var(--colorsActionMajorYang100);
34
+ border: 2px solid var(--colorsSemanticFocus500);
40
35
  }
41
36
  `;
42
- StyledSimpleColorInput.defaultProps = {
43
- theme: _base.default
44
- };
45
37
  var _default = StyledSimpleColorInput;
46
38
  exports.default = _default;
@@ -9,8 +9,6 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
9
 
10
10
  var _validationIcon = _interopRequireDefault(require("../../__internal__/validations/validation-icon.style"));
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; }
@@ -43,24 +41,20 @@ const StyledColorOptions = _styledComponents.default.div`
43
41
  border-top: ${BORDER_WIDTH}px solid transparent;
44
42
 
45
43
  ${({
46
- theme,
47
44
  error,
48
45
  info,
49
46
  warning
50
47
  }) => {
51
48
  if (error) return (0, _styledComponents.css)`
52
- outline: 2px solid ${theme.colors.error};
49
+ outline: var(--borderWidth200) solid var(--colorsSemanticNegative500);
53
50
  `;
54
51
  if (warning) return (0, _styledComponents.css)`
55
- outline: 1px solid ${theme.colors.warning};
52
+ outline: var(--borderWidth200) solid var(--colorsSemanticCaution500);
56
53
  `;
57
54
  if (info) return (0, _styledComponents.css)`
58
- outline: 1px solid ${theme.colors.info};
55
+ outline: var(--borderWidth200) solid var(--colorsSemanticInfo500);
59
56
  `;
60
57
  return "";
61
58
  }}
62
59
  `;
63
- exports.StyledColorOptions = StyledColorOptions;
64
- StyledColorOptions.defaultProps = {
65
- theme: _base.default
66
- };
60
+ exports.StyledColorOptions = StyledColorOptions;
@@ -11,15 +11,13 @@ var _icon = _interopRequireDefault(require("../../icon"));
11
11
 
12
12
  var _getRgbValues = _interopRequireDefault(require("../../../style/utils/get-rgb-values"));
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; }
19
17
 
20
18
  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
19
 
22
- const getIconColor = (color, theme) => {
20
+ const getIconColor = color => {
23
21
  const rgbValues = (0, _getRgbValues.default)(color);
24
22
  const [r, g, b] = rgbValues; // color contrast calculating formula as per W3 suggestions
25
23
 
@@ -27,8 +25,8 @@ const getIconColor = (color, theme) => {
27
25
  greenMultiplier = 587,
28
26
  blueMultiplier = 114;
29
27
  const contrast = (Math.round(r * redMultiplier) + Math.round(g * greenMultiplier) + Math.round(b * blueMultiplier)) / 1000;
30
- if (contrast < 128) return theme.colors.white;
31
- return theme.text.color;
28
+ if (contrast < 128) return "var(--colorsActionMajorYang100)";
29
+ return "var(--colorsActionMajorYin090)";
32
30
  };
33
31
 
34
32
  const StyledTickIcon = (0, _styledComponents.default)(_icon.default)`
@@ -40,9 +38,8 @@ const StyledTickIcon = (0, _styledComponents.default)(_icon.default)`
40
38
  &::before {
41
39
  font-size: 22px;
42
40
  color: ${({
43
- color,
44
- theme
45
- }) => getIconColor(color, theme)};
41
+ color
42
+ }) => getIconColor(color)};
46
43
  }
47
44
 
48
45
  ${({
@@ -53,8 +50,5 @@ const StyledTickIcon = (0, _styledComponents.default)(_icon.default)`
53
50
  }
54
51
  `}
55
52
  `;
56
- StyledTickIcon.defaultProps = {
57
- theme: _base.default
58
- };
59
53
  var _default = StyledTickIcon;
60
54
  exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "104.25.0",
3
+ "version": "104.27.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {