@carbon/ibm-products 2.43.2-canary.53 → 2.43.2-canary.55

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 (111) hide show
  1. package/css/index-full-carbon.css +8 -2
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +8 -2
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +1 -1
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +8 -2
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +1 -1
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/Coachmark/Coachmark.js +12 -7
  14. package/es/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
  15. package/es/components/CoachmarkStack/CoachmarkStack.js +7 -3
  16. package/es/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
  17. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +21 -11
  18. package/es/components/ConditionBuilder/ConditionBuilder.js +15 -5
  19. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
  20. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +58 -36
  21. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
  22. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +21 -9
  23. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
  24. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -4
  25. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +8 -4
  26. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +17 -9
  27. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +19 -10
  28. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
  29. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
  30. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
  31. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +18 -17
  32. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +36 -39
  33. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +36 -38
  34. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +20 -12
  35. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +8 -3
  36. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +9 -7
  37. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +9 -4
  38. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +10 -5
  39. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
  40. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +19 -7
  41. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +23 -17
  42. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  43. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +31 -14
  44. package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
  45. package/es/components/ConditionBuilder/utils/useTranslations.js +26 -0
  46. package/es/components/ConditionBuilder/utils/util.js +1 -9
  47. package/es/components/CreateFullPage/CreateFullPage.js +2 -2
  48. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
  49. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
  50. package/es/components/Datagrid/useSelectRows.js +2 -1
  51. package/es/components/Nav/NavItem.js +12 -3
  52. package/es/components/OptionsTile/OptionsTile.js +4 -5
  53. package/es/components/SidePanel/SidePanel.js +17 -20
  54. package/es/components/SidePanel/motion/variants.d.ts +4 -6
  55. package/es/components/SidePanel/motion/variants.js +10 -11
  56. package/es/components/Tearsheet/TearsheetShell.js +3 -1
  57. package/es/components/WebTerminal/WebTerminal.js +10 -12
  58. package/es/global/js/hooks/usePrefersReducedMotion.js +14 -8
  59. package/lib/components/Coachmark/Coachmark.js +12 -7
  60. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
  61. package/lib/components/CoachmarkStack/CoachmarkStack.js +7 -3
  62. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
  63. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +20 -10
  64. package/lib/components/ConditionBuilder/ConditionBuilder.js +15 -5
  65. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
  66. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +56 -33
  67. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
  68. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +20 -8
  69. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
  70. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -3
  71. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +6 -2
  72. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +16 -8
  73. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +18 -9
  74. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
  75. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
  76. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
  77. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +17 -17
  78. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +36 -39
  79. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +36 -38
  80. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +19 -11
  81. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +8 -3
  82. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +8 -6
  83. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +8 -3
  84. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -4
  85. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
  86. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +18 -6
  87. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +21 -15
  88. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  89. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +30 -13
  90. package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
  91. package/lib/components/ConditionBuilder/utils/useTranslations.js +30 -0
  92. package/lib/components/ConditionBuilder/utils/util.js +0 -9
  93. package/lib/components/CreateFullPage/CreateFullPage.js +2 -2
  94. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
  95. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
  96. package/lib/components/Datagrid/useSelectRows.js +2 -1
  97. package/lib/components/Nav/NavItem.js +10 -1
  98. package/lib/components/OptionsTile/OptionsTile.js +4 -5
  99. package/lib/components/SidePanel/SidePanel.js +16 -19
  100. package/lib/components/SidePanel/motion/variants.d.ts +4 -6
  101. package/lib/components/SidePanel/motion/variants.js +10 -11
  102. package/lib/components/Tearsheet/TearsheetShell.js +3 -1
  103. package/lib/components/WebTerminal/WebTerminal.js +10 -12
  104. package/lib/global/js/hooks/usePrefersReducedMotion.js +13 -7
  105. package/package.json +3 -3
  106. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
  107. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +3 -1
  108. package/es/global/js/utils/window.d.ts +0 -2
  109. package/es/global/js/utils/window.js +0 -12
  110. package/lib/global/js/utils/window.d.ts +0 -2
  111. package/lib/global/js/utils/window.js +0 -16
@@ -16,11 +16,12 @@ var _excluded = ["onChange"];
16
16
  var blockClass = "".concat(pkg.prefix, "--datagrid");
