carbon-react 112.0.3 → 113.0.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.
@@ -32,55 +32,19 @@ const tooltipColor = (theme, bgColor, type) => {
32
32
  return type === "error" ? "var(--colorsSemanticNegative500)" : "var(--colorsSemanticNeutral500)";
33
33
  };
34
34
 
35
- const tooltipOffset = (position, inputSize, isPartOfInput) => {
36
- if (!isPartOfInput) {
37
- return {
38
- [position]: "1px"
39
- };
40
- }
41
-
42
- switch (inputSize) {
43
- case "small":
44
- return `
45
- ${position}: 5px;
46
- @-moz-document url-prefix() {
47
- ${position}: ${["top", "bottom"].includes(position) ? "7px" : "6px"};
48
- }
49
- `;
50
-
51
- case "large":
52
- return `
53
- ${position}: ${["top", "bottom"].includes(position) ? "0px" : "-2px"};
54
- @-moz-document url-prefix() {
55
- ${position}: -1px;
56
- }
57
- `;
58
-
59
- default:
60
- return `
61
- ${position}: ${["top", "bottom"].includes(position) ? "4px" : "2px"};
62
- @-moz-document url-prefix() {
63
- ${position}: 4px;
64
- }
65
- `;
66
- }
67
- };
68
-
69
35
  const StyledTooltip = _styledComponents.default.div`
70
36
  ${({
71
- position,
72
37
  size,
73
38
  theme,
74
39
  type,
75
- isPartOfInput,
76
- inputSize = "medium",
77
40
  bgColor,
78
41
  fontColor
79
42
  }) => (0, _styledComponents.css)`
80
43
  bottom: auto;
81
44
  right: auto;
82
45
  max-width: 300px;
83
- position: relative;
46
+ width: max-content;
47
+ position: absolute;
84
48
  animation: ${fadeIn} 0.2s linear;
85
49
  z-index: ${theme.zIndex.popover}; // TODO (tokens): implement elevation tokens - FE-4437
86
50
  text-align: left;
@@ -93,7 +57,6 @@ const StyledTooltip = _styledComponents.default.div`
93
57
  line-height: 1.5rem;
94
58
  font-weight: 400;
95
59
  background-color: ${tooltipColor(theme, bgColor, type)};
96
- ${tooltipOffset(position, inputSize, isPartOfInput)};
97
60
  `}
98
61
  `;
99
62
  StyledTooltip.defaultProps = {
@@ -2,8 +2,8 @@
2
2
  import { Strategy, Middleware, Placement } from "@floating-ui/dom";
3
3
  export interface UseFloatingProps {
4
4
  isOpen?: boolean;
5
- reference: React.RefObject<HTMLElement>;
6
- floating: React.RefObject<HTMLElement>;
5
+ reference: React.RefObject<HTMLElement | null>;
6
+ floating: React.RefObject<HTMLElement | null>;
7
7
  strategy?: Strategy;
8
8
  middleware?: Middleware[];
9
9
  placement?: Placement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "112.0.3",
3
+ "version": "113.0.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -164,10 +164,10 @@
164
164
  "webpack-dev-server": "^4.0.0"
165
165
  },
166
166
  "dependencies": {
167
- "@floating-ui/dom": "^1.0.2",
167
+ "@floating-ui/dom": "^1.0.7",
168
+ "@floating-ui/react-dom": "^1.0.1",
168
169
  "@octokit/rest": "^18.12.0",
169
170
  "@styled-system/prop-types": "^5.1.5",
170
- "@tippyjs/react": "^4.2.5",
171
171
  "@types/styled-system": "^5.1.11",
172
172
  "chalk": "^4.1.1",
173
173
  "ci-info": "^3.3.2",