@carbon/ibm-products 2.44.0 → 2.45.0-rc.0

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 (195) hide show
  1. package/css/index-full-carbon.css +118 -15
  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-released-only.css +203 -5
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +118 -15
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +118 -15
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/Coachmark/Coachmark.js +12 -7
  18. package/es/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
  19. package/es/components/CoachmarkStack/CoachmarkStack.js +7 -3
  20. package/es/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
  21. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +35 -22
  22. package/es/components/ConditionBuilder/ConditionBuilder.js +17 -7
  23. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
  24. package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +58 -36
  25. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
  26. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +23 -11
  27. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
  28. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +14 -4
  29. package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +8 -4
  30. package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +17 -9
  31. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +29 -16
  32. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
  33. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
  34. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
  35. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +23 -20
  36. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
  37. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
  38. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
  39. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +49 -23
  40. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
  41. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
  42. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +12 -9
  43. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +9 -4
  44. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +10 -5
  45. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
  46. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +19 -7
  47. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
  48. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +70 -17
  49. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  50. package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +31 -14
  51. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
  52. package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +120 -28
  53. package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
  54. package/es/components/ConditionBuilder/utils/useTranslations.js +26 -0
  55. package/es/components/ConditionBuilder/utils/util.js +1 -9
  56. package/es/components/CreateFullPage/CreateFullPage.js +2 -2
  57. package/es/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
  58. package/es/components/DataSpreadsheet/DataSpreadsheet.js +25 -7
  59. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
  60. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
  61. package/es/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
  62. package/es/components/Datagrid/Datagrid/Datagrid.js +2 -8
  63. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
  64. package/es/components/Datagrid/Datagrid/DatagridRow.js +8 -6
  65. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
  66. package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
  67. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
  68. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
  69. package/es/components/Datagrid/types/index.d.ts +28 -6
  70. package/es/components/Datagrid/useCustomizeColumns.d.ts +8 -1
  71. package/es/components/Datagrid/useCustomizeColumns.js +4 -3
  72. package/es/components/Datagrid/useDefaultStringRenderer.js +0 -1
  73. package/es/components/Datagrid/useNestedRowExpander.js +1 -3
  74. package/es/components/Datagrid/useRowExpander.js +1 -3
  75. package/es/components/Datagrid/useSelectRows.js +2 -1
  76. package/es/components/Datagrid/useStickyColumn.d.ts +8 -1
  77. package/es/components/Datagrid/useStickyColumn.js +12 -9
  78. package/es/components/EditInPlace/EditInPlace.d.ts +4 -0
  79. package/es/components/EditInPlace/EditInPlace.js +21 -10
  80. package/es/components/EditTearsheet/EditTearsheet.d.ts +2 -1
  81. package/es/components/EditTearsheet/EditTearsheet.js +44 -9
  82. package/es/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
  83. package/es/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
  84. package/es/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
  85. package/es/components/Nav/NavItem.js +12 -3
  86. package/es/components/OptionsTile/OptionsTile.js +11 -6
  87. package/es/components/PageHeader/PageHeader.js +1 -0
  88. package/es/components/SearchBar/SearchBar.d.ts +1 -1
  89. package/es/components/SearchBar/SearchBar.js +2 -2
  90. package/es/components/SidePanel/SidePanel.js +17 -21
  91. package/es/components/SidePanel/motion/variants.d.ts +4 -6
  92. package/es/components/SidePanel/motion/variants.js +10 -11
  93. package/es/components/Tearsheet/TearsheetShell.js +3 -1
  94. package/es/components/WebTerminal/WebTerminal.js +10 -12
  95. package/es/global/js/hooks/usePrefersReducedMotion.js +14 -8
  96. package/es/global/js/package-settings.d.ts +1 -1
  97. package/es/global/js/package-settings.js +1 -1
  98. package/es/settings.d.ts +1 -1
  99. package/lib/components/Coachmark/Coachmark.js +12 -7
  100. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +13 -11
  101. package/lib/components/CoachmarkStack/CoachmarkStack.js +7 -3
  102. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +8 -4
  103. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +34 -21
  104. package/lib/components/ConditionBuilder/ConditionBuilder.js +17 -7
  105. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.d.ts +2 -2
  106. package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +56 -33
  107. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +3 -1
  108. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +22 -10
  109. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +4 -1
  110. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +13 -3
  111. package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +6 -2
  112. package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +16 -8
  113. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +28 -15
  114. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +12 -6
  115. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +20 -7
  116. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +2 -1
  117. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +22 -20
  118. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +37 -39
  119. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +37 -38
  120. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -1
  121. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +48 -22
  122. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +3 -1
  123. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +24 -9
  124. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +11 -8
  125. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +8 -3
  126. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +9 -4
  127. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +5 -1
  128. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +18 -6
  129. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
  130. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +68 -15
  131. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.d.ts +3 -1
  132. package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +30 -13
  133. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.d.ts +1 -1
  134. package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +119 -27
  135. package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -0
  136. package/lib/components/ConditionBuilder/utils/useTranslations.js +30 -0
  137. package/lib/components/ConditionBuilder/utils/util.js +0 -9
  138. package/lib/components/CreateFullPage/CreateFullPage.js +2 -2
  139. package/lib/components/DataSpreadsheet/DataSpreadsheet.d.ts +8 -0
  140. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +25 -7
  141. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.d.ts +8 -0
  142. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +13 -3
  143. package/lib/components/Datagrid/Datagrid/Datagrid.d.ts +0 -4
  144. package/lib/components/Datagrid/Datagrid/Datagrid.js +2 -8
  145. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +12 -7
  146. package/lib/components/Datagrid/Datagrid/DatagridRow.js +8 -6
  147. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +2 -1
  148. package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +3 -2
  149. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterProvider.js +1 -1
  150. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +1 -2
  151. package/lib/components/Datagrid/types/index.d.ts +28 -6
  152. package/lib/components/Datagrid/useCustomizeColumns.d.ts +8 -1
  153. package/lib/components/Datagrid/useCustomizeColumns.js +4 -3
  154. package/lib/components/Datagrid/useDefaultStringRenderer.js +0 -1
  155. package/lib/components/Datagrid/useNestedRowExpander.js +1 -3
  156. package/lib/components/Datagrid/useRowExpander.js +1 -3
  157. package/lib/components/Datagrid/useSelectRows.js +2 -1
  158. package/lib/components/Datagrid/useStickyColumn.d.ts +8 -1
  159. package/lib/components/Datagrid/useStickyColumn.js +12 -9
  160. package/lib/components/EditInPlace/EditInPlace.d.ts +4 -0
  161. package/lib/components/EditInPlace/EditInPlace.js +21 -10
  162. package/lib/components/EditTearsheet/EditTearsheet.d.ts +2 -1
  163. package/lib/components/EditTearsheet/EditTearsheet.js +43 -8
  164. package/lib/components/HTTPErrors/assets/HTTPErrorSvg403.js +204 -200
  165. package/lib/components/HTTPErrors/assets/HTTPErrorSvg404.js +116 -112
  166. package/lib/components/HTTPErrors/assets/HTTPErrorSvgOther.js +110 -106
  167. package/lib/components/Nav/NavItem.js +10 -1
  168. package/lib/components/OptionsTile/OptionsTile.js +11 -6
  169. package/lib/components/PageHeader/PageHeader.js +1 -0
  170. package/lib/components/SearchBar/SearchBar.d.ts +1 -1
  171. package/lib/components/SearchBar/SearchBar.js +2 -2
  172. package/lib/components/SidePanel/SidePanel.js +16 -20
  173. package/lib/components/SidePanel/motion/variants.d.ts +4 -6
  174. package/lib/components/SidePanel/motion/variants.js +10 -11
  175. package/lib/components/Tearsheet/TearsheetShell.js +3 -1
  176. package/lib/components/WebTerminal/WebTerminal.js +10 -12
  177. package/lib/global/js/hooks/usePrefersReducedMotion.js +13 -7
  178. package/lib/global/js/package-settings.d.ts +1 -1
  179. package/lib/global/js/package-settings.js +1 -1
  180. package/lib/settings.d.ts +1 -1
  181. package/package.json +4 -4
  182. package/scss/components/ConditionBuilder/_condition-builder.scss +1 -1
  183. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +5 -1
  184. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +8 -4
  185. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +9 -2
  186. package/scss/components/Datagrid/_datagrid.scss +0 -4
  187. package/scss/components/HTTPErrors/_http-errors.scss +77 -0
  188. package/scss/components/OptionsTile/_options-tile.scss +6 -6
  189. package/scss/components/SidePanel/_side-panel.scss +1 -1
  190. package/scss/components/_index-released-only.scss +1 -0
  191. package/telemetry.yml +12 -2
  192. package/es/global/js/utils/window.d.ts +0 -2
  193. package/es/global/js/utils/window.js +0 -12
  194. package/lib/global/js/utils/window.d.ts +0 -2
  195. package/lib/global/js/utils/window.js +0 -16