17
17
  var SelectAll = function SelectAll(datagridState) {
18
18
  var _columns$;
19
- var _useState = useState(typeof window !== 'undefined' ? window.innerWidth : ''),
19
+ var _useState = useState(),
20
20
  _useState2 = _slicedToArray(_useState, 2),
21
21
  windowSize = _useState2[0],
22
22
  setWindowSize = _useState2[1];
23
23
  useLayoutEffect(function () {
24
+ setWindowSize(window.innerWidth);
24
25
  /* istanbul ignore next */
25
26
  function updateSize() {
26
27
  setWindowSize(window.innerWidth);
@@ -43,11 +43,12 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
43
43
  onSelectAllRows(isAllRowsSelected && selectAllMode === SELECT_ALL_ROWS);
44
44
  }
45
45
  }, [isAllRowsSelected, selectAllMode, onSelectAllRows]);
46
- var _useState3 = useState(window.innerWidth),
46
+ var _useState3 = useState(),
47
47
  _useState4 = _slicedToArray(_useState3, 2),
48
48
  windowSize = _useState4[0],
49
49
  setWindowSize = _useState4[1];
50
50
  useLayoutEffect(function () {
51
+ setWindowSize(window.innerWidth);
51
52
  function updateSize() {
52
53
  setWindowSize(window.innerWidth);
53
54
  }
@@ -68,7 +69,7 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
68
69
  var isFirstColumnStickyLeft = (columns === null || columns === void 0 || (_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
69
70
  return /*#__PURE__*/React__default.createElement("th", {
70
71
  scope: "col",
71
- className: cx("".concat(blockClass, "__select-all-toggle-on"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), isFirstColumnStickyLeft && windowSize > 671))
72
+ className: cx("".concat(blockClass, "__select-all-toggle-on"), _defineProperty({}, "".concat(blockClass, "__select-all-sticky-left"), isFirstColumnStickyLeft && (windowSize !== null && windowSize !== void 0 ? windowSize : 0) > 671))
72
73
  }, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(Checkbox, _extends({}, selectProps, {
73
74
  name: "".concat(tableId, "-select-all-checkbox-name"),
74
75
  onClick: function onClick(e) {
@@ -81,11 +81,12 @@ var SelectRow = function SelectRow(datagridState) {
81
81
  withStickyColumn = datagridState.withStickyColumn,
82
82
  dispatch = datagridState.dispatch,
83
83
  getRowId = datagridState.getRowId;
84
- var _useState = useState(typeof window !== 'undefined' ? window.innerWidth : ''),
84
+ var _useState = useState(),
85
85
  _useState2 = _slicedToArray(_useState, 2),
86
86
  windowSize = _useState2[0],
87
87
  setWindowSize = _useState2[1];
88
88
  useLayoutEffect(function () {
89
+ setWindowSize(window.innerWidth);
89
90
  function updateSize() {
90
91
  setWindowSize(window.innerWidth);
91
92
  }
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default, { useRef } from 'react';
8
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default, { useState, useEffect, useRef } from 'react';
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import cx from 'classnames';
12
12
  import { pkg } from '../../settings.js';
@@ -51,11 +51,20 @@ var NavItem = function NavItem(_ref) {
51
51
  _ref$tabIndex = _ref.tabIndex,
52
52
  tabIndex = _ref$tabIndex === void 0 ? defaults.tabIndex : _ref$tabIndex,
53
53
  rest = _objectWithoutProperties(_ref, _excluded);
54
+ var _useState = useState(false),
55
+ _useState2 = _slicedToArray(_useState, 2),
56
+ hrefHasDifferentHost = _useState2[0],
57
+ setHrefHasDifferentHost = _useState2[1];
58
+ useEffect(function () {
59
+ if (href.indexOf(window.location.host) === -1) {
60
+ setHrefHasDifferentHost(true);
61
+ }
62
+ }, [href]);
54
63
  var internalId = useRef(uuidv4());
55
64
  var instanceId = "".concat(blockClass, "__").concat(internalId.current);
56
65
  var navItemId = id || instanceId;
57
66
  var isAbsoluteLink = new RegExp('^([a-z]+://|//)', 'i');
58
- var externalLink = isAbsoluteLink.test(href) && href.indexOf(window.location.host) === -1;
67
+ var externalLink = isAbsoluteLink.test(href) && hrefHasDifferentHost;
59
68
  var linkClassName = "".concat(blockClass, "__link");
60
69
  var handleDisabled = function handleDisabled(action) {
61
70
  var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
@@ -15,6 +15,7 @@ import { pkg } from '../../settings.js';
15
15
  import { Toggle, Layer } from '@carbon/react';
16
16
  import { ChevronDown, Locked, WarningFilled, WarningAltFilled } from '@carbon/react/icons';
17
17
  import * as carbonMotion from '@carbon/motion';
18
+ import usePrefersReducedMotion from '../../global/js/hooks/usePrefersReducedMotion.js';
18
19
  import { useControllableState } from '../../global/js/hooks/useControllableState.js';
19
20
 
20
21
  var _Locked;
@@ -71,9 +72,7 @@ var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
71
72
  var isInvalid = invalid;
72
73
  var isWarn = !isInvalid && warn;
73
74
  var isLocked = !isInvalid && !isWarn && locked;
74
- var reducedMotion = window && window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
75
- matches: true
76
- };
75
+ var shouldReduceMotion = usePrefersReducedMotion();
77
76
  if (open !== prevIsOpen) {
78
77
  if (isOpen && !open) {
79
78
  collapse();
@@ -83,7 +82,7 @@ var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
83
82
  setPrevIsOpen(open);
84
83
  }
85
84
  function expand() {
86
- if (detailsRef.current && contentRef.current && !reducedMotion.matches) {
85
+ if (detailsRef.current && contentRef.current && !shouldReduceMotion) {
87
86
  setIsOpen(true);
88
87
  detailsRef.current.open = true;
89
88
  var _getComputedStyle = getComputedStyle(contentRef.current),
@@ -112,7 +111,7 @@ var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
112
111
  }
113
112
  }
114
113
  function collapse() {
115
- if (contentRef.current && !reducedMotion.matches) {
114
+ if (contentRef.current && !shouldReduceMotion) {
116
115
  setClosing(true);
117
116
  var _getComputedStyle2 = getComputedStyle(contentRef.current),
118
117
  paddingTop = _getComputedStyle2.paddingTop,
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useState, useRef, useEffect, useCallback } from 'react';
10
- import { motion, useReducedMotion, AnimatePresence } from 'framer-motion';
10
+ import { motion, AnimatePresence } from 'framer-motion';
11
11
  import PropTypes from '../../node_modules/prop-types/index.js';
12
12
  import cx from 'classnames';
13
13
  import { moderate02 } from '@carbon/motion';
@@ -19,6 +19,7 @@ import { Button, IconButton } from '@carbon/react';
19
19
  import { ArrowLeft, Close } from '@carbon/react/icons';
20
20
  import { actionSetVariants, overlayVariants, panelVariants } from './motion/variants.js';
21
21
  import pconsole from '../../global/js/utils/pconsole.js';
22
+ import usePrefersReducedMotion from '../../global/js/hooks/usePrefersReducedMotion.js';
22
23
  import { ActionSet } from '../ActionSet/ActionSet.js';
23
24
  import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
24
25
  import { useFocus } from '../../global/js/hooks/useFocus.js';
@@ -44,7 +45,6 @@ var defaults = {
44
45
  * Side panels keep users in-context of a page while performing tasks like navigating, editing, viewing details, or configuring something new.
45
46
  */
46
47
  var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
47
- var _window;
48
48
  var actionToolbarButtons = _ref.actionToolbarButtons,
49
49
  actions = _ref.actions,
50
50
  _ref$animateTitle = _ref.animateTitle,
@@ -111,7 +111,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
111
111
  keyDownListener = _useFocus.keyDownListener;
112
112
  var panelRefValue = sidePanelRef.current;
113
113
  var previousOpen = usePreviousValue(open);
114
- var shouldReduceMotion = useReducedMotion();
114
+ var shouldReduceMotion = usePrefersReducedMotion();
115
115
 
116
116
  // Title animation on scroll related state
117
117
  var _useState7 = useState(0),
@@ -154,9 +154,6 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
154
154
  titleItemsStyles(animationProgress);
155
155
  }
156
156
  }, [doAnimateTitle, panelRefValue === null || panelRefValue === void 0 ? void 0 : panelRefValue.style, scrollAnimationDistance, titleItemsStyles]);
157
- var reducedMotion = typeof document !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
158
- matches: true
159
- };
160
157
 
161
158
  // scroll panel to top going between steps
162
159
  useEffect(function () {
@@ -193,7 +190,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
193
190
  }, [launcherButtonRef, open, previousOpen]);
194
191
  var checkSetDoAnimateTitle = function checkSetDoAnimateTitle() {
195
192
  var canDoAnimateTitle = false;
196
- if (panelRefValue && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !reducedMotion.matches) {
193
+ if (panelRefValue && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !shouldReduceMotion) {
197
194
  var _labelTextRef$current3, _labelTextRef$current4, _subtitleRef$current$, _subtitleRef$current;
198
195
  var titleEl = titleRef.current;
199
196
  var labelHeight = (_labelTextRef$current3 = labelTextRef === null || labelTextRef === void 0 || (_labelTextRef$current4 = labelTextRef.current) === null || _labelTextRef$current4 === void 0 ? void 0 : _labelTextRef$current4.offsetHeight) !== null && _labelTextRef$current3 !== void 0 ? _labelTextRef$current3 : 0;
@@ -209,8 +206,8 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
209
206
  panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-distance"), _scrollAnimationDistance.toString());
210
207
  var scrollEl = innerContentRef.current;
211
208
  if (scrollEl) {
212
- var _window2;
213
- var innerComputed = (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.getComputedStyle(innerContentRef.current);
209
+ var _window;
210
+ var innerComputed = (_window = window) === null || _window === void 0 ? void 0 : _window.getComputedStyle(innerContentRef.current);
214
211
  var innerPaddingHeight = innerComputed ? parseFloat(innerComputed === null || innerComputed === void 0 ? void 0 : innerComputed.paddingTop) + parseFloat(innerComputed === null || innerComputed === void 0 ? void 0 : innerComputed.paddingBottom) : 0;
215
212
  canDoAnimateTitle = (!!labelText || !!actionToolbarButtons || !!subtitle) && scrollEl.scrollHeight - scrollEl.clientHeight >= _scrollAnimationDistance + innerPaddingHeight;
216
213
  }
@@ -228,12 +225,12 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
228
225
 
229
226
  // Calculate scroll distances
230
227
  useEffect(function () {
231
- if (panelRefValue && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !reducedMotion.matches) {
228
+ if (panelRefValue && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !shouldReduceMotion) {
232
229
  checkSetDoAnimateTitle();
233
230
  }
234
231
 
235
232
  // eslint-disable-next-line react-hooks/exhaustive-deps
236
- }, [open, doAnimateTitle /* use do instead of animateTitle directly */, animationComplete, handleScroll, title, size, reducedMotion.matches, id]);
233
+ }, [open, doAnimateTitle /* use do instead of animateTitle directly */, animationComplete, handleScroll, title, size, shouldReduceMotion, id]);
237
234
 
238
235
  // click outside functionality if `includeOverlay` prop is set
239
236
  useEffect(function () {
@@ -269,10 +266,10 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
269
266
  // Set the internal state `animationComplete` to true if
270
267
  // prefers reduced motion is true
271
268
  useEffect(function () {
272
- if (reducedMotion.matches) {
269
+ if (shouldReduceMotion) {
273
270
  setAnimationComplete(true);
274
271
  }
275
- }, [reducedMotion.matches]);
272
+ }, [shouldReduceMotion]);
276
273
 
277
274
  // initializes the side panel to open
278
275
  var onAnimationStart = function onAnimationStart() {
@@ -291,10 +288,10 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
291
288
  }
292
289
  }, [open, placement, selectorPageContent, slideIn]);
293
290
  useEffect(function () {
294
- if (!open && previousState && previousState['open'] && reducedMotion.matches) {
291
+ if (!open && previousState && previousState['open'] && shouldReduceMotion) {
295
292
  onUnmount === null || onUnmount === void 0 || onUnmount();
296
293
  }
297
- }, [open, onUnmount, reducedMotion.matches, previousState]);
294
+ }, [open, onUnmount, shouldReduceMotion, previousState]);
298
295
 
299
296
  // used to set margins of content for slide in panel version
300
297
  useEffect(function () {
@@ -307,15 +304,15 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
307
304
  }
308
305
  if (placement && placement === 'right' && pageContentElement) {
309
306
  pageContentElement.style.marginInlineEnd = '0';
310
- pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-end ".concat(moderate02) : '';
307
+ pageContentElement.style.transition = !shouldReduceMotion ? "margin-inline-end ".concat(moderate02) : '';
311
308
  pageContentElement.style.marginInlineEnd = SIDE_PANEL_SIZES[size];
312
309
  } else if (pageContentElement) {
313
310
  pageContentElement.style.marginInlineStart = '0';
314
- pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-start ".concat(moderate02) : '';
311
+ pageContentElement.style.transition = !shouldReduceMotion ? "margin-inline-start ".concat(moderate02) : '';
315
312
  pageContentElement.style.marginInlineStart = SIDE_PANEL_SIZES[size];
316
313
  }
317
314
  }
318
- }, [slideIn, selectorPageContent, placement, size, reducedMotion.matches, open]);
315
+ }, [slideIn, selectorPageContent, placement, size, shouldReduceMotion, open]);
319
316
  useEffect(function () {
320
317
  if (open) {
321
318
  setTimeout(function () {
@@ -341,7 +338,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
341
338
  className: "".concat(blockClass, "__title-text"),
342
339
  title: title,
343
340
  "aria-hidden": false
344
- }, title), doAnimateTitle && !reducedMotion.matches && /*#__PURE__*/React__default.createElement("h2", {
341
+ }, title), doAnimateTitle && !shouldReduceMotion && /*#__PURE__*/React__default.createElement("h2", {
345
342
  className: "".concat(blockClass, "__collapsed-title-text"),
346
343
  title: title,
347
344
  "aria-hidden": true
@@ -358,7 +355,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
358
355
  });
359
356
  }
360
357
  return /*#__PURE__*/React__default.createElement("div", {
361
- className: cx("".concat(blockClass, "__header"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__header--on-detail-step"), currentStep > 0), "".concat(blockClass, "__header--no-title-animation"), !animateTitle), "".concat(blockClass, "__header--reduced-motion"), reducedMotion.matches), "".concat(blockClass, "__header--has-title"), title)),
358
+ className: cx("".concat(blockClass, "__header"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__header--on-detail-step"), currentStep > 0), "".concat(blockClass, "__header--no-title-animation"), !animateTitle), "".concat(blockClass, "__header--reduced-motion"), shouldReduceMotion), "".concat(blockClass, "__header--has-title"), title)),
362
359
  ref: headerRef
363
360
  }, currentStep > 0 && /*#__PURE__*/React__default.createElement(Button, {
364
361
  "aria-label": navigationBackIconDescription,
@@ -16,15 +16,13 @@ export namespace overlayVariants {
16
16
  }
17
17
  }
18
18
  export namespace panelVariants {
19
- export function visible_1({ shouldReduceMotion }: {
20
- shouldReduceMotion: any;
21
- }): {
19
+ export function visible_1(): {
22
20
  x: number;
23
21
  transition: {
24
22
  duration: number;
25
23
  ease: number[];
26
24
  };
27
- opacity: any;
25
+ opacity: number;
28
26
  };
29
27
  export { visible_1 as visible };
30
28
  export function hidden_1({ placement, shouldReduceMotion }: {
@@ -32,7 +30,7 @@ export namespace panelVariants {
32
30
  shouldReduceMotion: any;
33
31
  }): {
34
32
  x: string | number;
35
- opacity: any;
33
+ opacity: number;
36
34
  };
37
35
  export { hidden_1 as hidden };
38
36
  export function exit_1({ placement, shouldReduceMotion }: {
@@ -44,7 +42,7 @@ export namespace panelVariants {
44
42
  duration: number;
45
43
  ease: number[];
46
44
  };
47
- opacity: any;
45
+ opacity: number;
48
46
  };
49
47
  export { exit_1 as exit };
50
48
  }
@@ -23,35 +23,34 @@ var overlayVariants = {
23
23
  }
24
24
  };
25
25
  var panelVariants = {
26
- visible: function visible(_ref) {
27
- var shouldReduceMotion = _ref.shouldReduceMotion;
26
+ visible: function visible() {
28
27
  return {
29
28
  x: 0,
30
29
  transition: {
31
30
  duration: DURATIONS.moderate02,
32
31
  ease: EASINGS.productive.standard
33
32
  },
34
- opacity: shouldReduceMotion && 1
33
+ opacity: 1
35
34
  };
36
35
  },
37
- hidden: function hidden(_ref2) {
38
- var placement = _ref2.placement,
39
- shouldReduceMotion = _ref2.shouldReduceMotion;
36
+ hidden: function hidden(_ref) {
37
+ var placement = _ref.placement,
38
+ shouldReduceMotion = _ref.shouldReduceMotion;
40
39
  return {
41
40
  x: placement === 'right' ? shouldReduceMotion ? 0 : '100%' : shouldReduceMotion ? 0 : -320,
42
- opacity: shouldReduceMotion && 0
41
+ opacity: shouldReduceMotion ? 0 : 1
43
42
  };
44
43
  },
45
- exit: function exit(_ref3) {
46
- var placement = _ref3.placement,
47
- shouldReduceMotion = _ref3.shouldReduceMotion;
44
+ exit: function exit(_ref2) {
45
+ var placement = _ref2.placement,
46
+ shouldReduceMotion = _ref2.shouldReduceMotion;
48
47
  return {
49
48
  x: placement === 'right' ? shouldReduceMotion ? 0 : '100%' : shouldReduceMotion ? 0 : -320,
50
49
  transition: {
51
50
  duration: DURATIONS.moderate01,
52
51
  ease: EASINGS.productive.exit
53
52
  },
54
- opacity: shouldReduceMotion && 0
53
+ opacity: shouldReduceMotion ? 0 : 1
55
54
  };
56
55
  }
57
56
  };
@@ -313,7 +313,9 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
313
313
  // The display name of the component, used by React. Note that displayName
314
314
  // is used in preference to relying on function.name.
315
315
  TearsheetShell.displayName = componentName;
316
- var portalType = typeof Element === 'undefined' ? PropTypes.object : PropTypes.instanceOf(Element);
316
+ var portalType = typeof Element === 'undefined' ? PropTypes.object
317
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
318
+ : PropTypes.instanceOf(Element);
317
319
  var deprecatedProps = {
318
320
  /**
319
321
  * **Deprecated**
@@ -15,6 +15,7 @@ import { OverflowMenu, OverflowMenuItem, Button, Theme } from '@carbon/react';
15
15
  import { moderate02 } from '@carbon/motion';
16
16
  import { useWebTerminal } from './hooks/index.js';
17
17
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
18
+ import usePrefersReducedMotion from '../../global/js/hooks/usePrefersReducedMotion.js';
18
19
 
19
20
  var _excluded = ["actions", "children", "className", "closeIconDescription", "documentationLinks", "documentationLinksIconDescription", "isInitiallyOpen", "webTerminalAriaLabel"];
20
21
 
@@ -56,10 +57,7 @@ var WebTerminal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
56
57
  _useState2 = _slicedToArray(_useState, 2),
57
58
  shouldRender = _useState2[0],
58
59
  setRender = _useState2[1];
59
- var _ref2 = window && window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
60
- matches: true
61
- },
62
- prefersReducedMotion = _ref2.matches;
60
+ var shouldReduceMotion = usePrefersReducedMotion();
63
61
  var webTerminalAnimationName = "".concat(open ? 'web-terminal-entrance' : 'web-terminal-exit forwards', " ").concat(moderate02);
64
62
  var showDocumentationLinks = useMemo(function () {
65
63
  return documentationLinks.length > 0;
@@ -92,7 +90,7 @@ var WebTerminal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
92
90
  If the user prefers reduced motion, we have to manually set render to false
93
91
  because onAnimationEnd will never be called.
94
92
  */
95
- if (prefersReducedMotion) {
93
+ if (shouldReduceMotion) {
96
94
  setRender(false);
97
95
  }
98
96
  closeWebTerminal === null || closeWebTerminal === void 0 || closeWebTerminal();
@@ -101,7 +99,7 @@ var WebTerminal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
101
99
  ref: ref,
102
100
  className: cx([blockClass, className, _defineProperty(_defineProperty({}, "".concat(blockClass, "--open"), open), "".concat(blockClass, "--closed"), !open)]),
103
101
  style: {
104
- animation: !prefersReducedMotion ? webTerminalAnimationName : ''
102
+ animation: !shouldReduceMotion ? webTerminalAnimationName : ''
105
103
  },
106
104
  onAnimationEnd: onAnimationEnd
107
105
  }), /*#__PURE__*/React__default.createElement("header", {
@@ -119,15 +117,15 @@ var WebTerminal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
119
117
  "aria-label": documentationLinksIconDescription,
120
118
  menuOptionsClass: "".concat(blockClass, "__documentation-overflow"),
121
119
  size: "lg"
122
- }, documentationLinks.map(function (_ref4, i) {
123
- var rest = _extends({}, (_objectDestructuringEmpty(_ref4), _ref4));
120
+ }, documentationLinks.map(function (_ref3, i) {
121
+ var rest = _extends({}, (_objectDestructuringEmpty(_ref3), _ref3));
124
122
  return /*#__PURE__*/React__default.createElement(OverflowMenuItem, _extends({
125
123
  key: i
126
124
  }, rest));
127
- })), actions.map(function (_ref5) {
128
- var renderIcon = _ref5.renderIcon,
129
- onClick = _ref5.onClick,
130
- iconDescription = _ref5.iconDescription;
125
+ })), actions.map(function (_ref4) {
126
+ var renderIcon = _ref4.renderIcon,
127
+ onClick = _ref4.onClick,
128
+ iconDescription = _ref4.iconDescription;
131
129
  return /*#__PURE__*/React__default.createElement(Button, {
132
130
  key: iconDescription,
133
131
  hasIconOnly: true,
@@ -6,20 +6,26 @@
6
6
  */
7
7
 
8
8
  import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
- import { useState, useEffect } from 'react';
10
- import { hasDocument } from '../utils/window.js';
9
+ import { useState } from 'react';
10
+ import { useIsomorphicEffect } from './useIsomorphicEffect.js';
11
11
 
12
12
  var usePrefersReducedMotion = function usePrefersReducedMotion() {
13
13
  var _useState = useState(false),
14
14
  _useState2 = _slicedToArray(_useState, 2),
15
15
  prefersReducedMotion = _useState2[0],
16
16
  setPrefersReducedMotion = _useState2[1];
17
- useEffect(function () {
18
- if (hasDocument()) {
19
- var _window$matchMedia = window.matchMedia('(prefers-reduced-motion: reduce)'),
20
- matches = _window$matchMedia.matches;
21
- setPrefersReducedMotion(matches);
22
- }
17
+ useIsomorphicEffect(function () {
18
+ var mediaQueryList = window.matchMedia('(prefers-reduced-motion: no-preference)');
19
+ var _window$matchMedia = window.matchMedia('(prefers-reduced-motion: no-preference)'),
20
+ matches = _window$matchMedia.matches;
21
+ setPrefersReducedMotion(!matches);
22
+ var listener = function listener(event) {
23
+ setPrefersReducedMotion(!event.matches);
24
+ };
25
+ mediaQueryList.addEventListener('change', listener);
26
+ return function () {
27
+ mediaQueryList.removeEventListener('change', listener);
28
+ };
23
29
  }, []);
24
30
  return prefersReducedMotion;
25
31
  };
@@ -21,6 +21,7 @@ var hooks = require('./utils/hooks.js');
21
21
  var devtools = require('../../global/js/utils/devtools.js');
22
22
  var settings = require('../../settings.js');
23
23
  var lodash = require('lodash');
24
+ var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
24
25
 
25
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
26
27
 
@@ -45,7 +46,6 @@ var defaults = {
45
46
  */
46
47
 
47
48
  exports.Coachmark = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
48
- var _document$querySelect;
49
49
  var _ref$align = _ref.align,
50
50
  align = _ref$align === void 0 ? defaults.align : _ref$align,
51
51
  children = _ref.children,
@@ -64,7 +64,6 @@ exports.Coachmark = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
64
64
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
65
65
  var isBeacon = overlayKind === enums.COACHMARK_OVERLAY_KIND.TOOLTIP;
66
66
  var isStacked = overlayKind === enums.COACHMARK_OVERLAY_KIND.STACKED;
67
- var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
68
67
  var _useState = React.useState(isStacked),
69
68
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
70
69
  isOpen = _useState2[0],
@@ -88,6 +87,11 @@ exports.Coachmark = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
88
87
  var backupRef = React.useRef();
89
88
  var _coachmarkRef = ref || backupRef;
90
89
  var _overlayRef = overlayRef || overlayBackupRef;
90
+ var portalNode = React.useRef(null);
91
+ useIsomorphicEffect.useIsomorphicEffect(function () {
92
+ var _document$querySelect, _document, _document2, _document3;
93
+ portalNode.current = portalTarget ? (_document$querySelect = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.querySelector('body') : (_document3 = document) === null || _document3 === void 0 ? void 0 : _document3.querySelector('body');
94
+ }, [portalTarget]);
91
95
  var closeOverlay = function closeOverlay() {
92
96
  setIsOpen(false);
93
97
  };
@@ -178,18 +182,19 @@ exports.Coachmark = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
178
182
  }, /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
179
183
  className: cx__default["default"](blockClass, "".concat(blockClass, "__").concat(theme), className),
180
184
  ref: _coachmarkRef
181
- }, rest, devtools.getDevtoolsProps(componentName)), target, isOpen && /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default["default"].createElement(CoachmarkOverlay.CoachmarkOverlay, {
185
+ }, rest, devtools.getDevtoolsProps(componentName)), target, isOpen && (portalNode === null || portalNode === void 0 ? void 0 : portalNode.current) && /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default["default"].createElement(CoachmarkOverlay.CoachmarkOverlay, {
182
186
  ref: _overlayRef,
183
187
  fixedIsVisible: false,
184
188
  kind: overlayKind,
185
189
  onClose: handleClose,
186
190
  theme: theme,
187
191
  className: cx__default["default"](overlayClassName, "".concat(overlayBlockClass, "--is-visible"))
188
- }, children),
189
- // Default to `document.body` when `portalNode` is `null`
190
- portalNode || document.body)));
192
+ }, children), // Default to `document.body` when `portalNode` is `null`
193
+ portalNode === null || portalNode === void 0 ? void 0 : portalNode.current)));
191
194
  });
192
- var overlayRefType = typeof HTMLElement === 'undefined' ? index["default"].object : index["default"].instanceOf(HTMLElement);
195
+ var overlayRefType = typeof HTMLElement === 'undefined' ? index["default"].object :
196
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
197
+ index["default"].instanceOf(HTMLElement);
193
198
 
194
199
  // Return a placeholder if not released and not enabled by feature flag
195
200
  exports.Coachmark = settings.pkg.checkComponentEnabled(exports.Coachmark, componentName);
@@ -20,6 +20,8 @@ var CoachmarkOverlay = require('../Coachmark/CoachmarkOverlay.js');
20
20
  var CoachmarkTagline = require('../Coachmark/CoachmarkTagline.js');
21
21
  var context = require('../Coachmark/utils/context.js');
22
22
  var enums = require('../Coachmark/utils/enums.js');
23
+ var framerMotion = require('framer-motion');
24
+ var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
23
25
 
24
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
25
27
 
@@ -48,7 +50,6 @@ var defaults = {
48
50
  * This variant allows the a coachmark overlay to be displayed by interacting with the tagline.
49
51
  */
50
52
  exports.CoachmarkFixed = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
51
- var _document$querySelect;
52
53
  var children = _ref.children,
53
54
  className = _ref.className,
54
55
  _ref$onClose = _ref.onClose,
@@ -60,7 +61,7 @@ exports.CoachmarkFixed = /*#__PURE__*/React__default["default"].forwardRef(funct
60
61
  theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
61
62
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
62
63
  var overlayRef = React.useRef(null);
63
- var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
64
+ var portalNode = React.useRef(null);
64
65
  var _useState = React.useState(false),
65
66
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
66
67
  isOpen = _useState2[0],
@@ -84,17 +85,19 @@ exports.CoachmarkFixed = /*#__PURE__*/React__default["default"].forwardRef(funct
84
85
  _useState10 = _rollupPluginBabelHelpers.slicedToArray(_useState9, 2),
85
86
  fixedIsVisible = _useState10[0],
86
87
  setFixedIsVisible = _useState10[1];
87
- var prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
88
+ var shouldReduceMotion = framerMotion.useReducedMotion();
89
+ useIsomorphicEffect.useIsomorphicEffect(function () {
90
+ var _document$querySelect, _document, _document2, _document3;
91
+ portalNode.current = portalTarget ? (_document$querySelect = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.querySelector('body') : (_document3 = document) === null || _document3 === void 0 ? void 0 : _document3.querySelector('body');
92
+ }, [portalTarget]);
88
93
  var handleClose = React.useCallback(function () {
89
- console.log('HANDLING CLOSE HERE...');
90
- if (prefersReducedMotion.matches) {
94
+ if (shouldReduceMotion) {
91
95
  setIsOpen(false);
92
96
  } else {
93
97
  setFixedIsVisible(false);
94
98
  }
95
- }, [prefersReducedMotion.matches]);
99
+ }, [shouldReduceMotion]);
96
100
  var handleTransitionEnd = function handleTransitionEnd(e) {
97
- console.log('Here at transition end... ', e.propertyName === 'transform' && !fixedIsVisible);
98
101
  if (e.propertyName === 'transform' && !fixedIsVisible) {
99
102
  setIsOpen(false);
100
103
  onClose();
@@ -173,7 +176,7 @@ exports.CoachmarkFixed = /*#__PURE__*/React__default["default"].forwardRef(funct
173
176
  }, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement(CoachmarkTagline.CoachmarkTagline, {
174
177
  title: tagline,
175
178
  onClose: onClose
176
- }), isOpen && /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default["default"].createElement(CoachmarkOverlay.CoachmarkOverlay, {
179
+ }), isOpen && (portalNode === null || portalNode === void 0 ? void 0 : portalNode.current) && /*#__PURE__*/reactDom.createPortal( /*#__PURE__*/React__default["default"].createElement(CoachmarkOverlay.CoachmarkOverlay, {
177
180
  ref: overlayRef,
178
181
  fixedIsVisible: fixedIsVisible,
179
182
  kind: enums.COACHMARK_OVERLAY_KIND.FIXED,
@@ -181,9 +184,8 @@ exports.CoachmarkFixed = /*#__PURE__*/React__default["default"].forwardRef(funct
181
184
  onTransitionEnd: handleTransitionEnd,
182
185
  theme: theme,
183
186
  className: cx__default["default"](fixedIsVisible && "".concat(overlayBlockClass, "--is-visible"), overlayBlockClass)
184
- }, children),
185
- // Default to `document.body` when `portalNode` is `null`
186
- portalNode || document.body)));
187
+ }, children), // Default to `document.body` when `portalNode` is `null`
188
+ portalNode === null || portalNode === void 0 ? void 0 : portalNode.current)));
187
189
  });
188
190
 
189
191
  // Return a placeholder if not released and not enabled by feature flag
@@ -21,6 +21,7 @@ var CoachmarkStackHome = require('./CoachmarkStackHome.js');
21
21
  var CoachmarkTagline = require('../Coachmark/CoachmarkTagline.js');
22
22
  var context = require('../Coachmark/utils/context.js');
23
23
  var enums = require('../Coachmark/utils/enums.js');
24
+ var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
24
25
 
25
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
26
27
 
@@ -56,7 +57,6 @@ var defaults = {
56
57
  * This variant allows the stacking of multiple coachmark overlays to be displayed by interacting with the tagline.
57
58
  */
58
59
  exports.CoachmarkStack = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
59
- var _document$querySelect;
60
60
  var children = _ref.children,
61
61
  className = _ref.className,
62
62
  _ref$onClose = _ref.onClose,
@@ -72,7 +72,11 @@ exports.CoachmarkStack = /*#__PURE__*/React__default["default"].forwardRef(funct
72
72
  theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
73
73
  title = _ref.title,
74
74
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
75
- var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
75
+ var portalNode = React.useRef();
76
+ useIsomorphicEffect.useIsomorphicEffect(function () {
77
+ var _document$querySelect, _document, _document2, _document3;
78
+ portalNode.current = portalTarget ? (_document$querySelect = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.querySelector('body') : (_document3 = document) === null || _document3 === void 0 ? void 0 : _document3.querySelector('body');
79
+ }, [portalTarget]);
76
80
  var stackHomeRef = React.useRef();
77
81
  var stackedCoachmarkRefs = React.useRef([]);
78
82
  var _useState = React.useState(false),
@@ -215,7 +219,7 @@ exports.CoachmarkStack = /*#__PURE__*/React__default["default"].forwardRef(funct
215
219
  portalTarget: portalTarget,
216
220
  closeButtonLabel: closeButtonLabel,
217
221
  title: title
218
- }), /*#__PURE__*/reactDom.createPortal(wrappedChildren, portalNode)));
222
+ }), portalNode !== null && portalNode !== void 0 && portalNode.current ? /*#__PURE__*/reactDom.createPortal(wrappedChildren, portalNode === null || portalNode === void 0 ? void 0 : portalNode.current) : null));
219
223
  });
220
224
 
221
225
  // Return a placeholder if not released and not enabled by feature flag