@carbon/ibm-products 2.58.0 → 2.59.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.
- package/css/index-full-carbon.css +18 -14
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +17 -4
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +18 -14
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +18 -14
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +1 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -1
- package/es/components/InterstitialScreen/InterstitialScreen.js +10 -7
- package/es/components/NotificationsPanel/NotificationsPanel.js +12 -3
- package/es/components/PageHeader/PageHeader.js +11 -1
- package/es/components/ScrollGradient/ScrollGradient.js +34 -27
- package/es/components/StringFormatter/StringFormatter.js +9 -6
- package/es/components/TagOverflow/TagOverflow.d.ts +10 -1
- package/es/components/TagOverflow/TagOverflow.js +54 -146
- package/es/components/Tearsheet/Tearsheet.d.ts +6 -14
- package/es/components/Tearsheet/Tearsheet.js +2 -18
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +6 -4
- package/es/components/Tearsheet/TearsheetNarrow.js +2 -10
- package/es/components/Tearsheet/TearsheetShell.d.ts +8 -8
- package/es/components/Tearsheet/TearsheetShell.js +40 -27
- package/es/components/TruncatedList/TruncatedList.js +7 -4
- package/es/components/WebTerminal/WebTerminal.js +15 -5
- package/es/global/js/hooks/useOverflowItems.d.ts +16 -0
- package/es/global/js/hooks/useOverflowItems.js +88 -0
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +1 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -1
- package/lib/components/InterstitialScreen/InterstitialScreen.js +9 -6
- package/lib/components/NotificationsPanel/NotificationsPanel.js +12 -3
- package/lib/components/PageHeader/PageHeader.js +11 -1
- package/lib/components/ScrollGradient/ScrollGradient.js +32 -25
- package/lib/components/StringFormatter/StringFormatter.js +8 -5
- package/lib/components/TagOverflow/TagOverflow.d.ts +10 -1
- package/lib/components/TagOverflow/TagOverflow.js +52 -144
- package/lib/components/Tearsheet/Tearsheet.d.ts +6 -14
- package/lib/components/Tearsheet/Tearsheet.js +1 -17
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +6 -4
- package/lib/components/Tearsheet/TearsheetNarrow.js +1 -9
- package/lib/components/Tearsheet/TearsheetShell.d.ts +8 -8
- package/lib/components/Tearsheet/TearsheetShell.js +37 -24
- package/lib/components/TruncatedList/TruncatedList.js +7 -4
- package/lib/components/WebTerminal/WebTerminal.js +14 -4
- package/lib/global/js/hooks/useOverflowItems.d.ts +16 -0
- package/lib/global/js/hooks/useOverflowItems.js +90 -0
- package/package.json +5 -5
- package/scss/components/ConditionBuilder/_condition-builder.scss +0 -6
- package/scss/components/TagOverflow/_tag-overflow.scss +1 -6
- package/scss/components/Tearsheet/_tearsheet.scss +21 -6
@@ -8,7 +8,7 @@
|
|
8
8
|
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { Button } from '@carbon/react';
|
10
10
|
import React__default from 'react';
|
11
|
-
import {
|
11
|
+
import { portalType, TearsheetShell } from './TearsheetShell.js';
|
12
12
|
import { ActionSet } from '../ActionSet/ActionSet.js';
|
13
13
|
import PropTypes from '../../_virtual/index.js';
|
14
14
|
import { allPropTypes } from '../../global/js/utils/props-helper.js';
|
@@ -19,14 +19,6 @@ var _excluded = ["influencerPosition", "influencerWidth"];
|
|
19
19
|
var componentName = 'Tearsheet';
|
20
20
|
|
21
21
|
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
22
|
-
|
23
|
-
/**
|
24
|
-
* The accessibility title for the close icon (if shown).
|
25
|
-
*
|
26
|
-
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
27
|
-
* there are a no navigation actions and/or hasCloseIcon is true.
|
28
|
-
*/
|
29
|
-
|
30
22
|
// The types and DocGen commentary for the component props,
|
31
23
|
// in alphabetical order (for consistency).
|
32
24
|
// See https://www.npmjs.com/package/prop-types#usage.
|
@@ -122,15 +114,8 @@ Tearsheet.propTypes = _objectSpread2({
|
|
122
114
|
/**
|
123
115
|
* The accessibility title for the close icon (if shown).
|
124
116
|
*
|
125
|
-
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
126
|
-
* there are a no navigation actions and/or hasCloseIcon is true.
|
127
117
|
*/
|
128
|
-
|
129
|
-
closeIconDescription: PropTypes.string.isRequired.if(function (_ref2) {
|
130
|
-
var actions = _ref2.actions,
|
131
|
-
hasCloseIcon = _ref2.hasCloseIcon;
|
132
|
-
return tearsheetHasCloseIcon(actions, hasCloseIcon);
|
133
|
-
}),
|
118
|
+
closeIconDescription: PropTypes.string,
|
134
119
|
/**
|
135
120
|
* A description of the flow, displayed in the header area of the tearsheet.
|
136
121
|
*/
|
@@ -143,7 +128,6 @@ Tearsheet.propTypes = _objectSpread2({
|
|
143
128
|
* tearsheet"), and that behavior can be overridden if required by setting
|
144
129
|
* this prop to either true or false.
|
145
130
|
*/
|
146
|
-
/**@ts-ignore */
|
147
131
|
hasCloseIcon: PropTypes.bool,
|
148
132
|
/**
|
149
133
|
* The content for the header actions area, displayed alongside the title in
|
@@ -6,10 +6,9 @@
|
|
6
6
|
*/
|
7
7
|
/// <reference path="../../../src/custom-typings/index.d.ts" />
|
8
8
|
import { ButtonProps } from '@carbon/react';
|
9
|
-
import { CloseIconDescriptionTypes } from './TearsheetShell';
|
10
9
|
import React, { PropsWithChildren, ReactNode } from 'react';
|
11
10
|
import PropTypes from 'prop-types';
|
12
|
-
interface
|
11
|
+
export interface TearsheetNarrowProps extends PropsWithChildren {
|
13
12
|
/**
|
14
13
|
* The navigation actions to be shown as buttons in the action area at the
|
15
14
|
* bottom of the tearsheet. Each action is specified as an object with
|
@@ -33,6 +32,11 @@ interface TearsheetNarrowBaseProps extends PropsWithChildren {
|
|
33
32
|
* An optional class or classes to be added to the outermost element.
|
34
33
|
*/
|
35
34
|
className?: string;
|
35
|
+
/**
|
36
|
+
* The accessibility title for the close icon (if shown).
|
37
|
+
*
|
38
|
+
*/
|
39
|
+
closeIconDescription?: string;
|
36
40
|
/**
|
37
41
|
* A description of the flow, displayed in the header area of the tearsheet.
|
38
42
|
*/
|
@@ -90,7 +94,6 @@ interface TearsheetNarrowBaseProps extends PropsWithChildren {
|
|
90
94
|
*/
|
91
95
|
verticalPosition?: 'normal' | 'lower';
|
92
96
|
}
|
93
|
-
export type TearsheetNarrowProps = TearsheetNarrowBaseProps & CloseIconDescriptionTypes;
|
94
97
|
/**
|
95
98
|
* A narrow tearsheet is a slimmer variant of the tearsheet, providing a dialog
|
96
99
|
* that keeps users in-context and focused by bringing actionable content front
|
@@ -112,4 +115,3 @@ export declare const deprecatedProps: {
|
|
112
115
|
*/
|
113
116
|
verticalPosition: PropTypes.Requireable<string>;
|
114
117
|
};
|
115
|
-
export {};
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { Button } from '@carbon/react';
|
10
|
-
import {
|
10
|
+
import { portalType, TearsheetShell, tearsheetShellWideProps } from './TearsheetShell.js';
|
11
11
|
import React__default from 'react';
|
12
12
|
import { allPropTypes, prepareProps } from '../../global/js/utils/props-helper.js';
|
13
13
|
import { ActionSet } from '../ActionSet/ActionSet.js';
|
@@ -107,15 +107,8 @@ TearsheetNarrow.propTypes = _objectSpread2({
|
|
107
107
|
/**
|
108
108
|
* The accessibility title for the close icon (if shown).
|
109
109
|
*
|
110
|
-
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
111
|
-
* there are a no navigation actions and/or hasCloseIcon is true.
|
112
110
|
*/
|
113
|
-
|
114
|
-
closeIconDescription: PropTypes.string.isRequired.if(function (_ref2) {
|
115
|
-
var actions = _ref2.actions,
|
116
|
-
hasCloseIcon = _ref2.hasCloseIcon;
|
117
|
-
return tearsheetHasCloseIcon(actions, hasCloseIcon);
|
118
|
-
}),
|
111
|
+
closeIconDescription: PropTypes.string,
|
119
112
|
/**
|
120
113
|
* A description of the flow, displayed in the header area of the tearsheet.
|
121
114
|
*/
|
@@ -126,7 +119,6 @@ TearsheetNarrow.propTypes = _objectSpread2({
|
|
126
119
|
* the tearsheet is read-only or has no navigation actions (sometimes called
|
127
120
|
* a "passive tearsheet").
|
128
121
|
*/
|
129
|
-
/**@ts-ignore*/
|
130
122
|
hasCloseIcon: PropTypes.bool,
|
131
123
|
/**
|
132
124
|
* A label for the tearsheet, displayed in the header area of the tearsheet
|
@@ -14,6 +14,13 @@ interface TearsheetShellProps extends PropsWithChildren {
|
|
14
14
|
* An optional class or classes to be added to the outermost element.
|
15
15
|
*/
|
16
16
|
className?: string;
|
17
|
+
/**
|
18
|
+
* The accessibility title for the close icon (if shown).
|
19
|
+
*
|
20
|
+
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
21
|
+
* there are a no navigation actions and/or hasCloseIcon is true.
|
22
|
+
*/
|
23
|
+
closeIconDescription?: string;
|
17
24
|
/**
|
18
25
|
* Used to track the current step on components which use `StepsContext` and `TearsheetShell`
|
19
26
|
*/
|
@@ -118,13 +125,6 @@ interface TearsheetShellProps extends PropsWithChildren {
|
|
118
125
|
*/
|
119
126
|
slug?: ReactNode;
|
120
127
|
}
|
121
|
-
export type CloseIconDescriptionTypes = {
|
122
|
-
hasCloseIcon?: false;
|
123
|
-
closeIconDescription?: string;
|
124
|
-
} | {
|
125
|
-
hasCloseIcon: true;
|
126
|
-
closeIconDescription: string;
|
127
|
-
};
|
128
128
|
export declare const tearsheetShellWideProps: string[];
|
129
129
|
export declare const tearsheetIsPassive: (actions: any) => boolean;
|
130
130
|
export declare const tearsheetHasCloseIcon: (actions: any, hasCloseIcon: any) => any;
|
@@ -135,7 +135,7 @@ export declare const tearsheetHasCloseIcon: (actions: any, hasCloseIcon: any) =>
|
|
135
135
|
*
|
136
136
|
* See the canvas tab for the component API details.
|
137
137
|
* */
|
138
|
-
export declare const TearsheetShell: React.ForwardRefExoticComponent<
|
138
|
+
export declare const TearsheetShell: React.ForwardRefExoticComponent<TearsheetShellProps & React.RefAttributes<HTMLDivElement>>;
|
139
139
|
export declare const portalType: PropTypes.Requireable<object>;
|
140
140
|
export declare const deprecatedProps: {
|
141
141
|
/**
|
@@ -5,8 +5,8 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray,
|
9
|
-
import React__default, { useRef,
|
8
|
+
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, defineProperty as _defineProperty, extends as _extends, toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default, { useRef, useState, useEffect } from 'react';
|
10
10
|
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
|
11
11
|
import PropTypes from '../../_virtual/index.js';
|
12
12
|
import cx from 'classnames';
|
@@ -14,12 +14,14 @@ 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
16
|
import { deprecateProp } from '../../global/js/utils/props-helper.js';
|
17
|
-
import {
|
17
|
+
import { checkHeightOverflow } from '../../global/js/utils/checkForOverflow.js';
|
18
|
+
import { Button, usePrefix, unstable_FeatureFlags, ComposedModal, ModalHeader, Layer, DefinitionTooltip } from '@carbon/react';
|
18
19
|
import { ActionSet } from '../ActionSet/ActionSet.js';
|
19
20
|
import { Wrap } from '../../global/js/utils/Wrap.js';
|
20
21
|
import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
|
21
22
|
import { useFocus, claimFocus } from '../../global/js/hooks/useFocus.js';
|
22
23
|
import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
|
24
|
+
import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
|
23
25
|
|
24
26
|
var _excluded = ["actions", "decorator", "ariaLabel", "children", "className", "closeIconDescription", "currentStep", "description", "hasCloseIcon", "hasError", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "selectorsFloatingMenus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
|
25
27
|
// The block part of our conventional BEM class names (bc__E--M).
|
@@ -67,7 +69,8 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
67
69
|
ariaLabel = _ref.ariaLabel,
|
68
70
|
children = _ref.children,
|
69
71
|
className = _ref.className,
|
70
|
-
|
72
|
+
_ref$closeIconDescrip = _ref.closeIconDescription,
|
73
|
+
closeIconDescription = _ref$closeIconDescrip === void 0 ? 'Close' : _ref$closeIconDescrip,
|
71
74
|
currentStep = _ref.currentStep,
|
72
75
|
description = _ref.description,
|
73
76
|
hasCloseIcon = _ref.hasCloseIcon,
|
@@ -104,12 +107,12 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
104
107
|
firstElement = _useFocus.firstElement,
|
105
108
|
keyDownListener = _useFocus.keyDownListener;
|
106
109
|
var modalRefValue = modalRef.current;
|
107
|
-
|
108
|
-
|
109
|
-
var
|
110
|
-
|
111
|
-
|
112
|
-
|
110
|
+
var descriptionRef = useRef(null);
|
111
|
+
var isOverflowing = checkHeightOverflow(descriptionRef.current);
|
112
|
+
var descriptionContent = /*#__PURE__*/React__default.createElement("span", {
|
113
|
+
ref: descriptionRef,
|
114
|
+
className: "".concat(bc, "__description-text")
|
115
|
+
}, description);
|
113
116
|
var wide = size === 'wide';
|
114
117
|
|
115
118
|
// Keep track of the stack depth and our position in it (1-based, 0=closed)
|
@@ -189,6 +192,25 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
189
192
|
}
|
190
193
|
};
|
191
194
|
}, [open, size]);
|
195
|
+
var areAllSameSizeVariant = function areAllSameSizeVariant() {
|
196
|
+
return new Set(stack.sizes).size === 1;
|
197
|
+
};
|
198
|
+
useIsomorphicEffect(function () {
|
199
|
+
var setScaleValues = function setScaleValues() {
|
200
|
+
if (!areAllSameSizeVariant()) {
|
201
|
+
return _defineProperty(_defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), 1), "--".concat(bc, "--stacking-scale-factor-double"), 1);
|
202
|
+
}
|
203
|
+
return _defineProperty(_defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), (width - 32) / width), "--".concat(bc, "--stacking-scale-factor-double"), (width - 64) / width);
|
204
|
+
};
|
205
|
+
if (modalRef.current) {
|
206
|
+
Object.entries(setScaleValues()).map(function (_ref4) {
|
207
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
208
|
+
key = _ref5[0],
|
209
|
+
value = _ref5[1];
|
210
|
+
modalRef.current.style.setProperty(key, String(value));
|
211
|
+
});
|
212
|
+
}
|
213
|
+
}, [modalRef, width]);
|
192
214
|
if (position <= depth) {
|
193
215
|
var _prevDepth$current, _decorator$type, _decorator$type2;
|
194
216
|
// Include a modal header if and only if one or more of these is given.
|
@@ -198,15 +220,9 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
198
220
|
|
199
221
|
// Include an ActionSet if and only if one or more actions is given.
|
200
222
|
var includeActions = actions && (actions === null || actions === void 0 ? void 0 : actions.length) > 0;
|
201
|
-
var
|
223
|
+
var _areAllSameSizeVariant = function _areAllSameSizeVariant() {
|
202
224
|
return new Set(stack.sizes).size === 1;
|
203
225
|
};
|
204
|
-
var setScaleValues = function setScaleValues() {
|
205
|
-
if (!areAllSameSizeVariant()) {
|
206
|
-
return _defineProperty(_defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), 1), "--".concat(bc, "--stacking-scale-factor-double"), 1);
|
207
|
-
}
|
208
|
-
return _defineProperty(_defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), (width - 32) / width), "--".concat(bc, "--stacking-scale-factor-double"), (width - 64) / width);
|
209
|
-
};
|
210
226
|
return renderPortalUse( /*#__PURE__*/React__default.createElement(unstable_FeatureFlags, {
|
211
227
|
enableExperimentalFocusWrapWithoutSentinels: true
|
212
228
|
}, /*#__PURE__*/React__default.createElement(ComposedModal, _extends({}, rest, {
|
@@ -215,8 +231,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
215
231
|
// Don't apply this on the initial open of a single tearsheet.
|
216
232
|
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"), deprecated_slug), "".concat(bc, "--has-ai-label"), !!decorator && ((_decorator$type = decorator['type']) === null || _decorator$type === void 0 ? void 0 : _decorator$type.displayName) === 'AILabel'), "".concat(bc, "--has-decorator"), !!decorator && ((_decorator$type2 = decorator['type']) === null || _decorator$type2 === void 0 ? void 0 : _decorator$type2.displayName) !== 'AILabel'), "".concat(bc, "--has-close"), effectiveHasCloseIcon)),
|
217
233
|
decorator: decorator || deprecated_slug,
|
218
|
-
|
219
|
-
containerClassName: cx("".concat(bc, "__container"), _defineProperty(_defineProperty({}, "".concat(bc, "__container--lower"), verticalPosition === 'lower'), "".concat(bc, "__container--mixed-size-stacking"), !areAllSameSizeVariant())),
|
234
|
+
containerClassName: cx("".concat(bc, "__container"), _defineProperty(_defineProperty({}, "".concat(bc, "__container--lower"), verticalPosition === 'lower'), "".concat(bc, "__container--mixed-size-stacking"), !_areAllSameSizeVariant())),
|
220
235
|
onClose: onClose,
|
221
236
|
open: open,
|
222
237
|
selectorPrimaryFocus: selectorPrimaryFocus,
|
@@ -242,9 +257,11 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
242
257
|
element: "h3",
|
243
258
|
className: cx("".concat(bcModalHeader, "__heading"), "".concat(bc, "__heading"))
|
244
259
|
}, title), /*#__PURE__*/React__default.createElement(Wrap, {
|
245
|
-
className: "".concat(bc, "__header-description")
|
246
|
-
|
247
|
-
|
260
|
+
className: "".concat(bc, "__header-description")
|
261
|
+
}, isOverflowing ? /*#__PURE__*/React__default.createElement(DefinitionTooltip, {
|
262
|
+
definition: description,
|
263
|
+
className: "".concat(bc, "__description-tooltip")
|
264
|
+
}, descriptionContent) : descriptionContent)), /*#__PURE__*/React__default.createElement(Wrap, {
|
248
265
|
className: "".concat(bc, "__header-actions")
|
249
266
|
}, headerActions)), /*#__PURE__*/React__default.createElement(Wrap, {
|
250
267
|
className: "".concat(bc, "__header-navigation")
|
@@ -354,11 +371,7 @@ TearsheetShell.propTypes = _objectSpread2({
|
|
354
371
|
* there are a no navigation actions and/or hasCloseIcon is true.
|
355
372
|
*/
|
356
373
|
/**@ts-ignore*/
|
357
|
-
closeIconDescription: PropTypes.string
|
358
|
-
var actions = _ref4.actions,
|
359
|
-
hasCloseIcon = _ref4.hasCloseIcon;
|
360
|
-
return tearsheetHasCloseIcon(actions, hasCloseIcon);
|
361
|
-
}),
|
374
|
+
closeIconDescription: PropTypes.string,
|
362
375
|
/**
|
363
376
|
* Optional prop that allows you to pass any component.
|
364
377
|
*/
|
@@ -12,6 +12,7 @@ import { Button } from '@carbon/react';
|
|
12
12
|
import PropTypes from '../../_virtual/index.js';
|
13
13
|
import cx from 'classnames';
|
14
14
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
15
|
+
import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
|
15
16
|
|
16
17
|
var _excluded = ["children", "className", "as", "buttonClassName", "collapsedItemsLimit", "expandedItemsLimit", "onClick", "viewLessLabel", "viewMoreLabel"];
|
17
18
|
|
@@ -98,6 +99,11 @@ var TruncatedList = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
98
99
|
setListHeight(_listHeight);
|
99
100
|
}
|
100
101
|
}, [childrenArray, minItems, maxItems, isCollapsed, listRef]);
|
102
|
+
useIsomorphicEffect(function () {
|
103
|
+
if (listRef.current) {
|
104
|
+
listRef.current.style.height = "".concat(listHeight, "px");
|
105
|
+
}
|
106
|
+
}, [listHeight]);
|
101
107
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
102
108
|
className: cx(blockClass, className, isCollapsed ? "".concat(blockClass, "--collapsed") : "".concat(blockClass, "--expanded"),
|
103
109
|
// If the list is expanded && showing all the items,
|
@@ -106,10 +112,7 @@ var TruncatedList = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
106
112
|
ref: ref
|
107
113
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement(List, {
|
108
114
|
className: "".concat(blockClass, "__list"),
|
109
|
-
ref: listRef
|
110
|
-
style: {
|
111
|
-
height: listHeight
|
112
|
-
}
|
115
|
+
ref: listRef
|
113
116
|
}, isCollapsed ? childrenArray.slice(0, minItems) : children), childrenArray.length > minItems && /*#__PURE__*/React__default.createElement(Button, {
|
114
117
|
className: cx("".concat(blockClass, "__button"), "".concat(carbon.prefix, "--link"), buttonClassName),
|
115
118
|
kind: "ghost",
|
@@ -8,7 +8,7 @@
|
|
8
8
|
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty, objectDestructuringEmpty as _objectDestructuringEmpty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { OverflowMenuItem, OverflowMenu, Button, Theme } from '@carbon/react';
|
10
10
|
import { Help, Close } from '@carbon/react/icons';
|
11
|
-
import React__default, { useState, useMemo, useEffect } from 'react';
|
11
|
+
import React__default, { useRef, useState, useMemo, useEffect } from 'react';
|
12
12
|
import PropTypes from '../../_virtual/index.js';
|
13
13
|
import cx from 'classnames';
|
14
14
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
@@ -16,6 +16,7 @@ import { moderate02 } from '@carbon/motion';
|
|
16
16
|
import { pkg } from '../../settings.js';
|
17
17
|
import usePrefersReducedMotion from '../../global/js/hooks/usePrefersReducedMotion.js';
|
18
18
|
import { useWebTerminal } from './hooks/index.js';
|
19
|
+
import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
|
19
20
|
|
20
21
|
var _excluded = ["actions", "children", "className", "closeIconDescription", "documentationLinks", "documentationLinksIconDescription", "isInitiallyOpen", "webTerminalAriaLabel"];
|
21
22
|
|
@@ -49,6 +50,8 @@ var WebTerminal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
49
50
|
_ref$webTerminalAriaL = _ref.webTerminalAriaLabel,
|
50
51
|
webTerminalAriaLabel = _ref$webTerminalAriaL === void 0 ? defaults.webTerminalAriaLabel : _ref$webTerminalAriaL,
|
51
52
|
rest = _objectWithoutProperties(_ref, _excluded);
|
53
|
+
var localRef = useRef();
|
54
|
+
var webTerminalRef = ref !== null && ref !== void 0 ? ref : localRef;
|
52
55
|
var _useWebTerminal = useWebTerminal(),
|
53
56
|
open = _useWebTerminal.open,
|
54
57
|
closeWebTerminal = _useWebTerminal.closeWebTerminal,
|
@@ -59,6 +62,16 @@ var WebTerminal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
59
62
|
setRender = _useState2[1];
|
60
63
|
var shouldReduceMotion = usePrefersReducedMotion();
|
61
64
|
var webTerminalAnimationName = "".concat(open ? 'web-terminal-entrance' : 'web-terminal-exit forwards', " ").concat(moderate02);
|
65
|
+
useIsomorphicEffect(function () {
|
66
|
+
var timeout = setTimeout(function () {
|
67
|
+
if (webTerminalRef.current && !shouldReduceMotion) {
|
68
|
+
webTerminalRef.current.style.animation = webTerminalAnimationName;
|
69
|
+
}
|
70
|
+
}, 0);
|
71
|
+
return function () {
|
72
|
+
return clearTimeout(timeout);
|
73
|
+
};
|
74
|
+
}, [shouldReduceMotion, webTerminalAnimationName, webTerminalRef]);
|
62
75
|
var showDocumentationLinks = useMemo(function () {
|
63
76
|
return documentationLinks.length > 0;
|
64
77
|
}, [documentationLinks]);
|
@@ -96,11 +109,8 @@ var WebTerminal = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
96
109
|
closeWebTerminal === null || closeWebTerminal === void 0 || closeWebTerminal();
|
97
110
|
};
|
98
111
|
return shouldRender ? /*#__PURE__*/React__default.createElement("div", _extends({}, _objectSpread2(_objectSpread2({}, rest), getDevtoolsProps(componentName)), {
|
99
|
-
ref:
|
112
|
+
ref: webTerminalRef,
|
100
113
|
className: cx([blockClass, className, _defineProperty(_defineProperty({}, "".concat(blockClass, "--open"), open), "".concat(blockClass, "--closed"), !open)]),
|
101
|
-
style: {
|
102
|
-
animation: !shouldReduceMotion ? webTerminalAnimationName : ''
|
103
|
-
},
|
104
114
|
onAnimationEnd: onAnimationEnd
|
105
115
|
}), /*#__PURE__*/React__default.createElement("header", {
|
106
116
|
"aria-label": webTerminalAriaLabel,
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2025, 2025
|
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 { RefObject } from 'react';
|
8
|
+
type Item = {
|
9
|
+
id: string;
|
10
|
+
};
|
11
|
+
export declare const useOverflowItems: <T extends Item>(items: T[] | undefined, containerRef: RefObject<HTMLDivElement>, offsetRef?: RefObject<HTMLDivElement>, maxItems?: number, onChange?: (hiddenItems: T[]) => void) => {
|
12
|
+
visibleItems: T[];
|
13
|
+
itemRefHandler: (id: string, node: HTMLDivElement | null) => () => void;
|
14
|
+
hiddenItems: T[];
|
15
|
+
};
|
16
|
+
export {};
|
@@ -0,0 +1,88 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2025
|
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 { useRef, useState } from 'react';
|
10
|
+
import { useResizeObserver } from './useResizeObserver.js';
|
11
|
+
|
12
|
+
var useOverflowItems = function useOverflowItems() {
|
13
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
14
|
+
var containerRef = arguments.length > 1 ? arguments[1] : undefined;
|
15
|
+
var offsetRef = arguments.length > 2 ? arguments[2] : undefined;
|
16
|
+
var maxItems = arguments.length > 3 ? arguments[3] : undefined;
|
17
|
+
var onChange = arguments.length > 4 ? arguments[4] : undefined;
|
18
|
+
var itemsRef = useRef(null);
|
19
|
+
var _useState = useState(0),
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
21
|
+
maxWidth = _useState2[0],
|
22
|
+
setMaxWidth = _useState2[1];
|
23
|
+
var visibleItemCount = useRef(0);
|
24
|
+
var handleResize = function handleResize() {
|
25
|
+
if (containerRef.current) {
|
26
|
+
var _offsetRef$current;
|
27
|
+
var offset = (offsetRef === null || offsetRef === void 0 || (_offsetRef$current = offsetRef.current) === null || _offsetRef$current === void 0 ? void 0 : _offsetRef$current.offsetWidth) || 0;
|
28
|
+
var newMax = containerRef.current.offsetWidth - offset;
|
29
|
+
setMaxWidth(newMax);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
useResizeObserver(containerRef, handleResize);
|
33
|
+
var getMap = function getMap() {
|
34
|
+
if (!itemsRef.current) {
|
35
|
+
itemsRef.current = new Map();
|
36
|
+
}
|
37
|
+
return itemsRef.current;
|
38
|
+
};
|
39
|
+
var itemRefHandler = function itemRefHandler(id, node) {
|
40
|
+
var map = getMap();
|
41
|
+
if (node) {
|
42
|
+
var _getComputedStyle;
|
43
|
+
var style = (_getComputedStyle = getComputedStyle) === null || _getComputedStyle === void 0 ? void 0 : _getComputedStyle(node);
|
44
|
+
var totalWidth = node.offsetWidth + parseInt(style.marginLeft) + parseInt(style.marginRight);
|
45
|
+
map.set(id, totalWidth);
|
46
|
+
}
|
47
|
+
return function () {
|
48
|
+
map.delete(id);
|
49
|
+
};
|
50
|
+
};
|
51
|
+
var getVisibleItems = function getVisibleItems() {
|
52
|
+
if (!containerRef) {
|
53
|
+
return items;
|
54
|
+
}
|
55
|
+
var map = getMap();
|
56
|
+
var maxReached = false;
|
57
|
+
var accumulatedWidth = 0;
|
58
|
+
var visibleItems = items.slice(0, maxItems).reduce(function (prev, cur) {
|
59
|
+
if (maxReached) {
|
60
|
+
return prev;
|
61
|
+
}
|
62
|
+
var itemWidth = map.get(cur.id) || 0;
|
63
|
+
var willFit = accumulatedWidth + itemWidth <= maxWidth;
|
64
|
+
if (willFit) {
|
65
|
+
accumulatedWidth += itemWidth;
|
66
|
+
prev.push(cur);
|
67
|
+
} else {
|
68
|
+
maxReached = true;
|
69
|
+
}
|
70
|
+
return prev;
|
71
|
+
}, []);
|
72
|
+
return visibleItems;
|
73
|
+
};
|
74
|
+
var visibleItems = getVisibleItems();
|
75
|
+
var hiddenItems = items.slice(visibleItems.length);
|
76
|
+
// only call the change handler when the number of visible items has changed
|
77
|
+
if (visibleItems.length !== visibleItemCount.current) {
|
78
|
+
visibleItemCount.current = visibleItems.length;
|
79
|
+
onChange === null || onChange === void 0 || onChange(hiddenItems);
|
80
|
+
}
|
81
|
+
return {
|
82
|
+
visibleItems: visibleItems,
|
83
|
+
itemRefHandler: itemRefHandler,
|
84
|
+
hiddenItems: hiddenItems
|
85
|
+
};
|
86
|
+
};
|
87
|
+
|
88
|
+
export { useOverflowItems };
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
7
7
|
*/
|
8
8
|
import { TextAreaProps, TextInputProps } from '@carbon/react';
|
9
|
-
import { CarbonIconType } from '@carbon/react
|
9
|
+
import { CarbonIconType } from '@carbon/icons-react';
|
10
10
|
import { NumberInputProps } from '@carbon/react/lib/components/NumberInput/NumberInput';
|
11
11
|
import { Dispatch, ForwardedRef, PropsWithChildren, ReactNode, SetStateAction } from 'react';
|
12
12
|
export type LogicalOperator = 'and' | 'or';
|
@@ -154,7 +154,7 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
154
154
|
onChange: onSearchChangeHandler
|
155
155
|
})), multiSelectable && /*#__PURE__*/React.createElement("div", {
|
156
156
|
className: "".concat(util.blockClass, "__multiselectSelectionStatusContainer")
|
157
|
-
}, /*#__PURE__*/React.createElement("
|
157
|
+
}, /*#__PURE__*/React.createElement("label", null, selection.length, "/", allOptions.length, " Selected"), /*#__PURE__*/React.createElement(react.Button, {
|
158
158
|
kind: 'ghost',
|
159
159
|
size: 'sm',
|
160
160
|
"data-selected-all": "".concat(selection.length == 0 ? true : false),
|
@@ -378,7 +378,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
378
378
|
}, cell.render('Cell')));
|
379
379
|
}));
|
380
380
|
}
|
381
|
-
}, [prepareRow, renderRowHeader,
|
381
|
+
}, [prepareRow, renderRowHeader, rows, hasCustomRowHeader, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, columns, defaultColumn, renderRowHeaderDirection]);
|
382
382
|
var spreadsheetBodyRef = React.useRef(undefined);
|
383
383
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({
|
384
384
|
ref: spreadsheetBodyRef,
|
@@ -174,6 +174,9 @@ exports.InterstitialScreen = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
174
174
|
return window.removeEventListener('keydown', close);
|
175
175
|
};
|
176
176
|
}, [handleClose]);
|
177
|
+
var stepSize = React.useMemo(function () {
|
178
|
+
return children && React.Children.count(children) > 1 ? parseFloat((1 / (React.Children.count(children) - 1)).toFixed(2)) : 0;
|
179
|
+
}, [children]);
|
177
180
|
if (!isOpen) {
|
178
181
|
return null;
|
179
182
|
}
|
@@ -239,6 +242,10 @@ exports.InterstitialScreen = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
239
242
|
}
|
240
243
|
})))), childElements, renderFooter()));
|
241
244
|
};
|
245
|
+
var scrollToCurrentStep = function scrollToCurrentStep(scrollPercent) {
|
246
|
+
var currentStep = scrollPercent / stepSize;
|
247
|
+
setProgStep(Math.ceil(currentStep));
|
248
|
+
};
|
242
249
|
var renderBody = function renderBody() {
|
243
250
|
return /*#__PURE__*/React.createElement("div", {
|
244
251
|
className: cx("".concat(blockClass, "--body")),
|
@@ -261,9 +268,7 @@ exports.InterstitialScreen = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
261
268
|
}, /*#__PURE__*/React.createElement(Carousel.Carousel, {
|
262
269
|
disableArrowScroll: true,
|
263
270
|
ref: scrollRef,
|
264
|
-
onScroll:
|
265
|
-
scrollPercent === 0 && setProgStep(0);
|
266
|
-
}
|
271
|
+
onScroll: scrollToCurrentStep
|
267
272
|
}, children)) : childArray[0])), mediaIsDefined && /*#__PURE__*/React.createElement(react.Column, {
|
268
273
|
xlg: mediaBreakpoints.xlg,
|
269
274
|
lg: mediaBreakpoints.lg,
|
@@ -283,9 +288,7 @@ exports.InterstitialScreen = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
283
288
|
}, /*#__PURE__*/React.createElement(Carousel.Carousel, {
|
284
289
|
disableArrowScroll: true,
|
285
290
|
ref: scrollRef,
|
286
|
-
onScroll:
|
287
|
-
scrollPercent === 0 && setProgStep(0);
|
288
|
-
}
|
291
|
+
onScroll: scrollToCurrentStep
|
289
292
|
}, children)) : /*#__PURE__*/React.createElement("div", null, childArray[0])));
|
290
293
|
};
|
291
294
|
var renderFooter = function renderFooter() {
|
@@ -29,6 +29,7 @@ var usePrefersReducedMotion = require('../../global/js/hooks/usePrefersReducedMo
|
|
29
29
|
var wrapFocus = require('../../global/js/utils/wrapFocus.js');
|
30
30
|
var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
|
31
31
|
var useClickOutside = require('../../global/js/hooks/useClickOutside.js');
|
32
|
+
var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
|
32
33
|
|
33
34
|
var _Close;
|
34
35
|
var _excluded = ["className", "data", "daysAgoText", "dismissAllLabel", "dismissSingleNotificationIconDescription", "doNotDisturbDefaultToggled", "doNotDisturbLabel", "emptyStateLabel", "hourAgoText", "hoursAgoText", "minuteAgoText", "minutesAgoText", "monthAgoText", "monthsAgoText", "nowText", "onClickOutside", "onDismissAllNotifications", "onDismissSingleNotification", "onDoNotDisturbChange", "onSettingsClick", "onViewAllClick", "open", "previousLabel", "readLessLabel", "readMoreLabel", "secondsAgoText", "settingsIconDescription", "title", "todayLabel", "viewAllLabel", "yearAgoText", "yearsAgoText", "yesterdayAtText", "yesterdayLabel", "selectorsFloatingMenus", "triggerButtonRef"];
|
@@ -378,6 +379,17 @@ exports.NotificationsPanel = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
378
379
|
onDismissSingleNotification(notification);
|
379
380
|
};
|
380
381
|
var mainSectionClassName = cx(["".concat(blockClass, "__main-section"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__main-section-empty"), allNotifications && !allNotifications.length)]);
|
382
|
+
useIsomorphicEffect.useIsomorphicEffect(function () {
|
383
|
+
// setTimeout ensures that this gets run
|
384
|
+
var timeout = setTimeout(function () {
|
385
|
+
if (notificationPanelRef.current && !reducedMotion) {
|
386
|
+
notificationPanelRef.current.style.animation = open ? 'fade-in 250ms' : 'fade-out forwards 250ms';
|
387
|
+
}
|
388
|
+
}, 0);
|
389
|
+
return function () {
|
390
|
+
return clearTimeout(timeout);
|
391
|
+
};
|
392
|
+
}, [open, reducedMotion]);
|
381
393
|
return shouldRender ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
382
394
|
type: "button",
|
383
395
|
className: "".concat(carbonPrefix, "--visually-hidden"),
|
@@ -391,9 +403,6 @@ exports.NotificationsPanel = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
391
403
|
}, rest, {
|
392
404
|
id: blockClass,
|
393
405
|
className: cx(blockClass, className, "".concat(blockClass, "__container")),
|
394
|
-
style: {
|
395
|
-
animation: !reducedMotion ? "".concat(open ? 'fade-in 250ms' : 'fade-out forwards 250ms') : undefined
|
396
|
-
},
|
397
406
|
onAnimationEnd: onAnimationEnd,
|
398
407
|
ref: ref || notificationPanelRef
|
399
408
|
}, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement("div", {
|
@@ -24,6 +24,7 @@ var useResizeObserver = require('../../global/js/hooks/useResizeObserver.js');
|
|
24
24
|
var checkForOverflow = require('../../global/js/utils/checkForOverflow.js');
|
25
25
|
var useWindowScroll = require('../../global/js/hooks/useWindowScroll.js');
|
26
26
|
var useWindowResize = require('../../global/js/hooks/useWindowResize.js');
|
27
|
+
var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
|
27
28
|
var BreadcrumbWithOverflow = require('../BreadcrumbWithOverflow/BreadcrumbWithOverflow.js');
|
28
29
|
var ActionBar = require('../ActionBar/ActionBar.js');
|
29
30
|
var ButtonSetWithOverflow = require('../ButtonSetWithOverflow/ButtonSetWithOverflow.js');
|
@@ -364,6 +365,16 @@ exports.PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
364
365
|
}
|
365
366
|
};
|
366
367
|
var displayedBreadcrumbs = getBreadcrumbs();
|
368
|
+
useIsomorphicEffect.useIsomorphicEffect(function () {
|
369
|
+
Object.keys(pageHeaderStyles).forEach(function (key) {
|
370
|
+
// check if style is a css var
|
371
|
+
if (key.startsWith('--')) {
|
372
|
+
headerRef.current.style.setProperty(key, pageHeaderStyles[key]);
|
373
|
+
} else {
|
374
|
+
headerRef.current.style[key] = pageHeaderStyles[key];
|
375
|
+
}
|
376
|
+
});
|
377
|
+
}, [headerRef, pageHeaderStyles]);
|
367
378
|
var subtitleRef = React.useRef(null);
|
368
379
|
var isOverflowing = checkForOverflow.checkHeightOverflow(subtitleRef.current);
|
369
380
|
var subtitleContent = /*#__PURE__*/React.createElement("span", {
|
@@ -375,7 +386,6 @@ exports.PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
375
386
|
ref: offsetTopMeasuringRef
|
376
387
|
}), /*#__PURE__*/React.createElement("section", _rollupPluginBabelHelpers.extends({}, rest, {
|
377
388
|
className: cx([PageHeaderUtils.blockClass, "".concat(PageHeaderUtils.blockClass, "--no-margins-below-row"), className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(PageHeaderUtils.blockClass, "--has-navigation"), navigation || tags), "".concat(PageHeaderUtils.blockClass, "--has-navigation-tags-only"), !navigation && tags)]),
|
378
|
-
style: pageHeaderStyles,
|
379
389
|
ref: headerRef
|
380
390
|
}, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(react.FlexGrid, {
|
381
391
|
fullWidth: fullWidthGrid === true || fullWidthGrid === 'xl',
|