carbon-react 144.9.1 → 144.9.3

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.
@@ -241,7 +241,7 @@ const StyledMenuItemWrapper = styled.a.attrs({
241
241
  }
242
242
  }
243
243
  ` : `
244
- ${hasSubmenu || maxWidth ? `
244
+ ${hasSubmenu || maxWidth && !inFullscreenView ? `
245
245
  a,
246
246
  ${StyledLink} a,
247
247
  button,
@@ -435,7 +435,10 @@ const StyledMenuItemWrapper = styled.a.attrs({
435
435
 
436
436
  ${asPassiveItem && css`
437
437
  cursor: default;
438
- padding: 0 16px;
438
+
439
+ a {
440
+ padding: 0 16px;
441
+ }
439
442
 
440
443
  :hover {
441
444
  background: transparent;
@@ -1,13 +1,15 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useRef, useState } from "react";
2
+ import React, { useRef, useState, useContext } from "react";
3
3
  import PropTypes from "prop-types";
4
- import { StyledTabTitleButton, StyledTabTitleLink, StyledTitleContent, StyledLayoutWrapper, StyledSelectedIndicator } from "./tab-title.style";
4
+ import { StyledTabTitleButton, StyledTabTitleLink, StyledTitleContent, StyledLayoutWrapper, StyledSelectedIndicator, StyledVerticalIndicator } from "./tab-title.style";
5
5
  import tagComponent from "../../../../__internal__/utils/helpers/tags/tags";
6
6
  import ValidationIcon from "../../../../__internal__/validations/validation-icon.component";
7
7
  import Icon from "../../../icon";
8
8
  import Events from "../../../../__internal__/utils/helpers/events";
9
9
  import { TooltipProvider } from "../../../../__internal__/tooltip-provider";
10
10
  import TabTitleContext from "./tab-title.context";
11
+ import Typography from "../../../typography";
12
+ import NewValidationContext from "../../../carbon-provider/__internal__/new-validation.context";
11
13
  const TabTitle = /*#__PURE__*/React.forwardRef(({
12
14
  isTabSelected,
13
15
  dataTabId,
@@ -34,6 +36,7 @@ const TabTitle = /*#__PURE__*/React.forwardRef(({
34
36
  onKeyDown,
35
37
  align,
36
38
  tabIndex,
39
+ id,
37
40
  ...tabTitleProps
38
41
  }, ref) => {
39
42
  const isHref = !!href;
@@ -41,6 +44,15 @@ const TabTitle = /*#__PURE__*/React.forwardRef(({
41
44
  const hasFailedValidation = error || warning || info;
42
45
  const [shouldShowTooltip, setShouldShowTooltip] = useState(false);
43
46
  const hasHover = useRef(false);
47
+ const {
48
+ validationRedesignOptIn
49
+ } = useContext(NewValidationContext);
50
+ let screenReaderMessage = "";
51
+ if (error) {
52
+ screenReaderMessage = errorMessage;
53
+ } else if (warning) {
54
+ screenReaderMessage = warningMessage;
55
+ }
44
56
  const showTooltip = () => {
45
57
  setShouldShowTooltip(true);
46
58
  };
@@ -121,12 +133,14 @@ const TabTitle = /*#__PURE__*/React.forwardRef(({
121
133
  hasCustomLayout: !!customLayout,
122
134
  alternateStyling: hasAlternateStyling,
123
135
  align: align,
124
- hasHref: !!href
136
+ hasHref: !!href,
137
+ validationRedesignOptIn: validationRedesignOptIn
125
138
  }, renderContent(), isHref && /*#__PURE__*/React.createElement(Icon, {
126
139
  type: "link"
127
140
  }), hasFailedValidation && /*#__PURE__*/React.createElement(StyledLayoutWrapper, {
128
141
  position: position,
129
- hasCustomSibling: !!customLayout
142
+ hasCustomSibling: !!customLayout,
143
+ validationRedesignOptIn: validationRedesignOptIn
130
144
  }, error && /*#__PURE__*/React.createElement(ValidationIcon, {
131
145
  tooltipPosition: "top",
132
146
  error: errorMessage
@@ -136,7 +150,9 @@ const TabTitle = /*#__PURE__*/React.forwardRef(({
136
150
  }), !warning && !error && info && /*#__PURE__*/React.createElement(ValidationIcon, {
137
151
  tooltipPosition: "top",
138
152
  info: infoMessage
139
- }))), !(hasFailedValidation || hasAlternateStyling) && isTabSelected && /*#__PURE__*/React.createElement(StyledSelectedIndicator, {
153
+ }))), validationRedesignOptIn && position === "left" && /*#__PURE__*/React.createElement(StyledVerticalIndicator, null), (!(hasFailedValidation || hasAlternateStyling) || validationRedesignOptIn) && isTabSelected && /*#__PURE__*/React.createElement(StyledSelectedIndicator, {
154
+ warning: warning,
155
+ error: error,
140
156
  "data-element": "tab-selected-indicator",
141
157
  "data-role": "tab-selected-indicator",
142
158
  position: position
@@ -158,8 +174,12 @@ const TabTitle = /*#__PURE__*/React.forwardRef(({
158
174
  borders,
159
175
  isInSidebar,
160
176
  tabIndex,
177
+ id,
161
178
  ...tabTitleProps,
162
- ...tagComponent("tab-header", tabTitleProps),
179
+ ...tagComponent("tab-header", {
180
+ id,
181
+ ...tabTitleProps
182
+ }),
163
183
  onKeyDown: handleKeyDown,
164
184
  onClick: handleClick,
165
185
  size,
@@ -172,7 +192,13 @@ const TabTitle = /*#__PURE__*/React.forwardRef(({
172
192
  hideTooltip();
173
193
  },
174
194
  onFocus: showTooltip,
175
- onBlur: hideTooltip
195
+ onBlur: hideTooltip,
196
+ ...(validationRedesignOptIn && hasFailedValidation && {
197
+ "aria-invalid": true,
198
+ "aria-errormessage": `${id}-message`,
199
+ "aria-describedby": `${id}-message`
200
+ }),
201
+ validationRedesignOptIn
176
202
  };
177
203
  const tabTitle = isHref ? /*#__PURE__*/React.createElement(StyledTabTitleLink, _extends({}, titleWrapperProps, {
178
204
  ref: ref,
@@ -183,12 +209,15 @@ const TabTitle = /*#__PURE__*/React.forwardRef(({
183
209
  ref: ref
184
210
  }), titleChildren);
185
211
  return /*#__PURE__*/React.createElement(TooltipProvider, {
186
- tooltipVisible: shouldShowTooltip
212
+ tooltipVisible: validationRedesignOptIn ? false : shouldShowTooltip
187
213
  }, /*#__PURE__*/React.createElement(TabTitleContext.Provider, {
188
214
  value: {
189
215
  isInTab: true
190
216
  }
191
- }, tabTitle));
217
+ }, tabTitle), validationRedesignOptIn && hasFailedValidation && /*#__PURE__*/React.createElement(Typography, {
218
+ screenReaderOnly: true,
219
+ id: `${id}-message`
220
+ }, screenReaderMessage));
192
221
  });
193
222
  if (process.env.NODE_ENV !== "production") {
194
223
  TabTitle.propTypes = {
@@ -4,15 +4,23 @@ interface StyledTitleContentProps extends Pick<TabTitleProps, "align" | "borders
4
4
  hasCustomLayout?: boolean;
5
5
  hasHref?: boolean;
6
6
  hasSiblings?: boolean;
7
+ validationRedesignOptIn?: boolean;
7
8
  }
8
9
  declare const StyledTitleContent: import("styled-components").StyledComponent<"span", any, StyledTitleContentProps, never>;
9
- declare const StyledTabTitleButton: import("styled-components").StyledComponent<"button", any, TabTitleProps, never>;
10
- declare const StyledTabTitleLink: import("styled-components").StyledComponent<"a", any, TabTitleProps, never>;
10
+ declare const StyledTabTitleButton: import("styled-components").StyledComponent<"button", any, TabTitleProps & {
11
+ validationRedesignOptIn?: boolean | undefined;
12
+ }, never>;
13
+ declare const StyledTabTitleLink: import("styled-components").StyledComponent<"a", any, TabTitleProps & {
14
+ validationRedesignOptIn?: boolean | undefined;
15
+ }, never>;
11
16
  interface StyledLayoutWrapperProps extends Pick<TabTitleProps, "titlePosition" | "position"> {
12
17
  hasCustomLayout?: boolean;
13
18
  hasCustomSibling?: boolean;
19
+ validationRedesignOptIn?: boolean;
14
20
  }
15
21
  declare const StyledLayoutWrapper: import("styled-components").StyledComponent<"div", any, StyledLayoutWrapperProps, never>;
16
- declare type StyledSelectedIndicatorProps = Pick<TabTitleProps, "position">;
17
- declare const StyledSelectedIndicator: import("styled-components").StyledComponent<"div", any, StyledSelectedIndicatorProps, never>;
18
- export { StyledTabTitleButton, StyledTabTitleLink, StyledTitleContent, StyledLayoutWrapper, StyledSelectedIndicator, };
22
+ declare const StyledVerticalIndicator: import("styled-components").StyledComponent<"div", any, {}, never>;
23
+ declare const StyledSelectedIndicator: import("styled-components").StyledComponent<"div", any, Pick<TabTitleProps, "error" | "warning" | "position"> & {
24
+ validationRedesignOptIn?: boolean | undefined;
25
+ }, never>;
26
+ export { StyledTabTitleButton, StyledTabTitleLink, StyledTitleContent, StyledLayoutWrapper, StyledSelectedIndicator, StyledVerticalIndicator, };
@@ -7,7 +7,7 @@ const oldFocusStyling = `
7
7
  `;
8
8
  const StyledTitleContent = styled.span`
9
9
  outline: none;
10
- display: inline-block;
10
+ display: inline-flex;
11
11
  line-height: 20px;
12
12
  margin: 0;
13
13
  position: relative;
@@ -26,7 +26,8 @@ const StyledTitleContent = styled.span`
26
26
  noRightBorder,
27
27
  hasHref,
28
28
  alternateStyling,
29
- align
29
+ align,
30
+ validationRedesignOptIn
30
31
  }) => css`
31
32
  text-align: ${align};
32
33
 
@@ -40,6 +41,10 @@ const StyledTitleContent = styled.span`
40
41
  border-top-right-radius: var(--borderRadius000);
41
42
  `}
42
43
 
44
+ ${position === "left" && validationRedesignOptIn && css`
45
+ justify-content: space-between;
46
+ `}
47
+
43
48
  ${position === "top" && css`
44
49
  border-top-left-radius: var(--borderRadius100);
45
50
  border-top-right-radius: var(--borderRadius100);
@@ -110,7 +115,7 @@ const StyledTitleContent = styled.span`
110
115
  ${(warning || info) && css`
111
116
  outline: 1px solid;
112
117
  outline-offset: -1px;
113
- z-index: 2;
118
+ z-index: ${validationRedesignOptIn ? 1 : 2};
114
119
 
115
120
  ${info && !warning && css`
116
121
  outline-color: var(--colorsSemanticInfo500);
@@ -159,7 +164,7 @@ const StyledTitleContent = styled.span`
159
164
  ${error && css`
160
165
  outline: 2px solid var(--colorsSemanticNegative500);
161
166
  outline-offset: -2px;
162
- z-index: 2;
167
+ z-index: ${validationRedesignOptIn ? 1 : 2};
163
168
 
164
169
  ${position === "top" && css`
165
170
  border-bottom-color: transparent;
@@ -263,7 +268,8 @@ const tabTitleStyles = css`
263
268
  error,
264
269
  warning,
265
270
  info,
266
- isInSidebar
271
+ isInSidebar,
272
+ validationRedesignOptIn
267
273
  }) => css`
268
274
  height: ${size === "large" ? "var(--sizing600)" : "var(--sizing500)"};
269
275
 
@@ -290,9 +296,15 @@ const tabTitleStyles = css`
290
296
 
291
297
  ${!isTabSelected && css`
292
298
  color: var(--colorsActionMinorYin090);
299
+ ${validationRedesignOptIn && css`
300
+ background: transparent;
301
+ `}
293
302
 
294
303
  &:hover {
295
304
  background: var(--colorsActionMinor100);
305
+ ${validationRedesignOptIn && css`
306
+ background: var(--colorsUtilityMajor100);
307
+ `}
296
308
  color: var(--colorsActionMinorYin090);
297
309
  outline: none;
298
310
  }
@@ -334,7 +346,9 @@ const tabTitleStyles = css`
334
346
  border-bottom: 0px;
335
347
 
336
348
  ${!isInSidebar && !error && css`
337
- border-right: ${alternateStyling ? "1px" : "2px"} solid
349
+ --border-right-value: ${validationRedesignOptIn ? "0px" : "2px"}
350
+ border-right:
351
+ ${alternateStyling ? "1px" : "var(--border-right-value)"} solid
338
352
  var(--colorsActionMinor100);
339
353
  `}
340
354
 
@@ -360,6 +374,10 @@ const tabTitleStyles = css`
360
374
  border-right: none;
361
375
  `}
362
376
 
377
+ ${!isTabSelected && css`
378
+ border-right-color: var(--colorsActionMinor100);
379
+ `}
380
+
363
381
  ${isTabSelected && css`
364
382
  ${alternateStyling && css`
365
383
  border-right-color: var(--colorsActionMinor100);
@@ -370,7 +388,7 @@ const tabTitleStyles = css`
370
388
  padding-bottom: 0px;
371
389
 
372
390
  ${StyledTitleContent} {
373
- ${!(error || warning || info) && "margin-right: 2px;"}
391
+ ${!(error || warning || info) && !validationRedesignOptIn && "margin-right: 2px;"}
374
392
  border-right: none;
375
393
  }
376
394
  `}
@@ -415,7 +433,8 @@ const StyledLayoutWrapper = styled.div`
415
433
  hasCustomLayout,
416
434
  titlePosition = "before",
417
435
  hasCustomSibling,
418
- position
436
+ position,
437
+ validationRedesignOptIn
419
438
  }) => css`
420
439
  ${hasCustomLayout && css`
421
440
  flex-grow: 2;
@@ -441,27 +460,52 @@ const StyledLayoutWrapper = styled.div`
441
460
  z-index: 10;
442
461
 
443
462
  ${StyledIcon} {
444
- height: 16px;
463
+ height: ${validationRedesignOptIn ? "0px" : "16px"};
445
464
  left: -2px;
446
- top: ${position === "left" ? "1px" : "3px"};
447
465
  }
448
466
  }
449
467
  `}
450
468
  `}
451
469
  `;
470
+ const StyledVerticalIndicator = styled.div`
471
+ position: absolute;
472
+ top: 0px;
473
+ bottom: 0px;
474
+ right: 0px;
475
+ box-shadow: inset calc(-1 * var(--sizing050)) 0px 0px 0px
476
+ var(--colorsActionMinor100);
477
+ width: 2px;
478
+ z-index: 1;
479
+ `;
452
480
  const StyledSelectedIndicator = styled.div`
453
481
  position: absolute;
454
482
  z-index: 1;
483
+ ${validationRedesignOptIn => css`
484
+ ${validationRedesignOptIn && css`
485
+ z-index: 2;
486
+ `}
487
+ `}
455
488
 
456
489
  ${({
457
- position = "top"
490
+ position = "top",
491
+ warning,
492
+ error
458
493
  }) => css`
494
+ --selected-indicator-color: var(--colorsActionMajor500);
495
+
496
+ ${warning && css`
497
+ --selected-indicator-color: var(--colorsSemanticCaution500);
498
+ `}
499
+
500
+ ${error && css`
501
+ --selected-indicator-color: var(--colorsSemanticNegative500);
502
+ `}
459
503
  ${position === "top" && css`
460
504
  bottom: 0px;
461
505
  left: 0px;
462
506
  right: 0px;
463
507
  box-shadow: inset 0px calc(-1 * var(--sizing050)) 0px
464
- var(--colorsActionMajor500);
508
+ var(--selected-indicator-color);
465
509
  height: var(--sizing050);
466
510
  `}
467
511
 
@@ -470,9 +514,9 @@ const StyledSelectedIndicator = styled.div`
470
514
  bottom: 0px;
471
515
  right: 0px;
472
516
  box-shadow: inset calc(-1 * var(--sizing050)) 0px 0px 0px
473
- var(--colorsActionMajor500);
517
+ var(--selected-indicator-color);
474
518
  width: var(--sizing050);
475
519
  `}
476
520
  `}
477
521
  `;
478
- export { StyledTabTitleButton, StyledTabTitleLink, StyledTitleContent, StyledLayoutWrapper, StyledSelectedIndicator };
522
+ export { StyledTabTitleButton, StyledTabTitleLink, StyledTitleContent, StyledLayoutWrapper, StyledSelectedIndicator, StyledVerticalIndicator };
@@ -1,7 +1,8 @@
1
- import React, { useRef, useState } from "react";
1
+ import React, { useRef, useState, useContext } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import { StyledTabsHeaderWrapper, StyledTabsHeaderList, StyledTabsBottomBorder, StyledTabsWrapper, StyledTabsBottomBorderWrapper, StyledVerticalTabsWrapper } from "./tabs-header.style";
4
4
  import useThrottle from "../../../../hooks/__internal__/useThrottle";
5
+ import NewValidationContext from "../../../carbon-provider/__internal__/new-validation.context";
5
6
 
6
7
  /* In the original prototype the tabs have shadows that fade out as you scroll horizontally.
7
8
  * This value is the closest replication to the way that the shadow disappears.
@@ -24,6 +25,9 @@ const TabsHeader = ({
24
25
  }) => {
25
26
  const [leftScrollOpacity, setLeftScrollOpacity] = useState(0);
26
27
  const [rightScrollOpacity, setRightScrollOpacity] = useState(1);
28
+ const {
29
+ validationRedesignOptIn
30
+ } = useContext(NewValidationContext);
27
31
  const ref = useRef(null);
28
32
  let isScrollable = false;
29
33
  const {
@@ -56,7 +60,9 @@ const TabsHeader = ({
56
60
  rightScrollOpacity: rightScrollOpacity,
57
61
  isScrollable: isScrollable,
58
62
  ref: ref
59
- }, position === "top" ? /*#__PURE__*/React.createElement(StyledTabsWrapper, null, /*#__PURE__*/React.createElement(StyledTabsBottomBorderWrapper, null, /*#__PURE__*/React.createElement(StyledTabsBottomBorder, null)), children) : /*#__PURE__*/React.createElement(StyledVerticalTabsWrapper, {
63
+ }, position === "top" ? /*#__PURE__*/React.createElement(StyledTabsWrapper, null, /*#__PURE__*/React.createElement(StyledTabsBottomBorderWrapper, {
64
+ validationRedesignOptIn: validationRedesignOptIn
65
+ }, /*#__PURE__*/React.createElement(StyledTabsBottomBorder, null)), children) : /*#__PURE__*/React.createElement(StyledVerticalTabsWrapper, {
60
66
  isInSidebar: isInSidebar
61
67
  }, children)));
62
68
  };
@@ -10,6 +10,8 @@ declare const StyledTabsHeaderList: import("styled-components").StyledComponent<
10
10
  declare const StyledTabsWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
11
11
  declare type StyledVerticalTabsWrapperProps = Pick<TabHeaderProps, "isInSidebar">;
12
12
  declare const StyledVerticalTabsWrapper: import("styled-components").StyledComponent<"div", any, StyledVerticalTabsWrapperProps, never>;
13
- declare const StyledTabsBottomBorderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
13
+ declare const StyledTabsBottomBorderWrapper: import("styled-components").StyledComponent<"div", any, {
14
+ validationRedesignOptIn?: boolean | undefined;
15
+ }, never>;
14
16
  declare const StyledTabsBottomBorder: import("styled-components").StyledComponent<"div", any, {}, never>;
15
17
  export { StyledTabsHeaderWrapper, StyledTabsHeaderList, StyledTabsWrapper, StyledTabsBottomBorderWrapper, StyledTabsBottomBorder, StyledVerticalTabsWrapper, };
@@ -148,7 +148,12 @@ const StyledTabsBottomBorderWrapper = styled.div`
148
148
  position: absolute;
149
149
  width: 100%;
150
150
  height: auto;
151
- bottom: 0;
151
+ bottom: 0px;
152
+ ${({
153
+ validationRedesignOptIn
154
+ }) => css`
155
+ z-index: ${validationRedesignOptIn ? 2 : ""};
156
+ `}
152
157
  `;
153
158
  const StyledTabsBottomBorder = styled.div`
154
159
  position: sticky;
@@ -250,7 +250,7 @@ const StyledMenuItemWrapper = _styledComponents.default.a.attrs({
250
250
  }
251
251
  }
252
252
  ` : `
253
- ${hasSubmenu || maxWidth ? `
253
+ ${hasSubmenu || maxWidth && !inFullscreenView ? `
254
254
  a,
255
255
  ${_link.StyledLink} a,
256
256
  button,
@@ -444,7 +444,10 @@ const StyledMenuItemWrapper = _styledComponents.default.a.attrs({
444
444
 
445
445
  ${asPassiveItem && (0, _styledComponents.css)`
446
446
  cursor: default;
447
- padding: 0 16px;
447
+
448
+ a {
449
+ padding: 0 16px;
450
+ }
448
451
 
449
452
  :hover {
450
453
  background: transparent;
@@ -13,6 +13,8 @@ var _icon = _interopRequireDefault(require("../../../icon"));
13
13
  var _events = _interopRequireDefault(require("../../../../__internal__/utils/helpers/events"));
14
14
  var _tooltipProvider = require("../../../../__internal__/tooltip-provider");
15
15
  var _tabTitle2 = _interopRequireDefault(require("./tab-title.context"));
16
+ var _typography = _interopRequireDefault(require("../../../typography"));
17
+ var _newValidation = _interopRequireDefault(require("../../../carbon-provider/__internal__/new-validation.context"));
16
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
18
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -43,6 +45,7 @@ const TabTitle = /*#__PURE__*/_react.default.forwardRef(({
43
45
  onKeyDown,
44
46
  align,
45
47
  tabIndex,
48
+ id,
46
49
  ...tabTitleProps
47
50
  }, ref) => {
48
51
  const isHref = !!href;
@@ -50,6 +53,15 @@ const TabTitle = /*#__PURE__*/_react.default.forwardRef(({
50
53
  const hasFailedValidation = error || warning || info;
51
54
  const [shouldShowTooltip, setShouldShowTooltip] = (0, _react.useState)(false);
52
55
  const hasHover = (0, _react.useRef)(false);
56
+ const {
57
+ validationRedesignOptIn
58
+ } = (0, _react.useContext)(_newValidation.default);
59
+ let screenReaderMessage = "";
60
+ if (error) {
61
+ screenReaderMessage = errorMessage;
62
+ } else if (warning) {
63
+ screenReaderMessage = warningMessage;
64
+ }
53
65
  const showTooltip = () => {
54
66
  setShouldShowTooltip(true);
55
67
  };
@@ -130,12 +142,14 @@ const TabTitle = /*#__PURE__*/_react.default.forwardRef(({
130
142
  hasCustomLayout: !!customLayout,
131
143
  alternateStyling: hasAlternateStyling,
132
144
  align: align,
133
- hasHref: !!href
145
+ hasHref: !!href,
146
+ validationRedesignOptIn: validationRedesignOptIn
134
147
  }, renderContent(), isHref && /*#__PURE__*/_react.default.createElement(_icon.default, {
135
148
  type: "link"
136
149
  }), hasFailedValidation && /*#__PURE__*/_react.default.createElement(_tabTitle.StyledLayoutWrapper, {
137
150
  position: position,
138
- hasCustomSibling: !!customLayout
151
+ hasCustomSibling: !!customLayout,
152
+ validationRedesignOptIn: validationRedesignOptIn
139
153
  }, error && /*#__PURE__*/_react.default.createElement(_validationIcon.default, {
140
154
  tooltipPosition: "top",
141
155
  error: errorMessage
@@ -145,7 +159,9 @@ const TabTitle = /*#__PURE__*/_react.default.forwardRef(({
145
159
  }), !warning && !error && info && /*#__PURE__*/_react.default.createElement(_validationIcon.default, {
146
160
  tooltipPosition: "top",
147
161
  info: infoMessage
148
- }))), !(hasFailedValidation || hasAlternateStyling) && isTabSelected && /*#__PURE__*/_react.default.createElement(_tabTitle.StyledSelectedIndicator, {
162
+ }))), validationRedesignOptIn && position === "left" && /*#__PURE__*/_react.default.createElement(_tabTitle.StyledVerticalIndicator, null), (!(hasFailedValidation || hasAlternateStyling) || validationRedesignOptIn) && isTabSelected && /*#__PURE__*/_react.default.createElement(_tabTitle.StyledSelectedIndicator, {
163
+ warning: warning,
164
+ error: error,
149
165
  "data-element": "tab-selected-indicator",
150
166
  "data-role": "tab-selected-indicator",
151
167
  position: position
@@ -167,8 +183,12 @@ const TabTitle = /*#__PURE__*/_react.default.forwardRef(({
167
183
  borders,
168
184
  isInSidebar,
169
185
  tabIndex,
186
+ id,
170
187
  ...tabTitleProps,
171
- ...(0, _tags.default)("tab-header", tabTitleProps),
188
+ ...(0, _tags.default)("tab-header", {
189
+ id,
190
+ ...tabTitleProps
191
+ }),
172
192
  onKeyDown: handleKeyDown,
173
193
  onClick: handleClick,
174
194
  size,
@@ -181,7 +201,13 @@ const TabTitle = /*#__PURE__*/_react.default.forwardRef(({
181
201
  hideTooltip();
182
202
  },
183
203
  onFocus: showTooltip,
184
- onBlur: hideTooltip
204
+ onBlur: hideTooltip,
205
+ ...(validationRedesignOptIn && hasFailedValidation && {
206
+ "aria-invalid": true,
207
+ "aria-errormessage": `${id}-message`,
208
+ "aria-describedby": `${id}-message`
209
+ }),
210
+ validationRedesignOptIn
185
211
  };
186
212
  const tabTitle = isHref ? /*#__PURE__*/_react.default.createElement(_tabTitle.StyledTabTitleLink, _extends({}, titleWrapperProps, {
187
213
  ref: ref,
@@ -192,12 +218,15 @@ const TabTitle = /*#__PURE__*/_react.default.forwardRef(({
192
218
  ref: ref
193
219
  }), titleChildren);
194
220
  return /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
195
- tooltipVisible: shouldShowTooltip
221
+ tooltipVisible: validationRedesignOptIn ? false : shouldShowTooltip
196
222
  }, /*#__PURE__*/_react.default.createElement(_tabTitle2.default.Provider, {
197
223
  value: {
198
224
  isInTab: true
199
225
  }
200
- }, tabTitle));
226
+ }, tabTitle), validationRedesignOptIn && hasFailedValidation && /*#__PURE__*/_react.default.createElement(_typography.default, {
227
+ screenReaderOnly: true,
228
+ id: `${id}-message`
229
+ }, screenReaderMessage));
201
230
  });
202
231
  if (process.env.NODE_ENV !== "production") {
203
232
  TabTitle.propTypes = {
@@ -4,15 +4,23 @@ interface StyledTitleContentProps extends Pick<TabTitleProps, "align" | "borders
4
4
  hasCustomLayout?: boolean;
5
5
  hasHref?: boolean;
6
6
  hasSiblings?: boolean;
7
+ validationRedesignOptIn?: boolean;
7
8
  }
8
9
  declare const StyledTitleContent: import("styled-components").StyledComponent<"span", any, StyledTitleContentProps, never>;
9
- declare const StyledTabTitleButton: import("styled-components").StyledComponent<"button", any, TabTitleProps, never>;
10
- declare const StyledTabTitleLink: import("styled-components").StyledComponent<"a", any, TabTitleProps, never>;
10
+ declare const StyledTabTitleButton: import("styled-components").StyledComponent<"button", any, TabTitleProps & {
11
+ validationRedesignOptIn?: boolean | undefined;
12
+ }, never>;
13
+ declare const StyledTabTitleLink: import("styled-components").StyledComponent<"a", any, TabTitleProps & {
14
+ validationRedesignOptIn?: boolean | undefined;
15
+ }, never>;
11
16
  interface StyledLayoutWrapperProps extends Pick<TabTitleProps, "titlePosition" | "position"> {
12
17
  hasCustomLayout?: boolean;
13
18
  hasCustomSibling?: boolean;
19
+ validationRedesignOptIn?: boolean;
14
20
  }
15
21
  declare const StyledLayoutWrapper: import("styled-components").StyledComponent<"div", any, StyledLayoutWrapperProps, never>;
16
- declare type StyledSelectedIndicatorProps = Pick<TabTitleProps, "position">;
17
- declare const StyledSelectedIndicator: import("styled-components").StyledComponent<"div", any, StyledSelectedIndicatorProps, never>;
18
- export { StyledTabTitleButton, StyledTabTitleLink, StyledTitleContent, StyledLayoutWrapper, StyledSelectedIndicator, };
22
+ declare const StyledVerticalIndicator: import("styled-components").StyledComponent<"div", any, {}, never>;
23
+ declare const StyledSelectedIndicator: import("styled-components").StyledComponent<"div", any, Pick<TabTitleProps, "error" | "warning" | "position"> & {
24
+ validationRedesignOptIn?: boolean | undefined;
25
+ }, never>;
26
+ export { StyledTabTitleButton, StyledTabTitleLink, StyledTitleContent, StyledLayoutWrapper, StyledSelectedIndicator, StyledVerticalIndicator, };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledTitleContent = exports.StyledTabTitleLink = exports.StyledTabTitleButton = exports.StyledSelectedIndicator = exports.StyledLayoutWrapper = void 0;
6
+ exports.StyledVerticalIndicator = exports.StyledTitleContent = exports.StyledTabTitleLink = exports.StyledTabTitleButton = exports.StyledSelectedIndicator = exports.StyledLayoutWrapper = void 0;
7
7
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
8
8
  var _icon = _interopRequireDefault(require("../../../icon/icon.style"));
9
9
  var _validationIcon = _interopRequireDefault(require("../../../../__internal__/validations/validation-icon.style"));
@@ -16,7 +16,7 @@ const oldFocusStyling = `
16
16
  `;
17
17
  const StyledTitleContent = exports.StyledTitleContent = _styledComponents.default.span`
18
18
  outline: none;
19
- display: inline-block;
19
+ display: inline-flex;
20
20
  line-height: 20px;
21
21
  margin: 0;
22
22
  position: relative;
@@ -35,7 +35,8 @@ const StyledTitleContent = exports.StyledTitleContent = _styledComponents.defaul
35
35
  noRightBorder,
36
36
  hasHref,
37
37
  alternateStyling,
38
- align
38
+ align,
39
+ validationRedesignOptIn
39
40
  }) => (0, _styledComponents.css)`
40
41
  text-align: ${align};
41
42
 
@@ -49,6 +50,10 @@ const StyledTitleContent = exports.StyledTitleContent = _styledComponents.defaul
49
50
  border-top-right-radius: var(--borderRadius000);
50
51
  `}
51
52
 
53
+ ${position === "left" && validationRedesignOptIn && (0, _styledComponents.css)`
54
+ justify-content: space-between;
55
+ `}
56
+
52
57
  ${position === "top" && (0, _styledComponents.css)`
53
58
  border-top-left-radius: var(--borderRadius100);
54
59
  border-top-right-radius: var(--borderRadius100);
@@ -119,7 +124,7 @@ const StyledTitleContent = exports.StyledTitleContent = _styledComponents.defaul
119
124
  ${(warning || info) && (0, _styledComponents.css)`
120
125
  outline: 1px solid;
121
126
  outline-offset: -1px;
122
- z-index: 2;
127
+ z-index: ${validationRedesignOptIn ? 1 : 2};
123
128
 
124
129
  ${info && !warning && (0, _styledComponents.css)`
125
130
  outline-color: var(--colorsSemanticInfo500);
@@ -168,7 +173,7 @@ const StyledTitleContent = exports.StyledTitleContent = _styledComponents.defaul
168
173
  ${error && (0, _styledComponents.css)`
169
174
  outline: 2px solid var(--colorsSemanticNegative500);
170
175
  outline-offset: -2px;
171
- z-index: 2;
176
+ z-index: ${validationRedesignOptIn ? 1 : 2};
172
177
 
173
178
  ${position === "top" && (0, _styledComponents.css)`
174
179
  border-bottom-color: transparent;
@@ -272,7 +277,8 @@ const tabTitleStyles = (0, _styledComponents.css)`
272
277
  error,
273
278
  warning,
274
279
  info,
275
- isInSidebar
280
+ isInSidebar,
281
+ validationRedesignOptIn
276
282
  }) => (0, _styledComponents.css)`
277
283
  height: ${size === "large" ? "var(--sizing600)" : "var(--sizing500)"};
278
284
 
@@ -299,9 +305,15 @@ const tabTitleStyles = (0, _styledComponents.css)`
299
305
 
300
306
  ${!isTabSelected && (0, _styledComponents.css)`
301
307
  color: var(--colorsActionMinorYin090);
308
+ ${validationRedesignOptIn && (0, _styledComponents.css)`
309
+ background: transparent;
310
+ `}
302
311
 
303
312
  &:hover {
304
313
  background: var(--colorsActionMinor100);
314
+ ${validationRedesignOptIn && (0, _styledComponents.css)`
315
+ background: var(--colorsUtilityMajor100);
316
+ `}
305
317
  color: var(--colorsActionMinorYin090);
306
318
  outline: none;
307
319
  }
@@ -343,7 +355,9 @@ const tabTitleStyles = (0, _styledComponents.css)`
343
355
  border-bottom: 0px;
344
356
 
345
357
  ${!isInSidebar && !error && (0, _styledComponents.css)`
346
- border-right: ${alternateStyling ? "1px" : "2px"} solid
358
+ --border-right-value: ${validationRedesignOptIn ? "0px" : "2px"}
359
+ border-right:
360
+ ${alternateStyling ? "1px" : "var(--border-right-value)"} solid
347
361
  var(--colorsActionMinor100);
348
362
  `}
349
363
 
@@ -369,6 +383,10 @@ const tabTitleStyles = (0, _styledComponents.css)`
369
383
  border-right: none;
370
384
  `}
371
385
 
386
+ ${!isTabSelected && (0, _styledComponents.css)`
387
+ border-right-color: var(--colorsActionMinor100);
388
+ `}
389
+
372
390
  ${isTabSelected && (0, _styledComponents.css)`
373
391
  ${alternateStyling && (0, _styledComponents.css)`
374
392
  border-right-color: var(--colorsActionMinor100);
@@ -379,7 +397,7 @@ const tabTitleStyles = (0, _styledComponents.css)`
379
397
  padding-bottom: 0px;
380
398
 
381
399
  ${StyledTitleContent} {
382
- ${!(error || warning || info) && "margin-right: 2px;"}
400
+ ${!(error || warning || info) && !validationRedesignOptIn && "margin-right: 2px;"}
383
401
  border-right: none;
384
402
  }
385
403
  `}
@@ -424,7 +442,8 @@ const StyledLayoutWrapper = exports.StyledLayoutWrapper = _styledComponents.defa
424
442
  hasCustomLayout,
425
443
  titlePosition = "before",
426
444
  hasCustomSibling,
427
- position
445
+ position,
446
+ validationRedesignOptIn
428
447
  }) => (0, _styledComponents.css)`
429
448
  ${hasCustomLayout && (0, _styledComponents.css)`
430
449
  flex-grow: 2;
@@ -450,27 +469,52 @@ const StyledLayoutWrapper = exports.StyledLayoutWrapper = _styledComponents.defa
450
469
  z-index: 10;
451
470
 
452
471
  ${_icon.default} {
453
- height: 16px;
472
+ height: ${validationRedesignOptIn ? "0px" : "16px"};
454
473
  left: -2px;
455
- top: ${position === "left" ? "1px" : "3px"};
456
474
  }
457
475
  }
458
476
  `}
459
477
  `}
460
478
  `;
479
+ const StyledVerticalIndicator = exports.StyledVerticalIndicator = _styledComponents.default.div`
480
+ position: absolute;
481
+ top: 0px;
482
+ bottom: 0px;
483
+ right: 0px;
484
+ box-shadow: inset calc(-1 * var(--sizing050)) 0px 0px 0px
485
+ var(--colorsActionMinor100);
486
+ width: 2px;
487
+ z-index: 1;
488
+ `;
461
489
  const StyledSelectedIndicator = exports.StyledSelectedIndicator = _styledComponents.default.div`
462
490
  position: absolute;
463
491
  z-index: 1;
492
+ ${validationRedesignOptIn => (0, _styledComponents.css)`
493
+ ${validationRedesignOptIn && (0, _styledComponents.css)`
494
+ z-index: 2;
495
+ `}
496
+ `}
464
497
 
465
498
  ${({
466
- position = "top"
499
+ position = "top",
500
+ warning,
501
+ error
467
502
  }) => (0, _styledComponents.css)`
503
+ --selected-indicator-color: var(--colorsActionMajor500);
504
+
505
+ ${warning && (0, _styledComponents.css)`
506
+ --selected-indicator-color: var(--colorsSemanticCaution500);
507
+ `}
508
+
509
+ ${error && (0, _styledComponents.css)`
510
+ --selected-indicator-color: var(--colorsSemanticNegative500);
511
+ `}
468
512
  ${position === "top" && (0, _styledComponents.css)`
469
513
  bottom: 0px;
470
514
  left: 0px;
471
515
  right: 0px;
472
516
  box-shadow: inset 0px calc(-1 * var(--sizing050)) 0px
473
- var(--colorsActionMajor500);
517
+ var(--selected-indicator-color);
474
518
  height: var(--sizing050);
475
519
  `}
476
520
 
@@ -479,7 +523,7 @@ const StyledSelectedIndicator = exports.StyledSelectedIndicator = _styledCompone
479
523
  bottom: 0px;
480
524
  right: 0px;
481
525
  box-shadow: inset calc(-1 * var(--sizing050)) 0px 0px 0px
482
- var(--colorsActionMajor500);
526
+ var(--selected-indicator-color);
483
527
  width: var(--sizing050);
484
528
  `}
485
529
  `}
@@ -8,6 +8,7 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _tabsHeader = require("./tabs-header.style");
10
10
  var _useThrottle = _interopRequireDefault(require("../../../../hooks/__internal__/useThrottle"));
11
+ var _newValidation = _interopRequireDefault(require("../../../carbon-provider/__internal__/new-validation.context"));
11
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -32,6 +33,9 @@ const TabsHeader = ({
32
33
  }) => {
33
34
  const [leftScrollOpacity, setLeftScrollOpacity] = (0, _react.useState)(0);
34
35
  const [rightScrollOpacity, setRightScrollOpacity] = (0, _react.useState)(1);
36
+ const {
37
+ validationRedesignOptIn
38
+ } = (0, _react.useContext)(_newValidation.default);
35
39
  const ref = (0, _react.useRef)(null);
36
40
  let isScrollable = false;
37
41
  const {
@@ -64,7 +68,9 @@ const TabsHeader = ({
64
68
  rightScrollOpacity: rightScrollOpacity,
65
69
  isScrollable: isScrollable,
66
70
  ref: ref
67
- }, position === "top" ? /*#__PURE__*/_react.default.createElement(_tabsHeader.StyledTabsWrapper, null, /*#__PURE__*/_react.default.createElement(_tabsHeader.StyledTabsBottomBorderWrapper, null, /*#__PURE__*/_react.default.createElement(_tabsHeader.StyledTabsBottomBorder, null)), children) : /*#__PURE__*/_react.default.createElement(_tabsHeader.StyledVerticalTabsWrapper, {
71
+ }, position === "top" ? /*#__PURE__*/_react.default.createElement(_tabsHeader.StyledTabsWrapper, null, /*#__PURE__*/_react.default.createElement(_tabsHeader.StyledTabsBottomBorderWrapper, {
72
+ validationRedesignOptIn: validationRedesignOptIn
73
+ }, /*#__PURE__*/_react.default.createElement(_tabsHeader.StyledTabsBottomBorder, null)), children) : /*#__PURE__*/_react.default.createElement(_tabsHeader.StyledVerticalTabsWrapper, {
68
74
  isInSidebar: isInSidebar
69
75
  }, children)));
70
76
  };
@@ -10,6 +10,8 @@ declare const StyledTabsHeaderList: import("styled-components").StyledComponent<
10
10
  declare const StyledTabsWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
11
11
  declare type StyledVerticalTabsWrapperProps = Pick<TabHeaderProps, "isInSidebar">;
12
12
  declare const StyledVerticalTabsWrapper: import("styled-components").StyledComponent<"div", any, StyledVerticalTabsWrapperProps, never>;
13
- declare const StyledTabsBottomBorderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
13
+ declare const StyledTabsBottomBorderWrapper: import("styled-components").StyledComponent<"div", any, {
14
+ validationRedesignOptIn?: boolean | undefined;
15
+ }, never>;
14
16
  declare const StyledTabsBottomBorder: import("styled-components").StyledComponent<"div", any, {}, never>;
15
17
  export { StyledTabsHeaderWrapper, StyledTabsHeaderList, StyledTabsWrapper, StyledTabsBottomBorderWrapper, StyledTabsBottomBorder, StyledVerticalTabsWrapper, };
@@ -157,7 +157,12 @@ const StyledTabsBottomBorderWrapper = exports.StyledTabsBottomBorderWrapper = _s
157
157
  position: absolute;
158
158
  width: 100%;
159
159
  height: auto;
160
- bottom: 0;
160
+ bottom: 0px;
161
+ ${({
162
+ validationRedesignOptIn
163
+ }) => (0, _styledComponents.css)`
164
+ z-index: ${validationRedesignOptIn ? 2 : ""};
165
+ `}
161
166
  `;
162
167
  const StyledTabsBottomBorder = exports.StyledTabsBottomBorder = _styledComponents.default.div`
163
168
  position: sticky;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "144.9.1",
3
+ "version": "144.9.3",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",
@@ -196,8 +196,8 @@
196
196
  "polished": "^4.2.2",
197
197
  "prop-types": "^15.8.1",
198
198
  "react-day-picker": "~7.4.10",
199
- "react-dnd": "^15.1.2",
200
- "react-dnd-html5-backend": "^15.1.3",
199
+ "react-dnd": "^16.0.1",
200
+ "react-dnd-html5-backend": "^16.0.1",
201
201
  "react-is": "^17.0.2",
202
202
  "react-transition-group": "^4.4.5",
203
203
  "styled-system": "^5.1.5"