@@ -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,
@@ -164,6 +163,12 @@ var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
164
163
  var Icon = null;
165
164
  var text = summary;
166
165
  var summaryClasses = ["".concat(blockClass, "__summary")];
166
+ if (closing) {
167
+ summaryClasses.push("".concat(blockClass, "__summary--closing"));
168
+ }
169
+ if (isOpen) {
170
+ summaryClasses.push("".concat(blockClass, "__summary--open"));
171
+ }
167
172
  if (invalid) {
168
173
  Icon = WarningFilled;
169
174
  text = invalidText;
@@ -227,7 +232,7 @@ var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
227
232
  onClick: toggle
228
233
  }, /*#__PURE__*/React__default.createElement(ChevronDown, {
229
234
  size: 16,
230
- className: "".concat(blockClass, "__chevron")
235
+ className: cx("".concat(blockClass, "__chevron"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__chevron--open"), isOpen), "".concat(blockClass, "__chevron--closing"), closing))
231
236
  }), renderTitle()), /*#__PURE__*/React__default.createElement("div", {
232
237
  className: "".concat(blockClass, "__content"),
233
238
  ref: contentRef
@@ -27,6 +27,7 @@ import { ButtonSetWithOverflow } from '../ButtonSetWithOverflow/ButtonSetWithOve
27
27
 
28
28
  var _excluded = ["actionBarItems", "actionBarMenuOptionsClass", "actionBarOverflowAriaLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTitle", "hasBackgroundAlways", "breadcrumbOverflowAriaLabel", "breadcrumbs", "children", "className", "collapseHeader", "collapseHeaderIconDescription", "collapseTitle", "disableBreadcrumbScroll", "enableBreadcrumbScroll", "expandHeaderIconDescription", "fullWidthGrid", "hasCollapseHeaderToggle", "narrowGrid", "navigation", "pageActions", "pageActionsOverflowLabel", "pageActionsMenuOptionsClass", "showAllTagsLabel", "subtitle", "tags", "title", "withoutBackground", "breadcrumbOverflowTooltipAlign"];
29
29
  var componentName = 'PageHeader';
30
+ pkg._silenceWarnings(true);
30
31
  pkg.component.ActionBar = true;
31
32
 
32
33
  // Default values for props
@@ -17,7 +17,7 @@ interface SearchBarProps extends PropsWithChildren {
17
17
  */
18
18
  hideScopesLabel?: boolean;
19
19
  /** @type {string} The label text for the search text input. */
20
- labelText?: string;
20
+ labelText: string;
21
21
  /** @type {Function} Function handler for when the user changes their query search. */
22
22
  onChange?: (event: any) => void;
23
23
  /** @type {Function} Function handler for when the user submits a search. */
@@ -135,7 +135,7 @@ var SearchBar = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
135
135
  })) : null, /*#__PURE__*/React__default.createElement(Search, {
136
136
  className: "".concat(blockClass, "__input"),
137
137
  closeButtonLabelText: clearButtonLabelText,
138
- labelText: labelText || '',
138
+ labelText: labelText,
139
139
  name: "search-input",
140
140
  onChange: handleInputChange,
141
141
  placeholder: placeholderText,
@@ -188,7 +188,7 @@ SearchBar.propTypes = _objectSpread2({
188
188
  */
189
189
  hideScopesLabel: PropTypes.bool,
190
190
  /** @type {string} The label text for the search text input. */
191
- labelText: PropTypes.string,
191
+ labelText: PropTypes.string.isRequired,
192
192
  /** @type {Function} Function handler for when the user changes their query search. */
193
193
  onChange: PropTypes.func,
194
194
  /** @type {Function} Function handler for when the user submits a search. */
@@ -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,10 +355,9 @@ 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
- "aria-label": navigationBackIconDescription,
365
361
  kind: "ghost",
366
362
  size: slugCloseSize,
367
363
  disabled: false,
@@ -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
  };
@@ -39,6 +39,7 @@ declare namespace defaults {
39
39
  let ErrorEmptyState: boolean;
40
40
  let ExportModal: boolean;
41
41
  let ExpressiveCard: boolean;
42
+ let FullPageError: boolean;
42
43
  let HTTPError403: boolean;
43
44
  let HTTPError404: boolean;
44
45
  let HTTPErrorOther: boolean;
@@ -80,7 +81,6 @@ declare namespace defaults {
80
81
  let BigNumbers: boolean;
81
82
  let TruncatedList: boolean;
82
83
  let DelimitedList: boolean;
83
- let FullPageError: boolean;
84
84
  let ScrollGradient: boolean;
85
85
  let StringFormatter: boolean;
86
86
  let StatusIndicator: boolean;
@@ -37,6 +37,7 @@ var defaults = {
37
37
  ErrorEmptyState: true,
38
38
  ExportModal: true,
39
39
  ExpressiveCard: true,
40
+ FullPageError: true,
40
41
  HTTPError403: true,
41
42
  HTTPError404: true,
42
43
  HTTPErrorOther: true,
@@ -79,7 +80,6 @@ var defaults = {
79
80
  BigNumbers: false,
80
81
  TruncatedList: false,
81
82
  DelimitedList: false,
82
- FullPageError: false,
83
83
  ScrollGradient: false,
84
84
  StringFormatter: false,
85
85
  StatusIndicator: false,
package/es/settings.d.ts CHANGED
@@ -25,6 +25,7 @@ export const pkg: {
25
25
  ErrorEmptyState: boolean;
26
26
  ExportModal: boolean;
27
27
  ExpressiveCard: boolean;
28
+ FullPageError: boolean;
28
29
  HTTPError403: boolean;
29
30
  HTTPError404: boolean;
30
31
  HTTPErrorOther: boolean;
@@ -66,7 +67,6 @@ export const pkg: {
66
67
  BigNumbers: boolean;
67
68
  TruncatedList: boolean;
68
69
  DelimitedList: boolean;
69
- FullPageError: boolean;
70
70
  ScrollGradient: boolean;
71
71
  StringFormatter: boolean;
72
72
  StatusIndicator: boolean;
@@ -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