carbon-react 106.1.1 → 106.1.4

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 (41) hide show
  1. package/esm/__internal__/input/input-presentation.component.d.ts +2 -2
  2. package/esm/__internal__/validations/index.d.ts +1 -1
  3. package/esm/__internal__/validations/validation-icon.component.d.ts +50 -40
  4. package/esm/__internal__/validations/validation-icon.component.js +12 -64
  5. package/esm/__internal__/validations/validation-icon.style.d.ts +5 -1
  6. package/esm/__internal__/validations/validation-icon.style.js +0 -1
  7. package/esm/components/accordion/accordion.component.js +1 -1
  8. package/esm/components/duelling-picklist/picklist-item/picklist-item.component.js +7 -3
  9. package/esm/components/icon/icon.d.ts +4 -0
  10. package/esm/components/link/link.style.js +4 -0
  11. package/esm/components/modal/modal.component.js +7 -1
  12. package/esm/components/pages/page/page.component.js +7 -3
  13. package/esm/components/popover-container/popover-container.component.js +5 -2
  14. package/esm/components/portal/portal.js +12 -8
  15. package/esm/components/show-edit-pod/show-edit-pod.component.js +10 -4
  16. package/esm/components/toast/toast.component.js +6 -2
  17. package/esm/style/themes/base/base-theme.config.d.ts +78 -10
  18. package/esm/style/themes/sage/index.d.ts +78 -10
  19. package/lib/__internal__/input/input-presentation.component.d.ts +2 -2
  20. package/lib/__internal__/validations/index.d.ts +1 -1
  21. package/lib/__internal__/validations/validation-icon.component.d.ts +50 -40
  22. package/lib/__internal__/validations/validation-icon.component.js +13 -65
  23. package/lib/__internal__/validations/validation-icon.style.d.ts +5 -1
  24. package/lib/__internal__/validations/validation-icon.style.js +0 -1
  25. package/lib/components/accordion/accordion.component.js +1 -1
  26. package/lib/components/duelling-picklist/picklist-item/picklist-item.component.js +6 -2
  27. package/lib/components/icon/icon.d.ts +4 -0
  28. package/lib/components/link/link.style.js +4 -0
  29. package/lib/components/modal/modal.component.js +7 -1
  30. package/lib/components/pages/page/page.component.js +11 -3
  31. package/lib/components/popover-container/popover-container.component.js +5 -2
  32. package/lib/components/portal/portal.js +15 -8
  33. package/lib/components/show-edit-pod/show-edit-pod.component.js +10 -4
  34. package/lib/components/toast/toast.component.js +6 -2
  35. package/lib/style/themes/base/base-theme.config.d.ts +78 -10
  36. package/lib/style/themes/sage/index.d.ts +78 -10
  37. package/package.json +2 -2
  38. package/esm/__internal__/validations/validation-icon.d.ts +0 -38
  39. package/esm/__internal__/validations/validations.d.ts +0 -17
  40. package/lib/__internal__/validations/validation-icon.d.ts +0 -38
  41. package/lib/__internal__/validations/validations.d.ts +0 -17
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import { ValidationPropTypes } from "../validations";
2
+ import { ValidationProps } from "../validations";
3
3
  export declare type Sizes = "small" | "medium" | "large";
