carbon-react 144.19.0 → 144.20.1

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 (49) hide show
  1. package/esm/components/advanced-color-picker/advanced-color-picker.component.d.ts +3 -2
  2. package/esm/components/advanced-color-picker/advanced-color-picker.component.js +3 -1
  3. package/esm/components/button/button.component.d.ts +2 -2
  4. package/esm/components/checkbox/checkbox-group/checkbox-group.component.d.ts +3 -3
  5. package/esm/components/checkbox/checkbox-group/checkbox-group.component.js +0 -1
  6. package/esm/components/checkbox/checkbox.component.d.ts +2 -2
  7. package/esm/components/dialog/dialog.component.js +4 -1
  8. package/esm/components/dialog-full-screen/dialog-full-screen.component.d.ts +1 -1
  9. package/esm/components/dialog-full-screen/dialog-full-screen.component.js +3 -1
  10. package/esm/components/icon/icon.component.d.ts +7 -7
  11. package/esm/components/link/link.component.d.ts +2 -2
  12. package/esm/components/loader/loader-square.style.js +2 -2
  13. package/esm/components/modal/modal.component.d.ts +5 -1
  14. package/esm/components/modal/modal.component.js +2 -1
  15. package/esm/components/portrait/portrait.component.d.ts +8 -8
  16. package/esm/components/radio-button/radio-button-group/radio-button-group.component.d.ts +2 -2
  17. package/esm/components/radio-button/radio-button-group/radio-button-group.component.js +0 -3
  18. package/esm/components/radio-button/radio-button.component.d.ts +2 -2
  19. package/esm/components/radio-button/radio-button.component.js +4 -13
  20. package/esm/components/search/search.component.d.ts +1 -1
  21. package/esm/components/sidebar/sidebar.component.d.ts +1 -1
  22. package/esm/components/sidebar/sidebar.component.js +4 -1
  23. package/esm/components/tile/tile.style.js +2 -2
  24. package/esm/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.js +2 -1
  25. package/lib/components/advanced-color-picker/advanced-color-picker.component.d.ts +3 -2
  26. package/lib/components/advanced-color-picker/advanced-color-picker.component.js +3 -1
  27. package/lib/components/button/button.component.d.ts +2 -2
  28. package/lib/components/checkbox/checkbox-group/checkbox-group.component.d.ts +3 -3
  29. package/lib/components/checkbox/checkbox-group/checkbox-group.component.js +0 -1
  30. package/lib/components/checkbox/checkbox.component.d.ts +2 -2
  31. package/lib/components/dialog/dialog.component.js +4 -1
  32. package/lib/components/dialog-full-screen/dialog-full-screen.component.d.ts +1 -1
  33. package/lib/components/dialog-full-screen/dialog-full-screen.component.js +3 -1
  34. package/lib/components/icon/icon.component.d.ts +7 -7
  35. package/lib/components/link/link.component.d.ts +2 -2
  36. package/lib/components/loader/loader-square.style.js +2 -2
  37. package/lib/components/modal/modal.component.d.ts +5 -1
  38. package/lib/components/modal/modal.component.js +2 -1
  39. package/lib/components/portrait/portrait.component.d.ts +8 -8
  40. package/lib/components/radio-button/radio-button-group/radio-button-group.component.d.ts +2 -2
  41. package/lib/components/radio-button/radio-button-group/radio-button-group.component.js +0 -3
  42. package/lib/components/radio-button/radio-button.component.d.ts +2 -2
  43. package/lib/components/radio-button/radio-button.component.js +4 -13
  44. package/lib/components/search/search.component.d.ts +1 -1
  45. package/lib/components/sidebar/sidebar.component.d.ts +1 -1
  46. package/lib/components/sidebar/sidebar.component.js +4 -1
  47. package/lib/components/tile/tile.style.js +2 -2
  48. package/lib/components/vertical-menu/vertical-menu-full-screen/vertical-menu-full-screen.component.js +2 -1
  49. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
+ import { ModalProps } from "../modal";
3
4
  export interface AdvancedColor {
4
5
  label: string;
5
6
  value: string;
6
7
  }
7
- export interface AdvancedColorPickerProps extends MarginProps {
8
+ export interface AdvancedColorPickerProps extends MarginProps, Pick<ModalProps, "restoreFocusOnClose"> {
8
9
  /** Prop to specify the aria-describedby property of the component */
9
10
  "aria-describedby"?: string;
10
11
  /**
@@ -39,5 +40,5 @@ export interface AdvancedColorPickerProps extends MarginProps {
39
40
  /** Prop for `selectedColor` containing pre-selected color for `controlled` use */
40
41
  selectedColor?: string;
41
42
  }
42
- export declare const AdvancedColorPicker: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, availableColors, defaultColor, name, onOpen, onClose, onChange, onBlur, open, role, selectedColor, ...props }: AdvancedColorPickerProps) => React.JSX.Element;
43
+ export declare const AdvancedColorPicker: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, availableColors, defaultColor, name, onOpen, onClose, onChange, onBlur, open, role, selectedColor, restoreFocusOnClose, ...props }: AdvancedColorPickerProps) => React.JSX.Element;
43
44
  export default AdvancedColorPicker;
