@carbon/ibm-products 2.36.0 → 2.37.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. package/css/index-full-carbon.css +5404 -5117
  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 +4 -4
  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 +820 -61
  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 +329 -6
  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/_virtual/_rollupPluginBabelHelpers.js +9 -10
  18. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
  19. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
  20. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
  21. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +261 -0
  22. package/es/components/ConditionBuilder/ConditionBuilder.js +45 -16
  23. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
  24. package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +40 -0
  25. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
  26. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +74 -0
  27. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
  28. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
  29. package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
  30. package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
  31. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
  32. package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +112 -0
  33. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
  34. package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +40 -0
  35. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
  36. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +151 -0
  37. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
  38. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +59 -0
  39. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
  40. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +52 -0
  41. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
  42. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +162 -0
  43. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
  44. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +40 -0
  45. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
  46. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +82 -0
  47. package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
  48. package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +85 -0
  49. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
  50. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +145 -0
  51. package/es/components/ConditionBuilder/utils/util.d.ts +4 -0
  52. package/es/components/ConditionBuilder/utils/util.js +16 -0
  53. package/es/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
  54. package/es/components/CreateTearsheet/CreateTearsheet.js +12 -32
  55. package/es/components/Datagrid/useParentDimensions.js +1 -1
  56. package/es/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
  57. package/es/components/EditUpdateCards/EditUpdateCards.js +3 -0
  58. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
  59. package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
  60. package/es/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
  61. package/es/components/ExpressiveCard/ExpressiveCard.js +4 -0
  62. package/es/components/InlineTip/InlineTipButton.d.ts +21 -2
  63. package/es/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
  64. package/es/components/InterstitialScreen/InterstitialScreen.js +25 -14
  65. package/es/components/Nav/NavItem.js +1 -1
  66. package/es/components/NotificationsPanel/NotificationsPanel.js +5 -6
  67. package/es/components/PageHeader/PageHeader.js +12 -3
  68. package/es/components/SidePanel/SidePanel.js +1 -1
  69. package/es/components/SimpleHeader/SimpleHeader.d.ts +1 -5
  70. package/es/components/SimpleHeader/SimpleHeader.js +2 -4
  71. package/es/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
  72. package/es/components/Tearsheet/TearsheetShell.d.ts +119 -10
  73. package/es/components/Tearsheet/TearsheetShell.js +18 -8
  74. package/es/components/WebTerminal/WebTerminal.d.ts +46 -2
  75. package/es/components/WebTerminal/WebTerminal.js +2 -2
  76. package/es/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
  77. package/es/global/js/hooks/usePrefersReducedMotion.js +28 -0
  78. package/es/global/js/utils/Wrap.d.ts +31 -2
  79. package/es/global/js/utils/Wrap.js +7 -9
  80. package/es/global/js/utils/getNodeTextContent.d.ts +1 -1
  81. package/es/global/js/utils/getNodeTextContent.js +1 -1
  82. package/es/global/js/utils/window.d.ts +2 -0
  83. package/es/global/js/utils/window.js +12 -0
  84. package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2780 -0
  85. package/lib/_virtual/_rollupPluginBabelHelpers.js +9 -10
  86. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
  87. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
  88. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
  89. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +270 -0
  90. package/lib/components/ConditionBuilder/ConditionBuilder.js +46 -17
  91. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
  92. package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +48 -0
  93. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
  94. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +83 -0
  95. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
  96. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
  97. package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
  98. package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
  99. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
  100. package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +121 -0
  101. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
  102. package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +44 -0
  103. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
  104. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +159 -0
  105. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
  106. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +67 -0
  107. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
  108. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +60 -0
  109. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
  110. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +170 -0
  111. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
  112. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +48 -0
  113. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
  114. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +90 -0
  115. package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
  116. package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +93 -0
  117. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
  118. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +153 -0
  119. package/lib/components/ConditionBuilder/utils/util.d.ts +4 -0
  120. package/lib/components/ConditionBuilder/utils/util.js +20 -0
  121. package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
  122. package/lib/components/CreateTearsheet/CreateTearsheet.js +12 -32
  123. package/lib/components/Datagrid/useParentDimensions.js +1 -1
  124. package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
  125. package/lib/components/EditUpdateCards/EditUpdateCards.js +3 -0
  126. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
  127. package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
  128. package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
  129. package/lib/components/ExpressiveCard/ExpressiveCard.js +4 -0
  130. package/lib/components/InlineTip/InlineTipButton.d.ts +21 -2
  131. package/lib/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
  132. package/lib/components/InterstitialScreen/InterstitialScreen.js +24 -13
  133. package/lib/components/Nav/NavItem.js +2 -2
  134. package/lib/components/NotificationsPanel/NotificationsPanel.js +5 -6
  135. package/lib/components/PageHeader/PageHeader.js +11 -2
  136. package/lib/components/SidePanel/SidePanel.js +1 -1
  137. package/lib/components/SimpleHeader/SimpleHeader.d.ts +1 -5
  138. package/lib/components/SimpleHeader/SimpleHeader.js +2 -4
  139. package/lib/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
  140. package/lib/components/Tearsheet/TearsheetShell.d.ts +119 -10
  141. package/lib/components/Tearsheet/TearsheetShell.js +16 -6
  142. package/lib/components/WebTerminal/WebTerminal.d.ts +46 -2
  143. package/lib/components/WebTerminal/WebTerminal.js +2 -2
  144. package/lib/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
  145. package/lib/global/js/hooks/usePrefersReducedMotion.js +32 -0
  146. package/lib/global/js/utils/Wrap.d.ts +31 -2
  147. package/lib/global/js/utils/Wrap.js +7 -9
  148. package/lib/global/js/utils/getNodeTextContent.d.ts +1 -1
  149. package/lib/global/js/utils/getNodeTextContent.js +1 -1
  150. package/lib/global/js/utils/window.d.ts +2 -0
  151. package/lib/global/js/utils/window.js +16 -0
  152. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2912 -0
  153. package/package.json +4 -4
  154. package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -1
  155. package/scss/components/ConditionBuilder/_condition-builder.scss +26 -0
  156. package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +46 -0
  157. package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +194 -0
  158. package/scss/components/ConditionBuilder/styles/_index.scss +2 -0
  159. package/scss/components/Guidebanner/_guidebanner.scss +3 -0
  160. package/scss/components/InterstitialScreen/_interstitial-screen.scss +1 -6
  161. package/scss/components/Tearsheet/_tearsheet.scss +3 -1
  162. package/es/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
  163. package/es/global/js/utils/keyboardNavigation.d.ts +0 -27
  164. package/es/global/js/utils/keyboardNavigation.js +0 -33
  165. package/es/global/js/utils/wrapFocus.d.ts +0 -25
  166. package/es/global/js/utils/wrapFocus.js +0 -68
  167. package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3004
  168. package/lib/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
  169. package/lib/global/js/utils/keyboardNavigation.d.ts +0 -27
  170. package/lib/global/js/utils/keyboardNavigation.js +0 -39
  171. package/lib/global/js/utils/wrapFocus.d.ts +0 -25
  172. package/lib/global/js/utils/wrapFocus.js +0 -73
  173. package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3136
