carbon-react 142.11.0 → 142.11.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 (27) hide show
  1. package/esm/__internal__/checkable-input/checkable-input.component.d.ts +3 -3
  2. package/esm/__internal__/checkable-input/checkable-input.component.js +2 -6
  3. package/esm/components/checkbox/checkbox-group/checkbox-group.component.d.ts +3 -3
  4. package/esm/components/checkbox/checkbox-group/checkbox-group.component.js +6 -2
  5. package/esm/components/checkbox/checkbox.component.d.ts +2 -2
  6. package/esm/components/checkbox/checkbox.component.js +10 -12
  7. package/esm/components/checkbox/checkbox.style.js +3 -4
  8. package/esm/components/dialog/dialog.component.js +2 -1
  9. package/esm/components/form/form.component.js +2 -1
  10. package/esm/components/radio-button/radio-button-group/radio-button-group.component.d.ts +2 -2
  11. package/esm/components/radio-button/radio-button-group/radio-button-group.component.js +8 -1
  12. package/esm/components/radio-button/radio-button.component.d.ts +2 -2
  13. package/esm/components/radio-button/radio-button.component.js +16 -12
  14. package/lib/__internal__/checkable-input/checkable-input.component.d.ts +3 -3
  15. package/lib/__internal__/checkable-input/checkable-input.component.js +1 -5
  16. package/lib/components/checkbox/checkbox-group/checkbox-group.component.d.ts +3 -3
  17. package/lib/components/checkbox/checkbox-group/checkbox-group.component.js +6 -2
  18. package/lib/components/checkbox/checkbox.component.d.ts +2 -2
  19. package/lib/components/checkbox/checkbox.component.js +10 -12
  20. package/lib/components/checkbox/checkbox.style.js +3 -4
  21. package/lib/components/dialog/dialog.component.js +2 -1
  22. package/lib/components/form/form.component.js +2 -1
  23. package/lib/components/radio-button/radio-button-group/radio-button-group.component.d.ts +2 -2
  24. package/lib/components/radio-button/radio-button-group/radio-button-group.component.js +8 -1
  25. package/lib/components/radio-button/radio-button.component.d.ts +2 -2
  26. package/lib/components/radio-button/radio-button.component.js +16 -12
  27. package/package.json +1 -1
@@ -6,10 +6,10 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
6
6
  disabled?: boolean;
7
7
  /** @private @ignore */
8
8
  loading?: boolean;
9
- /** [Legacy] Help content to be displayed under an input */
9
+ /** Help content to be displayed under an input */
10
10
  fieldHelp?: React.ReactNode;
11
11
  /**
12
- * [Legacy] If true, the FieldHelp will be displayed inline
12
+ * If true, the FieldHelp will be displayed inline
13
13
  * To be used with labelInline prop set to true
14
14
  */
15
15
  fieldHelpInline?: boolean;
@@ -19,7 +19,7 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
19
19
  inputWidth?: number;
20
20
  /** Label content */
21
21
  label?: React.ReactNode;
22
- /** [Legacy] The content for the help tooltip, to appear next to the Label */
22
+ /** The content for the help tooltip, to appear next to the Label */
23
23
  labelHelp?: React.ReactNode;
