carbon-react 104.5.0 → 104.7.2

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.
Files changed (34) hide show
  1. package/lib/__internal__/checkable-input/checkable-input.component.js +2 -3
  2. package/lib/__internal__/form-field/form-field.component.d.ts +4 -1
  3. package/lib/__internal__/form-field/form-field.component.js +7 -2
  4. package/lib/__internal__/form-field/form-field.d.ts +2 -0
  5. package/lib/__internal__/input-icon-toggle/input-icon-toggle.component.d.ts +3 -3
  6. package/lib/__internal__/input-icon-toggle/input-icon-toggle.component.js +6 -5
  7. package/lib/__internal__/input-icon-toggle/input-icon-toggle.d.ts +2 -0
  8. package/lib/__internal__/label/label.component.d.ts +4 -1
  9. package/lib/__internal__/label/label.component.js +15 -6
  10. package/lib/__internal__/label/label.d.ts +2 -0
  11. package/lib/__internal__/tooltip-provider/index.js +22 -12
  12. package/lib/components/button/button-types.style.js +9 -9
  13. package/lib/components/dialog/dialog.style.js +4 -16
  14. package/lib/components/dialog-full-screen/dialog-full-screen.style.js +2 -4
  15. package/lib/components/draggable/draggable-container.component.js +2 -2
  16. package/lib/components/draggable/draggable-item.component.js +1 -1
  17. package/lib/components/draggable/draggable-test.stories.js +66 -0
  18. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +8 -8
  19. package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.d.ts +1 -0
  20. package/lib/components/flat-table/flat-table-row/__internal__/flat-table-row-draggable.component.js +2 -1
  21. package/lib/components/help/help.component.js +1 -1
  22. package/lib/components/help/help.d.ts +1 -1
  23. package/lib/components/loader/loader-square.style.js +1 -1
  24. package/lib/components/navigation-bar/navigation-bar.style.js +1 -0
  25. package/lib/components/sidebar/sidebar.style.js +2 -2
  26. package/lib/components/textarea/textarea.component.js +2 -3
  27. package/lib/components/textbox/textbox.component.js +4 -4
  28. package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.d.ts +2 -3
  29. package/lib/hooks/__internal__/useInputAccessibility/useInputAccessibility.js +3 -4
  30. package/lib/style/themes/base/base-theme.config.d.ts +1 -0
  31. package/lib/style/themes/base/base-theme.config.js +1 -0
  32. package/lib/style/themes/base/index.d.ts +1 -0
  33. package/lib/style/themes/sage/index.d.ts +1 -0
  34. package/package.json +3 -3