@@ -1,6 +1,107 @@
1
- export const tearsheetShellWideProps: string[];
2
- export function tearsheetIsPassive(actions: any): boolean;
3
- export function tearsheetHasCloseIcon(actions: any, hasCloseIcon: any): any;
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /// <reference path="../../../src/custom-typings/index.d.ts" />
8
+ import React, { PropsWithChildren, ReactNode } from 'react';
9
+ import PropTypes from 'prop-types';
10
+ import { type ButtonProps } from '@carbon/react';
11
+ interface TearsheetShellProps extends PropsWithChildren {
12
+ actions?: ButtonProps[];
13
+ ariaLabel?: string;
14
+ /**
15
+ * An optional class or classes to be added to the outermost element.
16
+ */
17
+ className?: string;
18
+ /**
19
+ * A description of the flow, displayed in the header area of the tearsheet.
20
+ */
21
+ description?: ReactNode;
22
+ /**
23
+ * Enable a close icon ('x') in the header area of the tearsheet. By default,
24
+ * (when this prop is omitted, or undefined or null) a tearsheet does not
25
+ * display a close icon if there are navigation actions ("transactional
26
+ * tearsheet") and displays one if there are no navigation actions ("passive
27
+ * tearsheet"), and that behavior can be overridden if required by setting
28
+ * this prop to either true or false.
29
+ */
30
+ hasCloseIcon?: boolean;
31
+ /**
32
+ * The content for the header actions area, displayed alongside the title in
33
+ * the header area of the tearsheet. This is typically a drop-down, or a set
34
+ * of small buttons, or similar. NB the headerActions is only applicable for
35
+ * wide tearsheets.
36
+ */
37
+ headerActions?: ReactNode;
38
+ /**
39
+ * The content for the influencer section of the tearsheet, displayed
40
+ * alongside the main content. This is typically a menu, or filter, or
41
+ * progress indicator, or similar. NB the influencer is only applicable for
42
+ * wide tearsheets.
43
+ */
44
+ influencer?: ReactNode;
45
+ /**
46
+ * The position of the influencer section, 'left' or 'right'.
47
+ */
48
+ influencerPosition?: 'left' | 'right';
49
+ /**
50
+ * The width of the influencer: 'narrow' (the default) is 256px, and 'wide'
51
+ * is 320px.
52
+ */
53
+ influencerWidth?: 'narrow' | 'wide';
54
+ /**
55
+ * A label for the tearsheet, displayed in the header area of the tearsheet
56
+ * to maintain context for the tearsheet (e.g. as the title changes from page
57
+ * to page of a multi-page task).
58
+ */
59
+ label?: ReactNode;
60
+ /**
61
+ * Navigation content, such as a set of tabs, to be displayed at the bottom
62
+ * of the header area of the tearsheet. NB the navigation is only applicable
63
+ * for wide tearsheets.
64
+ */
65
+ navigation?: ReactNode;
66
+ /**
67
+ * An optional handler that is called when the user closes the tearsheet (by
68
+ * clicking the close button, if enabled, or clicking outside, if enabled).
69
+ * Returning `false` here prevents the modal from closing.
70
+ */
71
+ onClose?: () => void;
72
+ /**
73
+ * Specifies whether the tearsheet is currently open.
74
+ */
75
+ open?: boolean;
76
+ /**
77
+ * The DOM element that the tearsheet should be rendered within. Defaults to document.body.
78
+ */
79
+ portalTarget?: ReactNode;
80
+ selectorPrimaryFocus?: string;
81
+ /**
82
+ * Specifies the width of the tearsheet, 'narrow' or 'wide'.
83
+ */
84
+ size: 'narrow' | 'wide';
85
+ /**
86
+ * **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component
87
+ */
88
+ slug?: ReactNode;
89
+ /**
90
+ * The main title of the tearsheet, displayed in the header area.
91
+ */
92
+ title?: ReactNode;
93
+ verticalPosition?: 'normal' | 'lower';
94
+ }
95
+ export type CloseIconDescriptionTypes = {
96
+ hasCloseIcon?: false;
97
+ closeIconDescription?: string;
98
+ } | {
99
+ hasCloseIcon: true;
100
+ closeIconDescription: string;
101
+ };
102
+ export declare const tearsheetShellWideProps: string[];
103
+ export declare const tearsheetIsPassive: (actions: any) => boolean;
104
+ export declare const tearsheetHasCloseIcon: (actions: any, hasCloseIcon: any) => any;
4
105
  /**
5
106
  * TearSheetShell is used internally by TearSheet and TearSheetNarrow
6
107
  *
@@ -8,10 +109,18 @@ export function tearsheetHasCloseIcon(actions: any, hasCloseIcon: any): any;
8
109
  *
9
110
  * See the canvas tab for the component API details.
10
111
  * */