4
- export interface CommonInputPresentationProps extends ValidationPropTypes {
4
+ export interface CommonInputPresentationProps extends ValidationProps {
5
5
  children: React.ReactNode;
6
6
  /** If true, the component will be disabled */
7
7
  disabled?: boolean;
@@ -1,2 +1,2 @@
1
1
  export { default } from "./validation-icon.component";
2
- export { ValidationPropTypes } from "./validations";
2
+ export type { ValidationProps, ValidationIconProps, } from "./validation-icon.component";
@@ -1,41 +1,51 @@
1
- export default ValidationIcon;
2
- declare function ValidationIcon({ error, warning, info, size, onFocus, onBlur, iconId, tooltipId, isPartOfInput, tabIndex, onClick, tooltipPosition, tooltipFlipOverrides, ...rest }: {
3
- [x: string]: any;
4
- error: any;
5
- warning: any;
6
- info: any;
7
- size: any;
8
- onFocus: any;
9
- onBlur: any;
10
- iconId: any;
11
- tooltipId: any;
12
- isPartOfInput: any;
13
- tabIndex: any;
14
- onClick: any;
15
- tooltipPosition: any;
16
- tooltipFlipOverrides: any;
17
- }): JSX.Element | null;
18
- declare namespace ValidationIcon {
19
- namespace propTypes {
20
- const size: PropTypes.Requireable<string>;
21
- const iconId: PropTypes.Requireable<string>;
22
- const tooltipPosition: PropTypes.Requireable<string>;
23
- function tooltipFlipOverrides(props: any, propName: any, componentName: any): Error | null;
24
- const tooltipId: PropTypes.Requireable<string>;
25
- const onClick: PropTypes.Requireable<(...args: any[]) => any>;
26
- const onFocus: PropTypes.Requireable<(...args: any[]) => any>;
27
- const onBlur: PropTypes.Requireable<(...args: any[]) => any>;
28
- const isPartOfInput: PropTypes.Requireable<boolean>;
29
- const tabIndex: PropTypes.Requireable<number>;
30
- const error: PropTypes.Requireable<string | boolean>;
31
- const warning: PropTypes.Requireable<string | boolean>;
32
- const info: PropTypes.Requireable<string | boolean>;
33
- }
34
- namespace defaultProps {
35
- const tooltipPosition_1: string;
36
- export { tooltipPosition_1 as tooltipPosition };
37
- const tabIndex_1: number;
38
- export { tabIndex_1 as tabIndex };
39
- }
1
+ import React from "react";
2
+ export interface ValidationProps {
3
+ /** Indicate that error has occurred
4
+ * Pass string to display icon, tooltip and red border
5
+ * Pass true boolean to only display red border
6
+ */
7
+ error?: boolean | string;
8
+ /** Indicate additional information
9
+ * Pass string to display icon, tooltip and blue border
10
+ * Pass true boolean to only display blue border
11
+ */
12
+ info?: boolean | string;
13
+ /** Indicate that warning has occurred
14
+ * Pass string to display icon, tooltip and orange border
15
+ * Pass true boolean to only display orange border
16
+ */
17
+ warning?: boolean | string;
18
+ }
19
+ declare type TooltipPositions = "top" | "bottom" | "left" | "right";
20
+ export interface ValidationIconProps extends ValidationProps {
21
+ /** A small string to indicate the size of the icon */
22
+ size?: "small" | "medium" | "large";
23
+ /** The unique id of the component (used with aria-describedby for accessibility) */
24
+ iconId?: string;
25
+ /** Define position of the tooltip */
26
+ tooltipPosition?: TooltipPositions;
27
+ /**
28
+ * Overrides the default flip behaviour of the Tooltip,
29
+ * must be an array containing some or all of ["top", "bottom", "left", "right"]
30
+ * (see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements)
31
+ */
32
+ tooltipFlipOverrides?: TooltipPositions[];
33
+ /** Id passed to the tooltip container, used for accessibility purposes */
34
+ tooltipId?: string;
35
+ /** An onClick handler */
36
+ onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
37
+ /** An onBlur handler */
38
+ onBlur?: (ev: React.FocusEvent<HTMLElement>) => void;
39
+ /** An onFocus handler */
40
+ onFocus?: (ev: React.FocusEvent<HTMLElement>) => void;
41
+ /** A boolean to indicate if the icon is part of an input */
42
+ isPartOfInput?: boolean;
43
+ /** Overrides the default tabindex of the component */
44
+ tabIndex?: number;
45
+ /** Margin right, given number will be multiplied by base spacing unit (8) */
46
+ mr?: number;
47
+ /** Margin left, given number will be multiplied by base spacing unit (8) */
48
+ ml?: number;
40
49
  }
41
- import PropTypes from "prop-types";
50
+ export declare const ValidationIcon: ({ error, warning, info, size, onFocus, onBlur, iconId, tooltipId, isPartOfInput, tabIndex, onClick, tooltipPosition, tooltipFlipOverrides, ...rest }: ValidationIconProps) => JSX.Element | null;
51
+ export default ValidationIcon;
@@ -1,13 +1,11 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React, { useContext, useState } from "react";
4
- import PropTypes from "prop-types";
5
- import styledSystemPropTypes from "@styled-system/prop-types";
4
+ import invariant from "invariant";
6
5
  import Icon from "../../components/icon";
7
6
  import ValidationIconStyle from "./validation-icon.style";
8
7
  import { InputContext, InputGroupContext } from "../input-behaviour";
9
8
  import { filterStyledSystemMarginProps } from "../../style/utils";
10
- const marginPropTypes = filterStyledSystemMarginProps(styledSystemPropTypes.space);
11
9
 
12
10
  const getValidationType = ({
13
11
  error,
@@ -17,10 +15,10 @@ const getValidationType = ({
17
15
  if (error) return "error";
18
16
  if (warning) return "warning";
19
17
  if (info) return "info";
20
- return "";
18
+ return null;
21
19
  };
22
20
 
23
- const ValidationIcon = ({
21
+ export const ValidationIcon = ({
24
22
  error,
25
23
  warning,
26
24
  info,
@@ -30,12 +28,18 @@ const ValidationIcon = ({
30
28
  iconId,
31
29
  tooltipId,
32
30
  isPartOfInput,
33
- tabIndex,
31
+ tabIndex = -1,
34
32
  onClick,
35
- tooltipPosition,
33
+ tooltipPosition = "right",
36
34
  tooltipFlipOverrides,
37
35
  ...rest
38
36
  }) => {
37
+ const flipBehaviourCheck = Array.isArray(tooltipFlipOverrides) && tooltipFlipOverrides.every(override => ["bottom", "left", "right", "top"].includes(override));
38
+
39
+ if (tooltipFlipOverrides) {
40
+ invariant(flipBehaviourCheck, `The tooltipFlipOverrides prop supplied to ValidationIcon must be an array containing some or all of ["top", "bottom", "left", "right"].`);
41
+ }
42
+
39
43
  const {
40
44
  hasFocus,
41
45
  hasMouseOver
@@ -52,7 +56,7 @@ const ValidationIcon = ({
52
56
  });
53
57
  const validationMessage = error || warning || info;
54
58
 
55
- if (typeof validationMessage !== "string") {
59
+ if (typeof validationMessage !== "string" || !validationType) {
56
60
  return null;
57
61
  }
58
62
 
@@ -86,60 +90,4 @@ const ValidationIcon = ({
86
90
  focusable: tabIndex !== -1
87
91
  }));
88
92
  };
89
-
90
- ValidationIcon.propTypes = { ...marginPropTypes,
91
-
92
- /** A small string to indicate the size of the icon */
93
- size: PropTypes.oneOf(["small", "medium", "large"]),
94
-
95
- /** The unique id of the component (used with aria-describedby for accessibility) */
96
- iconId: PropTypes.string,
97
-
98
- /** Define position of the tooltip */
99
- tooltipPosition: PropTypes.string,
100
-
101
- /** Overrides the default flip behaviour of the Tooltip, must be an array containing some or all of ["top", "bottom", "left", "right"] (see https://popper.js.org/docs/v2/modifiers/flip/#fallbackplacements) */
102
- tooltipFlipOverrides: (props, propName, componentName) => {
103
- const prop = props[propName];
104
- const isValid = prop && Array.isArray(prop) && prop.every(placement => ["bottom", "left", "right", "top"].includes(placement));
105
-
106
- if (!prop || isValid) {
107
- return null;
108
- }
109
-
110
- return new Error( // eslint-disable-next-line max-len
111
- `The \`${propName}\` prop supplied to \`${componentName}\` must be an array containing some or all of ["top", "bottom", "left", "right"].`);
112
- },
113
-
114
- /** Id passed to the tooltip container, used for accessibility purposes. */
115
- tooltipId: PropTypes.string,
116
-
117
- /** An onClick handler */
118
- onClick: PropTypes.func,
119
-
120
- /** An onFocus handler */
121
- onFocus: PropTypes.func,
122
-
123
- /** An onBlur handler */
124
- onBlur: PropTypes.func,
125
-
126
- /** A boolean to indicate if the icon is part of an input */
127
- isPartOfInput: PropTypes.bool,
128
-
129
- /** Overrides the default tabindex of the component */
130
- tabIndex: PropTypes.number,
131
-
132
- /** Status of error validations */
133
- error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
134
-
135
- /** Status of warnings */
136
- warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
137
-
138
- /** Status of info */
139
- info: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
140
- };
141
- ValidationIcon.defaultProps = {
142
- tooltipPosition: "right",
143
- tabIndex: -1
144
- };
145
93
  export default ValidationIcon;
@@ -1,2 +1,6 @@
1
+ import { ValidationIconProps } from "./validation-icon.component";
2
+ declare type ValidationType = "error" | "warning" | "info";
3
+ declare const ValidationIconStyle: import("styled-components").StyledComponent<"span", any, ValidationIconProps & {
4
+ validationType: ValidationType;
5
+ }, never>;
1
6
  export default ValidationIconStyle;
2
- declare const ValidationIconStyle: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -5,7 +5,6 @@ import StyledIcon from "../../components/icon/icon.style";
5
5
  const validationIconTypes = {
6
6
  error: "var(--colorsSemanticNegative500)",
7
7
  info: "var(--colorsSemanticInfo500)",
8
- success: "var(--colorsSemanticPositive500)",
9
8
  warning: "var(--colorsSemanticCaution500)"
10
9
  };
11
10
  const ValidationIconStyle = styled.span`
@@ -46,7 +46,7 @@ const Accordion = /*#__PURE__*/React.forwardRef(({
46
46
  });
47
47
  useEffect(() => {
48
48
  setContentHeight(accordionContent.current.scrollHeight);
49
- }, [isExpanded, children]);
49
+ }, [isExpanded]);
50
50
  const toggleAccordion = useCallback(ev => {
51
51
  if (!isControlled) {
52
52
  setIsExpandedInternal(!isExpanded);
@@ -1,6 +1,6 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- import React, { useCallback, useContext } from "react";
3
+ import React, { useCallback, useContext, useRef } from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import { CSSTransition } from "react-transition-group";
6
6
  import { StyledPicklistItem, StyledButton, StyledLockIcon } from "./picklist-item.style";
@@ -25,6 +25,7 @@ const PicklistItem = /*#__PURE__*/React.forwardRef(({
25
25
  const {
26
26
  setElementToFocus
27
27
  } = useContext(FocusContext);
28
+ const picklistItemNodeRef = useRef();
28
29
  const calculateFocusIndex = useCallback(() => {
29
30
  if (isLastItem) {
30
31
  const toggledListIndex = listIndex === 0 ? 1 : 0;
@@ -70,10 +71,13 @@ const PicklistItem = /*#__PURE__*/React.forwardRef(({
70
71
  classNames: "picklist-item"
71
72
  }, rest, type === "add" ? {
72
73
  enter: false
73
- } : {}), /*#__PURE__*/React.createElement(StyledPicklistItem, {
74
+ } : {}, {
75
+ nodeRef: picklistItemNodeRef
76
+ }), /*#__PURE__*/React.createElement(StyledPicklistItem, {
74
77
  onKeyDown: handleKeydown,
75
78
  "data-element": "picklist-item",
76
- locked: locked
79
+ locked: locked,
80
+ ref: picklistItemNodeRef
77
81
  }, children, !locked && /*#__PURE__*/React.createElement(StyledButton, {
78
82
  buttonType: "primary",
79
83
  destructive: type === "remove",
@@ -239,6 +239,10 @@ export interface IconProps extends MarginProps {
239
239
  tooltipId?: string;
240
240
  /** Id passed to the icon. */
241
241
  id?: string;
242
+ tabIndex?: number;
243
+ isPartOfInput?: boolean;
244
+ inputSize?: "small" | "medium" | "large";
245
+ focusable?: boolean;
242
246
  }
243
247
 
244
248
  declare function Icon(
@@ -51,6 +51,10 @@ const StyledLink = styled.span`
51
51
  &:hover {
52
52
  cursor: pointer;
53
53
  color: ${isSkipLink ? "var(--colorsUtilityYin090)" : "var(--colorsActionMajor600)"};
54
+
55
+ ${StyledIcon} {
56
+ color: var(--colorsActionMajor600);
57
+ }
54
58
  }
55
59
 
56
60
  &:focus {
@@ -21,6 +21,8 @@ const Modal = ({
21
21
  ...rest
22
22
  }) => {
23
23
  const ref = useRef();
24
+ const backgroundNodeRef = useRef();
25
+ const contentNodeRef = useRef();
24
26
  const listenerAdded = useRef(false);
25
27
  const modalRegistered = useRef(false);
26
28
  const [isAnimationComplete, setAnimationComplete] = useState(false);
@@ -114,6 +116,7 @@ const Modal = ({
114
116
 
115
117
  if (open) {
116
118
  background = !enableBackgroundUI ? /*#__PURE__*/React.createElement(StyledModalBackground, {
119
+ ref: backgroundNodeRef,
117
120
  "data-element": "modal-background",
118
121
  transitionName: "modal-background",
119
122
  transitionTime: timeout
@@ -127,6 +130,7 @@ const Modal = ({
127
130
  transitionTime: timeout,
128
131
  ref: ref
129
132
  }, rest), /*#__PURE__*/React.createElement(TransitionGroup, null, background && /*#__PURE__*/React.createElement(CSSTransition, {
133
+ nodeRef: backgroundNodeRef,
130
134
  key: "modal",
131
135
  appear: true,
132
136
  classNames: "modal-background",
@@ -134,6 +138,7 @@ const Modal = ({
134
138
  onEntered: () => setAnimationComplete(true),
135
139
  onExiting: () => setAnimationComplete(false)
136
140
  }, background)), /*#__PURE__*/React.createElement(TransitionGroup, null, content && /*#__PURE__*/React.createElement(CSSTransition, {
141
+ nodeRef: contentNodeRef,
137
142
  appear: true,
138
143
  classNames: "modal",
139
144
  timeout: timeout
@@ -142,7 +147,8 @@ const Modal = ({
142
147
  isAnimationComplete,
143
148
  triggerRefocusFlag,
144
149
  isInModal: true
145
- }
150
+ },
151
+ ref: contentNodeRef
146
152
  }, content)))));
147
153
  };
148
154
 
@@ -1,6 +1,6 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- import React from "react";
3
+ import React, { useRef } from "react";
4
4
  import PropTypes from "prop-types";
5
5
  import { CSSTransition } from "react-transition-group";
6
6
  import tagComponent from "../../../__internal__/utils/helpers/tags/tags";
@@ -13,6 +13,7 @@ const Page = ({
13
13
  children,
14
14
  ...props
15
15
  }) => {
16
+ const styledPageNodeRef = useRef();
16
17
  return /*#__PURE__*/React.createElement(CSSTransition, _extends({
17
18
  className: "carbon-carousel__transition",
18
19
  timeout: {
@@ -21,8 +22,11 @@ const Page = ({
21
22
  exit: 0
22
23
  } // eslint-disable-next-line react/prop-types
23
24
  ,
24
- classNames: props.transitionName()
25
- }, props), /*#__PURE__*/React.createElement(StyledPage, tagComponent("page", props), /*#__PURE__*/React.createElement(FullScreenHeading, {
25
+ classNames: props.transitionName(),
26
+ nodeRef: styledPageNodeRef
27
+ }, props), /*#__PURE__*/React.createElement(StyledPage, _extends({}, tagComponent("page", props), {
28
+ ref: styledPageNodeRef
29
+ }), /*#__PURE__*/React.createElement(FullScreenHeading, {
26
30
  hasContent: title
27
31
  }, title), /*#__PURE__*/React.createElement(StyledPageContent, {
28
32
  "data-element": "carbon-page-content"
@@ -31,6 +31,7 @@ const PopoverContainer = ({
31
31
  const closeButtonRef = useRef();
32
32
  const openButtonRef = useRef();
33
33
  const guid = useRef(createGuid());
34
+ const popoverContentNodeRef = useRef();
34
35
  const popoverContainerId = title ? `PopoverContainer_${guid.current}` : undefined;
35
36
  const isOpen = isControlled ? open : isOpenInternal;
36
37
  useEffect(() => {
@@ -78,7 +79,8 @@ const PopoverContainer = ({
78
79
  },
79
80
  appear: true,
80
81
  mountOnEnter: true,
81
- unmountOnExit: true
82
+ unmountOnExit: true,
83
+ nodeRef: popoverContentNodeRef
82
84
  }, state => /*#__PURE__*/React.createElement(PopoverContainerContentStyle, _extends({
83
85
  "data-element": "popover-container-content",
84
86
  role: "dialog",
@@ -88,7 +90,8 @@ const PopoverContainer = ({
88
90
  "aria-labelledby": popoverContainerId,
89
91
  "aria-label": containerAriaLabel,
90
92
  "aria-describedby": ariaDescribedBy,
91
- p: "16px 24px"
93
+ p: "16px 24px",
94
+ ref: popoverContentNodeRef
92
95
  }, filterStyledSystemPaddingProps(rest)), /*#__PURE__*/React.createElement(PopoverContainerHeaderStyle, null, /*#__PURE__*/React.createElement(PopoverContainerTitleStyle, {
93
96
  id: popoverContainerId,
94
97
  "data-element": "popover-container-title"
@@ -1,9 +1,10 @@
1
- import React, { useEffect, useMemo, useState } from "react";
1
+ import React, { useContext, useEffect, useMemo, useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import ReactDOM from "react-dom";
4
4
  import guid from "../../__internal__/utils/helpers/guid";
5
5
  import Browser from "../../__internal__/utils/helpers/browser";
6
6
  import CarbonScopedTokensProvider from "../../style/design-tokens/carbon-scoped-tokens-provider/carbon-scoped-tokens-provider.component";
7
+ export const PortalContext = /*#__PURE__*/React.createContext({});
7
8
 
8
9
  const Portal = ({
9
10
  children,
@@ -13,6 +14,9 @@ const Portal = ({
13
14
  }) => {
14
15
  const [portalNode, setPortalNode] = useState(null);
15
16
  const uniqueId = useMemo(() => guid(), []);
17
+ const {
18
+ renderInRoot
19
+ } = useContext(PortalContext);
16
20
  useEffect(() => {
17
21
  if (onReposition) {
18
22
  onReposition();
@@ -45,7 +49,7 @@ const Portal = ({
45
49
  if (!node && id !== undefined && document.getElementById(id)) {
46
50
  node = document.getElementById(id);
47
51
  setPortalNode(node);
48
- } else if (!node) {
52
+ } else if (!node || document.getElementsByClassName(portalClassName).length === 0) {
49
53
  node = document.createElement("div");
50
54
  node.classList.add(portalClassName);
51
55
  node.setAttribute("data-portal-exit", uniqueId);
@@ -55,14 +59,14 @@ const Portal = ({
55
59
  }
56
60
 
57
61
  setPortalNode(node);
58
- const rootDiv = document.getElementById("root"); // Storybook adds the hidden attribute to the root element when on the "Docs" pages
59
- // Without this check the portal would also be hidden
62
+ let mainNode = document.body;
63
+ const rootDiv = document.getElementById("root");
60
64
 
61
- if (rootDiv && !rootDiv.hasAttribute("hidden")) {
62
- rootDiv.appendChild(node);
63
- } else {
64
- document.body.appendChild(node);
65
+ if (rootDiv && renderInRoot) {
66
+ mainNode = rootDiv;
65
67
  }
68
+
69
+ mainNode.appendChild(node);
66
70
  }
67
71
 
68
72
  if (className) {
@@ -37,6 +37,8 @@ const ShowEditPod = ({
37
37
  }) => {
38
38
  const locale = useContext(LocaleContext);
39
39
  const ref = useRef();
40
+ const editModeNodeRef = useRef();
41
+ const showModeNodeRef = useRef();
40
42
  const [isEditing, setIsEditingState] = useState(false);
41
43
  const isControlled = editing !== undefined;
42
44
 
@@ -122,9 +124,11 @@ const ShowEditPod = ({
122
124
  timeout: {
123
125
  enter: 300,
124
126
  exit: 50
125
- }
127
+ },
128
+ nodeRef: editModeNodeRef
126
129
  }, /*#__PURE__*/React.createElement("div", {
127
- key: "edit"
130
+ key: "edit",
131
+ ref: editModeNodeRef
128
132
  }, editContent()));
129
133
  }
130
134
 
@@ -134,9 +138,11 @@ const ShowEditPod = ({
134
138
  timeout: {
135
139
  enter: 300,
136
140
  exit: 50
137
- }
141
+ },
142
+ nodeRef: showModeNodeRef
138
143
  }, /*#__PURE__*/React.createElement("div", {
139
- key: "show"
144
+ key: "show",
145
+ ref: showModeNodeRef
140
146
  }, children));
141
147
  };
142
148
 
@@ -37,6 +37,7 @@ const Toast = ({
37
37
  const locale = useLocale();
38
38
  const toastRef = useRef();
39
39
  const timer = useRef();
40
+ const toastContentNodeRef = useRef();
40
41
  const componentClasses = useMemo(() => {
41
42
  return classNames(className);
42
43
  }, [className]);
@@ -93,10 +94,13 @@ const Toast = ({
93
94
  appear: 1600,
94
95
  enter: 1500,
95
96
  exit: 500
96
- }
97
+ },
98
+ nodeRef: toastContentNodeRef
97
99
  }, /*#__PURE__*/React.createElement(ToastStyle, _extends({
98
100
  className: componentClasses
99
- }, tagComponent(restProps["data-component"] || "toast", restProps), toastProps), /*#__PURE__*/React.createElement(TypeIcon, {
101
+ }, tagComponent(restProps["data-component"] || "toast", restProps), toastProps, {
102
+ ref: toastContentNodeRef
103
+ }), /*#__PURE__*/React.createElement(TypeIcon, {
100
104
  variant: toastProps.variant
101
105
  }, /*#__PURE__*/React.createElement(Icon, {
102
106
  type: toastProps.variant