carbon-react 104.0.0 → 104.3.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.
- package/lib/__internal__/popover/popover.component.js +2 -6
- package/lib/__internal__/tooltip-provider/index.d.ts +1 -0
- package/lib/__internal__/tooltip-provider/index.js +6 -3
- package/lib/components/accordion/accordion.style.js +20 -45
- package/lib/components/button/button.component.d.ts +21 -1
- package/lib/components/button/button.component.js +63 -52
- package/lib/components/icon/icon.component.js +4 -2
- package/lib/components/icon-button/icon-button.component.js +11 -19
- package/lib/components/portal/portal.js +3 -6
- package/lib/components/step-sequence/step-sequence-item/step-sequence-item.style.js +13 -23
- package/lib/components/tooltip/tooltip.component.js +7 -7
- package/lib/components/tooltip/tooltip.d.ts +1 -0
- package/lib/style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component.d.ts +7 -5
- package/lib/style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component.js +11 -36
- package/lib/style/themes/aegean/aegean-theme.config.d.ts +1 -0
- package/lib/style/themes/aegean/aegean-theme.config.js +2 -1
- package/lib/style/themes/base/base-theme.config.d.ts +162 -93
- package/lib/style/themes/mint/mint-theme.config.d.ts +1 -0
- package/lib/style/themes/mint/mint-theme.config.js +2 -1
- package/lib/style/themes/sage/index.d.ts +162 -93
- package/package.json +4 -3
|
@@ -13,11 +13,9 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
|
|
14
14
|
var _core = require("@popperjs/core");
|
|
15
15
|
|
|
16
|
-
var _styledComponents = require("styled-components");
|
|
17
|
-
|
|
18
16
|
var _useResizeObserver = _interopRequireDefault(require("../../hooks/__internal__/useResizeObserver"));
|
|
19
17
|
|
|
20
|
-
var _carbonScopedTokensProvider = require("../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component");
|
|
18
|
+
var _carbonScopedTokensProvider = _interopRequireDefault(require("../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component"));
|
|
21
19
|
|
|
22
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
21
|
|
|
@@ -34,11 +32,9 @@ const Popover = ({
|
|
|
34
32
|
modifiers
|
|
35
33
|
}) => {
|
|
36
34
|
const elementDOM = (0, _react.useRef)();
|
|
37
|
-
const theme = (0, _react.useContext)(_styledComponents.ThemeContext);
|
|
38
35
|
|
|
39
36
|
if (!elementDOM.current && !disablePortal) {
|
|
40
37
|
elementDOM.current = document.createElement("div");
|
|
41
|
-
elementDOM.current.classList.add((0, _carbonScopedTokensProvider.tokensClassName)(theme === null || theme === void 0 ? void 0 : theme.name));
|
|
42
38
|
document.body.appendChild(elementDOM.current);
|
|
43
39
|
}
|
|
44
40
|
|
|
@@ -98,7 +94,7 @@ const Popover = ({
|
|
|
98
94
|
return content;
|
|
99
95
|
}
|
|
100
96
|
|
|
101
|
-
return /*#__PURE__*/_reactDom.default.createPortal(content, elementDOM.current);
|
|
97
|
+
return /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement(_carbonScopedTokensProvider.default, null, content), elementDOM.current);
|
|
102
98
|
};
|
|
103
99
|
|
|
104
100
|
Popover.propTypes = {
|
|
@@ -21,14 +21,16 @@ const TooltipProvider = ({
|
|
|
21
21
|
helpAriaLabel,
|
|
22
22
|
focusable = true,
|
|
23
23
|
tooltipVisible,
|
|
24
|
-
disabled = false
|
|
24
|
+
disabled = false,
|
|
25
|
+
target
|
|
25
26
|
}) => /*#__PURE__*/_react.default.createElement(TooltipContext.Provider, {
|
|
26
27
|
value: {
|
|
27
28
|
tooltipPosition,
|
|
28
29
|
helpAriaLabel,
|
|
29
30
|
focusable,
|
|
30
31
|
tooltipVisible,
|
|
31
|
-
disabled
|
|
32
|
+
disabled,
|
|
33
|
+
target
|
|
32
34
|
}
|
|
33
35
|
}, children);
|
|
34
36
|
|
|
@@ -39,5 +41,6 @@ TooltipProvider.propTypes = {
|
|
|
39
41
|
helpAriaLabel: _propTypes.default.string,
|
|
40
42
|
focusable: _propTypes.default.bool,
|
|
41
43
|
tooltipVisible: _propTypes.default.bool,
|
|
42
|
-
disabled: _propTypes.default.bool
|
|
44
|
+
disabled: _propTypes.default.bool,
|
|
45
|
+
target: _propTypes.default.instanceOf(Element)
|
|
43
46
|
};
|
|
@@ -37,18 +37,11 @@ const StyledAccordionContainer = _styledComponents.default.div`
|
|
|
37
37
|
width: ${({
|
|
38
38
|
width
|
|
39
39
|
}) => width || "100%"};
|
|
40
|
-
color:
|
|
41
|
-
theme
|
|
42
|
-
}) => theme.text.color};
|
|
40
|
+
color: var(--colorsUtilityYin090);
|
|
43
41
|
background-color: ${({
|
|
44
|
-
scheme
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
${({
|
|
48
|
-
theme
|
|
49
|
-
}) => (0, _styledComponents.css)`
|
|
50
|
-
border: 1px solid ${theme.accordion.border};
|
|
51
|
-
`}
|
|
42
|
+
scheme
|
|
43
|
+
}) => scheme === "white" ? "var(--colorsUtilityYang100)" : "var(--colorsUtilityMajorTransparent)"};
|
|
44
|
+
border: 1px solid var(--colorsUtilityMajor100);
|
|
52
45
|
${({
|
|
53
46
|
borders
|
|
54
47
|
}) => borders === "default" && (0, _styledComponents.css)`
|
|
@@ -63,12 +56,8 @@ const StyledAccordionContainer = _styledComponents.default.div`
|
|
|
63
56
|
|
|
64
57
|
& + & {
|
|
65
58
|
margin-top: -1px;
|
|
66
|
-
border-top: 1px solid
|
|
67
|
-
|
|
68
|
-
}) => theme.accordion.border};
|
|
69
|
-
border-bottom: 1px solid ${({
|
|
70
|
-
theme
|
|
71
|
-
}) => theme.accordion.border};
|
|
59
|
+
border-top: 1px solid var(--colorsUtilityMajor100);
|
|
60
|
+
border-bottom: 1px solid var(--colorsUtilityMajor100);
|
|
72
61
|
}
|
|
73
62
|
`;
|
|
74
63
|
exports.StyledAccordionContainer = StyledAccordionContainer;
|
|
@@ -91,15 +80,15 @@ exports.StyledAccordionSubTitle = StyledAccordionSubTitle;
|
|
|
91
80
|
const StyledAccordionIcon = (0, _styledComponents.default)(_icon.default)`
|
|
92
81
|
transition: transform 0.3s;
|
|
93
82
|
margin-right: ${({
|
|
94
|
-
iconAlign
|
|
95
|
-
|
|
96
|
-
}) => iconAlign === "left" ? theme.spacing * 2 : 0}px;
|
|
83
|
+
iconAlign
|
|
84
|
+
}) => iconAlign === "left" ? "var(--spacing200)" : "var(--spacing000)"};
|
|
97
85
|
${({
|
|
98
86
|
isExpanded,
|
|
99
87
|
iconAlign
|
|
100
88
|
}) => {
|
|
101
89
|
return !isExpanded && (iconAlign === "right" ? "transform: rotate(90deg)" : "transform: rotate(-90deg)");
|
|
102
90
|
}};
|
|
91
|
+
color: var(--colorsActionMinor500);
|
|
103
92
|
`;
|
|
104
93
|
exports.StyledAccordionIcon = StyledAccordionIcon;
|
|
105
94
|
const StyledAccordionHeadingsContainer = _styledComponents.default.div`
|
|
@@ -134,10 +123,9 @@ const StyledAccordionTitleContainer = _styledComponents.default.div`
|
|
|
134
123
|
buttonWidth,
|
|
135
124
|
iconAlign,
|
|
136
125
|
size,
|
|
137
|
-
theme,
|
|
138
126
|
hasButtonProps
|
|
139
127
|
}) => (0, _styledComponents.css)`
|
|
140
|
-
padding: ${size === "small" ?
|
|
128
|
+
padding: ${size === "small" ? "var(--spacing200)" : "var(--spacing300)"};
|
|
141
129
|
${_styledSystem.space}
|
|
142
130
|
display: flex;
|
|
143
131
|
align-items: center;
|
|
@@ -152,12 +140,12 @@ const StyledAccordionTitleContainer = _styledComponents.default.div`
|
|
|
152
140
|
z-index: 1;
|
|
153
141
|
|
|
154
142
|
&:focus {
|
|
155
|
-
outline:
|
|
143
|
+
outline: var(--borderWidth300) solid var(--colorsSemanticFocus500);
|
|
156
144
|
}
|
|
157
145
|
|
|
158
146
|
${!buttonHeading && (0, _styledComponents.css)`
|
|
159
147
|
&:hover {
|
|
160
|
-
background-color:
|
|
148
|
+
background-color: var(--colorsUtilityMajor050);
|
|
161
149
|
}
|
|
162
150
|
`}
|
|
163
151
|
|
|
@@ -165,10 +153,10 @@ const StyledAccordionTitleContainer = _styledComponents.default.div`
|
|
|
165
153
|
box-sizing: border-box;
|
|
166
154
|
font-weight: 600;
|
|
167
155
|
text-decoration: none;
|
|
168
|
-
font-size:
|
|
169
|
-
min-height:
|
|
156
|
+
font-size: var(--fontSizes100);
|
|
157
|
+
min-height: var(--spacing500);
|
|
170
158
|
|
|
171
|
-
color:
|
|
159
|
+
color: var(--colorsActionMajor500);
|
|
172
160
|
|
|
173
161
|
${!hasButtonProps && (0, _styledComponents.css)`
|
|
174
162
|
${StyledAccordionHeadingsContainer} {
|
|
@@ -177,7 +165,7 @@ const StyledAccordionTitleContainer = _styledComponents.default.div`
|
|
|
177
165
|
`}
|
|
178
166
|
|
|
179
167
|
${StyledAccordionIcon} {
|
|
180
|
-
color:
|
|
168
|
+
color: var(--colorsActionMajor500);
|
|
181
169
|
${!hasButtonProps && (0, _styledComponents.css)`
|
|
182
170
|
position: relative;
|
|
183
171
|
${iconAlign}: 16px;
|
|
@@ -185,9 +173,9 @@ const StyledAccordionTitleContainer = _styledComponents.default.div`
|
|
|
185
173
|
}
|
|
186
174
|
|
|
187
175
|
&:hover {
|
|
188
|
-
color:
|
|
176
|
+
color: var(--colorsActionMajor600);
|
|
189
177
|
${StyledAccordionIcon} {
|
|
190
|
-
color:
|
|
178
|
+
color: var(--colorsActionMajor600);
|
|
191
179
|
}
|
|
192
180
|
}
|
|
193
181
|
|
|
@@ -217,9 +205,8 @@ const StyledAccordionContentContainer = _styledComponents.default.div`
|
|
|
217
205
|
`;
|
|
218
206
|
exports.StyledAccordionContentContainer = StyledAccordionContentContainer;
|
|
219
207
|
const StyledAccordionContent = _styledComponents.default.div`
|
|
220
|
-
padding:
|
|
221
|
-
|
|
222
|
-
}) => theme.spacing * 3}px;
|
|
208
|
+
padding: var(--spacing300);
|
|
209
|
+
padding-top: 0;
|
|
223
210
|
overflow: hidden;
|
|
224
211
|
|
|
225
212
|
${({
|
|
@@ -237,16 +224,4 @@ StyledAccordionContainer.defaultProps = {
|
|
|
237
224
|
};
|
|
238
225
|
StyledAccordionTitleContainer.defaultProps = {
|
|
239
226
|
theme: _themes.baseTheme
|
|
240
|
-
};
|
|
241
|
-
StyledAccordionTitle.defaultProps = {
|
|
242
|
-
theme: _themes.baseTheme
|
|
243
|
-
};
|
|
244
|
-
StyledAccordionIcon.defaultProps = {
|
|
245
|
-
theme: _themes.baseTheme
|
|
246
|
-
};
|
|
247
|
-
StyledAccordionContent.defaultProps = {
|
|
248
|
-
theme: _themes.baseTheme
|
|
249
|
-
};
|
|
250
|
-
StyledAccordionContentContainer.defaultProps = {
|
|
251
|
-
theme: _themes.baseTheme
|
|
252
227
|
};
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
export default Button;
|
|
2
2
|
export const ButtonWithForwardRef: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
3
|
-
declare function Button(
|
|
3
|
+
declare function Button({ size, subtext, as, children, forwardRef, "aria-label": ariaLabel, disabled, buttonType: buttonTypeProp, iconType, iconPosition, href, m, px, noWrap, target, rel, iconTooltipMessage, iconTooltipPosition, ...rest }: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
size: any;
|
|
6
|
+
subtext: any;
|
|
7
|
+
as: any;
|
|
8
|
+
children: any;
|
|
9
|
+
forwardRef: any;
|
|
10
|
+
"aria-label": any;
|
|
11
|
+
disabled: any;
|
|
12
|
+
buttonType: any;
|
|
13
|
+
iconType: any;
|
|
14
|
+
iconPosition: any;
|
|
15
|
+
href: any;
|
|
16
|
+
m?: number | undefined;
|
|
17
|
+
px: any;
|
|
18
|
+
noWrap: any;
|
|
19
|
+
target: any;
|
|
20
|
+
rel: any;
|
|
21
|
+
iconTooltipMessage: any;
|
|
22
|
+
iconTooltipPosition: any;
|
|
23
|
+
}): JSX.Element;
|
|
4
24
|
declare namespace Button {
|
|
5
25
|
const propTypes: any;
|
|
6
26
|
namespace defaultProps {
|
|
@@ -17,6 +17,8 @@ var _button = _interopRequireWildcard(require("./button.style"));
|
|
|
17
17
|
|
|
18
18
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
19
19
|
|
|
20
|
+
var _tooltipProvider = require("../../__internal__/tooltip-provider");
|
|
21
|
+
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
22
24
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -35,7 +37,8 @@ function renderChildren({
|
|
|
35
37
|
disabled,
|
|
36
38
|
buttonType,
|
|
37
39
|
iconTooltipMessage,
|
|
38
|
-
iconTooltipPosition
|
|
40
|
+
iconTooltipPosition,
|
|
41
|
+
tooltipTarget
|
|
39
42
|
/* eslint-enable */
|
|
40
43
|
|
|
41
44
|
}) {
|
|
@@ -57,43 +60,54 @@ function renderChildren({
|
|
|
57
60
|
"data-element": "main-text"
|
|
58
61
|
}, children), size === "large" && /*#__PURE__*/_react.default.createElement(_button.StyledButtonSubtext, {
|
|
59
62
|
"data-element": "subtext"
|
|
60
|
-
}, subtext)), iconType && !children && /*#__PURE__*/_react.default.createElement(
|
|
63
|
+
}, subtext)), iconType && !children && /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
|
|
64
|
+
disabled: disabled,
|
|
65
|
+
focusable: false,
|
|
66
|
+
target: tooltipTarget
|
|
67
|
+
}, /*#__PURE__*/_react.default.createElement(_icon.default, _extends({}, iconProps, {
|
|
61
68
|
tooltipMessage: iconTooltipMessage,
|
|
62
69
|
tooltipPosition: iconTooltipPosition
|
|
63
|
-
})), iconType && iconPosition === "after" && children && /*#__PURE__*/_react.default.createElement(_icon.default, iconProps));
|
|
70
|
+
}))), iconType && iconPosition === "after" && children && /*#__PURE__*/_react.default.createElement(_icon.default, iconProps));
|
|
64
71
|
}
|
|
65
72
|
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
const Button = ({
|
|
74
|
+
size,
|
|
75
|
+
subtext,
|
|
76
|
+
as,
|
|
77
|
+
children,
|
|
78
|
+
forwardRef,
|
|
79
|
+
"aria-label": ariaLabel,
|
|
80
|
+
disabled,
|
|
81
|
+
buttonType: buttonTypeProp,
|
|
82
|
+
iconType,
|
|
83
|
+
iconPosition,
|
|
84
|
+
href,
|
|
85
|
+
m = 0,
|
|
86
|
+
px,
|
|
87
|
+
noWrap,
|
|
88
|
+
target,
|
|
89
|
+
rel,
|
|
90
|
+
iconTooltipMessage,
|
|
91
|
+
iconTooltipPosition,
|
|
92
|
+
...rest
|
|
93
|
+
}) => {
|
|
94
|
+
const [internalRef, setInternalRef] = (0, _react.useState)(null);
|
|
95
|
+
const buttonType = buttonTypeProp || as;
|
|
96
|
+
|
|
97
|
+
if (subtext.length > 0 && size !== "large") {
|
|
98
|
+
throw new Error("subtext prop has no effect unless the button is large");
|
|
99
|
+
}
|
|
100
|
+
|
|
83
101
|
let paddingX;
|
|
84
102
|
|
|
85
103
|
const handleLinkKeyDown = event => {
|
|
86
104
|
// If space key click link
|
|
87
105
|
if (event.key === " ") {
|
|
88
106
|
event.preventDefault();
|
|
89
|
-
|
|
107
|
+
internalRef.click();
|
|
90
108
|
}
|
|
91
109
|
};
|
|
92
110
|
|
|
93
|
-
if (href) {
|
|
94
|
-
rest.href = href;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
111
|
switch (size) {
|
|
98
112
|
case "small":
|
|
99
113
|
paddingX = 2;
|
|
@@ -108,7 +122,7 @@ const renderStyledButton = buttonProps => {
|
|
|
108
122
|
}
|
|
109
123
|
|
|
110
124
|
return /*#__PURE__*/_react.default.createElement(_button.default, _extends({
|
|
111
|
-
"aria-label": !
|
|
125
|
+
"aria-label": !children && iconType ? ariaLabel || iconType : undefined,
|
|
112
126
|
as: !disabled && href ? "a" : "button",
|
|
113
127
|
onKeyDown: href && handleLinkKeyDown,
|
|
114
128
|
draggable: false,
|
|
@@ -121,36 +135,33 @@ const renderStyledButton = buttonProps => {
|
|
|
121
135
|
px: px ?? paddingX,
|
|
122
136
|
m: m,
|
|
123
137
|
noWrap: noWrap,
|
|
124
|
-
iconOnly: !
|
|
138
|
+
iconOnly: !children && iconType,
|
|
139
|
+
iconPosition: iconPosition,
|
|
125
140
|
target: target,
|
|
126
141
|
rel: rel
|
|
127
|
-
}, (0, _tags.default)("button",
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
142
|
+
}, (0, _tags.default)("button", rest), rest, href && {
|
|
143
|
+
href
|
|
144
|
+
}, {
|
|
145
|
+
ref: reference => {
|
|
146
|
+
if (reference) {
|
|
147
|
+
setInternalRef(reference);
|
|
148
|
+
if (!forwardRef) return;
|
|
149
|
+
if (typeof forwardRef === "object") forwardRef.current = reference;
|
|
150
|
+
if (typeof forwardRef === "function") forwardRef(reference);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}), renderChildren({
|
|
154
|
+
iconType,
|
|
155
|
+
iconPosition,
|
|
134
156
|
size,
|
|
135
|
-
subtext
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const {
|
|
139
|
-
as,
|
|
157
|
+
subtext,
|
|
158
|
+
children,
|
|
159
|
+
disabled,
|
|
140
160
|
buttonType,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
buttonType: buttonType || as,
|
|
146
|
-
ref: forwardRef || linkRef
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
if (subtext.length > 0 && size !== "large") {
|
|
150
|
-
throw new Error("subtext prop has no effect unless the button is large");
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return renderStyledButton(propsWithoutAs);
|
|
161
|
+
iconTooltipMessage,
|
|
162
|
+
iconTooltipPosition,
|
|
163
|
+
tooltipTarget: internalRef
|
|
164
|
+
}));
|
|
154
165
|
};
|
|
155
166
|
|
|
156
167
|
Button.propTypes = {
|
|
@@ -63,7 +63,8 @@ const Icon = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
63
63
|
tooltipPosition: tooltipPositionFromContext,
|
|
64
64
|
focusable: focusableFromContext,
|
|
65
65
|
tooltipVisible: tooltipVisibleFromContext,
|
|
66
|
-
disabled: disabledFromContext
|
|
66
|
+
disabled: disabledFromContext,
|
|
67
|
+
target
|
|
67
68
|
} = (0, _react.useContext)(_tooltipProvider.TooltipContext);
|
|
68
69
|
/** Return Icon type with overrides */
|
|
69
70
|
|
|
@@ -131,7 +132,8 @@ const Icon = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
131
132
|
inputSize: inputSize,
|
|
132
133
|
bgColor: tooltipBgColor,
|
|
133
134
|
fontColor: tooltipFontColor,
|
|
134
|
-
flipOverrides: tooltipFlipOverrides
|
|
135
|
+
flipOverrides: tooltipFlipOverrides,
|
|
136
|
+
target: target
|
|
135
137
|
}, icon);
|
|
136
138
|
}
|
|
137
139
|
|
|
@@ -38,13 +38,8 @@ const IconButton = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
38
38
|
disabled,
|
|
39
39
|
...rest
|
|
40
40
|
}, ref) => {
|
|
41
|
+
const [internalRef, setInternalRef] = (0, _react.useState)(null);
|
|
41
42
|
const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
|
|
42
|
-
const hasIconWithTooltip = !!_react.default.Children.toArray(children).find(child => {
|
|
43
|
-
var _child$props;
|
|
44
|
-
|
|
45
|
-
return child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.tooltipMessage;
|
|
46
|
-
});
|
|
47
|
-
const [tooltipVisible, setTooltipVisible] = (0, _react.useState)(undefined);
|
|
48
43
|
|
|
49
44
|
const onKeyDown = e => {
|
|
50
45
|
if (_events.default.isEnterKey(e) || _events.default.isSpaceKey(e)) {
|
|
@@ -59,26 +54,23 @@ const IconButton = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
59
54
|
onAction(e);
|
|
60
55
|
};
|
|
61
56
|
|
|
62
|
-
const handleTooltipVisibility = (ev, callbackName) => {
|
|
63
|
-
setTooltipVisible(["onFocus", "onMouseEnter"].includes(callbackName));
|
|
64
|
-
if (rest[callbackName]) rest[callbackName](ev);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
57
|
return /*#__PURE__*/_react.default.createElement(_iconButton.default, _extends({}, rest, {
|
|
68
58
|
"aria-label": ariaLabel,
|
|
69
59
|
onKeyDown: onKeyDown,
|
|
70
60
|
onClick: handleOnAction,
|
|
71
|
-
ref:
|
|
61
|
+
ref: reference => {
|
|
62
|
+
if (reference) {
|
|
63
|
+
setInternalRef(reference);
|
|
64
|
+
if (!ref) return;
|
|
65
|
+
if (typeof ref === "object") ref.current = reference;
|
|
66
|
+
if (typeof ref === "function") ref(reference);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
72
69
|
disabled: disabled
|
|
73
|
-
}, !disabled && hasIconWithTooltip && {
|
|
74
|
-
onFocus: ev => handleTooltipVisibility(ev, "onFocus"),
|
|
75
|
-
onBlur: ev => handleTooltipVisibility(ev, "onBlur"),
|
|
76
|
-
onMouseEnter: ev => handleTooltipVisibility(ev, "onMouseEnter"),
|
|
77
|
-
onMouseLeave: ev => handleTooltipVisibility(ev, "onMouseLeave")
|
|
78
70
|
}, marginProps), /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
|
|
79
71
|
disabled: disabled,
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
focusable: false,
|
|
73
|
+
target: internalRef
|
|
82
74
|
}, children));
|
|
83
75
|
});
|
|
84
76
|
|
|
@@ -11,13 +11,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
13
13
|
|
|
14
|
-
var _styledComponents = require("styled-components");
|
|
15
|
-
|
|
16
14
|
var _guid = _interopRequireDefault(require("../../__internal__/utils/helpers/guid"));
|
|
17
15
|
|
|
18
16
|
var _browser = _interopRequireDefault(require("../../__internal__/utils/helpers/browser"));
|
|
19
17
|
|
|
20
|
-
var _carbonScopedTokensProvider = require("../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component");
|
|
18
|
+
var _carbonScopedTokensProvider = _interopRequireDefault(require("../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component"));
|
|
21
19
|
|
|
22
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
21
|
|
|
@@ -33,7 +31,6 @@ const Portal = ({
|
|
|
33
31
|
}) => {
|
|
34
32
|
const [portalNode, setPortalNode] = (0, _react.useState)(null);
|
|
35
33
|
const uniqueId = (0, _react.useMemo)(() => (0, _guid.default)(), []);
|
|
36
|
-
const theme = (0, _react.useContext)(_styledComponents.ThemeContext);
|
|
37
34
|
(0, _react.useEffect)(() => {
|
|
38
35
|
if (onReposition) {
|
|
39
36
|
onReposition();
|
|
@@ -68,7 +65,7 @@ const Portal = ({
|
|
|
68
65
|
setPortalNode(node);
|
|
69
66
|
} else if (!node) {
|
|
70
67
|
node = document.createElement("div");
|
|
71
|
-
node.classList.add(portalClassName
|
|
68
|
+
node.classList.add(portalClassName);
|
|
72
69
|
node.setAttribute("data-portal-exit", uniqueId);
|
|
73
70
|
|
|
74
71
|
if (id !== undefined) {
|
|
@@ -99,7 +96,7 @@ const Portal = ({
|
|
|
99
96
|
|
|
100
97
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
101
98
|
"data-portal-entrance": uniqueId
|
|
102
|
-
}, /*#__PURE__*/_reactDom.default.createPortal(children, getPortalContainer()));
|
|
99
|
+
}, /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/_react.default.createElement(_carbonScopedTokensProvider.default, null, children), getPortalContainer()));
|
|
103
100
|
};
|
|
104
101
|
|
|
105
102
|
Portal.propTypes = {
|
|
@@ -7,8 +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
10
|
var _icon = _interopRequireDefault(require("../../icon/icon.style"));
|
|
13
11
|
|
|
14
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -23,19 +21,15 @@ const StepSequenceItemStyle = _styledComponents.default.li`
|
|
|
23
21
|
flex-grow: 1;
|
|
24
22
|
text-align: right;
|
|
25
23
|
list-style-type: none;
|
|
26
|
-
color:
|
|
27
|
-
theme
|
|
28
|
-
}) => theme.disabled.disabled};
|
|
24
|
+
color: var(--colorsUtilityYin055);
|
|
29
25
|
|
|
30
26
|
&::before {
|
|
31
27
|
content: "";
|
|
32
28
|
flex-grow: 1;
|
|
33
29
|
display: block;
|
|
34
|
-
height:
|
|
30
|
+
height: var(--sizing025);
|
|
35
31
|
margin: 0 16px;
|
|
36
|
-
background-color:
|
|
37
|
-
theme
|
|
38
|
-
}) => theme.disabled.disabled};
|
|
32
|
+
background-color: var(--colorsUtilityYin055);
|
|
39
33
|
}
|
|
40
34
|
|
|
41
35
|
& span {
|
|
@@ -46,9 +40,7 @@ const StepSequenceItemStyle = _styledComponents.default.li`
|
|
|
46
40
|
|
|
47
41
|
${_icon.default} {
|
|
48
42
|
margin-right: 8px;
|
|
49
|
-
color:
|
|
50
|
-
theme
|
|
51
|
-
}) => theme.colors.primary};
|
|
43
|
+
color: var(--colorsBaseTheme, var(--colorsSemanticPositive500));
|
|
52
44
|
}
|
|
53
45
|
|
|
54
46
|
&:first-child {
|
|
@@ -60,24 +52,25 @@ const StepSequenceItemStyle = _styledComponents.default.li`
|
|
|
60
52
|
}
|
|
61
53
|
|
|
62
54
|
${({
|
|
63
|
-
theme,
|
|
64
55
|
status
|
|
65
56
|
}) => status === "current" && (0, _styledComponents.css)`
|
|
66
|
-
color:
|
|
57
|
+
color: var(--colorsUtilityYin090);
|
|
67
58
|
|
|
68
59
|
&::before {
|
|
69
|
-
background-color:
|
|
60
|
+
background-color: var(--colorsUtilityYin090);
|
|
70
61
|
}
|
|
71
62
|
`}
|
|
72
63
|
|
|
73
64
|
${({
|
|
74
|
-
theme,
|
|
75
65
|
status
|
|
76
66
|
}) => status === "complete" && (0, _styledComponents.css)`
|
|
77
|
-
color:
|
|
67
|
+
color: var(--colorsBaseTheme, var(--colorsSemanticPositive500));
|
|
78
68
|
|
|
79
69
|
&::before {
|
|
80
|
-
background-color:
|
|
70
|
+
background-color: var(
|
|
71
|
+
--colorsBaseTheme,
|
|
72
|
+
var(--colorsSemanticPositive500)
|
|
73
|
+
);
|
|
81
74
|
}
|
|
82
75
|
`}
|
|
83
76
|
|
|
@@ -89,14 +82,11 @@ const StepSequenceItemStyle = _styledComponents.default.li`
|
|
|
89
82
|
|
|
90
83
|
&::before {
|
|
91
84
|
flex-grow: 0;
|
|
92
|
-
width:
|
|
93
|
-
height:
|
|
85
|
+
width: var(--sizing025);
|
|
86
|
+
height: var(--sizing300);
|
|
94
87
|
margin: 12px 8px;
|
|
95
88
|
}
|
|
96
89
|
`}
|
|
97
90
|
`;
|
|
98
|
-
StepSequenceItemStyle.defaultProps = {
|
|
99
|
-
theme: _base.default
|
|
100
|
-
};
|
|
101
91
|
var _default = StepSequenceItemStyle;
|
|
102
92
|
exports.default = _default;
|
|
@@ -11,15 +11,13 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _headless = _interopRequireDefault(require("@tippyjs/react/headless"));
|
|
13
13
|
|
|
14
|
-
var _styledComponents = require("styled-components");
|
|
15
|
-
|
|
16
14
|
var _tooltip = _interopRequireDefault(require("./tooltip.style"));
|
|
17
15
|
|
|
18
16
|
var _tooltipPointer = _interopRequireDefault(require("./tooltip-pointer.style"));
|
|
19
17
|
|
|
20
18
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
21
19
|
|
|
22
|
-
var _carbonScopedTokensProvider = require("../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component");
|
|
20
|
+
var _carbonScopedTokensProvider = _interopRequireDefault(require("../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component"));
|
|
23
21
|
|
|
24
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
23
|
|
|
@@ -44,15 +42,14 @@ const Tooltip = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
44
42
|
bgColor,
|
|
45
43
|
fontColor,
|
|
46
44
|
flipOverrides,
|
|
45
|
+
target,
|
|
47
46
|
...rest
|
|
48
47
|
}, ref) => {
|
|
49
48
|
const tooltipRef = (0, _react.useRef)(ref || null);
|
|
50
|
-
const theme = (0, _react.useContext)(_styledComponents.ThemeContext);
|
|
51
49
|
|
|
52
50
|
const tooltip = (attrs, content) => {
|
|
53
51
|
const currentPosition = attrs["data-placement"] || position;
|
|
54
|
-
return /*#__PURE__*/_react.default.createElement(_tooltip.default, _extends({
|
|
55
|
-
className: (0, _carbonScopedTokensProvider.tokensClassName)(theme === null || theme === void 0 ? void 0 : theme.name),
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_carbonScopedTokensProvider.default, null, /*#__PURE__*/_react.default.createElement(_tooltip.default, _extends({
|
|
56
53
|
"data-element": "tooltip",
|
|
57
54
|
role: "tooltip",
|
|
58
55
|
tabIndex: "-1",
|
|
@@ -75,7 +72,7 @@ const Tooltip = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
75
72
|
"data-popper-arrow": "",
|
|
76
73
|
"data-element": "tooltip-pointer",
|
|
77
74
|
bgColor: bgColor
|
|
78
|
-
})), /*#__PURE__*/_react.default.createElement("div", null, content));
|
|
75
|
+
})), /*#__PURE__*/_react.default.createElement("div", null, content)));
|
|
79
76
|
};
|
|
80
77
|
|
|
81
78
|
return /*#__PURE__*/_react.default.createElement(_headless.default, _extends({
|
|
@@ -85,6 +82,7 @@ const Tooltip = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
85
82
|
visible: isVisible
|
|
86
83
|
}, {
|
|
87
84
|
render: attrs => tooltip(attrs, message),
|
|
85
|
+
reference: target,
|
|
88
86
|
popperOptions: {
|
|
89
87
|
modifiers: [...(flipOverrides ? [{
|
|
90
88
|
name: "flip",
|
|
@@ -123,6 +121,8 @@ Tooltip.propTypes = {
|
|
|
123
121
|
|
|
124
122
|
/** Defines the size of the tooltip content */
|
|
125
123
|
size: _propTypes.default.oneOf(["medium", "large"]),
|
|
124
|
+
// Reference element, tooltip will be positioned in relation to this element
|
|
125
|
+
target: _propTypes.default.instanceOf(Element),
|
|
126
126
|
|
|
127
127
|
/** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
|
|
128
128
|
bgColor: _propTypes.default.string,
|