11
- export const TearsheetShell: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
12
- export const portalType: PropTypes.Requireable<object>;
13
- export namespace deprecatedProps {
14
- let verticalPosition: PropTypes.Requireable<string>;
15
- }
16
- import React from 'react';
17
- import PropTypes from 'prop-types';
112
+ export declare const TearsheetShell: React.ForwardRefExoticComponent<(TearsheetShellProps & CloseIconDescriptionTypes) & React.RefAttributes<HTMLDivElement>>;
113
+ export declare const portalType: PropTypes.Requireable<object>;
114
+ export declare const deprecatedProps: {
115
+ /**
116
+ * **Deprecated**
117
+ *
118
+ * The position of the top of tearsheet in the viewport. The 'normal'
119
+ * position is a short distance down from the top of the
120
+ * viewport, leaving room at the top for a global header bar to show through
121
+ * from below. The 'lower' position (the default) provides a little extra room at the top
122
+ * to allow an action bar navigation or breadcrumbs to also show through.
123
+ */
124
+ verticalPosition: PropTypes.Requireable<string>;
125
+ };
126
+ export {};
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useRef, useState, useEffect } from 'react';
10
10
  import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
11
11
  import PropTypes from '../../node_modules/prop-types/index.js';
@@ -13,7 +13,7 @@ import cx from 'classnames';
13
13
  import { pkg } from '../../settings.js';