@@ -63,8 +63,8 @@ const CheckableInput = ({
63
63
  } = (0, _react.useRef)(inputId || (0, _guid.default)());
64
64
  const {
65
65
  labelId,
66
- tooltipId,
67
66
  fieldHelpId,
67
+ validationIconId,
68
68
  ariaDescribedBy,
69
69
  ariaLabelledBy
70
70
  } = (0, _useInputAccessibility.default)({
@@ -73,7 +73,6 @@ const CheckableInput = ({
73
73
  warning,
74
74
  info,
75
75
  label,
76
- labelHelp,
77
76
  fieldHelp
78
77
  });
79
78
  const isRadio = type === "radio";
@@ -82,7 +81,6 @@ const CheckableInput = ({
82
81
  error,
83
82
  fieldHelp,
84
83
  fieldHelpInline,
85
- tooltipId,
86
84
  fieldHelpId,
87
85
  id,
88
86
  info,
@@ -96,6 +94,7 @@ const CheckableInput = ({
96
94
  name: id,
97
95
  reverse,
98
96
  warning,
97
+ validationIconId,
99
98
  // We don't want an asterisk on each radio control, only the legend
100
99
  // However, we still want the input element to receive the required prop
101
100
  isRequired: isRadio ? undefined : required,
@@ -1,5 +1,5 @@
1
1
  export default FormField;
2
- declare function FormField({ children, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, helpTabIndex, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, ...rest }: {
2
+ declare function FormField({ children, disabled, fieldHelp: fieldHelpContent, fieldHelpInline, error, warning, info, tooltipId, fieldHelpId, helpTabIndex, label, labelId, labelAlign, labelHelp, labelHelpIcon, labelInline, labelSpacing, labelWidth, id, reverse, isOptional, useValidationIcon, adaptiveLabelBreakpoint, isRequired, validationIconId, ...rest }: {
3
3
  [x: string]: any;
4
4
  children: any;
5
5
  disabled: any;
@@ -25,6 +25,7 @@ declare function FormField({ children, disabled, fieldHelp: fieldHelpContent, fi
25
25
  useValidationIcon: any;
26
26
  adaptiveLabelBreakpoint: any;
27
27
  isRequired: any;
28
+ validationIconId: any;
28
29
  }): JSX.Element;
29
30
  declare namespace FormField {
30
31
  const propTypes: {
@@ -58,6 +59,8 @@ declare namespace FormField {
58
59
  adaptiveLabelBreakpoint: PropTypes.Requireable<number>;
59
60
  /** Flag to configure component as mandatory */
60
61
  isRequired: PropTypes.Requireable<boolean>;
62
+ /** Id of the validation icon */
63
+ validationIconId: PropTypes.Requireable<string>;
61
64
  };
62
65
  }
63
66
  import PropTypes from "prop-types";
@@ -60,6 +60,7 @@ const FormField = ({
60
60
  useValidationIcon,
61
61
  adaptiveLabelBreakpoint,
62
62
  isRequired,
63
+ validationIconId,
63
64
  ...rest
64
65
  }) => {
65
66
  const context = (0, _react.useContext)(_tab.TabContext);
@@ -103,7 +104,8 @@ const FormField = ({
103
104
  useValidationIcon: useValidationIcon,
104
105
  pr: !reverse ? labelSpacing : undefined,
105
106
  pl: reverse ? labelSpacing : undefined,
106
- isRequired: isRequired
107
+ isRequired: isRequired,
108
+ validationIconId: validationIconId
107
109
  }, label), fieldHelpInline && fieldHelp, !reverse && children), !fieldHelpInline && fieldHelp);
108
110
  };
109
111
 
@@ -150,7 +152,10 @@ FormField.propTypes = {
150
152
  adaptiveLabelBreakpoint: _propTypes.default.number,
151
153
 
152
154
  /** Flag to configure component as mandatory */
153
- isRequired: _propTypes.default.bool
155
+ isRequired: _propTypes.default.bool,
156
+
157
+ /** Id of the validation icon */
158
+ validationIconId: _propTypes.default.string
154
159
  };
155
160
  var _default = FormField;
156
161
  exports.default = _default;
@@ -33,6 +33,8 @@ export interface CommonFormFieldPropTypes
33
33
  labelWidth?: number;
34
34
  /** If true the label switches position with the input */
35
35
  reverse?: boolean;
36
+ /** Id of the validation icon */
37
+ validationIconId?: string;
36
38
  }
37
39
 
38
40
  export interface FormFieldPropTypes extends CommonFormFieldPropTypes {
@@ -1,5 +1,5 @@
1
1
  export default InputIconToggle;
2
- declare function InputIconToggle({ disabled, readOnly, size, inputIcon: type, onClick, onFocus, onBlur, onMouseDown, error, warning, info, useValidationIcon, align, iconTabIndex, tooltipId, }: {
2
+ declare function InputIconToggle({ disabled, readOnly, size, inputIcon: type, onClick, onFocus, onBlur, onMouseDown, error, warning, info, useValidationIcon, align, iconTabIndex, validationIconId, }: {
3
3
  disabled: any;
4
4
  readOnly: any;
5
5
  size: any;
@@ -14,7 +14,7 @@ declare function InputIconToggle({ disabled, readOnly, size, inputIcon: type, on
14
14
  useValidationIcon: any;
15
15
  align: any;
16
16
  iconTabIndex: any;
17
- tooltipId: any;
17
+ validationIconId: any;
18
18
  }): JSX.Element | null;
19
19
  declare namespace InputIconToggle {
20
20
  namespace propTypes {
@@ -32,7 +32,7 @@ declare namespace InputIconToggle {
32
32
  const align: PropTypes.Requireable<string>;
33
33
  const useValidationIcon: PropTypes.Requireable<boolean>;
34
34
  const iconTabIndex: PropTypes.Requireable<number>;
35
- const tooltipId: PropTypes.Requireable<string>;
35
+ const validationIconId: PropTypes.Requireable<string>;
36
36
  }
37
37
  }
38
38
  import PropTypes from "prop-types";
@@ -41,7 +41,7 @@ const InputIconToggle = ({
41
41
  useValidationIcon,
42
42
  align,
43
43
  iconTabIndex,
44
- tooltipId
44
+ validationIconId
45
45
  }) => {
46
46
  if (useValidationIcon && !disabled && shouldDisplayValidationIcon({
47
47
  error,
@@ -60,7 +60,7 @@ const InputIconToggle = ({
60
60
  onBlur: onBlur,
61
61
  isPartOfInput: true,
62
62
  tabIndex: iconTabIndex,
63
- tooltipId: tooltipId,
63
+ iconId: validationIconId,
64
64
  tooltipPosition: align === "right" ? "left" : "right"
65
65
  }));
66
66
  }
@@ -74,8 +74,7 @@ const InputIconToggle = ({
74
74
  onMouseDown: onMouseDown,
75
75
  tabIndex: iconTabIndex
76
76
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
77
- type: type,
78
- tooltipId: tooltipId
77
+ type: type
79
78
  }));
80
79
  }
81
80
 
@@ -97,7 +96,9 @@ InputIconToggle.propTypes = {
97
96
  align: _propTypes.default.oneOf(["left", "right"]),
98
97
  useValidationIcon: _propTypes.default.bool,
99
98
  iconTabIndex: _propTypes.default.number,
100
- tooltipId: _propTypes.default.string
99
+
100
+ /** Id of the validation icon */
101
+ validationIconId: _propTypes.default.string
101
102
  };
102
103
  var _default = InputIconToggle;
103
104
  exports.default = _default;
@@ -16,6 +16,8 @@ export interface InputIconToggleProps {
16
16
  useValidationIcon?: boolean;
17
17
  iconTabIndex?: number;
18
18
  tooltipId?: string;
19
+ /** Id of the validation icon */
20
+ validationIconId?: string;
19
21
  }
20
22
  declare function InputIconToggle(props: InputIconToggleProps): JSX.Element;
21
23
 
@@ -1,5 +1,5 @@
1
1
  declare var _default: React.MemoExoticComponent<{
2
- ({ disabled, inline, align, width, optional, labelId, tooltipId, children, error, warning, info, help, helpIcon, helpTabIndex, useValidationIcon, htmlFor, pr, pl, isRequired, }: {
2
+ ({ disabled, inline, align, width, optional, labelId, tooltipId, children, error, warning, info, help, helpIcon, helpTabIndex, useValidationIcon, htmlFor, pr, pl, isRequired, validationIconId, }: {
3
3
  disabled: any;
4
4
  inline: any;
5
5
  align?: string | undefined;
@@ -19,6 +19,7 @@ declare var _default: React.MemoExoticComponent<{
19
19
  pr: any;
20
20
  pl: any;
21
21
  isRequired: any;
22
+ validationIconId: any;
22
23
  }): JSX.Element;
23
24
  propTypes: {
24
25
  /** Label width */
@@ -59,6 +60,8 @@ declare var _default: React.MemoExoticComponent<{
59
60
  pl: PropTypes.Requireable<number>;
60
61
  /** Flag to configure component as mandatory */
61
62
  isRequired: PropTypes.Requireable<boolean>;
63
+ /** Id of the validation icon */
64
+ validationIconId: PropTypes.Requireable<string>;
62
65
  };
63
66
  }>;
64
67
  export default _default;
@@ -63,11 +63,11 @@ const Label = ({
63
63
  htmlFor,
64
64
  pr,
65
65
  pl,
66
- isRequired
66
+ isRequired,
67
+ validationIconId
67
68
  }) => {
69
+ const [isFocused, setFocus] = (0, _react.useState)(false);
68
70
  const {
69
- hasFocus,
70
- hasMouseOver,
71
71
  onMouseEnter,
72
72
  onMouseLeave
73
73
  } = (0, _react.useContext)(_inputBehaviour.InputContext);
@@ -87,6 +87,11 @@ const Label = ({
87
87
  };
88
88
 
89
89
  const icon = () => {
90
+ const wrapperProps = {
91
+ onFocus: () => setFocus(true),
92
+ onBlur: () => setFocus(false)
93
+ };
94
+
90
95
  if (useValidationIcon && shouldDisplayValidationIcon({
91
96
  error,
92
97
  warning,
@@ -100,6 +105,7 @@ const Label = ({
100
105
  inline
101
106
  });
102
107
  return /*#__PURE__*/_react.default.createElement(_iconWrapper.default, null, /*#__PURE__*/_react.default.createElement(_validationIcon.default, {
108
+ iconId: validationIconId,
103
109
  tooltipId: tooltipId,
104
110
  error: error,
105
111
  warning: warning,
@@ -109,11 +115,11 @@ const Label = ({
109
115
  }));
110
116
  }
111
117
 
112
- return help && /*#__PURE__*/_react.default.createElement(_iconWrapper.default, null, /*#__PURE__*/_react.default.createElement(_help.default, {
118
+ return help && /*#__PURE__*/_react.default.createElement(_iconWrapper.default, wrapperProps, /*#__PURE__*/_react.default.createElement(_help.default, {
113
119
  tooltipId: tooltipId,
114
120
  tabIndex: helpTabIndex,
115
121
  type: helpIcon,
116
- isFocused: hasFocus || hasMouseOver
122
+ isFocused: isFocused
117
123
  }, help));
118
124
  };
119
125
 
@@ -191,7 +197,10 @@ Label.propTypes = {
191
197
  pl: _propTypes.default.oneOf([1, 2]),
192
198
 
193
199
  /** Flag to configure component as mandatory */
194
- isRequired: _propTypes.default.bool
200
+ isRequired: _propTypes.default.bool,
201
+
202
+ /** Id of the validation icon */
203
+ validationIconId: _propTypes.default.string
195
204
  };
196
205
 
197
206
  var _default = /*#__PURE__*/_react.default.memo(Label);
@@ -34,6 +34,8 @@ export interface LabelPropTypes extends ValidationPropTypes {
34
34
  pr?: 1 | 2;
35
35
  /** Padding left, integer multiplied by base spacing constant (8) */
36
36
  pl?: 1 | 2;
37
+ /** Id of the validation icon */
38
+ validationIconId?: string;
37
39
  }
38
40
 
39
41
  declare function Label(props: LabelPropTypes): JSX.Element;
@@ -5,12 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.TooltipProvider = exports.TooltipContext = void 0;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
+ var _guid = _interopRequireDefault(require("../utils/helpers/guid/guid"));
13
+
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
16
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
17
+
18
+ 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; }
19
+
14
20
  const TooltipContext = /*#__PURE__*/_react.default.createContext({});
15
21
 
16
22
  exports.TooltipContext = TooltipContext;
@@ -21,18 +27,22 @@ const TooltipProvider = ({
21
27
  helpAriaLabel,
22
28
  focusable = true,
23
29
  tooltipVisible,
24
- disabled = false,
30
+ disabled,
25
31
  target
26
- }) => /*#__PURE__*/_react.default.createElement(TooltipContext.Provider, {
27
- value: {
28
- tooltipPosition,
29
- helpAriaLabel,
30
- focusable,
31
- tooltipVisible,
32
- disabled,
33
- target
34
- }
35
- }, children);
32
+ }) => {
33
+ const tooltipId = (0, _react.useRef)((0, _guid.default)());
34
+ return /*#__PURE__*/_react.default.createElement(TooltipContext.Provider, {
35
+ value: {
36
+ tooltipPosition,
37
+ helpAriaLabel,
38
+ focusable,
39
+ tooltipVisible,
40
+ disabled,
41
+ tooltipId,
42
+ target
43
+ }
44
+ }, children);
45
+ };
36
46
 
37
47
  exports.TooltipProvider = TooltipProvider;
38
48
  TooltipProvider.propTypes = {
@@ -30,7 +30,7 @@ var _default = (isDisabled, destructive) => ({
30
30
 
31
31
  ${isDisabled ? `
32
32
  background: var(--colorsActionDisabled500);
33
- ${makeColors("var(--colorsYin030)")};
33
+ ${makeColors("var(--colorsActionMajorYin030)")};
34
34
  &:hover {
35
35
  background: var(--colorsActionDisabled500);
36
36
  }
@@ -44,7 +44,7 @@ var _default = (isDisabled, destructive) => ({
44
44
 
45
45
  ${isDisabled ? `
46
46
  background: var(--colorsActionDisabled500);
47
- ${makeColors("var(--colorsYin030)")};
47
+ ${makeColors("var(--colorsActionMajorYin030)")};
48
48
  &:hover {
49
49
  background: var(--colorsActionDisabled500);
50
50
  }
@@ -72,11 +72,11 @@ var _default = (isDisabled, destructive) => ({
72
72
 
73
73
  ${isDisabled ? `
74
74
  border-color: var(--colorsActionDisabled500);
75
- ${makeColors("var(--colorsYin030)")};
75
+ ${makeColors("var(--colorsActionMajorYin030)")};
76
76
  &:hover {
77
77
  background: transparent;
78
78
  border-color: var(--colorsActionDisabled500);
79
- ${makeColors("var(--colorsYin030)")};
79
+ ${makeColors("var(--colorsActionMajorYin030)")};
80
80
  }
81
81
  ` : ""}
82
82
  `,
@@ -98,10 +98,10 @@ var _default = (isDisabled, destructive) => ({
98
98
  ` : ""}
99
99
 
100
100
  ${isDisabled ? `
101
- ${makeColors("var(--colorsYin030)")};
101
+ ${makeColors("var(--colorsActionMajorYin030)")};
102
102
  &:hover {
103
103
  background: var(--colorsActionMajorTransparent);
104
- ${makeColors("var(--colorsYin030)")};
104
+ ${makeColors("var(--colorsActionMajorYin030)")};
105
105
  }
106
106
  ` : ""}
107
107
  `,
@@ -119,7 +119,7 @@ var _default = (isDisabled, destructive) => ({
119
119
 
120
120
  ${isDisabled ? `
121
121
  border-color: var(--colorsActionDisabled500);
122
- ${makeColors("var(--colorsYin030)")};
122
+ ${makeColors("var(--colorsActionMinorYin030)")};
123
123
  &:hover {
124
124
  background-color: transparent;
125
125
  }
@@ -136,10 +136,10 @@ var _default = (isDisabled, destructive) => ({
136
136
 
137
137
  ${isDisabled ? `
138
138
  background: var(--colorsActionDisabled500);
139
- ${makeColors("var(--colorsYin030)")};
139
+ ${makeColors("var(--colorsActionMajorYin030)")};
140
140
  &:hover {
141
141
  background: var(--colorsActionDisabled500);
142
- ${makeColors("var(--colorsYin030)")};
142
+ ${makeColors("var(--colorsActionMajorYin030)")};
143
143
  }
144
144
  ` : ""}
145
145
  `
@@ -7,8 +7,6 @@ exports.DialogInnerContentStyle = exports.DialogContentStyle = exports.DialogTit
7
7
 
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
9
 
10
- var _base = _interopRequireDefault(require("../../style/themes/base"));
11
-
12
10
  var _form = require("../form/form.style");
13
11
 
14
12
  var _heading = require("../heading/heading.style");
@@ -34,10 +32,8 @@ const dialogSizes = {
34
32
  const HORIZONTAL_PADDING = 35;
35
33
  const CONTENT_BOTTOM_PADDING = 30;
36
34
  const DialogStyle = _styledComponents.default.div`
37
- background-color: #f2f5f6;
38
- box-shadow: ${({
39
- theme
40
- }) => theme.shadows.depth3};
35
+ background-color: var(--colorsUtilityMajor025);
36
+ box-shadow: var(--boxShadow300);
41
37
  display: flex;
42
38
  flex-direction: column;
43
39
  position: fixed;
@@ -119,9 +115,7 @@ const DialogTitleStyle = _styledComponents.default.div`
119
115
  margin-bottom: 20px;
120
116
 
121
117
  ${_heading.StyledHeadingTitle} {
122
- color: ${({
123
- theme
124
- }) => theme.text.color};
118
+ color: var(--colorsUtilityYin090);
125
119
  display: block;
126
120
  overflow: hidden;
127
121
  text-overflow: ellipsis;
@@ -147,10 +141,4 @@ const DialogInnerContentStyle = _styledComponents.default.div`
147
141
  position: relative;
148
142
  flex: 1;
149
143
  `;
150
- exports.DialogInnerContentStyle = DialogInnerContentStyle;
151
- DialogTitleStyle.defaultProps = {
152
- theme: _base.default
153
- };
154
- DialogStyle.defaultProps = {
155
- theme: _base.default
156
- };
144
+ exports.DialogInnerContentStyle = DialogInnerContentStyle;
@@ -26,9 +26,7 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
26
26
  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; }
27
27
 
28
28
  const StyledDialogFullScreen = _styledComponents.default.div`
29
- background-color: ${({
30
- theme
31
- }) => theme.disabled.input};
29
+ background-color: var(--colorsUtilityMajor025);
32
30
  height: 100%;
33
31
  left: 0;
34
32
  position: fixed;
@@ -36,7 +34,7 @@ const StyledDialogFullScreen = _styledComponents.default.div`
36
34
  width: 100%;
37
35
  z-index: ${({
38
36
  theme
39
- }) => theme.zIndex.fullScreenModal};
37
+ }) => theme.zIndex.fullScreenModal}; // TODO (tokens): implement elevation tokens - FE-4437
40
38
  display: flex;
41
39
  flex-direction: column;
42
40
 
@@ -9,7 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactDnd = require("react-dnd");
11
11
 
12
- var _reactDndHtml5Backend = _interopRequireDefault(require("react-dnd-html5-backend"));
12
+ var _reactDndHtml5Backend = require("react-dnd-html5-backend");
13
13
 
14
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
 
@@ -96,7 +96,7 @@ const DraggableContainer = ({
96
96
 
97
97
  const marginProps = (0, _utils.filterStyledSystemMarginProps)(rest);
98
98
  return /*#__PURE__*/_react.default.createElement(_reactDnd.DndProvider, {
99
- backend: _reactDndHtml5Backend.default
99
+ backend: _reactDndHtml5Backend.HTML5Backend
100
100
  }, /*#__PURE__*/_react.default.createElement(DropTarget, _extends({
101
101
  getOrder: getItemsId
102
102
  }, marginProps), draggableItems.map(item => /*#__PURE__*/_react.default.cloneElement(item, {
@@ -35,8 +35,8 @@ const DraggableItem = ({
35
35
  const [{
36
36
  isDragging
37
37
  }, drag] = (0, _reactDnd.useDrag)({
38
+ type: "draggableItem",
38
39
  item: {
39
- type: "draggableItem",
40
40
  id,
41
41
  originalIndex
42
42
  },
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Default = exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _addonActions = require("@storybook/addon-actions");
11
+
12
+ var _draggableContainer = _interopRequireDefault(require("./draggable-container.component"));
13
+
14
+ var _draggableItem = _interopRequireDefault(require("./draggable-item.component"));
15
+
16
+ var _checkbox = require("../checkbox");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ var _default = {
21
+ title: "Draggable/Test",
22
+ parameters: {
23
+ info: {
24
+ disable: true
25
+ },
26
+ chromatic: {
27
+ disable: true
28
+ }
29
+ }
30
+ };
31
+ exports.default = _default;
32
+
33
+ const Default = () => {
34
+ const handleUpdate = items => {
35
+ (0, _addonActions.action)("onUpdate")(items);
36
+ };
37
+
38
+ return /*#__PURE__*/_react.default.createElement(_draggableContainer.default, {
39
+ getOrder: handleUpdate
40
+ }, /*#__PURE__*/_react.default.createElement(_draggableItem.default, {
41
+ key: "1",
42
+ id: 1
43
+ }, /*#__PURE__*/_react.default.createElement(_checkbox.Checkbox, {
44
+ label: "Draggable Label One"
45
+ })), /*#__PURE__*/_react.default.createElement(_draggableItem.default, {
46
+ key: "2",
47
+ id: 2
48
+ }, /*#__PURE__*/_react.default.createElement(_checkbox.Checkbox, {
49
+ label: "Draggable Label Two"
50
+ })), /*#__PURE__*/_react.default.createElement(_draggableItem.default, {
51
+ key: "3",
52
+ id: 3
53
+ }, /*#__PURE__*/_react.default.createElement(_checkbox.Checkbox, {
54
+ label: "Draggable Label Three"
55
+ })), /*#__PURE__*/_react.default.createElement(_draggableItem.default, {
56
+ key: "4",
57
+ id: 4
58
+ }, /*#__PURE__*/_react.default.createElement(_checkbox.Checkbox, {
59
+ label: "Draggable Label Four"
60
+ })));
61
+ };
62
+
63
+ exports.Default = Default;
64
+ Default.story = {
65
+ name: "default"
66
+ };
@@ -9,7 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactDnd = require("react-dnd");
11
11
 
12
- var _reactDndHtml5Backend = _interopRequireDefault(require("react-dnd-html5-backend"));
12
+ var _reactDndHtml5Backend = require("react-dnd-html5-backend");
13
13
 
14
14
  var _propTypes = _interopRequireDefault(require("prop-types"));
15
15
 
@@ -45,6 +45,11 @@ const DropTarget = ({
45
45
  }, rest), children);
46
46
  };
47
47
 
48
+ DropTarget.propTypes = {
49
+ children: _propTypes.default.node.isRequired,
50
+ getOrder: _propTypes.default.func
51
+ };
52
+
48
53
  const FlatTableBodyDraggable = ({
49
54
  children,
50
55
  getOrder
@@ -88,15 +93,14 @@ const FlatTableBodyDraggable = ({
88
93
  };
89
94
 
90
95
  return /*#__PURE__*/_react.default.createElement(_reactDnd.DndProvider, {
91
- backend: _reactDndHtml5Backend.default
96
+ backend: _reactDndHtml5Backend.HTML5Backend
92
97
  }, /*#__PURE__*/_react.default.createElement(DropTarget, {
93
98
  getOrder: getItemsId
94
99
  }, draggableItems.map(item => /*#__PURE__*/_react.default.cloneElement(item, {
95
100
  id: `${item.props.id}`,
96
101
  moveItem,
97
102
  findItem,
98
- draggable: true,
99
- key: `${item.props.id}`
103
+ draggable: true
100
104
  }, [/*#__PURE__*/_react.default.createElement(_flatTableCell.default, {
101
105
  key: item.props.id
102
106
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
@@ -108,9 +112,5 @@ FlatTableBodyDraggable.propTypes = {
108
112
  getOrder: _propTypes.default.func,
109
113
  children: _propTypes.default.node.isRequired
110
114
  };
111
- DropTarget.propTypes = {
112
- children: _propTypes.default.node.isRequired,
113
- getOrder: _propTypes.default.func
114
- };
115
115
  var _default = FlatTableBodyDraggable;
116
116
  exports.default = _default;
@@ -5,6 +5,7 @@ declare function FlatTableRowDraggable({ children, id, findItem, moveItem }: {
5
5
  findItem: any;
6
6
  moveItem: any;
7
7
  }): React.DetailedReactHTMLElement<{
8
+ key: any;
8
9
  id: any;
9
10
  isDragging: boolean;
10
11
  ref: (node: any) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -23,8 +23,8 @@ const FlatTableRowDraggable = ({
23
23
  const [{
24
24
  isDragging
25
25
  }, drag] = (0, _reactDnd.useDrag)({
26
+ type: "flatTableRow",
26
27
  item: {
27
- type: "flatTableRow",
28
28
  id,
29
29
  originalIndex
30
30
  },
@@ -60,6 +60,7 @@ const FlatTableRowDraggable = ({
60
60
 
61
61
  });
62
62
  return /*#__PURE__*/_react.default.cloneElement(children, {
63
+ key: originalIndex,
63
64
  id,
64
65
  isDragging,
65
66
  ref: node => drag(drop(node))
@@ -139,7 +139,7 @@ Help.propTypes = { ...marginPropTypes,
139
139
  /** A path for the anchor */
140
140
  href: _propTypes.default.string,
141
141
 
142
- /** Overrides the visibility of the Tooltip if true */
142
+ /** A boolean received from IconWrapper */
143
143
  isFocused: _propTypes.default.bool,
144
144
 
145
145
  /** <a href="https://brand.sage.com/d/NdbrveWvNheA/foundations#/icons/icons" target="_blank">List of supported icons</a>
@@ -13,7 +13,7 @@ export interface HelpProps extends MarginProps {
13
13
  helpId?: string;
14
14
  /** A path for the anchor */
15
15
  href?: string;
16
- /** Overrides the visibility of the Tooltip if true */
16
+ /** A boolean received from IconWrapper */
17
17
  isFocused?: boolean;
18
18
  /** Overrides the default tabindex of the component */
19
19
  tabIndex?: number | string;
@@ -67,7 +67,7 @@ const StyledLoaderSquare = _styledComponents.default.div`
67
67
  ${getDimentions(size)}
68
68
 
69
69
  ${isInsideButton && (0, _styledComponents.css)`
70
- background-color: ${isActive ? "var(--colorsYang100)" : "var(--colorsSemanticNeutral500)"};
70
+ background-color: ${isActive ? "var(--colorsUtilityYang100)" : "var(--colorsSemanticNeutral500)"};
71
71
  `}
72
72
 
73
73
  &:nth-of-type(1) {
@@ -62,6 +62,7 @@ const StyledNavigationBar = _styledComponents.default.nav`
62
62
  theme
63
63
  }) => (0, _styledComponents.css)`
64
64
  min-height: 40px;
65
+ z-index: ${theme.zIndex.nav};
65
66
 
66
67
  ${navigationType === "light" && (0, _styledComponents.css)`
67
68
  background-color: ${theme.navigationBar.light.background};
@@ -26,7 +26,7 @@ const SidebarStyle = _styledComponents.default.div`
26
26
  size,
27
27
  theme
28
28
  }) => (0, _styledComponents.css)`
29
- background-color: ${theme.disabled.input};
29
+ background: var(--colorsUtilityMajor025);
30
30
  border-radius: 1px;
31
31
  bottom: 0;
32
32
  position: fixed;
@@ -40,7 +40,7 @@ const SidebarStyle = _styledComponents.default.div`
40
40
  `}
41
41
 
42
42
  ${position && (0, _styledComponents.css)`
43
- box-shadow: ${theme.shadows.depth3};
43
+ box-shadow: var(--boxShadow300);
44
44
  ${position}: 0;
45
45
  `}
46
46
 
@@ -105,7 +105,7 @@ const Textarea = ({
105
105
 
106
106
  const {
107
107
  labelId,
108
- tooltipId,
108
+ validationIconId,
109
109
  fieldHelpId,
110
110
  ariaDescribedBy,
111
111
  ariaLabelledBy
@@ -115,7 +115,6 @@ const Textarea = ({
115
115
  warning,
116
116
  info,
117
117
  label,
118
- labelHelp,
119
118
  fieldHelp
120
119
  });
121
120
  (0, _react.useEffect)(() => {
@@ -176,7 +175,6 @@ const Textarea = ({
176
175
  labelWidth: labelWidth,
177
176
  labelHelp: labelHelp,
178
177
  labelSpacing: labelSpacing,
179
- tooltipId: tooltipId,
180
178
  isRequired: props.required,
181
179
  useValidationIcon: validationOnLabel,
182
180
  adaptiveLabelBreakpoint: adaptiveLabelBreakpoint
@@ -214,6 +212,7 @@ const Textarea = ({
214
212
  error: error,
215
213
  warning: warning,
216
214
  info: info,
215
+ validationIconId: validationIconId,
217
216
  useValidationIcon: !validationOnLabel
218
217
  }))), characterCount())));
219
218
  };
@@ -94,7 +94,7 @@ const Textbox = ({
94
94
  const [maxLength, characterCount] = (0, _useCharacterCount.default)(value, characterLimit, warnOverLimit, enforceCharacterLimit);
95
95
  const {
96
96
  labelId: internalLabelId,
97
- tooltipId,
97
+ validationIconId,
98
98
  fieldHelpId,
99
99
  ariaDescribedBy
100
100
  } = (0, _useInputAccessibility.default)({
@@ -111,7 +111,6 @@ const Textbox = ({
111
111
  helpAriaLabel: helpAriaLabel,
112
112
  tooltipPosition: tooltipPosition
113
113
  }, /*#__PURE__*/_react.default.createElement(_inputBehaviour.InputBehaviour, null, /*#__PURE__*/_react.default.createElement(_formField.default, _extends({
114
- tooltipId: tooltipId,
115
114
  disabled: disabled,
116
115
  fieldHelp: fieldHelp,
117
116
  fieldHelpId: fieldHelpId,
@@ -133,7 +132,8 @@ const Textbox = ({
133
132
  isRequired: required,
134
133
  "data-component": dataComponent,
135
134
  "data-role": dataRole,
136
- "data-element": dataElement
135
+ "data-element": dataElement,
136
+ validationIconId: validationIconId
137
137
  }, (0, _utils.filterStyledSystemMarginProps)(props)), /*#__PURE__*/_react.default.createElement(_input.InputPresentation, {
138
138
  align: align,
139
139
  disabled: disabled,
@@ -182,7 +182,7 @@ const Textbox = ({
182
182
  size: size,
183
183
  useValidationIcon: !validationOnLabel,
184
184
  warning: warning,
185
- tooltipId: tooltipId
185
+ validationIconId: validationIconId
186
186
  }))), characterCount));
187
187
  };
188
188
 
@@ -1,14 +1,13 @@
1
- export default function useInputAccessibility({ id, error, warning, info, label, labelHelp, fieldHelp, }: {
1
+ export default function useInputAccessibility({ id, error, warning, info, label, fieldHelp, }: {
2
2
  id: any;
3
3
  error: any;
4
4
  warning: any;
5
5
  info: any;
6
6
  label: any;
7
- labelHelp: any;
8
7
  fieldHelp: any;
9
8
  }): {
10
9
  labelId: string | undefined;
11
- tooltipId: string | undefined;
10
+ validationIconId: string | undefined;
12
11
  fieldHelpId: string | undefined;
13
12
  ariaDescribedBy: string;
14
13
  ariaLabelledBy: string | undefined;
@@ -11,17 +11,16 @@ function useInputAccessibility({
11
11
  warning,
12
12
  info,
13
13
  label,
14
- labelHelp,
15
14
  fieldHelp
16
15
  }) {
17
16
  const labelId = label ? `${id}-label` : undefined;
18
- const tooltipId = [error, warning, info, labelHelp].filter(validation => typeof validation === "string").length ? `${id}-tooltip` : undefined;
17
+ const validationIconId = [error, warning, info].filter(validation => typeof validation === "string").length ? `${id}-validation-icon` : undefined;
19
18
  const fieldHelpId = fieldHelp ? `${id}-field-help` : undefined;
20
- const ariaDescribedBy = [fieldHelpId, tooltipId].filter(Boolean).join(" ");
19
+ const ariaDescribedBy = [fieldHelpId, validationIconId].filter(Boolean).join(" ");
21
20
  const ariaLabelledBy = labelId;
22
21
  return {
23
22
  labelId,
24
- tooltipId,
23
+ validationIconId,
25
24
  fieldHelpId,
26
25
  ariaDescribedBy,
27
26
  ariaLabelledBy
@@ -349,6 +349,7 @@ declare function _default(palette: any): {
349
349
  smallOverlay: number;
350
350
  overlay: number;
351
351
  popover: number;
352
+ nav: number;
352
353
  modal: number;
353
354
  header: number;
354
355
  fullScreenModal: number;
@@ -370,6 +370,7 @@ var _default = palette => {
370
370
  smallOverlay: 10,
371
371
  overlay: 1000,
372
372
  popover: 2000,
373
+ nav: 2999,
373
374
  modal: 3000,
374
375
  header: 4000,
375
376
  fullScreenModal: 5000,
@@ -365,6 +365,7 @@ export interface ThemeObject {
365
365
  smallOverlay: number;
366
366
  overlay: number;
367
367
  popover: number;
368
+ nav: number;
368
369
  modal: number;
369
370
  header: number;
370
371
  fullScreenModal: number;
@@ -637,6 +637,7 @@ declare var _default: {
637
637
  smallOverlay: number;
638
638
  overlay: number;
639
639
  popover: number;
640
+ nav: number;
640
641
  modal: number;
641
642
  header: number;
642
643
  fullScreenModal: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "104.5.0",
3
+ "version": "104.7.2",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -171,8 +171,8 @@
171
171
  "polished": "^4.0.5",
172
172
  "prop-types": "^15.7.2",
173
173
  "react-day-picker": "~7.4.10",
174
- "react-dnd": "^10.0.2",
175
- "react-dnd-html5-backend": "^10.0.2",
174
+ "react-dnd": "^14.0.5",
175
+ "react-dnd-html5-backend": "^14.1.0",
176
176
  "react-is": "^17.0.2",
177
177
  "react-transition-group": "^4.4.1",
178
178
  "styled-system": "^5.1.5",