@@ -24,6 +24,7 @@ export const AdvancedColorPicker = ({
24
24
  open = false,
25
25
  role,
26
26
  selectedColor,
27
+ restoreFocusOnClose = true,
27
28
  ...props
28
29
  }) => {
29
30
  const [dialogOpen, setDialogOpen] = useState();
@@ -142,7 +143,8 @@ export const AdvancedColorPicker = ({
142
143
  onCancel: handleOnClose,
143
144
  bespokeFocusTrap: handleFocus,
144
145
  focusFirstElement: selectedColorRef,
145
- role: role
146
+ role: role,
147
+ restoreFocusOnClose: restoreFocusOnClose
146
148
  }, /*#__PURE__*/React.createElement(StyledAdvancedColorPickerPreview, {
147
149
  "data-element": "color-picker-preview",
148
150
  color: currentColor
@@ -32,9 +32,9 @@ export interface ButtonProps extends SpaceProps, TagProps {
32
32
  href?: string;
33
33
  /** Defines an Icon position related to the children: "before" | "after" */
34
34
  iconPosition?: ButtonIconPosition;
35
- /** Provides a tooltip message when the icon is hovered. */
35
+ /** [Legacy] Provides a tooltip message when the icon is hovered. */
36
36
  iconTooltipMessage?: string;
37
- /** Provides positioning when the tooltip is displayed. */
37
+ /** [Legacy] Provides positioning when the tooltip is displayed. */
38
38
  iconTooltipPosition?: TooltipPositions;
39
39
  /** Defines an Icon type within the button */
40
40
  iconType?: IconType;
@@ -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 Help tooltip,
9
- * will be rendered as hint text when `validationRedesignOptIn` is true.
8
+ * The content for the CheckboxGroup hint text,
9
+ * will only be rendered 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 in line */
30
+ /** When true, Checkboxes are inline */
31
31
  inline?: boolean;
32
32
  }
33
33
  export declare const CheckboxGroup: {
@@ -40,7 +40,6 @@ export const CheckboxGroup = props => {
40
40
  legendSpacing: legendSpacing,
41
41
  error: error,
42
42
  warning: warning,
43
- info: info,
44
43
  isRequired: required,
45
44
  isOptional: isOptional
46
45
  }, tagComponent("checkboxgroup", props), {
@@ -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
- /** Aria label for rendered help component */
15
+ /** [Legacy] 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
- /** Overrides the default tooltip position */
21
+ /** [Legacy] 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;
@@ -40,6 +40,7 @@ const Dialog = /*#__PURE__*/forwardRef(({
40
40
  focusableContainers,
41
41
  topModalOverride,
42
42
  closeButtonDataProps,
43
+ restoreFocusOnClose = true,
43
44
  ...rest
44
45
  }, ref) => {
45
46
  if (!deprecatedClassNameWarningShown && className) {
@@ -101,7 +102,8 @@ const Dialog = /*#__PURE__*/forwardRef(({
101
102
  disableEscKey: disableEscKey,
102
103
  disableClose: disableClose,
103
104
  className: className ? `${className} carbon-dialog` : "carbon-dialog",
104
- topModalOverride: topModalOverride
105
+ topModalOverride: topModalOverride,
106
+ restoreFocusOnClose: restoreFocusOnClose
105
107
  }, /*#__PURE__*/React.createElement(FocusTrap, {
106
108
  autoFocus: !disableAutoFocus,
107
109
  focusFirstElement: focusFirstElement,
@@ -182,6 +184,7 @@ if (process.env.NODE_ENV !== "production") {
182
184
  "help": PropTypes.string,
183
185
  "onCancel": PropTypes.func,
184
186
  "open": PropTypes.bool.isRequired,
187
+ "restoreFocusOnClose": PropTypes.bool,
185
188
  "role": PropTypes.string,
186
189
  "showCloseIcon": PropTypes.bool,
187
190
  "size": PropTypes.oneOf(["auto", "extra-large", "extra-small", "large", "maximise", "medium-large", "medium-small", "medium", "small"]),
@@ -55,5 +55,5 @@ export interface DialogFullScreenProps extends ModalProps {
55
55
  /** A custom close event handler */
56
56
  onCancel?: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLButtonElement>) => void;
57
57
  }
58
- export declare const DialogFullScreen: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disableAutoFocus, focusFirstElement, bespokeFocusTrap, open, children, title, subtitle, pagesStyling, headerChildren, showCloseIcon, disableContentPadding, disableEscKey, onCancel, contentRef, help, role, focusableContainers, focusableSelectors, topModalOverride, closeButtonDataProps, ...rest }: DialogFullScreenProps) => React.JSX.Element;
58
+ export declare const DialogFullScreen: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disableAutoFocus, focusFirstElement, bespokeFocusTrap, open, children, title, subtitle, pagesStyling, headerChildren, showCloseIcon, disableContentPadding, disableEscKey, onCancel, contentRef, help, role, focusableContainers, focusableSelectors, topModalOverride, closeButtonDataProps, restoreFocusOnClose, ...rest }: DialogFullScreenProps) => React.JSX.Element;
59
59
  export default DialogFullScreen;
@@ -37,6 +37,7 @@ export const DialogFullScreen = ({
37
37
  focusableSelectors,
38
38
  topModalOverride,
39
39
  closeButtonDataProps,
40
+ restoreFocusOnClose = true,
40
41
  ...rest
41
42
  }) => {
42
43
  const locale = useLocale();
@@ -87,7 +88,8 @@ export const DialogFullScreen = ({
87
88
  open: open,
88
89
  onCancel: onCancel,
89
90
  disableEscKey: disableEscKey,
90
- topModalOverride: topModalOverride
91
+ topModalOverride: topModalOverride,
92
+ restoreFocusOnClose: restoreFocusOnClose
91
93
  }, componentTags), /*#__PURE__*/React.createElement(FocusTrap, {
92
94
  autoFocus: !disableAutoFocus,
93
95
  focusFirstElement: focusFirstElement,
@@ -14,19 +14,19 @@ export interface IconProps extends Omit<StyledIconProps, "type">, MarginProps, O
14
14
  id?: string;
15
15
  /** The ARIA role to be applied to the Icon */
16
16
  role?: string;
17
- /** The message to be displayed within the tooltip */
17
+ /** [Legacy] The message to be displayed within the tooltip */
18
18
  tooltipMessage?: React.ReactNode;
19
- /** The position to display the tooltip */
19
+ /** [Legacy] The position to display the tooltip */
20
20
  tooltipPosition?: TooltipPositions;
21
- /** Control whether the tooltip is visible */
21
+ /** [Legacy] Control whether the tooltip is visible */
22
22
  tooltipVisible?: boolean;
23
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
23
+ /** [Legacy] Override background color of the Tooltip, provide any color from palette or any valid css color value. */
24
24
  tooltipBgColor?: string;
25
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
25
+ /** [Legacy] Override font color of the Tooltip, provide any color from palette or any valid css color value. */
26
26
  tooltipFontColor?: string;
27
- /** Overrides the default flip behaviour of the Tooltip */
27
+ /** [Legacy] Overrides the default flip behaviour of the Tooltip */
28
28
  tooltipFlipOverrides?: TooltipPositions[];
29
- /** Id passed to the tooltip container, used for accessibility purposes */
29
+ /** [Legacy] Id passed to the tooltip container, used for accessibility purposes */
30
30
  tooltipId?: string;
31
31
  /**
32
32
  * Icon type
@@ -12,9 +12,9 @@ export interface LinkProps extends StyledLinkProps, React.AriaAttributes {
12
12
  onKeyDown?: (ev: React.KeyboardEvent<HTMLAnchorElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
13
13
  /** Function called when a mouse down event triggers. */
14
14
  onMouseDown?: (ev: React.MouseEvent<HTMLAnchorElement> | React.MouseEvent<HTMLButtonElement>) => void;
15
- /** A message to display as a tooltip to the link. */
15
+ /** [Legacy] A message to display as a tooltip to the link. */
16
16
  tooltipMessage?: string;
17
- /** Positions the tooltip with the link. */
17
+ /** [Legacy] Positions the tooltip with the link. */
18
18
  tooltipPosition?: "bottom" | "left" | "right" | "top";
19
19
  /** Child content to render in the link. */
20
20
  children?: React.ReactNode;
@@ -10,7 +10,7 @@ const loaderAnimation = keyframes`
10
10
  transform: scale(1);
11
11
  }
12
12
  `;
13
- const getDimentions = (size, roundedCornersOptOut) => {
13
+ const getDimensions = (size, roundedCornersOptOut) => {
14
14
  let width;
15
15
  let marginRight;
16
16
  switch (size) {
@@ -44,7 +44,7 @@ const StyledLoaderSquare = styled.div`
44
44
  animation: ${loaderAnimation} 1s infinite ease-in-out both;
45
45
  background-color: ${backgroundColor};
46
46
  display: inline-block;
47
- ${getDimentions(size, theme.roundedCornersOptOut)}
47
+ ${getDimensions(size, theme.roundedCornersOptOut)}
48
48
 
49
49
  ${isInsideButton && css`
50
50
  background-color: ${isActive ? "var(--colorsUtilityYang100)" : "var(--colorsSemanticNeutral500)"};
@@ -21,6 +21,10 @@ export interface ModalProps extends Omit<TagProps, "data-component"> {
21
21
  timeout?: number;
22
22
  /** Manually override the internal modal stacking order to set this as top */
23
23
  topModalOverride?: boolean;
24
+ /** Enables the automatic restoration of focus to the element that invoked
25
+ * the modal when the modal is closed.
26
+ */
27
+ restoreFocusOnClose?: boolean;
24
28
  }
25
- declare const Modal: ({ children, "data-element": dataElement, "data-role": dataRole, open, onCancel, disableEscKey, disableClose, enableBackgroundUI, timeout, topModalOverride, ...rest }: ModalProps) => React.JSX.Element;
29
+ declare const Modal: ({ children, "data-element": dataElement, "data-role": dataRole, open, onCancel, disableEscKey, disableClose, enableBackgroundUI, timeout, topModalOverride, restoreFocusOnClose, ...rest }: ModalProps) => React.JSX.Element;
26
30
  export default Modal;
@@ -21,6 +21,7 @@ const Modal = ({
21
21
  enableBackgroundUI = false,
22
22
  timeout = 300,
23
23
  topModalOverride,
24
+ restoreFocusOnClose = true,
24
25
  ...rest
25
26
  }) => {
26
27
  if (!deprecatedClassNameWarningShown && rest.className) {
@@ -65,7 +66,7 @@ const Modal = ({
65
66
  modalRef: ref,
66
67
  setTriggerRefocusFlag,
67
68
  topModalOverride,
68
- focusCallToActionElement: document.activeElement
69
+ focusCallToActionElement: restoreFocusOnClose ? document.activeElement : undefined
69
70
  });
70
71
  let background;
71
72
  let content;
@@ -24,21 +24,21 @@ export interface PortraitProps extends MarginProps {
24
24
  darkBackground?: boolean;
25
25
  /** Prop for `onClick` events. */
26
26
  onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
27
- /** The message to be displayed within the tooltip */
27
+ /** [Legacy] The message to be displayed within the tooltip */
28
28
  tooltipMessage?: React.ReactNode;
29
- /** The id attribute to use for the tooltip */
29
+ /** [Legacy] The id attribute to use for the tooltip */
30
30
  tooltipId?: string;
31
- /** Whether to to show the Tooltip */
31
+ /** [Legacy] Whether to to show the Tooltip */
32
32
  tooltipIsVisible?: boolean;
33
- /** Sets position of the tooltip */
33
+ /** [Legacy] Sets position of the tooltip */
34
34
  tooltipPosition?: "top" | "bottom" | "left" | "right";
35
- /** Defines the message type */
35
+ /** [Legacy] Defines the message type */
36
36
  tooltipType?: string;
37
- /** Defines the size of the tooltip content */
37
+ /** [Legacy] Defines the size of the tooltip content */
38
38
  tooltipSize?: "medium" | "large";
39
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
39
+ /** [Legacy] Override background color of the Tooltip, provide any color from palette or any valid css color value. */
40
40
  tooltipBgColor?: string;
41
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
41
+ /** [Legacy] Override font color of the Tooltip, provide any color from palette or any valid css color value. */
42
42
  tooltipFontColor?: string;
43
43
  }
44
44
  declare const Portrait: ({ alt, name, darkBackground, gravatar, iconType, initials, shape, size, src, onClick, tooltipMessage, tooltipId, tooltipIsVisible, tooltipPosition, tooltipType, tooltipSize, tooltipBgColor, tooltipFontColor, ...rest }: PortraitProps) => React.JSX.Element;
@@ -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 Legend Help tooltip,
19
- * will be rendered as hint text when `validationRedesignOptIn` is true.
18
+ * The content for the RadioButtonGroup hint text,
19
+ * will only be rendered when `validationRedesignOptIn` is true.
20
20
  */
21
21
  legendHelp?: string;
22
22
  /** [Legacy] Text alignment of legend when inline */
@@ -61,7 +61,6 @@ export const RadioButtonGroup = props => {
61
61
  legend: legend,
62
62
  error: error,
63
63
  warning: warning,
64
- info: info,
65
64
  inline: inlineLegend,
66
65
  legendWidth: legendWidth,
67
66
  legendAlign: legendAlign,
@@ -99,8 +98,6 @@ export const RadioButtonGroup = props => {
99
98
  labelSpacing,
100
99
  error: !!error,
101
100
  warning: !!warning,
102
- info: !!info,
103
- required,
104
101
  ...child.props
105
102
  });
106
103
  }))))) : /*#__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
- /** Overrides the default tooltip position */
18
+ /** [Legacy] Overrides the default tooltip position */
19
19
  tooltipPosition?: "top" | "bottom" | "left" | "right";
20
- /** Aria label for rendered help component */
20
+ /** [Legacy] 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,23 +52,19 @@ const RadioButton = /*#__PURE__*/React.forwardRef(({
52
52
  event.target.focus();
53
53
  }, [onChange]);
54
54
  const validationProps = {
55
- disabled,
56
- inputWidth,
57
55
  error,
58
56
  warning,
59
57
  info
60
58
  };
61
59
  const commonProps = {
62
60
  ...validationProps,
61
+ disabled,
62
+ inputWidth,
63
63
  fieldHelpInline,
64
64
  labelSpacing
65
65
  };
66
66
  const inputProps = {
67
- ...(validationRedesignOptIn ? {
68
- ...validationProps
69
- } : {
70
- ...commonProps
71
- }),
67
+ ...commonProps,
72
68
  autoFocus,
73
69
  checked,
74
70
  fieldHelp,
@@ -101,12 +97,7 @@ const RadioButton = /*#__PURE__*/React.forwardRef(({
101
97
  inline: inline,
102
98
  reverse: reverse,
103
99
  size: size
104
- }, validationRedesignOptIn ? {
105
- ...validationProps
106
- } : {
107
- ...commonProps,
108
- fieldHelp
109
- }, marginProps), /*#__PURE__*/React.createElement(CheckableInput, inputProps, /*#__PURE__*/React.createElement(RadioButtonSvg, null)));
100
+ }, commonProps, marginProps), /*#__PURE__*/React.createElement(CheckableInput, inputProps, /*#__PURE__*/React.createElement(RadioButtonSvg, null)));
110
101
  return /*#__PURE__*/React.createElement(React.Fragment, null, validationRedesignOptIn ? componentToRender : /*#__PURE__*/React.createElement(TooltipProvider, {
111
102
  helpAriaLabel: helpAriaLabel,
112
103
  tooltipPosition: tooltipPosition
@@ -58,7 +58,7 @@ export interface SearchProps extends ValidationProps, MarginProps {
58
58
  variant?: "default" | "dark";
59
59
  /** Input tabindex */
60
60
  tabIndex?: number;
61
- /** Overrides the default tooltip position */
61
+ /** [Legacy] Overrides the default tooltip position */
62
62
  tooltipPosition?: "top" | "bottom" | "left" | "right";
63
63
  }
64
64
  export declare type SearchHandle = {
@@ -5,7 +5,7 @@ import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
5
5
  declare type CustomRefObject<T> = {
6
6
  current?: T | null;
7
7
  };
8
- export interface SidebarProps extends PaddingProps, Omit<TagProps, "data-component">, WidthProps, Pick<ModalProps, "topModalOverride"> {
8
+ export interface SidebarProps extends PaddingProps, Omit<TagProps, "data-component">, WidthProps, Pick<ModalProps, "topModalOverride" | "restoreFocusOnClose"> {
9
9
  /** Prop to specify the aria-describedby property of the component */
10
10
  "aria-describedby"?: string;
11
11
  /**
@@ -38,6 +38,7 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
38
38
  width,
39
39
  headerPadding = {},
40
40
  topModalOverride,
41
+ restoreFocusOnClose = true,
41
42
  ...rest
42
43
  }, ref) => {
43
44
  const locale = useLocale();
@@ -93,7 +94,8 @@ const Sidebar = /*#__PURE__*/React.forwardRef(({
93
94
  onCancel: onCancel,
94
95
  disableEscKey: disableEscKey,
95
96
  enableBackgroundUI: enableBackgroundUI,
96
- topModalOverride: topModalOverride
97
+ topModalOverride: topModalOverride,
98
+ restoreFocusOnClose: restoreFocusOnClose
97
99
  }, enableBackgroundUI ? sidebar : /*#__PURE__*/React.createElement(FocusTrap, {
98
100
  wrapperRef: sidebarRef,
99
101
  isOpen: open,
@@ -449,6 +451,7 @@ if (process.env.NODE_ENV !== "production") {
449
451
  "toString": PropTypes.func.isRequired,
450
452
  "valueOf": PropTypes.func.isRequired
451
453
  }), PropTypes.string]),
454
+ "restoreFocusOnClose": PropTypes.bool,
452
455
  "role": PropTypes.string,
453
456
  "size": PropTypes.oneOf(["extra-large", "extra-small", "large", "medium-large", "medium-small", "medium", "small"]),
454
457
  "topModalOverride": PropTypes.bool,
@@ -36,7 +36,7 @@ const getBorderRadius = roundness => {
36
36
  return "var(--borderRadius100)";
37
37
  }
38
38
  };
39
- const getHeighlightVariant = variant => {
39
+ const getHighlightVariant = variant => {
40
40
  switch (variant) {
41
41
  case "success":
42
42
  return "var(--colorsSemanticPositive500)";
@@ -115,7 +115,7 @@ export const StyledHighlight = styled.div`
115
115
  position: relative;
116
116
  background: ${({
117
117
  variant
118
- }) => getHeighlightVariant(variant)};
118
+ }) => getHighlightVariant(variant)};
119
119
  border-radius: ${({
120
120
  roundness
121
121
  }) => getBorderRadius(roundness)};
@@ -32,7 +32,8 @@ export const VerticalMenuFullScreen = ({
32
32
  open: isOpen,
33
33
  closeModal: handleKeyDown,
34
34
  modalRef: menuWrapperRef,
35
- topModalOverride: true
35
+ topModalOverride: true,
36
+ focusCallToActionElement: document.activeElement
36
37
  });
37
38
 
38
39
  // TODO remove this as part of FE-5650
@@ -1,10 +1,11 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
+ import { ModalProps } from "../modal";
3
4
  export interface AdvancedColor {
4
5
  label: string;
5
6
  value: string;
6
7
  }
7
- export interface AdvancedColorPickerProps extends MarginProps {
8
+ export interface AdvancedColorPickerProps extends MarginProps, Pick<ModalProps, "restoreFocusOnClose"> {
8
9
  /** Prop to specify the aria-describedby property of the component */
9
10
  "aria-describedby"?: string;
10
11
  /**
@@ -39,5 +40,5 @@ export interface AdvancedColorPickerProps extends MarginProps {
39
40
  /** Prop for `selectedColor` containing pre-selected color for `controlled` use */
40
41
  selectedColor?: string;
41
42
  }
42
- export declare const AdvancedColorPicker: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, availableColors, defaultColor, name, onOpen, onClose, onChange, onBlur, open, role, selectedColor, ...props }: AdvancedColorPickerProps) => React.JSX.Element;
43
+ export declare const AdvancedColorPicker: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, availableColors, defaultColor, name, onOpen, onClose, onChange, onBlur, open, role, selectedColor, restoreFocusOnClose, ...props }: AdvancedColorPickerProps) => React.JSX.Element;
43
44
  export default AdvancedColorPicker;
@@ -33,6 +33,7 @@ const AdvancedColorPicker = ({
33
33
  open = false,
34
34
  role,
35
35
  selectedColor,
36
+ restoreFocusOnClose = true,
36
37
  ...props
37
38
  }) => {
38
39
  const [dialogOpen, setDialogOpen] = (0, _react.useState)();
@@ -151,7 +152,8 @@ const AdvancedColorPicker = ({
151
152
  onCancel: handleOnClose,
152
153
  bespokeFocusTrap: handleFocus,
153
154
  focusFirstElement: selectedColorRef,
154
- role: role
155
+ role: role,
156
+ restoreFocusOnClose: restoreFocusOnClose
155
157
  }, /*#__PURE__*/_react.default.createElement(_advancedColorPicker.StyledAdvancedColorPickerPreview, {
156
158
  "data-element": "color-picker-preview",
157
159
  color: currentColor
@@ -32,9 +32,9 @@ export interface ButtonProps extends SpaceProps, TagProps {
32
32
  href?: string;
33
33
  /** Defines an Icon position related to the children: "before" | "after" */
34
34
  iconPosition?: ButtonIconPosition;
35
- /** Provides a tooltip message when the icon is hovered. */
35
+ /** [Legacy] Provides a tooltip message when the icon is hovered. */
36
36
  iconTooltipMessage?: string;
37
- /** Provides positioning when the tooltip is displayed. */
37
+ /** [Legacy] Provides positioning when the tooltip is displayed. */
38
38
  iconTooltipPosition?: TooltipPositions;
39
39
  /** Defines an Icon type within the button */
40
40
  iconType?: IconType;
@@ -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 Help tooltip,
9
- * will be rendered as hint text when `validationRedesignOptIn` is true.
8
+ * The content for the CheckboxGroup hint text,
9
+ * will only be rendered 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 in line */
30
+ /** When true, Checkboxes are inline */
31
31
  inline?: boolean;
32
32
  }
33
33
  export declare const CheckboxGroup: {
@@ -49,7 +49,6 @@ const CheckboxGroup = props => {
49
49
  legendSpacing: legendSpacing,
50
50
  error: error,
51
51
  warning: warning,
52
- info: info,
53
52
  isRequired: required,
54
53
  isOptional: isOptional
55
54
  }, (0, _tags.default)("checkboxgroup", props), {
@@ -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
- /** Aria label for rendered help component */
15
+ /** [Legacy] 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
- /** Overrides the default tooltip position */
21
+ /** [Legacy] 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;
@@ -49,6 +49,7 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
49
49
  focusableContainers,
50
50
  topModalOverride,
51
51
  closeButtonDataProps,
52
+ restoreFocusOnClose = true,
52
53
  ...rest
53
54
  }, ref) => {
54
55
  if (!deprecatedClassNameWarningShown && className) {
@@ -110,7 +111,8 @@ const Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(({
110
111
  disableEscKey: disableEscKey,
111
112
  disableClose: disableClose,
112
113
  className: className ? `${className} carbon-dialog` : "carbon-dialog",
113
- topModalOverride: topModalOverride
114
+ topModalOverride: topModalOverride,
115
+ restoreFocusOnClose: restoreFocusOnClose
114
116
  }, /*#__PURE__*/_react.default.createElement(_focusTrap.default, {
115
117
  autoFocus: !disableAutoFocus,
116
118
  focusFirstElement: focusFirstElement,
@@ -191,6 +193,7 @@ if (process.env.NODE_ENV !== "production") {
191
193
  "help": _propTypes.default.string,
192
194
  "onCancel": _propTypes.default.func,
193
195
  "open": _propTypes.default.bool.isRequired,
196
+ "restoreFocusOnClose": _propTypes.default.bool,
194
197
  "role": _propTypes.default.string,
195
198
  "showCloseIcon": _propTypes.default.bool,
196
199
  "size": _propTypes.default.oneOf(["auto", "extra-large", "extra-small", "large", "maximise", "medium-large", "medium-small", "medium", "small"]),
@@ -55,5 +55,5 @@ export interface DialogFullScreenProps extends ModalProps {
55
55
  /** A custom close event handler */
56
56
  onCancel?: (ev: React.KeyboardEvent<HTMLElement> | React.MouseEvent<HTMLButtonElement>) => void;
57
57
  }
58
- export declare const DialogFullScreen: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disableAutoFocus, focusFirstElement, bespokeFocusTrap, open, children, title, subtitle, pagesStyling, headerChildren, showCloseIcon, disableContentPadding, disableEscKey, onCancel, contentRef, help, role, focusableContainers, focusableSelectors, topModalOverride, closeButtonDataProps, ...rest }: DialogFullScreenProps) => React.JSX.Element;
58
+ export declare const DialogFullScreen: ({ "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disableAutoFocus, focusFirstElement, bespokeFocusTrap, open, children, title, subtitle, pagesStyling, headerChildren, showCloseIcon, disableContentPadding, disableEscKey, onCancel, contentRef, help, role, focusableContainers, focusableSelectors, topModalOverride, closeButtonDataProps, restoreFocusOnClose, ...rest }: DialogFullScreenProps) => React.JSX.Element;
59
59
  export default DialogFullScreen;
@@ -46,6 +46,7 @@ const DialogFullScreen = ({
46
46
  focusableSelectors,
47
47
  topModalOverride,
48
48
  closeButtonDataProps,
49
+ restoreFocusOnClose = true,
49
50
  ...rest
50
51
  }) => {
51
52
  const locale = (0, _useLocale.default)();
@@ -96,7 +97,8 @@ const DialogFullScreen = ({
96
97
  open: open,
97
98
  onCancel: onCancel,
98
99
  disableEscKey: disableEscKey,
99
- topModalOverride: topModalOverride
100
+ topModalOverride: topModalOverride,
101
+ restoreFocusOnClose: restoreFocusOnClose
100
102
  }, componentTags), /*#__PURE__*/_react.default.createElement(_focusTrap.default, {
101
103
  autoFocus: !disableAutoFocus,
102
104
  focusFirstElement: focusFirstElement,
@@ -14,19 +14,19 @@ export interface IconProps extends Omit<StyledIconProps, "type">, MarginProps, O
14
14
  id?: string;
15
15
  /** The ARIA role to be applied to the Icon */
16
16
  role?: string;
17
- /** The message to be displayed within the tooltip */
17
+ /** [Legacy] The message to be displayed within the tooltip */
18
18
  tooltipMessage?: React.ReactNode;
19
- /** The position to display the tooltip */
19
+ /** [Legacy] The position to display the tooltip */
20
20
  tooltipPosition?: TooltipPositions;
21
- /** Control whether the tooltip is visible */
21
+ /** [Legacy] Control whether the tooltip is visible */
22
22
  tooltipVisible?: boolean;
23
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
23
+ /** [Legacy] Override background color of the Tooltip, provide any color from palette or any valid css color value. */
24
24
  tooltipBgColor?: string;
25
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
25
+ /** [Legacy] Override font color of the Tooltip, provide any color from palette or any valid css color value. */
26
26
  tooltipFontColor?: string;
27
- /** Overrides the default flip behaviour of the Tooltip */
27
+ /** [Legacy] Overrides the default flip behaviour of the Tooltip */
28
28
  tooltipFlipOverrides?: TooltipPositions[];
29
- /** Id passed to the tooltip container, used for accessibility purposes */
29
+ /** [Legacy] Id passed to the tooltip container, used for accessibility purposes */
30
30
  tooltipId?: string;
31
31
  /**
32
32
  * Icon type
@@ -12,9 +12,9 @@ export interface LinkProps extends StyledLinkProps, React.AriaAttributes {
12
12
  onKeyDown?: (ev: React.KeyboardEvent<HTMLAnchorElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
13
13
  /** Function called when a mouse down event triggers. */
14
14
  onMouseDown?: (ev: React.MouseEvent<HTMLAnchorElement> | React.MouseEvent<HTMLButtonElement>) => void;
15
- /** A message to display as a tooltip to the link. */
15
+ /** [Legacy] A message to display as a tooltip to the link. */
16
16
  tooltipMessage?: string;
17
- /** Positions the tooltip with the link. */
17
+ /** [Legacy] Positions the tooltip with the link. */
18
18
  tooltipPosition?: "bottom" | "left" | "right" | "top";
19
19
  /** Child content to render in the link. */
20
20
  children?: React.ReactNode;
@@ -19,7 +19,7 @@ const loaderAnimation = (0, _styledComponents.keyframes)`
19
19
  transform: scale(1);
20
20
  }
21
21
  `;
22
- const getDimentions = (size, roundedCornersOptOut) => {
22
+ const getDimensions = (size, roundedCornersOptOut) => {
23
23
  let width;
24
24
  let marginRight;
25
25
  switch (size) {
@@ -53,7 +53,7 @@ const StyledLoaderSquare = _styledComponents.default.div`
53
53
  animation: ${loaderAnimation} 1s infinite ease-in-out both;
54
54
  background-color: ${backgroundColor};
55
55
  display: inline-block;
56
- ${getDimentions(size, theme.roundedCornersOptOut)}
56
+ ${getDimensions(size, theme.roundedCornersOptOut)}
57
57
 
58
58
  ${isInsideButton && (0, _styledComponents.css)`
59
59
  background-color: ${isActive ? "var(--colorsUtilityYang100)" : "var(--colorsSemanticNeutral500)"};
@@ -21,6 +21,10 @@ export interface ModalProps extends Omit<TagProps, "data-component"> {
21
21
  timeout?: number;
22
22
  /** Manually override the internal modal stacking order to set this as top */
23
23
  topModalOverride?: boolean;
24
+ /** Enables the automatic restoration of focus to the element that invoked
25
+ * the modal when the modal is closed.
26
+ */
27
+ restoreFocusOnClose?: boolean;
24
28
  }
25
- declare const Modal: ({ children, "data-element": dataElement, "data-role": dataRole, open, onCancel, disableEscKey, disableClose, enableBackgroundUI, timeout, topModalOverride, ...rest }: ModalProps) => React.JSX.Element;
29
+ declare const Modal: ({ children, "data-element": dataElement, "data-role": dataRole, open, onCancel, disableEscKey, disableClose, enableBackgroundUI, timeout, topModalOverride, restoreFocusOnClose, ...rest }: ModalProps) => React.JSX.Element;
26
30
  export default Modal;
@@ -30,6 +30,7 @@ const Modal = ({
30
30
  enableBackgroundUI = false,
31
31
  timeout = 300,
32
32
  topModalOverride,
33
+ restoreFocusOnClose = true,
33
34
  ...rest
34
35
  }) => {
35
36
  if (!deprecatedClassNameWarningShown && rest.className) {
@@ -74,7 +75,7 @@ const Modal = ({
74
75
  modalRef: ref,
75
76
  setTriggerRefocusFlag,
76
77
  topModalOverride,
77
- focusCallToActionElement: document.activeElement
78
+ focusCallToActionElement: restoreFocusOnClose ? document.activeElement : undefined
78
79
  });
79
80
  let background;
80
81
  let content;
@@ -24,21 +24,21 @@ export interface PortraitProps extends MarginProps {
24
24
  darkBackground?: boolean;
25
25
  /** Prop for `onClick` events. */
26
26
  onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
27
- /** The message to be displayed within the tooltip */
27
+ /** [Legacy] The message to be displayed within the tooltip */
28
28
  tooltipMessage?: React.ReactNode;
29
- /** The id attribute to use for the tooltip */
29
+ /** [Legacy] The id attribute to use for the tooltip */
30
30
  tooltipId?: string;
31
- /** Whether to to show the Tooltip */
31
+ /** [Legacy] Whether to to show the Tooltip */
32
32
  tooltipIsVisible?: boolean;
33
- /** Sets position of the tooltip */
33
+ /** [Legacy] Sets position of the tooltip */
34
34
  tooltipPosition?: "top" | "bottom" | "left" | "right";
35
- /** Defines the message type */
35
+ /** [Legacy] Defines the message type */
36
36
  tooltipType?: string;
37
- /** Defines the size of the tooltip content */
37
+ /** [Legacy] Defines the size of the tooltip content */
38
38
  tooltipSize?: "medium" | "large";
39
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
39
+ /** [Legacy] Override background color of the Tooltip, provide any color from palette or any valid css color value. */
40
40
  tooltipBgColor?: string;
41
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
41
+ /** [Legacy] Override font color of the Tooltip, provide any color from palette or any valid css color value. */
42
42
  tooltipFontColor?: string;
43
43
  }
44
44
  declare const Portrait: ({ alt, name, darkBackground, gravatar, iconType, initials, shape, size, src, onClick, tooltipMessage, tooltipId, tooltipIsVisible, tooltipPosition, tooltipType, tooltipSize, tooltipBgColor, tooltipFontColor, ...rest }: PortraitProps) => React.JSX.Element;
@@ -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 Legend Help tooltip,
19
- * will be rendered as hint text when `validationRedesignOptIn` is true.
18
+ * The content for the RadioButtonGroup hint text,
19
+ * will only be rendered when `validationRedesignOptIn` is true.
20
20
  */
21
21
  legendHelp?: string;
22
22
  /** [Legacy] Text alignment of legend when inline */
@@ -70,7 +70,6 @@ const RadioButtonGroup = props => {
70
70
  legend: legend,
71
71
  error: error,
72
72
  warning: warning,
73
- info: info,
74
73
  inline: inlineLegend,
75
74
  legendWidth: legendWidth,
76
75
  legendAlign: legendAlign,
@@ -108,8 +107,6 @@ const RadioButtonGroup = props => {
108
107
  labelSpacing,
109
108
  error: !!error,
110
109
  warning: !!warning,
111
- info: !!info,
112
- required,
113
110
  ...child.props
114
111
  });
115
112
  }))))) : /*#__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
- /** Overrides the default tooltip position */
18
+ /** [Legacy] Overrides the default tooltip position */
19
19
  tooltipPosition?: "top" | "bottom" | "left" | "right";
20
- /** Aria label for rendered help component */
20
+ /** [Legacy] 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,23 +61,19 @@ const RadioButton = exports.RadioButton = /*#__PURE__*/_react.default.forwardRef
61
61
  event.target.focus();
62
62
  }, [onChange]);
63
63
  const validationProps = {
64
- disabled,
65
- inputWidth,
66
64
  error,
67
65
  warning,
68
66
  info
69
67
  };
70
68
  const commonProps = {
71
69
  ...validationProps,
70
+ disabled,
71
+ inputWidth,
72
72
  fieldHelpInline,
73
73
  labelSpacing
74
74
  };
75
75
  const inputProps = {
76
- ...(validationRedesignOptIn ? {
77
- ...validationProps
78
- } : {
79
- ...commonProps
80
- }),
76
+ ...commonProps,
81
77
  autoFocus,
82
78
  checked,
83
79
  fieldHelp,
@@ -110,12 +106,7 @@ const RadioButton = exports.RadioButton = /*#__PURE__*/_react.default.forwardRef
110
106
  inline: inline,
111
107
  reverse: reverse,
112
108
  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)));
109
+ }, commonProps, marginProps), /*#__PURE__*/_react.default.createElement(_checkableInput.default, inputProps, /*#__PURE__*/_react.default.createElement(_radioButtonSvg.default, null)));
119
110
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, validationRedesignOptIn ? componentToRender : /*#__PURE__*/_react.default.createElement(_tooltipProvider.TooltipProvider, {
120
111
  helpAriaLabel: helpAriaLabel,
121
112
  tooltipPosition: tooltipPosition
@@ -58,7 +58,7 @@ export interface SearchProps extends ValidationProps, MarginProps {
58
58
  variant?: "default" | "dark";
59
59
  /** Input tabindex */
60
60
  tabIndex?: number;
61
- /** Overrides the default tooltip position */
61
+ /** [Legacy] Overrides the default tooltip position */
62
62
  tooltipPosition?: "top" | "bottom" | "left" | "right";
63
63
  }
64
64
  export declare type SearchHandle = {
@@ -5,7 +5,7 @@ import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
5
5
  declare type CustomRefObject<T> = {
6
6
  current?: T | null;
7
7
  };
8
- export interface SidebarProps extends PaddingProps, Omit<TagProps, "data-component">, WidthProps, Pick<ModalProps, "topModalOverride"> {
8
+ export interface SidebarProps extends PaddingProps, Omit<TagProps, "data-component">, WidthProps, Pick<ModalProps, "topModalOverride" | "restoreFocusOnClose"> {
9
9
  /** Prop to specify the aria-describedby property of the component */
10
10
  "aria-describedby"?: string;
11
11
  /**
@@ -46,6 +46,7 @@ const Sidebar = exports.Sidebar = /*#__PURE__*/_react.default.forwardRef(({
46
46
  width,
47
47
  headerPadding = {},
48
48
  topModalOverride,
49
+ restoreFocusOnClose = true,
49
50
  ...rest
50
51
  }, ref) => {
51
52
  const locale = (0, _useLocale.default)();
@@ -101,7 +102,8 @@ const Sidebar = exports.Sidebar = /*#__PURE__*/_react.default.forwardRef(({
101
102
  onCancel: onCancel,
102
103
  disableEscKey: disableEscKey,
103
104
  enableBackgroundUI: enableBackgroundUI,
104
- topModalOverride: topModalOverride
105
+ topModalOverride: topModalOverride,
106
+ restoreFocusOnClose: restoreFocusOnClose
105
107
  }, enableBackgroundUI ? sidebar : /*#__PURE__*/_react.default.createElement(_focusTrap.default, {
106
108
  wrapperRef: sidebarRef,
107
109
  isOpen: open,
@@ -457,6 +459,7 @@ if (process.env.NODE_ENV !== "production") {
457
459
  "toString": _propTypes.default.func.isRequired,
458
460
  "valueOf": _propTypes.default.func.isRequired
459
461
  }), _propTypes.default.string]),
462
+ "restoreFocusOnClose": _propTypes.default.bool,
460
463
  "role": _propTypes.default.string,
461
464
  "size": _propTypes.default.oneOf(["extra-large", "extra-small", "large", "medium-large", "medium-small", "medium", "small"]),
462
465
  "topModalOverride": _propTypes.default.bool,
@@ -45,7 +45,7 @@ const getBorderRadius = roundness => {
45
45
  return "var(--borderRadius100)";
46
46
  }
47
47
  };
48
- const getHeighlightVariant = variant => {
48
+ const getHighlightVariant = variant => {
49
49
  switch (variant) {
50
50
  case "success":
51
51
  return "var(--colorsSemanticPositive500)";
@@ -124,7 +124,7 @@ const StyledHighlight = exports.StyledHighlight = _styledComponents.default.div`
124
124
  position: relative;
125
125
  background: ${({
126
126
  variant
127
- }) => getHeighlightVariant(variant)};
127
+ }) => getHighlightVariant(variant)};
128
128
  border-radius: ${({
129
129
  roundness
130
130
  }) => getBorderRadius(roundness)};
@@ -41,7 +41,8 @@ const VerticalMenuFullScreen = ({
41
41
  open: isOpen,
42
42
  closeModal: handleKeyDown,
43
43
  modalRef: menuWrapperRef,
44
- topModalOverride: true
44
+ topModalOverride: true,
45
+ focusCallToActionElement: document.activeElement
45
46
  });
46
47
 
47
48
  // TODO remove this as part of FE-5650
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "144.19.0",
3
+ "version": "144.20.1",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",