14
14
  import pconsole from '../../global/js/utils/pconsole.js';
15
15
  import { getNodeTextContent } from '../../global/js/utils/getNodeTextContent.js';
16
- import { usePrefix, ComposedModal, ModalHeader, Layer, Button } from '@carbon/react';
16
+ import { Button, usePrefix, ComposedModal, ModalHeader, Layer } from '@carbon/react';
17
17
  import { Wrap } from '../../global/js/utils/Wrap.js';
18
18
  import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
19
19
  import { useFocus } from '../../global/js/hooks/useFocus.js';
@@ -37,6 +37,7 @@ var maxDepth = 3;
37
37
  // The 'sizes' array contains an array of the sizes for every stacked tearsheet.
38
38
  // This is so we can opt-out of including the stacking scale effect when there
39
39
  // are stacked tearsheets with mixed sizes (ie, using wide and narrow together)
40
+
40
41
  var stack = {
41
42
  open: [],
42
43
  all: [],
@@ -94,6 +95,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
94
95
  var _useFocus = useFocus(modalRef),
95
96
  firstElement = _useFocus.firstElement,
96
97
  keyDownListener = _useFocus.keyDownListener;
98
+ var modalRefValue = modalRef.current;
97
99
  var wide = size === 'wide';
98
100
 
99
101
  // Keep track of the stack depth and our position in it (1-based, 0=closed)
@@ -124,7 +126,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
124
126
  }
125
127
  handleStackChange.checkFocus = function () {
126
128
  // if we are now the topmost tearsheet, ensure we have focus
127
- if (open && position === depth && modalRef.current && !modalRef.current.contains(document.activeElement)) {
129
+ if (open && position === depth && modalRefValue && !modalRefValue.contains(document.activeElement)) {
128
130
  handleStackChange.claimFocus();
129
131
  }
130
132
  };
@@ -152,8 +154,9 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
152
154
  useEffect(function () {
153
155
  var notify = function notify() {
154
156
  return stack.all.forEach(function (handler) {
157
+ var _handler$checkFocus;
155
158
  handler(Math.min(stack.open.length, maxDepth), stack.open.indexOf(handler) + 1);
156
- handler.checkFocus();
159
+ (_handler$checkFocus = handler.checkFocus) === null || _handler$checkFocus === void 0 || _handler$checkFocus.call(handler);
157
160
  });
158
161
  };
159
162
 
@@ -192,10 +195,12 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
192
195
  // If something within us is receiving focus but we are not the topmost
193
196
  // stacked tearsheet, transfer focus to the topmost tearsheet instead
194
197
  if (position < depth) {
195
- stack.open[stack.open.length - 1].claimFocus();
198
+ var _stack$open$claimFocu, _stack$open;
199
+ (_stack$open$claimFocu = (_stack$open = stack.open[stack.open.length - 1]).claimFocus) === null || _stack$open$claimFocu === void 0 || _stack$open$claimFocu.call(_stack$open);
196
200
  }
197
201
  }
198
202
  if (position <= depth) {
203
+ var _prevDepth$current;
199
204
  // Include a modal header if and only if one or more of these is given.
200
205
  // We can't use a Wrap for the ModalHeader because ComposedModal requires
201
206
  // the direct child to be the ModalHeader instance.
@@ -216,7 +221,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
216
221
  "aria-label": ariaLabel || getNodeTextContent(title),
217
222
  className: cx(bc, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(bc, "--stacked-").concat(position, "-of-").concat(depth),
218
223
  // Don't apply this on the initial open of a single tearsheet.
219
- depth > 1 || depth === 1 && prevDepth.current > 1), "".concat(bc, "--wide"), wide), "".concat(bc, "--narrow"), !wide), "".concat(bc, "--has-slug"), slug), "".concat(bc, "--has-close"), effectiveHasCloseIcon)),
224
+ depth > 1 || depth === 1 && ((_prevDepth$current = prevDepth === null || prevDepth === void 0 ? void 0 : prevDepth.current) !== null && _prevDepth$current !== void 0 ? _prevDepth$current : 0) > 1), "".concat(bc, "--wide"), wide), "".concat(bc, "--narrow"), !wide), "".concat(bc, "--has-slug"), slug), "".concat(bc, "--has-close"), effectiveHasCloseIcon)),
220
225
  slug: slug,