24
24
  /** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
25
25
  labelSpacing?: 1 | 2;
@@ -1,5 +1,5 @@
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, useContext } from "react";
2
+ import React, { useRef } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { StyledCheckableInput, StyledCheckableInputWrapper } from "./checkable-input.style";
5
5
  import { InputBehaviour } from "../input-behaviour";
@@ -7,7 +7,6 @@ import FormField from "../form-field";
7
7
  import HiddenCheckableInput from "./hidden-checkable-input.component";
8
8
  import guid from "../utils/helpers/guid";
9
9
  import useInputAccessibility from "../../hooks/__internal__/useInputAccessibility";
10
- import NewValidationContext from "../../components/carbon-provider/__internal__/new-validation.context";
11
10
  const CheckableInput = /*#__PURE__*/React.forwardRef(({
12
11
  ariaLabelledBy,
13
12
  autoFocus,
@@ -42,9 +41,6 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
42
41
  const {
43
42
  current: id
44
43
  } = useRef(inputId || guid());
45
- const {
46
- validationRedesignOptIn
47
- } = useContext(NewValidationContext);
48
44
  const {
49
45
  labelId,
50
46
  fieldHelpId,
@@ -80,7 +76,7 @@ const CheckableInput = /*#__PURE__*/React.forwardRef(({
80
76
  // However, we still want the input element to receive the required prop
81
77
  isRequired: required,
82
78
  isOptional,
83
- useValidationIcon: validationRedesignOptIn ? false : validationOnLabel
79
+ useValidationIcon: validationOnLabel
84
80
  };
85
81
  const inputProps = {
86
82
  ariaDescribedBy,
@@ -5,8 +5,8 @@ export interface CheckboxGroupProps extends ValidationProps, MarginProps {
5
5
  /** The content for the CheckboxGroup Legend */
6
6
  legend?: string;
7
7
  /**
8
- * The content for the CheckboxGroup hint text,
9
- * will only be rendered when `validationRedesignOptIn` is true.
8
+ * The content for the CheckboxGroup Help tooltip,
9
+ * will be rendered as hint text when `validationRedesignOptIn` is true.
10
10
  */
11
11
  legendHelp?: string;
12
12
  /** [Legacy] When true, legend is placed inline with the checkboxes */
@@ -27,7 +27,7 @@ export interface CheckboxGroupProps extends ValidationProps, MarginProps {
27
27
  isOptional?: boolean;
28
28
  /** [Legacy] Overrides the default tooltip */
29
29
  tooltipPosition?: "top" | "bottom" | "left" | "right";
30
- /** When true, Checkboxes are inline */
30
+ /** When true, Checkboxes are in line */
31
31
  inline?: boolean;
32
32
  }
33
33
  export declare const CheckboxGroup: {
@@ -35,8 +35,12 @@ export const CheckboxGroup = props => {
35
35
  return /*#__PURE__*/React.createElement(React.Fragment, null, validationRedesignOptIn ? /*#__PURE__*/React.createElement(Fieldset, _extends({
36
36
  legend: legend,
37
37
  inline: legendInline,
38
+ legendWidth: legendWidth,
39
+ legendAlign: legendAlign,
40
+ legendSpacing: legendSpacing,
38
41
  error: error,
39
42
  warning: warning,
43
+ info: info,
40
44
  isRequired: required,
41
45
  isOptional: isOptional
42
46
  }, tagComponent("checkboxgroup", props), {
@@ -52,6 +56,7 @@ export const CheckboxGroup = props => {
52
56
  }), /*#__PURE__*/React.createElement(StyledCheckboxGroup, {
53
57
  "data-component": "checkbox-group",
54
58
  "data-role": "checkbox-group",
59
+ legendInline: legendInline,
55
60
  inline: inline
56
61
  }, /*#__PURE__*/React.createElement(CheckboxGroupContext.Provider, {
57
62
  value: {
@@ -78,8 +83,7 @@ export const CheckboxGroup = props => {
78
83
  }, filterStyledSystemMarginProps(props)), /*#__PURE__*/React.createElement(StyledCheckboxGroup, {
79
84
  "data-component": "checkbox-group",
80
85
  "data-role": "checkbox-group",
81
- legendInline: legendInline,
82
- inline: inline
86
+ legendInline: legendInline
83
87
  }, /*#__PURE__*/React.createElement(CheckboxGroupContext.Provider, {
84
88
  value: {
85
89
  error: !!error,
@@ -12,13 +12,13 @@ export interface CheckboxProps extends CommonCheckableInputProps, MarginProps {
12
12
  "data-element"?: string;
13
13
  /** Identifier used for testing purposes, applied to the root element of the component. */
14
14
  "data-role"?: string;
15
- /** [Legacy] Aria label for rendered help component */
15
+ /** Aria label for rendered help component */
16
16
  helpAriaLabel?: string;
17
17
  /** When true label is inline */
18
18
  labelInline?: boolean;
19
19
  /** Accepts a callback function which is triggered on click event */
20
20
  onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
21
- /** [Legacy] Overrides the default tooltip position */
21
+ /** Overrides the default tooltip position */
22
22
  tooltipPosition?: "top" | "bottom" | "left" | "right";
23
23
  /** The value of the checkbox, passed on form submit */
24
24
  value?: string;
@@ -61,13 +61,6 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
61
61
  deprecateUncontrolledWarnTriggered = true;
62
62
  Logger.deprecate("Uncontrolled behaviour in `Checkbox` is deprecated and support will soon be removed. Please make sure all your inputs are controlled.");
63
63
  }
64
- const commonProps = {
65
- fieldHelpInline,
66
- labelSpacing,
67
- labelHelp,
68
- fieldHelp
69
- };
70
- const isInGroup = Object.keys(checkboxGroupContext).length !== 0;
71
64
  const inputProps = {
72
65
  ariaLabelledBy,
73
66
  onClick,
@@ -81,23 +74,28 @@ const Checkbox = /*#__PURE__*/React.forwardRef(({
81
74
  type: "checkbox",
82
75
  name,
83
76
  reverse: !reverse,
77
+ fieldHelp,
84
78
  autoFocus,
79
+ labelHelp,
80
+ labelSpacing,
85
81
  required,
86
82
  isOptional,
83
+ fieldHelpInline,
87
84
  checked,
88
85
  disabled,
89
86
  inputWidth,
90
87
  labelWidth,
91
88
  ref,
92
- ...rest,
93
- ...(isInGroup && validationRedesignOptIn ? {} : {
94
- ...commonProps
95
- })
89
+ ...rest
96
90
  };
97
91
  const validationProps = {
98
92
  error: contextError || error,
99
93
  warning: contextWarning || warning,
100
- info: contextInfo || info
94
+ ...(validationRedesignOptIn ? {
95
+ validationOnLabel: false
96
+ } : {
97
+ info: contextInfo || info
98
+ })
101
99
  };
102
100
  const marginProps = useFormSpacing(rest);
103
101
  const componentToRender = /*#__PURE__*/React.createElement(CheckboxStyle, _extends({
@@ -41,12 +41,11 @@ const StyledCheckbox = styled.div`
41
41
  ${!disabled && css`
42
42
  border: 1px solid var(--colorsUtilityMajor300);
43
43
 
44
+ ${info && `border: 1px solid var(--colorsSemanticInfo500);`}
45
+ ${warning && `border: 1px solid var(--colorsSemanticCaution500);`}
44
46
  ${error && `border: 2px solid var(--colorsSemanticNegative500);`}
45
47
 
46
- ${!applyNewValidation && css`
47
- ${info && `border: 1px solid var(--colorsSemanticInfo500);`}
48
- ${warning && `border: 1px solid var(--colorsSemanticCaution500);`}
49
- `}
48
+ ${warning && applyNewValidation && `border: 1px solid var(--colorsUtilityMajor300);`}
50
49
  `}
51
50
  }
52
51
 
@@ -187,7 +187,8 @@ const Dialog = /*#__PURE__*/forwardRef(({
187
187
  }, contentPadding, {
188
188
  backgroundColor: greyBackground ? "var(--colorsUtilityMajor025)" : "var(--colorsUtilityYang100)"
189
189
  }), dialogTitle(), closeIcon(), /*#__PURE__*/React.createElement(StyledDialogContent, _extends({}, contentPadding, {
190
- "data-role": "dialog-content"
190
+ "data-role": "dialog-content",
191
+ tabIndex: -1
191
192
  }), /*#__PURE__*/React.createElement(StyledDialogInnerContent, _extends({
192
193
  "data-role": "dialog-inner-content",
193
194
  ref: innerContentRef
@@ -50,7 +50,8 @@ export const Form = ({
50
50
  "data-role": "form-content",
51
51
  className: stickyFooter ? "sticky" : "",
52
52
  stickyFooter: stickyFooter,
53
- isInModal: isInModal
53
+ isInModal: isInModal,
54
+ tabIndex: -1
54
55
  }, /*#__PURE__*/React.createElement(FormSpacingProvider, {
55
56
  marginBottom: formSpacing[fieldSpacing]
56
57
  }, children)), !fullWidthButtons && renderFooter && /*#__PURE__*/React.createElement(StyledFormFooter, _extends({
@@ -15,8 +15,8 @@ export interface RadioButtonGroupProps extends ValidationProps, MarginProps {
15
15
  /** The content for the RadioGroup Legend */
16
16
  legend?: string;
17
17
  /**
18
- * The content for the RadioButtonGroup hint text,
19
- * will only be rendered when `validationRedesignOptIn` is true.
18
+ * The content for the RadioButtonGroup Legend Help tooltip,
19
+ * will be rendered as hint text when `validationRedesignOptIn` is true.
20
20
  */
21
21
  legendHelp?: string;
22
22
  /** [Legacy] Text alignment of legend when inline */
@@ -60,7 +60,11 @@ export const RadioButtonGroup = props => {
60
60
  legend: legend,
61
61
  error: error,
62
62
  warning: warning,
63
+ info: info,
63
64
  inline: inlineLegend,
65
+ legendWidth: legendWidth,
66
+ legendAlign: legendAlign,
67
+ legendSpacing: legendSpacing,
64
68
  isRequired: required,
65
69
  isOptional: isOptional
66
70
  }, tagComponent("radiogroup", props), marginProps, {
@@ -78,7 +82,8 @@ export const RadioButtonGroup = props => {
78
82
  }), /*#__PURE__*/React.createElement(RadioButtonGroupStyle, {
79
83
  "data-component": "radio-button-group",
80
84
  role: "radiogroup",
81
- inline: inline
85
+ inline: inline,
86
+ legendInline: inlineLegend
82
87
  }, /*#__PURE__*/React.createElement(RadioButtonMapper, {
83
88
  name: name,
84
89
  onBlur: onBlur,
@@ -93,6 +98,8 @@ export const RadioButtonGroup = props => {
93
98
  labelSpacing,
94
99
  error: !!error,
95
100
  warning: !!warning,
101
+ info: !!info,
102
+ required,
96
103
  ...child.props
97
104
  });
98
105
  }))))) : /*#__PURE__*/React.createElement(TooltipProvider, {
@@ -15,9 +15,9 @@ export interface RadioButtonProps extends Omit<CommonCheckableInputProps, "requi
15
15
  onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
16
16
  /** the value of the Radio Button, passed on form submit */
17
17
  value: string;
18
- /** [Legacy] Overrides the default tooltip position */
18
+ /** Overrides the default tooltip position */
19
19
  tooltipPosition?: "top" | "bottom" | "left" | "right";
20
- /** [Legacy] Aria label for rendered help component */
20
+ /** Aria label for rendered help component */
21
21
  helpAriaLabel?: string;
22
22
  }
23
23
  export declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & InternalRadioButtonProps & React.RefAttributes<HTMLInputElement>>;
@@ -52,31 +52,34 @@ const RadioButton = /*#__PURE__*/React.forwardRef(({
52
52
  event.target.focus();
53
53
  }, [onChange]);
54
54
  const validationProps = {
55
+ disabled,
56
+ inputWidth,
55
57
  error,
56
58
  warning,
57
59
  info
58
60
  };
59
61
  const commonProps = {
62
+ ...validationProps,
60
63
  fieldHelpInline,
61
- labelHelp,
62
- fieldHelp
64
+ labelSpacing
63
65
  };
64
66
  const inputProps = {
65
- ...(!validationRedesignOptIn && {
67
+ ...(validationRedesignOptIn ? {
68
+ ...validationProps
69
+ } : {
66
70
  ...commonProps
67
71
  }),
68
72
  autoFocus,
69
73
  checked,
74
+ fieldHelp,
70
75
  name,
71
76
  onChange: handleChange,
72
77
  onBlur,
73
78
  onFocus,
74
79
  labelInline: true,
75
80
  labelWidth,
76
- labelSpacing,
77
81
  label,
78
- disabled,
79
- inputWidth,
82
+ labelHelp,
80
83
  id,
81
84
  value,
82
85
  type: "radio",
@@ -97,12 +100,13 @@ const RadioButton = /*#__PURE__*/React.forwardRef(({
97
100
  "data-element": dataElement,
98
101
  inline: inline,
99
102
  reverse: reverse,
100
- size: size,
101
- disabled: disabled,
102
- inputWidth: inputWidth,
103
- labelSpacing: labelSpacing,
104
- fieldHelpInline: fieldHelpInline
105
- }, validationProps, marginProps), /*#__PURE__*/React.createElement(CheckableInput, _extends({}, inputProps, validationProps), /*#__PURE__*/React.createElement(RadioButtonSvg, null)));
103
+ size: size
104
+ }, validationRedesignOptIn ? {
105
+ ...validationProps
106
+ } : {
107
+ ...commonProps,
108
+ fieldHelp
109
+ }, marginProps), /*#__PURE__*/React.createElement(CheckableInput, inputProps, /*#__PURE__*/React.createElement(RadioButtonSvg, null)));
106
110
  return /*#__PURE__*/React.createElement(React.Fragment, null, validationRedesignOptIn ? componentToRender : /*#__PURE__*/React.createElement(TooltipProvider, {
107
111
  helpAriaLabel: helpAriaLabel,
108
112
  tooltipPosition: tooltipPosition
@@ -6,10 +6,10 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
6
6
  disabled?: boolean;
7
7
  /** @private @ignore */
8
8
  loading?: boolean;
9
- /** [Legacy] Help content to be displayed under an input */
9
+ /** Help content to be displayed under an input */
10
10
  fieldHelp?: React.ReactNode;
11
11
  /**
12
- * [Legacy] If true, the FieldHelp will be displayed inline
12
+ * If true, the FieldHelp will be displayed inline
13
13
  * To be used with labelInline prop set to true
14
14
  */
15
15
  fieldHelpInline?: boolean;
@@ -19,7 +19,7 @@ export interface CommonCheckableInputProps extends ValidationProps, CommonHidden
19
19
  inputWidth?: number;
20
20
  /** Label content */
21
21
  label?: React.ReactNode;
22
- /** [Legacy] The content for the help tooltip, to appear next to the Label */
22
+ /** The content for the help tooltip, to appear next to the Label */
23
23
  labelHelp?: React.ReactNode;
24
24
  /** Spacing between label and a field for inline label, given number will be multiplied by base spacing unit (8) */
25
25
  labelSpacing?: 1 | 2;
@@ -12,7 +12,6 @@ var _formField = _interopRequireDefault(require("../form-field"));
12
12
  var _hiddenCheckableInput = _interopRequireDefault(require("./hidden-checkable-input.component"));
13
13
  var _guid = _interopRequireDefault(require("../utils/helpers/guid"));
14
14
  var _useInputAccessibility = _interopRequireDefault(require("../../hooks/__internal__/useInputAccessibility"));
15
- var _newValidation = _interopRequireDefault(require("../../components/carbon-provider/__internal__/new-validation.context"));
16
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
16
  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
17
  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; }
@@ -51,9 +50,6 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef(({
51
50
  const {
52
51
  current: id
53
52
  } = (0, _react.useRef)(inputId || (0, _guid.default)());
54
- const {
55
- validationRedesignOptIn
56
- } = (0, _react.useContext)(_newValidation.default);
57
53
  const {
58
54
  labelId,
59
55
  fieldHelpId,
@@ -89,7 +85,7 @@ const CheckableInput = /*#__PURE__*/_react.default.forwardRef(({
89
85
  // However, we still want the input element to receive the required prop
90
86
  isRequired: required,
91
87
  isOptional,
92
- useValidationIcon: validationRedesignOptIn ? false : validationOnLabel
88
+ useValidationIcon: validationOnLabel
93
89
  };
94
90
  const inputProps = {
95
91
  ariaDescribedBy,
@@ -5,8 +5,8 @@ export interface CheckboxGroupProps extends ValidationProps, MarginProps {
5
5
  /** The content for the CheckboxGroup Legend */
6
6
  legend?: string;
7
7
  /**
8
- * The content for the CheckboxGroup hint text,
9
- * will only be rendered when `validationRedesignOptIn` is true.
8
+ * The content for the CheckboxGroup Help tooltip,
9
+ * will be rendered as hint text when `validationRedesignOptIn` is true.
10
10
  */
11
11
  legendHelp?: string;
12
12
  /** [Legacy] When true, legend is placed inline with the checkboxes */
@@ -27,7 +27,7 @@ export interface CheckboxGroupProps extends ValidationProps, MarginProps {
27
27
  isOptional?: boolean;
28
28
  /** [Legacy] Overrides the default tooltip */
29
29
  tooltipPosition?: "top" | "bottom" | "left" | "right";
30
- /** When true, Checkboxes are inline */
30
+ /** When true, Checkboxes are in line */
31
31
  inline?: boolean;
32
32
  }
33
33
  export declare const CheckboxGroup: {
@@ -44,8 +44,12 @@ const CheckboxGroup = props => {
44
44
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, validationRedesignOptIn ? /*#__PURE__*/_react.default.createElement(_fieldset.default, _extends({
45
45
  legend: legend,
46
46
  inline: legendInline,
47
+ legendWidth: legendWidth,
48
+ legendAlign: legendAlign,
49
+ legendSpacing: legendSpacing,
47
50
  error: error,
48
51
  warning: warning,
52
+ info: info,
49
53
  isRequired: required,
50
54
  isOptional: isOptional
51
55
  }, (0, _tags.default)("checkboxgroup", props), {
@@ -61,6 +65,7 @@ const CheckboxGroup = props => {
61
65
  }), /*#__PURE__*/_react.default.createElement(_checkboxGroup.default, {
62
66
  "data-component": "checkbox-group",
63
67
  "data-role": "checkbox-group",
68
+ legendInline: legendInline,
64
69
  inline: inline
65
70
  }, /*#__PURE__*/_react.default.createElement(_checkboxGroup2.default.Provider, {
66
71
  value: {
@@ -87,8 +92,7 @@ const CheckboxGroup = props => {
87
92
  }, (0, _utils.filterStyledSystemMarginProps)(props)), /*#__PURE__*/_react.default.createElement(_checkboxGroup.default, {
88
93
  "data-component": "checkbox-group",
89
94
  "data-role": "checkbox-group",
90
- legendInline: legendInline,
91
- inline: inline
95
+ legendInline: legendInline
92
96
  }, /*#__PURE__*/_react.default.createElement(_checkboxGroup2.default.Provider, {
93
97
  value: {
94
98
  error: !!error,
@@ -12,13 +12,13 @@ export interface CheckboxProps extends CommonCheckableInputProps, MarginProps {
12
12
  "data-element"?: string;
13
13
  /** Identifier used for testing purposes, applied to the root element of the component. */
14
14
  "data-role"?: string;
15
- /** [Legacy] Aria label for rendered help component */
15
+ /** Aria label for rendered help component */
16
16
  helpAriaLabel?: string;
17
17
  /** When true label is inline */
18
18
  labelInline?: boolean;
19
19
  /** Accepts a callback function which is triggered on click event */
20
20
  onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
21
- /** [Legacy] Overrides the default tooltip position */
21
+ /** Overrides the default tooltip position */
22
22
  tooltipPosition?: "top" | "bottom" | "left" | "right";
23
23
  /** The value of the checkbox, passed on form submit */
24
24
  value?: string;
@@ -70,13 +70,6 @@ const Checkbox = exports.Checkbox = /*#__PURE__*/_react.default.forwardRef(({
70
70
  deprecateUncontrolledWarnTriggered = true;
71
71
  _logger.default.deprecate("Uncontrolled behaviour in `Checkbox` is deprecated and support will soon be removed. Please make sure all your inputs are controlled.");
72
72
  }
73
- const commonProps = {
74
- fieldHelpInline,
75
- labelSpacing,
76
- labelHelp,
77
- fieldHelp
78
- };
79
- const isInGroup = Object.keys(checkboxGroupContext).length !== 0;
80
73
  const inputProps = {
81
74
  ariaLabelledBy,
82
75
  onClick,
@@ -90,23 +83,28 @@ const Checkbox = exports.Checkbox = /*#__PURE__*/_react.default.forwardRef(({
90
83
  type: "checkbox",
91
84
  name,
92
85
  reverse: !reverse,
86
+ fieldHelp,
93
87
  autoFocus,
88
+ labelHelp,
89
+ labelSpacing,
94
90
  required,
95
91
  isOptional,
92
+ fieldHelpInline,
96
93
  checked,
97
94
  disabled,
98
95
  inputWidth,
99
96
  labelWidth,
100
97
  ref,
101
- ...rest,
102
- ...(isInGroup && validationRedesignOptIn ? {} : {
103
- ...commonProps
104
- })
98
+ ...rest
105
99
  };
106
100
  const validationProps = {
107
101
  error: contextError || error,
108
102
  warning: contextWarning || warning,
109
- info: contextInfo || info
103
+ ...(validationRedesignOptIn ? {
104
+ validationOnLabel: false
105
+ } : {
106
+ info: contextInfo || info
107
+ })
110
108
  };
111
109
  const marginProps = (0, _useFormSpacing.default)(rest);
112
110
  const componentToRender = /*#__PURE__*/_react.default.createElement(_checkbox.default, _extends({
@@ -50,12 +50,11 @@ const StyledCheckbox = _styledComponents.default.div`
50
50
  ${!disabled && (0, _styledComponents.css)`
51
51
  border: 1px solid var(--colorsUtilityMajor300);
52
52
 
53
+ ${info && `border: 1px solid var(--colorsSemanticInfo500);`}
54
+ ${warning && `border: 1px solid var(--colorsSemanticCaution500);`}
53
55
  ${error && `border: 2px solid var(--colorsSemanticNegative500);`}
54
56
 
55
- ${!applyNewValidation && (0, _styledComponents.css)`
56
- ${info && `border: 1px solid var(--colorsSemanticInfo500);`}
57
- ${warning && `border: 1px solid var(--colorsSemanticCaution500);`}
58
- `}
57
+ ${warning && applyNewValidation && `border: 1px solid var(--colorsUtilityMajor300);`}
59
58
  `}
60
59
  }
61
60
 
@@ -196,7 +196,8 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
196
196
  }, contentPadding, {
197
197
  backgroundColor: greyBackground ? "var(--colorsUtilityMajor025)" : "var(--colorsUtilityYang100)"
198
198
  }), dialogTitle(), closeIcon(), /*#__PURE__*/_react.default.createElement(_dialog.StyledDialogContent, _extends({}, contentPadding, {
199
- "data-role": "dialog-content"
199
+ "data-role": "dialog-content",
200
+ tabIndex: -1
200
201
  }), /*#__PURE__*/_react.default.createElement(_dialog.StyledDialogInnerContent, _extends({
201
202
  "data-role": "dialog-inner-content",
202
203
  ref: innerContentRef
@@ -59,7 +59,8 @@ const Form = ({
59
59
  "data-role": "form-content",
60
60
  className: stickyFooter ? "sticky" : "",
61
61
  stickyFooter: stickyFooter,
62
- isInModal: isInModal
62
+ isInModal: isInModal,
63
+ tabIndex: -1
63
64
  }, /*#__PURE__*/_react.default.createElement(_formSpacingProvider.default, {
64
65
  marginBottom: _form2.formSpacing[fieldSpacing]
65
66
  }, children)), !fullWidthButtons && renderFooter && /*#__PURE__*/_react.default.createElement(_form.StyledFormFooter, _extends({
@@ -15,8 +15,8 @@ export interface RadioButtonGroupProps extends ValidationProps, MarginProps {
15
15
  /** The content for the RadioGroup Legend */
16
16
  legend?: string;
17
17
  /**
18
- * The content for the RadioButtonGroup hint text,
19
- * will only be rendered when `validationRedesignOptIn` is true.
18
+ * The content for the RadioButtonGroup Legend Help tooltip,
19
+ * will be rendered as hint text when `validationRedesignOptIn` is true.
20
20
  */
21
21
  legendHelp?: string;
22
22
  /** [Legacy] Text alignment of legend when inline */
@@ -69,7 +69,11 @@ const RadioButtonGroup = props => {
69
69
  legend: legend,
70
70
  error: error,
71
71
  warning: warning,
72
+ info: info,
72
73
  inline: inlineLegend,
74
+ legendWidth: legendWidth,
75
+ legendAlign: legendAlign,
76
+ legendSpacing: legendSpacing,
73
77
  isRequired: required,
74
78
  isOptional: isOptional
75
79
  }, (0, _tags.default)("radiogroup", props), marginProps, {
@@ -87,7 +91,8 @@ const RadioButtonGroup = props => {
87
91
  }), /*#__PURE__*/_react.default.createElement(_radioButtonGroup.default, {
88
92
  "data-component": "radio-button-group",
89
93
  role: "radiogroup",
90
- inline: inline
94
+ inline: inline,
95
+ legendInline: inlineLegend
91
96
  }, /*#__PURE__*/_react.default.createElement(_radioButtonMapper.default, {
92
97
  name: name,
93
98
  onBlur: onBlur,
@@ -102,6 +107,8 @@ const RadioButtonGroup = props => {
102
107
  labelSpacing,
103
108
  error: !!error,
104
109
  warning: !!warning,
110
+ info: !!info,
111
+ required,
105
112
  ...child.props
106
113
  });
107
114
  }))))) : /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
@@ -15,9 +15,9 @@ export interface RadioButtonProps extends Omit<CommonCheckableInputProps, "requi
15
15
  onClick?: (ev: React.MouseEvent<HTMLInputElement>) => void;
16
16
  /** the value of the Radio Button, passed on form submit */
17
17
  value: string;
18
- /** [Legacy] Overrides the default tooltip position */
18
+ /** Overrides the default tooltip position */
19
19
  tooltipPosition?: "top" | "bottom" | "left" | "right";
20
- /** [Legacy] Aria label for rendered help component */
20
+ /** Aria label for rendered help component */
21
21
  helpAriaLabel?: string;
22
22
  }
23
23
  export declare const RadioButton: React.ForwardRefExoticComponent<RadioButtonProps & InternalRadioButtonProps & React.RefAttributes<HTMLInputElement>>;
@@ -61,31 +61,34 @@ const RadioButton = exports.RadioButton = /*#__PURE__*/_react.default.forwardRef
61
61
  event.target.focus();
62
62
  }, [onChange]);
63
63
  const validationProps = {
64
+ disabled,
65
+ inputWidth,
64
66
  error,
65
67
  warning,
66
68
  info
67
69
  };
68
70
  const commonProps = {
71
+ ...validationProps,
69
72
  fieldHelpInline,
70
- labelHelp,
71
- fieldHelp
73
+ labelSpacing
72
74
  };
73
75
  const inputProps = {
74
- ...(!validationRedesignOptIn && {
76
+ ...(validationRedesignOptIn ? {
77
+ ...validationProps
78
+ } : {
75
79
  ...commonProps
76
80
  }),
77
81
  autoFocus,
78
82
  checked,
83
+ fieldHelp,
79
84
  name,
80
85
  onChange: handleChange,
81
86
  onBlur,
82
87
  onFocus,
83
88
  labelInline: true,
84
89
  labelWidth,
85
- labelSpacing,
86
90
  label,
87
- disabled,
88
- inputWidth,
91
+ labelHelp,
89
92
  id,
90
93
  value,
91
94
  type: "radio",
@@ -106,12 +109,13 @@ const RadioButton = exports.RadioButton = /*#__PURE__*/_react.default.forwardRef
106
109
  "data-element": dataElement,
107
110
  inline: inline,
108
111
  reverse: reverse,
109
- size: size,
110
- disabled: disabled,
111
- inputWidth: inputWidth,
112
- labelSpacing: labelSpacing,
113
- fieldHelpInline: fieldHelpInline
114
- }, validationProps, marginProps), /*#__PURE__*/_react.default.createElement(_checkableInput.default, _extends({}, inputProps, validationProps), /*#__PURE__*/_react.default.createElement(_radioButtonSvg.default, null)));
112
+ size: size
113
+ }, validationRedesignOptIn ? {
114
+ ...validationProps
115
+ } : {
116
+ ...commonProps,
117
+ fieldHelp
118
+ }, marginProps), /*#__PURE__*/_react.default.createElement(_checkableInput.default, inputProps, /*#__PURE__*/_react.default.createElement(_radioButtonSvg.default, null)));
115
119
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, validationRedesignOptIn ? componentToRender : /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
116
120
  helpAriaLabel: helpAriaLabel,
117
121
  tooltipPosition: tooltipPosition
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "142.11.0",
3
+ "version": "142.11.2",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",