carbon-react 123.4.2 → 123.4.4

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.
@@ -49,7 +49,7 @@ const InputIconToggle = ({
49
49
  tooltipPosition: align === "right" ? "left" : "right"
50
50
  }));
51
51
  }
52
- if (type && !(disabled || readOnly)) {
52
+ if (type) {
53
53
  return /*#__PURE__*/React.createElement(InputIconToggleStyle, {
54
54
  size: size,
55
55
  onClick: onClick,
@@ -57,8 +57,11 @@ const InputIconToggle = ({
57
57
  onBlur: onBlur,
58
58
  onMouseDown: onMouseDown,
59
59
  tabIndex: iconTabIndex,
60
- "data-element": "input-icon-toggle"
60
+ "data-element": "input-icon-toggle",
61
+ disabled: disabled,
62
+ readOnly: readOnly
61
63
  }, /*#__PURE__*/React.createElement(Icon, {
64
+ disabled: disabled || readOnly,
62
65
  type: type
63
66
  }));
64
67
  }
@@ -2,6 +2,8 @@
2
2
  import { ValidationProps } from "../validations";
3
3
  export interface InputIconToggleStyleProps extends ValidationProps {
4
4
  size?: "small" | "medium" | "large";
5
+ disabled?: boolean;
6
+ readOnly?: boolean;
5
7
  onClick?: (event: React.MouseEvent<HTMLSpanElement> | React.KeyboardEvent<HTMLSpanElement>) => void;
6
8
  }
7
9
  declare const InputIconToggleStyle: import("styled-components").StyledComponent<"span", any, {
@@ -26,6 +26,18 @@ const InputIconToggleStyle = styled.span.attrs(({
26
26
  width: ${sizes[size].height};
27
27
  `}
28
28
 
29
+ ${({
30
+ disabled
31
+ }) => disabled && css`
32
+ cursor: not-allowed;
33
+ `}
34
+
35
+ ${({
36
+ readOnly
37
+ }) => readOnly && css`
38
+ cursor: default;
39
+ `}
40
+
29
41
  ${({
30
42
  theme
31
43
  }) => `
@@ -6,7 +6,7 @@ import StyledIcon from "../icon/icon.style";
6
6
  import addFocusStyling from "../../style/utils/add-focus-styling";
7
7
  function additionalIconStyle(iconType) {
8
8
  if (iconType === "services") return "6px";
9
- return "16px";
9
+ return "20px";
10
10
  }
11
11
  function stylingForIconOnly(size) {
12
12
  let dimension = "";
@@ -97,6 +97,7 @@ const StyledButton = styled.button`
97
97
  margin-right: ${!iconOnly && iconPosition === "before" ? "var(--spacing100)" : "0px"};
98
98
  margin-bottom: ${iconOnly ? "1px" : "0px"};
99
99
  height: ${additionalIconStyle(iconType)};
100
+ width: 20px;
100
101
  svg {
101
102
  margin-top: 0;
102
103
  }
@@ -56,7 +56,7 @@ const InputIconToggle = ({
56
56
  tooltipPosition: align === "right" ? "left" : "right"
57
57
  }));
58
58
  }
59
- if (type && !(disabled || readOnly)) {
59
+ if (type) {
60
60
  return /*#__PURE__*/_react.default.createElement(_inputIconToggle.default, {
61
61
  size: size,
62
62
  onClick: onClick,
@@ -64,8 +64,11 @@ const InputIconToggle = ({
64
64
  onBlur: onBlur,
65
65
  onMouseDown: onMouseDown,
66
66
  tabIndex: iconTabIndex,
67
- "data-element": "input-icon-toggle"
67
+ "data-element": "input-icon-toggle",
68
+ disabled: disabled,
69
+ readOnly: readOnly
68
70
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
71
+ disabled: disabled || readOnly,
69
72
  type: type
70
73
  }));
71
74
  }
@@ -2,6 +2,8 @@
2
2
  import { ValidationProps } from "../validations";
3
3
  export interface InputIconToggleStyleProps extends ValidationProps {
4
4
  size?: "small" | "medium" | "large";
5
+ disabled?: boolean;
6
+ readOnly?: boolean;
5
7
  onClick?: (event: React.MouseEvent<HTMLSpanElement> | React.KeyboardEvent<HTMLSpanElement>) => void;
6
8
  }
7
9
  declare const InputIconToggleStyle: import("styled-components").StyledComponent<"span", any, {
@@ -35,6 +35,18 @@ const InputIconToggleStyle = _styledComponents.default.span.attrs(({
35
35
  width: ${_inputSizes.default[size].height};
36
36
  `}
37
37
 
38
+ ${({
39
+ disabled
40
+ }) => disabled && (0, _styledComponents.css)`
41
+ cursor: not-allowed;
42
+ `}
43
+
44
+ ${({
45
+ readOnly
46
+ }) => readOnly && (0, _styledComponents.css)`
47
+ cursor: default;
48
+ `}
49
+
38
50
  ${({
39
51
  theme
40
52
  }) => `
@@ -15,7 +15,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
15
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
16
16
  function additionalIconStyle(iconType) {
17
17
  if (iconType === "services") return "6px";
18
- return "16px";
18
+ return "20px";
19
19
  }
20
20
  function stylingForIconOnly(size) {
21
21
  let dimension = "";
@@ -106,6 +106,7 @@ const StyledButton = _styledComponents.default.button`
106
106
  margin-right: ${!iconOnly && iconPosition === "before" ? "var(--spacing100)" : "0px"};
107
107
  margin-bottom: ${iconOnly ? "1px" : "0px"};
108
108
  height: ${additionalIconStyle(iconType)};
109
+ width: 20px;
109
110
  svg {
110
111
  margin-top: 0;
111
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "123.4.2",
3
+ "version": "123.4.4",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",