221
226
  style: setScaleValues(),
222
227
  containerClassName: cx("".concat(bc, "__container"), _defineProperty(_defineProperty({}, "".concat(bc, "__container--lower"), verticalPosition === 'lower'), "".concat(bc, "__container--mixed-size-stacking"), !areAllSameSizeVariant())),
@@ -264,7 +269,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
264
269
  alwaysRender: includeActions
265
270
  }, /*#__PURE__*/React__default.createElement(Wrap, {
266
271
  className: "".concat(bc, "__content"),
267
- alwaysRender: influencer && influencerPosition === 'right'
272
+ alwaysRender: !!(influencer && influencerPosition === 'right')
268
273
  }, children), /*#__PURE__*/React__default.createElement(Wrap, {
269
274
  className: cx(_defineProperty(_defineProperty({}, "".concat(bc, "__influencer"), true), "".concat(bc, "__influencer--wide"), influencerWidth === 'wide')),
270
275
  neverRender: influencerPosition !== 'right'
@@ -272,7 +277,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
272
277
  className: "".concat(bc, "__button-container")
273
278
  }, /*#__PURE__*/React__default.createElement(ActionSet, {
274
279
  actions: actions,
275
- buttonSize: wide ? '2xl' : null,
280
+ buttonSize: wide ? '2xl' : undefined,
276
281
  className: "".concat(bc, "__buttons"),
277
282
  size: wide ? '2xl' : 'lg',
278
283
  "aria-hidden": !open
@@ -323,6 +328,7 @@ TearsheetShell.propTypes = _objectSpread2({
323
328
  *
324
329
  * See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
325
330
  */
331
+ /**@ts-ignore*/
326
332
  actions: PropTypes.arrayOf(
327
333
  // NB we don't include the validator here, as the component wrapping this
328
334
  // one should ensure appropriate validation is done.
@@ -347,6 +353,7 @@ TearsheetShell.propTypes = _objectSpread2({
347
353
  * **Note:** This prop is only required if a close icon is shown, i.e. if
348
354
  * there are a no navigation actions and/or hasCloseIcon is true.
349
355
  */
356
+ /**@ts-ignore*/
350
357
  closeIconDescription: PropTypes.string.isRequired.if(function (_ref4) {
351
358
  var actions = _ref4.actions,
352
359
  hasCloseIcon = _ref4.hasCloseIcon;
@@ -364,6 +371,7 @@ TearsheetShell.propTypes = _objectSpread2({
364
371
  * tearsheet"), and that behavior can be overridden if required by setting
365
372
  * this prop to either true or false.
366
373
  */
374
+ /**@ts-ignore*/
367
375
  hasCloseIcon: PropTypes.bool,
368
376
  /**
369
377
  * The content for the header actions area, displayed alongside the title in
@@ -413,10 +421,12 @@ TearsheetShell.propTypes = _objectSpread2({
413
421
  /**
414
422
  * The DOM element that the tearsheet should be rendered within. Defaults to document.body.
415
423
  */
424
+ /**@ts-ignore*/
416
425
  portalTarget: portalType,
417
426
  /**
418
427
  * Specifies the width of the tearsheet, 'narrow' or 'wide'.
419
428
  */
429
+ /**@ts-ignore*/
420
430
  size: PropTypes.oneOf(['narrow', 'wide']).isRequired,
421
431
  /**
422
432
  * **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component
@@ -1,5 +1,49 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2022
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /// <reference path="../../../src/custom-typings/index.d.ts" />
8
+ import React, { PropsWithChildren, ReactNode } from 'react';
9
+ import { OverflowMenuItem } from '@carbon/react';
10
+ interface Action {
11
+ renderIcon: () => void;
12
+ onClick: () => void;
13
+ iconDescription: string;
14
+ }
15
+ interface WebTerminalProps extends PropsWithChildren {
16
+ /**
17
+ * Provide your own terminal component as children to show up in the web terminal
18
+ */
19
+ children: ReactNode | ReactNode[];
20
+ /**
21
+ * An array of actions to be displayed in the web terminal header bar
22
+ */
23
+ actions?: readonly Action[];
24
+ /**
25
+ * Custom classname for additional styling of the web terminal
26
+ */
27
+ className?: string;
28
+ /**
29
+ * Icon description for the close button
30
+ */
31
+ closeIconDescription: string;
32
+ /**
33
+ * Array of objects for each documentation link. Each documentation link uses the prop types of OverflowMenuItems. See more: https://react.carbondesignsystem.com/?path=/docs/components-overflowmenu--default
34
+ */
35
+ documentationLinks?: readonly OverflowMenuItem[];
36
+ /**
37
+ * Description for the documentation link overflow menu tooltip
38
+ */
39
+ documentationLinksIconDescription?: string;
40
+ /**
41
+ * Optionally pass if the web terminal should be open by default
42
+ */
43
+ isInitiallyOpen?: boolean;
44
+ }
1
45
  /**
2
46
  * The `WebTerminal` is prompted by the user and is persistent until dismissed. The purpose of a web terminal is to provide users with the ability to type commands manually instead of using the GUI.
3
47
  */
4
- export let WebTerminal: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
- import React from 'react';
48
+ export declare let WebTerminal: React.ForwardRefExoticComponent<WebTerminalProps & React.RefAttributes<HTMLDivElement>>;
49
+ export {};
@@ -29,7 +29,6 @@ var defaults = {
29
29
  documentationLinksIconDescription: 'Show documentation links',
30
30
  isInitiallyOpen: false
31
31
  };
32
-
33
32
  /**
34
33
  * The `WebTerminal` is prompted by the user and is persistent until dismissed. The purpose of a web terminal is to provide users with the ability to type commands manually instead of using the GUI.
35
34
  */
@@ -99,7 +98,7 @@ var WebTerminal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
99
98
  ref: ref,
100
99
  className: cx([blockClass, className, _defineProperty(_defineProperty({}, "".concat(blockClass, "--open"), open), "".concat(blockClass, "--closed"), !open)]),
101
100
  style: {
102
- animation: !prefersReducedMotion && webTerminalAnimationName
101
+ animation: !prefersReducedMotion ? webTerminalAnimationName : ''
103
102
  },
104
103
  onAnimationEnd: onAnimationEnd
105
104
  }), /*#__PURE__*/React__default.createElement("header", {
@@ -168,6 +167,7 @@ WebTerminal.propTypes = {
168
167
  /**
169
168
  * An array of actions to be displayed in the web terminal header bar
170
169
  */
170
+ /**@ts-ignore */
171
171
  actions: PropTypes.arrayOf(PropTypes.shape({
172
172
  renderIcon: PropTypes.func.isRequired,
173
173
  onClick: PropTypes.func.isRequired,
@@ -0,0 +1,2 @@
1
+ export default usePrefersReducedMotion;
2
+ declare function usePrefersReducedMotion(): boolean;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import { useState, useEffect } from 'react';
10
+ import { hasDocument } from '../utils/window.js';
11
+
12
+ var usePrefersReducedMotion = function usePrefersReducedMotion() {
13
+ var _useState = useState(false),
14
+ _useState2 = _slicedToArray(_useState, 2),
15
+ prefersReducedMotion = _useState2[0],
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
+ }
23
+ }, []);
24
+ return prefersReducedMotion;
25
+ };
26
+ var usePrefersReducedMotion$1 = usePrefersReducedMotion;
27
+
28
+ export { usePrefersReducedMotion$1 as default };
@@ -1,3 +1,32 @@
1
+ /**
2
+ * Copyright IBM Corp. 2021, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import React, { ElementType, PropsWithChildren, ReactNode } from 'react';
8
+ interface WrapProps extends PropsWithChildren {
9
+ /**
10
+ * Specify whether the wrapper element should render even if there are no
11
+ * children or the children are themselves empty wrappers. Useful if there
12
+ * are some conditions in which the wrapper element is still required. Note
13
+ * that this prop takes precedence over neverRender if both are set to true.
14
+ */
15
+ alwaysRender?: boolean | null;
16
+ /**
17
+ * The element name or component to use as a wrapper for the content.
18
+ */
19
+ element?: (() => ReactNode) | string | ElementType;
20
+ /**
21
+ * Specify whether nothing should be rendered even if there are children
22
+ * in the content. Useful if there are some circumstances in which the
23
+ * component should not render at all. Note that if alwaysRender is also
24
+ * set to true then it will take precedence and the wrapper element and
25
+ * content will be rendered.
26
+ */
27
+ neverRender?: boolean;
28
+ className?: string;
29
+ }
1
30
  /**
2
31
  * A simple conditional wrapper that encloses its children in a <div> (or other
3
32
  * element if specified), passing any supplied attributes to the <div> (or other
@@ -8,5 +37,5 @@
8
37
  * the ref.current will be set to the wrapper element if it renders, and will
9
38
  * remain undefined if it does not render.
10
39
  */
11
- export const Wrap: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
12
- import React from 'react';
40
+ export declare const Wrap: React.ForwardRefExoticComponent<WrapProps & React.RefAttributes<HTMLElement>>;
41
+ export {};
@@ -9,7 +9,7 @@ import { objectWithoutProperties as _objectWithoutProperties, extends as _extend
9
9
  import React__default from 'react';
10
10
  import PropTypes from '../../../node_modules/prop-types/index.js';
11
11
 
12
- var _excluded = ["alwaysRender", "children", "element", "neverRender"];
12
+ var _excluded = ["alwaysRender", "children", "element", "neverRender", "className"];
13
13
 
14
14
  // Examine a flat array of children to decide whether it is effectively empty.
15
15
  // If there are no children, or all the children are falsy, or all the non-falsy
@@ -24,12 +24,6 @@ var isEmpty = function isEmpty(children) {
24
24
  });
25
25
  return result;
26
26
  };
27
-
28
- // Default values for props
29
- var defaults = {
30
- element: 'div'
31
- };
32
-
33
27
  /**
34
28
  * A simple conditional wrapper that encloses its children in a <div> (or other
35
29
  * element if specified), passing any supplied attributes to the <div> (or other
@@ -44,10 +38,13 @@ var Wrap = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
44
38
  var alwaysRender = _ref.alwaysRender,
45
39
  children = _ref.children,
46
40
  _ref$element = _ref.element,
47
- Wrapper = _ref$element === void 0 ? defaults.element : _ref$element,
41
+ Wrapper = _ref$element === void 0 ? 'div' : _ref$element,
48
42
  neverRender = _ref.neverRender,
43
+ className = _ref.className,
49
44
  rest = _objectWithoutProperties(_ref, _excluded);
50
- return (neverRender || isEmpty(children)) && !alwaysRender ? null : /*#__PURE__*/React__default.createElement(Wrapper, _extends({}, rest, {
45
+ return (neverRender || isEmpty(children)) && !alwaysRender ? null : /*#__PURE__*/React__default.createElement(Wrapper, _extends({
46
+ className: className
47
+ }, rest, {
51
48
  ref: ref
52
49
  }), children);
53
50
  });
@@ -66,6 +63,7 @@ Wrap.propTypes = {
66
63
  * components that decide not to render, nothing will be rendered in the DOM.
67
64
  */
68
65
  children: PropTypes.node,
66
+ className: PropTypes.string,
69
67
  /**
70
68
  * The element name or component to use as a wrapper for the content.
71
69
  */
@@ -1 +1 @@
1
- export function getNodeTextContent(node: Node): string;
1
+ export function getNodeTextContent(node: ReactNode): string;
@@ -25,7 +25,7 @@ import { typeof as _typeof } from '../../../_virtual/_rollupPluginBabelHelpers.j
25
25
  * <li>Item 3</li>
26
26
  * </ul>
27
27
  * --> "Item 1Item 2Item 3"
28
- * @param {Node} node A React node
28
+ * @param {ReactNode} node A React node
29
29
  * @returns {string}
30
30
  */
31
31
  var getNodeTextContent = function getNodeTextContent(node) {
@@ -0,0 +1,2 @@
1
+ export function hasDocument(): boolean;
2
+ export function hasWindow(): boolean;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ var hasDocument = function hasDocument() {
9
+ return typeof document !== 'undefined';
10
+ };
11
+
12
+ export { hasDocument };