carbon-react 111.18.0 → 111.20.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/esm/__internal__/form-field/form-field.component.js +18 -4
- package/esm/components/box/box.component.js +11 -0
- package/esm/components/icon-button/icon-button.component.d.ts +2 -2
- package/esm/components/icon-button/icon-button.component.js +159 -5
- package/esm/components/icon-button/icon-button.style.js +4 -3
- package/esm/components/menu/menu-item/menu-item.component.js +3 -2
- package/esm/components/menu/menu-item/menu-item.style.js +28 -10
- package/esm/components/tabs/tab/tab.component.js +9 -9
- package/esm/components/tabs/tab/tab.d.ts +3 -3
- package/esm/components/tabs/tabs.component.js +43 -19
- package/esm/components/tabs/tabs.d.ts +4 -0
- package/esm/components/typography/typography.component.js +10 -0
- package/lib/__internal__/form-field/form-field.component.js +17 -3
- package/lib/components/box/box.component.js +13 -0
- package/lib/components/icon-button/icon-button.component.d.ts +2 -2
- package/lib/components/icon-button/icon-button.component.js +159 -6
- package/lib/components/icon-button/icon-button.style.js +3 -2
- package/lib/components/menu/menu-item/menu-item.component.js +3 -2
- package/lib/components/menu/menu-item/menu-item.style.js +27 -8
- package/lib/components/tabs/tab/tab.component.js +9 -9
- package/lib/components/tabs/tab/tab.d.ts +3 -3
- package/lib/components/tabs/tabs.component.js +42 -19
- package/lib/components/tabs/tabs.d.ts +4 -0
- package/lib/components/typography/typography.component.js +12 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
|
|
3
|
-
import React, { useContext, useEffect, useMemo } from "react";
|
|
3
|
+
import React, { useContext, useEffect, useLayoutEffect, useMemo, useRef } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import invariant from "invariant";
|
|
6
6
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
@@ -62,10 +62,24 @@ const FormField = ({
|
|
|
62
62
|
setWarning,
|
|
63
63
|
setInfo
|
|
64
64
|
} = useContext(TabContext);
|
|
65
|
+
const isMounted = useRef(false);
|
|
66
|
+
useLayoutEffect(() => {
|
|
67
|
+
isMounted.current = true;
|
|
68
|
+
return () => {
|
|
69
|
+
isMounted.current = false;
|
|
70
|
+
};
|
|
71
|
+
}, []);
|
|
65
72
|
useEffect(() => {
|
|
66
|
-
if (setError) setError(id,
|
|
67
|
-
if (setWarning) setWarning(id,
|
|
68
|
-
if (setInfo) setInfo(id,
|
|
73
|
+
if (setError) setError(id, error);
|
|
74
|
+
if (setWarning) setWarning(id, warning);
|
|
75
|
+
if (setInfo) setInfo(id, info);
|
|
76
|
+
return () => {
|
|
77
|
+
if (!isMounted.current) {
|
|
78
|
+
if (setError && error) setError(id, false);
|
|
79
|
+
if (setWarning && warning) setWarning(id, false);
|
|
80
|
+
if (setInfo && info) setInfo(id, false);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
69
83
|
}, [id, setError, setWarning, setInfo, error, warning, info]);
|
|
70
84
|
const marginProps = filterStyledSystemMarginProps(rest);
|
|
71
85
|
const fieldHelp = fieldHelpContent ? /*#__PURE__*/React.createElement(FieldHelp, {
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { space, layout, flexbox, position } from "styled-system";
|
|
3
|
+
import Logger from "../../__internal__/utils/logger";
|
|
3
4
|
import BaseTheme from "../../style/themes/base";
|
|
4
5
|
import styledColor from "../../style/utils/color";
|
|
5
6
|
import boxConfig from "./box.config";
|
|
6
7
|
const GAP_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
8
|
+
let isDeprecationWarningTriggered = false;
|
|
7
9
|
export const Box = styled.div`
|
|
10
|
+
${() => {
|
|
11
|
+
if (!isDeprecationWarningTriggered) {
|
|
12
|
+
isDeprecationWarningTriggered = true;
|
|
13
|
+
Logger.deprecate("Previous props that could be spread to the `Box` component are being removed. Only props documented in the intefaces will be supported.");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return css``;
|
|
17
|
+
}}
|
|
18
|
+
|
|
8
19
|
${space}
|
|
9
20
|
${layout}
|
|
10
21
|
${flexbox}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { SpaceProps } from "styled-system";
|
|
3
3
|
import { IconProps } from "../icon";
|
|
4
|
-
export interface IconButtonProps extends
|
|
4
|
+
export interface IconButtonProps extends SpaceProps {
|
|
5
5
|
/** Prop to specify the aria-label of the icon-button component */
|
|
6
6
|
"aria-label"?: string;
|
|
7
7
|
/** Icon meant to be rendered, should be an Icon component */
|
|
@@ -4,7 +4,6 @@ import React, { useState, useCallback } from "react";
|
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
import Events from "../../__internal__/utils/helpers/events";
|
|
6
6
|
import StyledIconButton from "./icon-button.style";
|
|
7
|
-
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
8
7
|
import { TooltipProvider } from "../../__internal__/tooltip-provider";
|
|
9
8
|
const IconButton = /*#__PURE__*/React.forwardRef(({
|
|
10
9
|
"aria-label": ariaLabel,
|
|
@@ -14,7 +13,6 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
|
|
|
14
13
|
...rest
|
|
15
14
|
}, ref) => {
|
|
16
15
|
const [internalRef, setInternalRef] = useState();
|
|
17
|
-
const marginProps = filterStyledSystemMarginProps(rest);
|
|
18
16
|
|
|
19
17
|
const handleKeyDown = e => {
|
|
20
18
|
if (Events.isEnterKey(e) || Events.isSpaceKey(e)) {
|
|
@@ -35,13 +33,15 @@ const IconButton = /*#__PURE__*/React.forwardRef(({
|
|
|
35
33
|
if (typeof ref === "object") ref.current = reference;
|
|
36
34
|
if (typeof ref === "function") ref(reference);
|
|
37
35
|
}, [ref]);
|
|
38
|
-
return /*#__PURE__*/React.createElement(StyledIconButton, _extends({
|
|
36
|
+
return /*#__PURE__*/React.createElement(StyledIconButton, _extends({
|
|
37
|
+
p: 0
|
|
38
|
+
}, rest, {
|
|
39
39
|
"aria-label": ariaLabel,
|
|
40
40
|
onKeyDown: handleKeyDown,
|
|
41
41
|
onClick: handleOnClick,
|
|
42
42
|
ref: setRefs,
|
|
43
43
|
disabled: disabled
|
|
44
|
-
}
|
|
44
|
+
}), /*#__PURE__*/React.createElement(TooltipProvider, {
|
|
45
45
|
disabled: disabled,
|
|
46
46
|
focusable: false,
|
|
47
47
|
target: internalRef
|
|
@@ -209,7 +209,161 @@ IconButton.propTypes = {
|
|
|
209
209
|
"onBlur": PropTypes.func,
|
|
210
210
|
"onFocus": PropTypes.func,
|
|
211
211
|
"onMouseEnter": PropTypes.func,
|
|
212
|
-
"onMouseLeave": PropTypes.func
|
|
212
|
+
"onMouseLeave": PropTypes.func,
|
|
213
|
+
"p": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
214
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
215
|
+
"description": PropTypes.string,
|
|
216
|
+
"toString": PropTypes.func.isRequired,
|
|
217
|
+
"valueOf": PropTypes.func.isRequired
|
|
218
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
219
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
220
|
+
"description": PropTypes.string,
|
|
221
|
+
"toString": PropTypes.func.isRequired,
|
|
222
|
+
"valueOf": PropTypes.func.isRequired
|
|
223
|
+
}), PropTypes.string]),
|
|
224
|
+
"padding": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
225
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
226
|
+
"description": PropTypes.string,
|
|
227
|
+
"toString": PropTypes.func.isRequired,
|
|
228
|
+
"valueOf": PropTypes.func.isRequired
|
|
229
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
230
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
231
|
+
"description": PropTypes.string,
|
|
232
|
+
"toString": PropTypes.func.isRequired,
|
|
233
|
+
"valueOf": PropTypes.func.isRequired
|
|
234
|
+
}), PropTypes.string]),
|
|
235
|
+
"paddingBottom": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
236
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
237
|
+
"description": PropTypes.string,
|
|
238
|
+
"toString": PropTypes.func.isRequired,
|
|
239
|
+
"valueOf": PropTypes.func.isRequired
|
|
240
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
241
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
242
|
+
"description": PropTypes.string,
|
|
243
|
+
"toString": PropTypes.func.isRequired,
|
|
244
|
+
"valueOf": PropTypes.func.isRequired
|
|
245
|
+
}), PropTypes.string]),
|
|
246
|
+
"paddingLeft": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
247
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
248
|
+
"description": PropTypes.string,
|
|
249
|
+
"toString": PropTypes.func.isRequired,
|
|
250
|
+
"valueOf": PropTypes.func.isRequired
|
|
251
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
252
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
253
|
+
"description": PropTypes.string,
|
|
254
|
+
"toString": PropTypes.func.isRequired,
|
|
255
|
+
"valueOf": PropTypes.func.isRequired
|
|
256
|
+
}), PropTypes.string]),
|
|
257
|
+
"paddingRight": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
258
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
259
|
+
"description": PropTypes.string,
|
|
260
|
+
"toString": PropTypes.func.isRequired,
|
|
261
|
+
"valueOf": PropTypes.func.isRequired
|
|
262
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
263
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
264
|
+
"description": PropTypes.string,
|
|
265
|
+
"toString": PropTypes.func.isRequired,
|
|
266
|
+
"valueOf": PropTypes.func.isRequired
|
|
267
|
+
}), PropTypes.string]),
|
|
268
|
+
"paddingTop": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
269
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
270
|
+
"description": PropTypes.string,
|
|
271
|
+
"toString": PropTypes.func.isRequired,
|
|
272
|
+
"valueOf": PropTypes.func.isRequired
|
|
273
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
274
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
275
|
+
"description": PropTypes.string,
|
|
276
|
+
"toString": PropTypes.func.isRequired,
|
|
277
|
+
"valueOf": PropTypes.func.isRequired
|
|
278
|
+
}), PropTypes.string]),
|
|
279
|
+
"paddingX": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
280
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
281
|
+
"description": PropTypes.string,
|
|
282
|
+
"toString": PropTypes.func.isRequired,
|
|
283
|
+
"valueOf": PropTypes.func.isRequired
|
|
284
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
285
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
286
|
+
"description": PropTypes.string,
|
|
287
|
+
"toString": PropTypes.func.isRequired,
|
|
288
|
+
"valueOf": PropTypes.func.isRequired
|
|
289
|
+
}), PropTypes.string]),
|
|
290
|
+
"paddingY": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
291
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
292
|
+
"description": PropTypes.string,
|
|
293
|
+
"toString": PropTypes.func.isRequired,
|
|
294
|
+
"valueOf": PropTypes.func.isRequired
|
|
295
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
296
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
297
|
+
"description": PropTypes.string,
|
|
298
|
+
"toString": PropTypes.func.isRequired,
|
|
299
|
+
"valueOf": PropTypes.func.isRequired
|
|
300
|
+
}), PropTypes.string]),
|
|
301
|
+
"pb": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
302
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
303
|
+
"description": PropTypes.string,
|
|
304
|
+
"toString": PropTypes.func.isRequired,
|
|
305
|
+
"valueOf": PropTypes.func.isRequired
|
|
306
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
307
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
308
|
+
"description": PropTypes.string,
|
|
309
|
+
"toString": PropTypes.func.isRequired,
|
|
310
|
+
"valueOf": PropTypes.func.isRequired
|
|
311
|
+
}), PropTypes.string]),
|
|
312
|
+
"pl": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
313
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
314
|
+
"description": PropTypes.string,
|
|
315
|
+
"toString": PropTypes.func.isRequired,
|
|
316
|
+
"valueOf": PropTypes.func.isRequired
|
|
317
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
318
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
319
|
+
"description": PropTypes.string,
|
|
320
|
+
"toString": PropTypes.func.isRequired,
|
|
321
|
+
"valueOf": PropTypes.func.isRequired
|
|
322
|
+
}), PropTypes.string]),
|
|
323
|
+
"pr": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
324
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
325
|
+
"description": PropTypes.string,
|
|
326
|
+
"toString": PropTypes.func.isRequired,
|
|
327
|
+
"valueOf": PropTypes.func.isRequired
|
|
328
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
329
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
330
|
+
"description": PropTypes.string,
|
|
331
|
+
"toString": PropTypes.func.isRequired,
|
|
332
|
+
"valueOf": PropTypes.func.isRequired
|
|
333
|
+
}), PropTypes.string]),
|
|
334
|
+
"pt": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
335
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
336
|
+
"description": PropTypes.string,
|
|
337
|
+
"toString": PropTypes.func.isRequired,
|
|
338
|
+
"valueOf": PropTypes.func.isRequired
|
|
339
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
340
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
341
|
+
"description": PropTypes.string,
|
|
342
|
+
"toString": PropTypes.func.isRequired,
|
|
343
|
+
"valueOf": PropTypes.func.isRequired
|
|
344
|
+
}), PropTypes.string]),
|
|
345
|
+
"px": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
346
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
347
|
+
"description": PropTypes.string,
|
|
348
|
+
"toString": PropTypes.func.isRequired,
|
|
349
|
+
"valueOf": PropTypes.func.isRequired
|
|
350
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
351
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
352
|
+
"description": PropTypes.string,
|
|
353
|
+
"toString": PropTypes.func.isRequired,
|
|
354
|
+
"valueOf": PropTypes.func.isRequired
|
|
355
|
+
}), PropTypes.string]),
|
|
356
|
+
"py": PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.number, PropTypes.shape({
|
|
357
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
358
|
+
"description": PropTypes.string,
|
|
359
|
+
"toString": PropTypes.func.isRequired,
|
|
360
|
+
"valueOf": PropTypes.func.isRequired
|
|
361
|
+
}), PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.shape({
|
|
362
|
+
"__@toStringTag": PropTypes.string.isRequired,
|
|
363
|
+
"description": PropTypes.string,
|
|
364
|
+
"toString": PropTypes.func.isRequired,
|
|
365
|
+
"valueOf": PropTypes.func.isRequired
|
|
366
|
+
}), PropTypes.string])
|
|
213
367
|
};
|
|
214
368
|
IconButton.displayName = "IconButton";
|
|
215
369
|
export default IconButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import {
|
|
2
|
+
import { space } from "styled-system";
|
|
3
3
|
import StyledIcon from "../icon/icon.style";
|
|
4
4
|
import { baseTheme } from "../../style/themes";
|
|
5
5
|
const StyledIconButton = styled.button.attrs({
|
|
@@ -8,10 +8,11 @@ const StyledIconButton = styled.button.attrs({
|
|
|
8
8
|
${({
|
|
9
9
|
disabled
|
|
10
10
|
}) => css`
|
|
11
|
-
|
|
11
|
+
&& {
|
|
12
|
+
${space}
|
|
13
|
+
}
|
|
12
14
|
background: transparent;
|
|
13
15
|
border: none;
|
|
14
|
-
padding: 0;
|
|
15
16
|
|
|
16
17
|
&:focus {
|
|
17
18
|
background-color: transparent;
|
|
@@ -109,9 +109,9 @@ const MenuItem = ({
|
|
|
109
109
|
const getTitle = title => maxWidth && typeof title === "string" ? title : "";
|
|
110
110
|
|
|
111
111
|
const itemMaxWidth = !inFullscreenView ? maxWidth : undefined;
|
|
112
|
+
const asPassiveItem = !(onClick || href);
|
|
112
113
|
|
|
113
114
|
if (submenu) {
|
|
114
|
-
const asPassiveItem = !(onClick || href);
|
|
115
115
|
return /*#__PURE__*/React.createElement(StyledMenuItem, _extends({
|
|
116
116
|
"data-component": "menu-item",
|
|
117
117
|
menuType: menuContext.menuType,
|
|
@@ -152,7 +152,8 @@ const MenuItem = ({
|
|
|
152
152
|
}, elementProps, {
|
|
153
153
|
ariaLabel: ariaLabel,
|
|
154
154
|
maxWidth: maxWidth,
|
|
155
|
-
inFullscreenView: inFullscreenView
|
|
155
|
+
inFullscreenView: inFullscreenView,
|
|
156
|
+
asPassiveItem: asPassiveItem
|
|
156
157
|
}), clonedChildren));
|
|
157
158
|
};
|
|
158
159
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
2
|
import { StyledLink } from "../../link/link.style";
|
|
3
|
-
import
|
|
3
|
+
import StyledIcon from "../../icon/icon.style";
|
|
4
|
+
import StyledIconButton from "../../icon-button/icon-button.style";
|
|
4
5
|
import menuConfigVariants from "../menu.config";
|
|
5
6
|
const StyledMenuItemWrapper = styled.a`
|
|
6
7
|
${({
|
|
@@ -16,7 +17,8 @@ const StyledMenuItemWrapper = styled.a`
|
|
|
16
17
|
maxWidth,
|
|
17
18
|
inFullscreenView,
|
|
18
19
|
overrideColor,
|
|
19
|
-
as
|
|
20
|
+
as,
|
|
21
|
+
asPassiveItem
|
|
20
22
|
}) => css`
|
|
21
23
|
display: inline-block;
|
|
22
24
|
font-size: 14px;
|
|
@@ -72,12 +74,28 @@ const StyledMenuItemWrapper = styled.a`
|
|
|
72
74
|
}
|
|
73
75
|
`}
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
${asPassiveItem ? `
|
|
78
|
+
${StyledIconButton} {
|
|
79
|
+
> span {
|
|
80
|
+
display: inline-flex;
|
|
81
|
+
margin-right: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:focus {
|
|
85
|
+
outline: none;
|
|
86
|
+
[data-component="icon"] {
|
|
87
|
+
color: ${menuConfigVariants[menuType].color};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
` : `
|
|
92
|
+
a,
|
|
93
|
+
${StyledLink} a,
|
|
94
|
+
button,
|
|
95
|
+
${StyledLink} button {
|
|
96
|
+
padding: 0 16px;
|
|
97
|
+
}
|
|
98
|
+
`}
|
|
81
99
|
|
|
82
100
|
button,
|
|
83
101
|
${StyledLink} button {
|
|
@@ -99,7 +117,7 @@ const StyledMenuItemWrapper = styled.a`
|
|
|
99
117
|
color: ${menuConfigVariants[menuType].color};
|
|
100
118
|
}
|
|
101
119
|
|
|
102
|
-
${
|
|
120
|
+
${StyledIcon} {
|
|
103
121
|
bottom: 1px;
|
|
104
122
|
}
|
|
105
123
|
}
|
|
@@ -192,7 +210,7 @@ const StyledMenuItemWrapper = styled.a`
|
|
|
192
210
|
|
|
193
211
|
${showDropdownArrow && css`
|
|
194
212
|
> a,
|
|
195
|
-
> button {
|
|
213
|
+
> button:not(${StyledIconButton}) {
|
|
196
214
|
padding-right: 32px;
|
|
197
215
|
}
|
|
198
216
|
|
|
@@ -27,24 +27,24 @@ const Tab = ({
|
|
|
27
27
|
const [tabErrors, setTabErrors] = useState({});
|
|
28
28
|
const [tabWarnings, setTabWarnings] = useState({});
|
|
29
29
|
const [tabInfos, setTabInfos] = useState({});
|
|
30
|
-
const setError = useCallback((childId,
|
|
31
|
-
if (tabErrors[childId] !==
|
|
30
|
+
const setError = useCallback((childId, error) => {
|
|
31
|
+
if (tabErrors[childId] !== error) {
|
|
32
32
|
setTabErrors({ ...tabErrors,
|
|
33
|
-
[childId]:
|
|
33
|
+
[childId]: error
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
}, [tabErrors]);
|
|
37
|
-
const setWarning = useCallback((childId,
|
|
38
|
-
if (tabWarnings[childId] !==
|
|
37
|
+
const setWarning = useCallback((childId, warning) => {
|
|
38
|
+
if (tabWarnings[childId] !== warning) {
|
|
39
39
|
setTabWarnings({ ...tabWarnings,
|
|
40
|
-
[childId]:
|
|
40
|
+
[childId]: warning
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
}, [tabWarnings]);
|
|
44
|
-
const setInfo = useCallback((childId,
|
|
45
|
-
if (tabInfos[childId] !==
|
|
44
|
+
const setInfo = useCallback((childId, info) => {
|
|
45
|
+
if (tabInfos[childId] !== info) {
|
|
46
46
|
setTabInfos({ ...tabInfos,
|
|
47
|
-
[childId]:
|
|
47
|
+
[childId]: info
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
}, [tabInfos]);
|
|
@@ -2,9 +2,9 @@ import * as React from "react";
|
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
3
|
|
|
4
4
|
export interface TabContextProps {
|
|
5
|
-
setError?: (childId: string,
|
|
6
|
-
setWarning?: (childId: string,
|
|
7
|
-
setInfo?: (childId: string,
|
|
5
|
+
setError?: (childId: string, error?: boolean | string) => void;
|
|
6
|
+
setWarning?: (childId: string, warning?: boolean | string) => void;
|
|
7
|
+
setInfo?: (childId: string, info?: boolean | string) => void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface TabProps extends PaddingProps {
|
|
@@ -27,6 +27,7 @@ const Tabs = ({
|
|
|
27
27
|
variant = "default",
|
|
28
28
|
validationStatusOverride,
|
|
29
29
|
headerWidth,
|
|
30
|
+
showValidationsSummary,
|
|
30
31
|
...rest
|
|
31
32
|
}) => {
|
|
32
33
|
/** The children nodes converted into an Array */
|
|
@@ -48,24 +49,24 @@ const Tabs = ({
|
|
|
48
49
|
const [tabsErrors, setTabsErrors] = useState({});
|
|
49
50
|
const [tabsWarnings, setTabsWarnings] = useState({});
|
|
50
51
|
const [tabsInfos, setTabsInfos] = useState({});
|
|
51
|
-
const updateErrors = useCallback((id,
|
|
52
|
-
if (tabsErrors[id] !==
|
|
52
|
+
const updateErrors = useCallback((id, error) => {
|
|
53
|
+
if (tabsErrors[id] !== error) {
|
|
53
54
|
setTabsErrors({ ...tabsErrors,
|
|
54
|
-
[id]:
|
|
55
|
+
[id]: error
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
}, [tabsErrors]);
|
|
58
|
-
const updateWarnings = useCallback((id,
|
|
59
|
-
if (tabsWarnings[id] !==
|
|
59
|
+
const updateWarnings = useCallback((id, warning) => {
|
|
60
|
+
if (tabsWarnings[id] !== warning) {
|
|
60
61
|
setTabsWarnings({ ...tabsWarnings,
|
|
61
|
-
[id]:
|
|
62
|
+
[id]: warning
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
}, [tabsWarnings]);
|
|
65
|
-
const updateInfos = useCallback((id,
|
|
66
|
-
if (tabsInfos[id] !==
|
|
66
|
+
const updateInfos = useCallback((id, info) => {
|
|
67
|
+
if (tabsInfos[id] !== info) {
|
|
67
68
|
setTabsInfos({ ...tabsInfos,
|
|
68
|
-
[id]:
|
|
69
|
+
[id]: info
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
}, [tabsInfos]);
|
|
@@ -182,16 +183,34 @@ const Tabs = ({
|
|
|
182
183
|
customLayout
|
|
183
184
|
} = child.props;
|
|
184
185
|
const refId = `${tabId}-tab`;
|
|
185
|
-
const errors = tabsErrors[tabId]
|
|
186
|
-
const warnings = tabsWarnings[tabId]
|
|
187
|
-
const infos = tabsInfos[tabId]
|
|
186
|
+
const errors = tabsErrors[tabId];
|
|
187
|
+
const warnings = tabsWarnings[tabId];
|
|
188
|
+
const infos = tabsInfos[tabId];
|
|
189
|
+
const errorsCount = errors && Object.entries(errors).filter(tab => tab[1]).length;
|
|
190
|
+
const warningsCount = warnings && Object.entries(warnings).filter(tab => tab[1]).length;
|
|
191
|
+
const infosCount = infos && Object.entries(infos).filter(tab => tab[1]).length;
|
|
188
192
|
const hasOverride = validationStatusOverride && validationStatusOverride[tabId];
|
|
189
193
|
const errorOverride = hasOverride && validationStatusOverride[tabId].error;
|
|
190
194
|
const warningOverride = hasOverride && validationStatusOverride[tabId].warning;
|
|
191
195
|
const infoOverride = hasOverride && validationStatusOverride[tabId].info;
|
|
192
|
-
const tabHasError = errorOverride !== undefined ? errorOverride :
|
|
193
|
-
const tabHasWarning = warningOverride !== undefined ? warningOverride :
|
|
194
|
-
const tabHasInfo = infoOverride !== undefined ? infoOverride :
|
|
196
|
+
const tabHasError = errorOverride !== undefined ? errorOverride : !!errorsCount;
|
|
197
|
+
const tabHasWarning = warningOverride !== undefined ? warningOverride : !!warningsCount && !tabHasError;
|
|
198
|
+
const tabHasInfo = infoOverride !== undefined ? infoOverride : !!infosCount && !tabHasError && !tabHasWarning;
|
|
199
|
+
|
|
200
|
+
const getValidationMessage = (message, validations = {}) => {
|
|
201
|
+
const summaryOfMessages = Object.values(validations).filter(value => value && typeof value === "string");
|
|
202
|
+
|
|
203
|
+
if (!showValidationsSummary || !summaryOfMessages.length) {
|
|
204
|
+
return message;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (summaryOfMessages.length === 1) {
|
|
208
|
+
return summaryOfMessages[0];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return summaryOfMessages.map(value => `• ${value}`).join("\n");
|
|
212
|
+
};
|
|
213
|
+
|
|
195
214
|
const tabTitle = /*#__PURE__*/React.createElement(TabTitle, {
|
|
196
215
|
position: isInSidebar ? "left" : position,
|
|
197
216
|
className: child.props.className || "",
|
|
@@ -212,9 +231,9 @@ const Tabs = ({
|
|
|
212
231
|
borders: borders !== "off",
|
|
213
232
|
siblings: siblings,
|
|
214
233
|
titlePosition: titlePosition,
|
|
215
|
-
errorMessage: errorMessage,
|
|
216
|
-
warningMessage: warningMessage,
|
|
217
|
-
infoMessage: infoMessage,
|
|
234
|
+
errorMessage: getValidationMessage(errorMessage, errors),
|
|
235
|
+
warningMessage: getValidationMessage(warningMessage, warnings),
|
|
236
|
+
infoMessage: getValidationMessage(infoMessage, infos),
|
|
218
237
|
alternateStyling: variant === "alternate",
|
|
219
238
|
noLeftBorder: ["no left side", "no sides"].includes(borders),
|
|
220
239
|
noRightBorder: ["no right side", "no sides"].includes(borders),
|
|
@@ -341,6 +360,11 @@ Tabs.propTypes = { ...marginPropTypes,
|
|
|
341
360
|
warning: PropTypes.bool,
|
|
342
361
|
info: PropTypes.bool
|
|
343
362
|
})
|
|
344
|
-
})
|
|
363
|
+
}),
|
|
364
|
+
|
|
365
|
+
/** When this prop is set any string validation failures in the children of each Tab
|
|
366
|
+
* will be summaraised in the Tooltip next to the Tab title
|
|
367
|
+
*/
|
|
368
|
+
showValidationsSummary: PropTypes.bool
|
|
345
369
|
};
|
|
346
370
|
export { Tabs, Tab };
|
|
@@ -40,6 +40,10 @@ export interface TabsProps extends MarginProps {
|
|
|
40
40
|
info?: boolean;
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
+
/** When this prop is set any string validation failures in the children of each Tab
|
|
44
|
+
* will be summaraised in the Tooltip next to the Tab title
|
|
45
|
+
*/
|
|
46
|
+
showValidationsSummary?: boolean;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
declare function Tabs(props: TabsProps): JSX.Element;
|
|
@@ -2,6 +2,7 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { space } from "styled-system";
|
|
3
3
|
import styledColor from "../../style/utils/color";
|
|
4
4
|
import baseTheme from "../../style/themes/base";
|
|
5
|
+
import Logger from "../../__internal__/utils/logger";
|
|
5
6
|
const VARIANT_TYPES = ["h1-large", "h1", "h2", "h3", "h4", "h5", "segment-header", "segment-header-small", "segment-subheader", "segment-subheader-alt", "p", "small", "big", "sup", "sub", "strong", "b", "em", "ul", "ol"];
|
|
6
7
|
|
|
7
8
|
const getAs = variant => {
|
|
@@ -146,6 +147,7 @@ const getDecoration = variant => {
|
|
|
146
147
|
return "none";
|
|
147
148
|
};
|
|
148
149
|
|
|
150
|
+
let isDeprecationWarningTriggered = false;
|
|
149
151
|
const Typography = styled.span.attrs(({
|
|
150
152
|
variant,
|
|
151
153
|
as,
|
|
@@ -165,6 +167,14 @@ const Typography = styled.span.attrs(({
|
|
|
165
167
|
defaultMargin: variant === "p" ? "0 0 16px" : "0"
|
|
166
168
|
};
|
|
167
169
|
})`
|
|
170
|
+
${() => {
|
|
171
|
+
if (!isDeprecationWarningTriggered) {
|
|
172
|
+
isDeprecationWarningTriggered = true;
|
|
173
|
+
Logger.deprecate("Previous props that could be spread to the `Typography` component are being removed. Only props documented in the intefaces will be supported.");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return css``;
|
|
177
|
+
}}
|
|
168
178
|
${({
|
|
169
179
|
size,
|
|
170
180
|
weight,
|
|
@@ -84,10 +84,24 @@ const FormField = ({
|
|
|
84
84
|
setWarning,
|
|
85
85
|
setInfo
|
|
86
86
|
} = (0, _react.useContext)(_tab.TabContext);
|
|
87
|
+
const isMounted = (0, _react.useRef)(false);
|
|
88
|
+
(0, _react.useLayoutEffect)(() => {
|
|
89
|
+
isMounted.current = true;
|
|
90
|
+
return () => {
|
|
91
|
+
isMounted.current = false;
|
|
92
|
+
};
|
|
93
|
+
}, []);
|
|
87
94
|
(0, _react.useEffect)(() => {
|
|
88
|
-
if (setError) setError(id,
|
|
89
|
-
if (setWarning) setWarning(id,
|
|
90
|
-
if (setInfo) setInfo(id,
|
|
95
|
+
if (setError) setError(id, error);
|
|
96
|
+
if (setWarning) setWarning(id, warning);
|
|
97
|
+
if (setInfo) setInfo(id, info);
|
|
98
|
+
return () => {
|
|
99
|
+
if (!isMounted.current) {
|
|
100
|
+
if (setError && error) setError(id, false);
|
|
101
|
+
if (setWarning && warning) setWarning(id, false);
|
|
102
|
+
if (setInfo && info) setInfo(id, false);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
91
105
|
}, [id, setError, setWarning, setInfo, error, warning, info]);
|
|
92
106
|
const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
|
|
93
107
|
const fieldHelp = fieldHelpContent ? /*#__PURE__*/_react.default.createElement(_fieldHelp.default, {
|
|
@@ -9,6 +9,8 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
9
9
|
|
|
10
10
|
var _styledSystem = require("styled-system");
|
|
11
11
|
|
|
12
|
+
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
13
|
+
|
|
12
14
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
13
15
|
|
|
14
16
|
var _color = _interopRequireDefault(require("../../style/utils/color"));
|
|
@@ -22,7 +24,18 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
22
24
|
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
25
|
|
|
24
26
|
const GAP_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
27
|
+
let isDeprecationWarningTriggered = false;
|
|
25
28
|
const Box = _styledComponents.default.div`
|
|
29
|
+
${() => {
|
|
30
|
+
if (!isDeprecationWarningTriggered) {
|
|
31
|
+
isDeprecationWarningTriggered = true;
|
|
32
|
+
|
|
33
|
+
_logger.default.deprecate("Previous props that could be spread to the `Box` component are being removed. Only props documented in the intefaces will be supported.");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (0, _styledComponents.css)``;
|
|
37
|
+
}}
|
|
38
|
+
|
|
26
39
|
${_styledSystem.space}
|
|
27
40
|
${_styledSystem.layout}
|
|
28
41
|
${_styledSystem.flexbox}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { SpaceProps } from "styled-system";
|
|
3
3
|
import { IconProps } from "../icon";
|
|
4
|
-
export interface IconButtonProps extends
|
|
4
|
+
export interface IconButtonProps extends SpaceProps {
|
|
5
5
|
/** Prop to specify the aria-label of the icon-button component */
|
|
6
6
|
"aria-label"?: string;
|
|
7
7
|
/** Icon meant to be rendered, should be an Icon component */
|
|
@@ -13,8 +13,6 @@ var _events = _interopRequireDefault(require("../../__internal__/utils/helpers/e
|
|
|
13
13
|
|
|
14
14
|
var _iconButton = _interopRequireDefault(require("./icon-button.style"));
|
|
15
15
|
|
|
16
|
-
var _utils = require("../../style/utils");
|
|
17
|
-
|
|
18
16
|
var _tooltipProvider = require("../../__internal__/tooltip-provider");
|
|
19
17
|
|
|
20
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -33,7 +31,6 @@ const IconButton = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
33
31
|
...rest
|
|
34
32
|
}, ref) => {
|
|
35
33
|
const [internalRef, setInternalRef] = (0, _react.useState)();
|
|
36
|
-
const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
|
|
37
34
|
|
|
38
35
|
const handleKeyDown = e => {
|
|
39
36
|
if (_events.default.isEnterKey(e) || _events.default.isSpaceKey(e)) {
|
|
@@ -54,13 +51,15 @@ const IconButton = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
54
51
|
if (typeof ref === "object") ref.current = reference;
|
|
55
52
|
if (typeof ref === "function") ref(reference);
|
|
56
53
|
}, [ref]);
|
|
57
|
-
return /*#__PURE__*/_react.default.createElement(_iconButton.default, _extends({
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_iconButton.default, _extends({
|
|
55
|
+
p: 0
|
|
56
|
+
}, rest, {
|
|
58
57
|
"aria-label": ariaLabel,
|
|
59
58
|
onKeyDown: handleKeyDown,
|
|
60
59
|
onClick: handleOnClick,
|
|
61
60
|
ref: setRefs,
|
|
62
61
|
disabled: disabled
|
|
63
|
-
}
|
|
62
|
+
}), /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
|
|
64
63
|
disabled: disabled,
|
|
65
64
|
focusable: false,
|
|
66
65
|
target: internalRef
|
|
@@ -229,7 +228,161 @@ IconButton.propTypes = {
|
|
|
229
228
|
"onBlur": _propTypes.default.func,
|
|
230
229
|
"onFocus": _propTypes.default.func,
|
|
231
230
|
"onMouseEnter": _propTypes.default.func,
|
|
232
|
-
"onMouseLeave": _propTypes.default.func
|
|
231
|
+
"onMouseLeave": _propTypes.default.func,
|
|
232
|
+
"p": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
233
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
234
|
+
"description": _propTypes.default.string,
|
|
235
|
+
"toString": _propTypes.default.func.isRequired,
|
|
236
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
237
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
238
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
239
|
+
"description": _propTypes.default.string,
|
|
240
|
+
"toString": _propTypes.default.func.isRequired,
|
|
241
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
242
|
+
}), _propTypes.default.string]),
|
|
243
|
+
"padding": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
244
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
245
|
+
"description": _propTypes.default.string,
|
|
246
|
+
"toString": _propTypes.default.func.isRequired,
|
|
247
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
248
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
249
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
250
|
+
"description": _propTypes.default.string,
|
|
251
|
+
"toString": _propTypes.default.func.isRequired,
|
|
252
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
253
|
+
}), _propTypes.default.string]),
|
|
254
|
+
"paddingBottom": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
255
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
256
|
+
"description": _propTypes.default.string,
|
|
257
|
+
"toString": _propTypes.default.func.isRequired,
|
|
258
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
259
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
260
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
261
|
+
"description": _propTypes.default.string,
|
|
262
|
+
"toString": _propTypes.default.func.isRequired,
|
|
263
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
264
|
+
}), _propTypes.default.string]),
|
|
265
|
+
"paddingLeft": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
266
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
267
|
+
"description": _propTypes.default.string,
|
|
268
|
+
"toString": _propTypes.default.func.isRequired,
|
|
269
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
270
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
271
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
272
|
+
"description": _propTypes.default.string,
|
|
273
|
+
"toString": _propTypes.default.func.isRequired,
|
|
274
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
275
|
+
}), _propTypes.default.string]),
|
|
276
|
+
"paddingRight": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
277
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
278
|
+
"description": _propTypes.default.string,
|
|
279
|
+
"toString": _propTypes.default.func.isRequired,
|
|
280
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
281
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
282
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
283
|
+
"description": _propTypes.default.string,
|
|
284
|
+
"toString": _propTypes.default.func.isRequired,
|
|
285
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
286
|
+
}), _propTypes.default.string]),
|
|
287
|
+
"paddingTop": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
288
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
289
|
+
"description": _propTypes.default.string,
|
|
290
|
+
"toString": _propTypes.default.func.isRequired,
|
|
291
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
292
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
293
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
294
|
+
"description": _propTypes.default.string,
|
|
295
|
+
"toString": _propTypes.default.func.isRequired,
|
|
296
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
297
|
+
}), _propTypes.default.string]),
|
|
298
|
+
"paddingX": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
299
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
300
|
+
"description": _propTypes.default.string,
|
|
301
|
+
"toString": _propTypes.default.func.isRequired,
|
|
302
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
303
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
304
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
305
|
+
"description": _propTypes.default.string,
|
|
306
|
+
"toString": _propTypes.default.func.isRequired,
|
|
307
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
308
|
+
}), _propTypes.default.string]),
|
|
309
|
+
"paddingY": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
310
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
311
|
+
"description": _propTypes.default.string,
|
|
312
|
+
"toString": _propTypes.default.func.isRequired,
|
|
313
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
314
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
315
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
316
|
+
"description": _propTypes.default.string,
|
|
317
|
+
"toString": _propTypes.default.func.isRequired,
|
|
318
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
319
|
+
}), _propTypes.default.string]),
|
|
320
|
+
"pb": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
321
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
322
|
+
"description": _propTypes.default.string,
|
|
323
|
+
"toString": _propTypes.default.func.isRequired,
|
|
324
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
325
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
326
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
327
|
+
"description": _propTypes.default.string,
|
|
328
|
+
"toString": _propTypes.default.func.isRequired,
|
|
329
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
330
|
+
}), _propTypes.default.string]),
|
|
331
|
+
"pl": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
332
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
333
|
+
"description": _propTypes.default.string,
|
|
334
|
+
"toString": _propTypes.default.func.isRequired,
|
|
335
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
336
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
337
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
338
|
+
"description": _propTypes.default.string,
|
|
339
|
+
"toString": _propTypes.default.func.isRequired,
|
|
340
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
341
|
+
}), _propTypes.default.string]),
|
|
342
|
+
"pr": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
343
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
344
|
+
"description": _propTypes.default.string,
|
|
345
|
+
"toString": _propTypes.default.func.isRequired,
|
|
346
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
347
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
348
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
349
|
+
"description": _propTypes.default.string,
|
|
350
|
+
"toString": _propTypes.default.func.isRequired,
|
|
351
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
352
|
+
}), _propTypes.default.string]),
|
|
353
|
+
"pt": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
354
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
355
|
+
"description": _propTypes.default.string,
|
|
356
|
+
"toString": _propTypes.default.func.isRequired,
|
|
357
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
358
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
359
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
360
|
+
"description": _propTypes.default.string,
|
|
361
|
+
"toString": _propTypes.default.func.isRequired,
|
|
362
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
363
|
+
}), _propTypes.default.string]),
|
|
364
|
+
"px": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
365
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
366
|
+
"description": _propTypes.default.string,
|
|
367
|
+
"toString": _propTypes.default.func.isRequired,
|
|
368
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
369
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
370
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
371
|
+
"description": _propTypes.default.string,
|
|
372
|
+
"toString": _propTypes.default.func.isRequired,
|
|
373
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
374
|
+
}), _propTypes.default.string]),
|
|
375
|
+
"py": _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.oneOf([null]), _propTypes.default.number, _propTypes.default.shape({
|
|
376
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
377
|
+
"description": _propTypes.default.string,
|
|
378
|
+
"toString": _propTypes.default.func.isRequired,
|
|
379
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
380
|
+
}), _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.shape({
|
|
381
|
+
"__@toStringTag": _propTypes.default.string.isRequired,
|
|
382
|
+
"description": _propTypes.default.string,
|
|
383
|
+
"toString": _propTypes.default.func.isRequired,
|
|
384
|
+
"valueOf": _propTypes.default.func.isRequired
|
|
385
|
+
}), _propTypes.default.string])
|
|
233
386
|
};
|
|
234
387
|
IconButton.displayName = "IconButton";
|
|
235
388
|
var _default = IconButton;
|
|
@@ -25,10 +25,11 @@ const StyledIconButton = _styledComponents.default.button.attrs({
|
|
|
25
25
|
${({
|
|
26
26
|
disabled
|
|
27
27
|
}) => (0, _styledComponents.css)`
|
|
28
|
-
|
|
28
|
+
&& {
|
|
29
|
+
${_styledSystem.space}
|
|
30
|
+
}
|
|
29
31
|
background: transparent;
|
|
30
32
|
border: none;
|
|
31
|
-
padding: 0;
|
|
32
33
|
|
|
33
34
|
&:focus {
|
|
34
35
|
background-color: transparent;
|
|
@@ -135,9 +135,9 @@ const MenuItem = ({
|
|
|
135
135
|
const getTitle = title => maxWidth && typeof title === "string" ? title : "";
|
|
136
136
|
|
|
137
137
|
const itemMaxWidth = !inFullscreenView ? maxWidth : undefined;
|
|
138
|
+
const asPassiveItem = !(onClick || href);
|
|
138
139
|
|
|
139
140
|
if (submenu) {
|
|
140
|
-
const asPassiveItem = !(onClick || href);
|
|
141
141
|
return /*#__PURE__*/_react.default.createElement(_menu2.StyledMenuItem, _extends({
|
|
142
142
|
"data-component": "menu-item",
|
|
143
143
|
menuType: menuContext.menuType,
|
|
@@ -178,7 +178,8 @@ const MenuItem = ({
|
|
|
178
178
|
}, elementProps, {
|
|
179
179
|
ariaLabel: ariaLabel,
|
|
180
180
|
maxWidth: maxWidth,
|
|
181
|
-
inFullscreenView: inFullscreenView
|
|
181
|
+
inFullscreenView: inFullscreenView,
|
|
182
|
+
asPassiveItem: asPassiveItem
|
|
182
183
|
}), clonedChildren));
|
|
183
184
|
};
|
|
184
185
|
|
|
@@ -11,6 +11,8 @@ var _link = require("../../link/link.style");
|
|
|
11
11
|
|
|
12
12
|
var _icon = _interopRequireDefault(require("../../icon/icon.style"));
|
|
13
13
|
|
|
14
|
+
var _iconButton = _interopRequireDefault(require("../../icon-button/icon-button.style"));
|
|
15
|
+
|
|
14
16
|
var _menu = _interopRequireDefault(require("../menu.config"));
|
|
15
17
|
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -33,7 +35,8 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
|
|
|
33
35
|
maxWidth,
|
|
34
36
|
inFullscreenView,
|
|
35
37
|
overrideColor,
|
|
36
|
-
as
|
|
38
|
+
as,
|
|
39
|
+
asPassiveItem
|
|
37
40
|
}) => (0, _styledComponents.css)`
|
|
38
41
|
display: inline-block;
|
|
39
42
|
font-size: 14px;
|
|
@@ -89,12 +92,28 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
|
|
|
89
92
|
}
|
|
90
93
|
`}
|
|
91
94
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
${asPassiveItem ? `
|
|
96
|
+
${_iconButton.default} {
|
|
97
|
+
> span {
|
|
98
|
+
display: inline-flex;
|
|
99
|
+
margin-right: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
:focus {
|
|
103
|
+
outline: none;
|
|
104
|
+
[data-component="icon"] {
|
|
105
|
+
color: ${_menu.default[menuType].color};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
` : `
|
|
110
|
+
a,
|
|
111
|
+
${_link.StyledLink} a,
|
|
112
|
+
button,
|
|
113
|
+
${_link.StyledLink} button {
|
|
114
|
+
padding: 0 16px;
|
|
115
|
+
}
|
|
116
|
+
`}
|
|
98
117
|
|
|
99
118
|
button,
|
|
100
119
|
${_link.StyledLink} button {
|
|
@@ -209,7 +228,7 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
|
|
|
209
228
|
|
|
210
229
|
${showDropdownArrow && (0, _styledComponents.css)`
|
|
211
230
|
> a,
|
|
212
|
-
> button {
|
|
231
|
+
> button:not(${_iconButton.default}) {
|
|
213
232
|
padding-right: 32px;
|
|
214
233
|
}
|
|
215
234
|
|
|
@@ -48,24 +48,24 @@ const Tab = ({
|
|
|
48
48
|
const [tabErrors, setTabErrors] = (0, _react.useState)({});
|
|
49
49
|
const [tabWarnings, setTabWarnings] = (0, _react.useState)({});
|
|
50
50
|
const [tabInfos, setTabInfos] = (0, _react.useState)({});
|
|
51
|
-
const setError = (0, _react.useCallback)((childId,
|
|
52
|
-
if (tabErrors[childId] !==
|
|
51
|
+
const setError = (0, _react.useCallback)((childId, error) => {
|
|
52
|
+
if (tabErrors[childId] !== error) {
|
|
53
53
|
setTabErrors({ ...tabErrors,
|
|
54
|
-
[childId]:
|
|
54
|
+
[childId]: error
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
}, [tabErrors]);
|
|
58
|
-
const setWarning = (0, _react.useCallback)((childId,
|
|
59
|
-
if (tabWarnings[childId] !==
|
|
58
|
+
const setWarning = (0, _react.useCallback)((childId, warning) => {
|
|
59
|
+
if (tabWarnings[childId] !== warning) {
|
|
60
60
|
setTabWarnings({ ...tabWarnings,
|
|
61
|
-
[childId]:
|
|
61
|
+
[childId]: warning
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
}, [tabWarnings]);
|
|
65
|
-
const setInfo = (0, _react.useCallback)((childId,
|
|
66
|
-
if (tabInfos[childId] !==
|
|
65
|
+
const setInfo = (0, _react.useCallback)((childId, info) => {
|
|
66
|
+
if (tabInfos[childId] !== info) {
|
|
67
67
|
setTabInfos({ ...tabInfos,
|
|
68
|
-
[childId]:
|
|
68
|
+
[childId]: info
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}, [tabInfos]);
|
|
@@ -2,9 +2,9 @@ import * as React from "react";
|
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
3
|
|
|
4
4
|
export interface TabContextProps {
|
|
5
|
-
setError?: (childId: string,
|
|
6
|
-
setWarning?: (childId: string,
|
|
7
|
-
setInfo?: (childId: string,
|
|
5
|
+
setError?: (childId: string, error?: boolean | string) => void;
|
|
6
|
+
setWarning?: (childId: string, warning?: boolean | string) => void;
|
|
7
|
+
setInfo?: (childId: string, info?: boolean | string) => void;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface TabProps extends PaddingProps {
|
|
@@ -57,6 +57,7 @@ const Tabs = ({
|
|
|
57
57
|
variant = "default",
|
|
58
58
|
validationStatusOverride,
|
|
59
59
|
headerWidth,
|
|
60
|
+
showValidationsSummary,
|
|
60
61
|
...rest
|
|
61
62
|
}) => {
|
|
62
63
|
/** The children nodes converted into an Array */
|
|
@@ -78,24 +79,24 @@ const Tabs = ({
|
|
|
78
79
|
const [tabsErrors, setTabsErrors] = (0, _react.useState)({});
|
|
79
80
|
const [tabsWarnings, setTabsWarnings] = (0, _react.useState)({});
|
|
80
81
|
const [tabsInfos, setTabsInfos] = (0, _react.useState)({});
|
|
81
|
-
const updateErrors = (0, _react.useCallback)((id,
|
|
82
|
-
if (tabsErrors[id] !==
|
|
82
|
+
const updateErrors = (0, _react.useCallback)((id, error) => {
|
|
83
|
+
if (tabsErrors[id] !== error) {
|
|
83
84
|
setTabsErrors({ ...tabsErrors,
|
|
84
|
-
[id]:
|
|
85
|
+
[id]: error
|
|
85
86
|
});
|
|
86
87
|
}
|
|
87
88
|
}, [tabsErrors]);
|
|
88
|
-
const updateWarnings = (0, _react.useCallback)((id,
|
|
89
|
-
if (tabsWarnings[id] !==
|
|
89
|
+
const updateWarnings = (0, _react.useCallback)((id, warning) => {
|
|
90
|
+
if (tabsWarnings[id] !== warning) {
|
|
90
91
|
setTabsWarnings({ ...tabsWarnings,
|
|
91
|
-
[id]:
|
|
92
|
+
[id]: warning
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
95
|
}, [tabsWarnings]);
|
|
95
|
-
const updateInfos = (0, _react.useCallback)((id,
|
|
96
|
-
if (tabsInfos[id] !==
|
|
96
|
+
const updateInfos = (0, _react.useCallback)((id, info) => {
|
|
97
|
+
if (tabsInfos[id] !== info) {
|
|
97
98
|
setTabsInfos({ ...tabsInfos,
|
|
98
|
-
[id]:
|
|
99
|
+
[id]: info
|
|
99
100
|
});
|
|
100
101
|
}
|
|
101
102
|
}, [tabsInfos]);
|
|
@@ -216,16 +217,33 @@ const Tabs = ({
|
|
|
216
217
|
customLayout
|
|
217
218
|
} = child.props;
|
|
218
219
|
const refId = `${tabId}-tab`;
|
|
219
|
-
const errors = tabsErrors[tabId]
|
|
220
|
-
const warnings = tabsWarnings[tabId]
|
|
221
|
-
const infos = tabsInfos[tabId]
|
|
220
|
+
const errors = tabsErrors[tabId];
|
|
221
|
+
const warnings = tabsWarnings[tabId];
|
|
222
|
+
const infos = tabsInfos[tabId];
|
|
223
|
+
const errorsCount = errors && Object.entries(errors).filter(tab => tab[1]).length;
|
|
224
|
+
const warningsCount = warnings && Object.entries(warnings).filter(tab => tab[1]).length;
|
|
225
|
+
const infosCount = infos && Object.entries(infos).filter(tab => tab[1]).length;
|
|
222
226
|
const hasOverride = validationStatusOverride && validationStatusOverride[tabId];
|
|
223
227
|
const errorOverride = hasOverride && validationStatusOverride[tabId].error;
|
|
224
228
|
const warningOverride = hasOverride && validationStatusOverride[tabId].warning;
|
|
225
229
|
const infoOverride = hasOverride && validationStatusOverride[tabId].info;
|
|
226
|
-
const tabHasError = errorOverride !== undefined ? errorOverride :
|
|
227
|
-
const tabHasWarning = warningOverride !== undefined ? warningOverride :
|
|
228
|
-
const tabHasInfo = infoOverride !== undefined ? infoOverride :
|
|
230
|
+
const tabHasError = errorOverride !== undefined ? errorOverride : !!errorsCount;
|
|
231
|
+
const tabHasWarning = warningOverride !== undefined ? warningOverride : !!warningsCount && !tabHasError;
|
|
232
|
+
const tabHasInfo = infoOverride !== undefined ? infoOverride : !!infosCount && !tabHasError && !tabHasWarning;
|
|
233
|
+
|
|
234
|
+
const getValidationMessage = (message, validations = {}) => {
|
|
235
|
+
const summaryOfMessages = Object.values(validations).filter(value => value && typeof value === "string");
|
|
236
|
+
|
|
237
|
+
if (!showValidationsSummary || !summaryOfMessages.length) {
|
|
238
|
+
return message;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (summaryOfMessages.length === 1) {
|
|
242
|
+
return summaryOfMessages[0];
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return summaryOfMessages.map(value => `• ${value}`).join("\n");
|
|
246
|
+
};
|
|
229
247
|
|
|
230
248
|
const tabTitle = /*#__PURE__*/_react.default.createElement(_tabTitle.default, {
|
|
231
249
|
position: isInSidebar ? "left" : position,
|
|
@@ -247,9 +265,9 @@ const Tabs = ({
|
|
|
247
265
|
borders: borders !== "off",
|
|
248
266
|
siblings: siblings,
|
|
249
267
|
titlePosition: titlePosition,
|
|
250
|
-
errorMessage: errorMessage,
|
|
251
|
-
warningMessage: warningMessage,
|
|
252
|
-
infoMessage: infoMessage,
|
|
268
|
+
errorMessage: getValidationMessage(errorMessage, errors),
|
|
269
|
+
warningMessage: getValidationMessage(warningMessage, warnings),
|
|
270
|
+
infoMessage: getValidationMessage(infoMessage, infos),
|
|
253
271
|
alternateStyling: variant === "alternate",
|
|
254
272
|
noLeftBorder: ["no left side", "no sides"].includes(borders),
|
|
255
273
|
noRightBorder: ["no right side", "no sides"].includes(borders),
|
|
@@ -378,5 +396,10 @@ Tabs.propTypes = { ...marginPropTypes,
|
|
|
378
396
|
warning: _propTypes.default.bool,
|
|
379
397
|
info: _propTypes.default.bool
|
|
380
398
|
})
|
|
381
|
-
})
|
|
399
|
+
}),
|
|
400
|
+
|
|
401
|
+
/** When this prop is set any string validation failures in the children of each Tab
|
|
402
|
+
* will be summaraised in the Tooltip next to the Tab title
|
|
403
|
+
*/
|
|
404
|
+
showValidationsSummary: _propTypes.default.bool
|
|
382
405
|
};
|
|
@@ -40,6 +40,10 @@ export interface TabsProps extends MarginProps {
|
|
|
40
40
|
info?: boolean;
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
+
/** When this prop is set any string validation failures in the children of each Tab
|
|
44
|
+
* will be summaraised in the Tooltip next to the Tab title
|
|
45
|
+
*/
|
|
46
|
+
showValidationsSummary?: boolean;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
declare function Tabs(props: TabsProps): JSX.Element;
|
|
@@ -13,6 +13,8 @@ var _color = _interopRequireDefault(require("../../style/utils/color"));
|
|
|
13
13
|
|
|
14
14
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
15
15
|
|
|
16
|
+
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -163,6 +165,7 @@ const getDecoration = variant => {
|
|
|
163
165
|
return "none";
|
|
164
166
|
};
|
|
165
167
|
|
|
168
|
+
let isDeprecationWarningTriggered = false;
|
|
166
169
|
const Typography = _styledComponents.default.span.attrs(({
|
|
167
170
|
variant,
|
|
168
171
|
as,
|
|
@@ -182,6 +185,15 @@ const Typography = _styledComponents.default.span.attrs(({
|
|
|
182
185
|
defaultMargin: variant === "p" ? "0 0 16px" : "0"
|
|
183
186
|
};
|
|
184
187
|
})`
|
|
188
|
+
${() => {
|
|
189
|
+
if (!isDeprecationWarningTriggered) {
|
|
190
|
+
isDeprecationWarningTriggered = true;
|
|
191
|
+
|
|
192
|
+
_logger.default.deprecate("Previous props that could be spread to the `Typography` component are being removed. Only props documented in the intefaces will be supported.");
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return (0, _styledComponents.css)``;
|
|
196
|
+
}}
|
|
185
197
|
${({
|
|
186
198
|
size,
|
|
187
199
|
weight,
|