@carbon/ibm-products 2.60.0 → 2.61.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.
- package/css/index-full-carbon.css +113 -497
- 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 +64 -492
- 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 +93 -492
- 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 +93 -510
- 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/ActionBar/ActionBar.d.ts +3 -3
- package/es/components/ActionBar/ActionBar.js +47 -150
- package/es/components/ActionBar/ActionBarOverflowItems.js +1 -1
- package/es/components/Checklist/ChecklistChart.js +1 -1
- package/es/components/Coachmark/Coachmark.js +1 -1
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +3 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +7 -2
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +7 -2
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +15 -15
- package/es/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/es/components/ConditionBuilder/utils/util.js +7 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +1 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +2 -2
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
- package/es/components/Datagrid/useDatagrid.js +2 -2
- package/es/components/Datagrid/useInfiniteScroll.js +2 -5
- package/es/components/Datagrid/useRowIsMouseOver.d.ts +1 -1
- package/es/components/Datagrid/useRowIsMouseOver.js +2 -1
- package/es/components/Datagrid/useStickyColumn.d.ts +1 -1
- package/es/components/Datagrid/useStickyColumn.js +1 -1
- package/es/components/FilterSummary/FilterSummary.js +1 -1
- package/es/components/InterstitialScreen/InterstitialScreen.js +1 -1
- package/es/components/Nav/NavItem.js +1 -1
- package/es/components/NotificationsPanel/NotificationsPanel.d.ts +5 -0
- package/es/components/NotificationsPanel/NotificationsPanel.js +11 -17
- package/es/components/OptionsTile/OptionsTile.d.ts +2 -3
- package/es/components/OptionsTile/OptionsTile.js +49 -97
- package/es/components/PageHeader/PageHeader.js +16 -14
- package/es/components/PageHeader/PageHeaderTitle.js +2 -2
- package/es/components/ScrollGradient/ScrollGradient.js +74 -25
- package/es/components/ScrollGradient/constants.d.ts +0 -5
- package/es/components/ScrollGradient/constants.js +2 -47
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +1 -1
- package/es/components/TagOverflow/TagOverflow.d.ts +5 -1
- package/es/components/Tearsheet/Tearsheet.d.ts +5 -1
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +5 -1
- package/es/components/WebTerminal/WebTerminal.js +0 -13
- package/es/global/js/hooks/useControllableState.d.ts +12 -24
- package/es/global/js/hooks/useControllableState.js +18 -60
- package/es/global/js/hooks/useOverflowItems.d.ts +7 -2
- package/es/global/js/hooks/useOverflowItems.js +50 -17
- package/es/global/js/hooks/useOverflowString.d.ts +9 -0
- package/es/global/js/hooks/useOverflowString.js +52 -0
- package/es/global/js/hooks/usePresence.d.ts +1 -1
- package/es/global/js/hooks/usePresence.js +2 -2
- package/es/global/js/utils/checkForOverflow.js +1 -11
- package/es/global/js/utils/clamp.d.ts +7 -0
- package/es/global/js/utils/clamp.js +25 -0
- package/es/global/js/utils/debounce.d.ts +7 -0
- package/es/global/js/utils/debounce.js +30 -0
- package/es/global/js/utils/deepCompareObject.d.ts +7 -0
- package/es/global/js/utils/deepCompareObject.js +47 -0
- package/es/global/js/utils/throttle.d.ts +7 -0
- package/es/global/js/utils/throttle.js +19 -0
- package/es/global/js/utils/uuidv4.d.ts +2 -2
- package/es/global/js/utils/uuidv4.js +3 -2
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-10.js +2787 -0
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-3.js +1013 -943
- package/lib/components/ActionBar/ActionBar.d.ts +3 -3
- package/lib/components/ActionBar/ActionBar.js +45 -148
- package/lib/components/ActionBar/ActionBarOverflowItems.js +1 -1
- package/lib/components/Checklist/ChecklistChart.js +2 -2
- package/lib/components/Coachmark/Coachmark.js +2 -2
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +4 -4
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +3 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +6 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +6 -1
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +15 -15
- package/lib/components/ConditionBuilder/utils/util.d.ts +1 -0
- package/lib/components/ConditionBuilder/utils/util.js +7 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/common.js +1 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +2 -2
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
- package/lib/components/Datagrid/useDatagrid.js +2 -2
- package/lib/components/Datagrid/useInfiniteScroll.js +2 -5
- package/lib/components/Datagrid/useRowIsMouseOver.d.ts +1 -1
- package/lib/components/Datagrid/useRowIsMouseOver.js +3 -2
- package/lib/components/Datagrid/useStickyColumn.d.ts +1 -1
- package/lib/components/Datagrid/useStickyColumn.js +2 -2
- package/lib/components/FilterSummary/FilterSummary.js +2 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.js +3 -3
- package/lib/components/Nav/NavItem.js +2 -2
- package/lib/components/NotificationsPanel/NotificationsPanel.d.ts +5 -0
- package/lib/components/NotificationsPanel/NotificationsPanel.js +11 -17
- package/lib/components/OptionsTile/OptionsTile.d.ts +2 -3
- package/lib/components/OptionsTile/OptionsTile.js +49 -97
- package/lib/components/PageHeader/PageHeader.js +16 -14
- package/lib/components/PageHeader/PageHeaderTitle.js +2 -2
- package/lib/components/ScrollGradient/ScrollGradient.js +72 -23
- package/lib/components/ScrollGradient/constants.d.ts +0 -5
- package/lib/components/ScrollGradient/constants.js +1 -48
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +2 -2
- package/lib/components/TagOverflow/TagOverflow.d.ts +5 -1
- package/lib/components/Tearsheet/Tearsheet.d.ts +5 -1
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +5 -1
- package/lib/components/WebTerminal/WebTerminal.js +0 -13
- package/lib/global/js/hooks/useControllableState.d.ts +12 -24
- package/lib/global/js/hooks/useControllableState.js +17 -59
- package/lib/global/js/hooks/useOverflowItems.d.ts +7 -2
- package/lib/global/js/hooks/useOverflowItems.js +49 -16
- package/lib/global/js/hooks/useOverflowString.d.ts +9 -0
- package/lib/global/js/hooks/useOverflowString.js +55 -0
- package/lib/global/js/hooks/usePresence.d.ts +1 -1
- package/lib/global/js/hooks/usePresence.js +2 -2
- package/lib/global/js/utils/checkForOverflow.js +0 -11
- package/lib/global/js/utils/clamp.d.ts +7 -0
- package/lib/global/js/utils/clamp.js +27 -0
- package/lib/global/js/utils/debounce.d.ts +7 -0
- package/lib/global/js/utils/debounce.js +32 -0
- package/lib/global/js/utils/deepCompareObject.d.ts +7 -0
- package/lib/global/js/utils/deepCompareObject.js +49 -0
- package/lib/global/js/utils/throttle.d.ts +7 -0
- package/lib/global/js/utils/throttle.js +21 -0
- package/lib/global/js/utils/uuidv4.d.ts +2 -2
- package/lib/global/js/utils/uuidv4.js +3 -2
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-10.js +2913 -0
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-3.js +1018 -948
- package/package.json +6 -7
- package/scss/components/NotificationsPanel/_notifications-panel.scss +33 -20
- package/scss/components/ScrollGradient/_scroll-gradient.scss +30 -0
- package/scss/components/UserAvatar/_user-avatar.scss +2 -6
- package/scss/components/WebTerminal/_web-terminal.scss +13 -1
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +0 -2959
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +0 -3085
@@ -6,6 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
import { Link } from '@carbon/react';
|
8
8
|
import React, { RefObject } from 'react';
|
9
|
+
export type Themes = 'light' | 'dark';
|
9
10
|
interface Link {
|
10
11
|
url: string;
|
11
12
|
text: string;
|
@@ -61,6 +62,10 @@ export interface NotificationsPanelProps {
|
|
61
62
|
* Sets the `hours ago` label text
|
62
63
|
*/
|
63
64
|
hoursAgoText?: (value: number) => string;
|
65
|
+
/**
|
66
|
+
* Determines the theme of the empty state's illustration.
|
67
|
+
*/
|
68
|
+
illustrationTheme: Themes;
|
64
69
|
/**
|
65
70
|
* Sets the `minute ago` label text
|
66
71
|
*/
|
@@ -22,19 +22,17 @@ import cx from 'classnames';
|
|
22
22
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
23
23
|
import { pkg } from '../../settings.js';
|
24
24
|
import { prepareProps } from '../../global/js/utils/props-helper.js';
|
25
|
-
import { timeAgo } from './utils.js';
|
26
25
|
import { usePrefersReducedMotion } from '../../global/js/hooks/usePrefersReducedMotion.js';
|
26
|
+
import { timeAgo } from './utils.js';
|
27
27
|
import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
|
28
28
|
import { useClickOutside } from '../../global/js/hooks/useClickOutside.js';
|
29
|
-
import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
|
30
29
|
|
31
30
|
var _Close;
|
32
|
-
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", "triggerButtonRef"];
|
31
|
+
var _excluded = ["className", "data", "daysAgoText", "dismissAllLabel", "dismissSingleNotificationIconDescription", "doNotDisturbDefaultToggled", "doNotDisturbLabel", "emptyStateLabel", "hourAgoText", "hoursAgoText", "illustrationTheme", "minuteAgoText", "minutesAgoText", "monthAgoText", "monthsAgoText", "nowText", "onClickOutside", "onDismissAllNotifications", "onDismissSingleNotification", "onDoNotDisturbChange", "onSettingsClick", "onViewAllClick", "open", "previousLabel", "readLessLabel", "readMoreLabel", "secondsAgoText", "settingsIconDescription", "title", "todayLabel", "viewAllLabel", "yearAgoText", "yearsAgoText", "yesterdayAtText", "yesterdayLabel", "triggerButtonRef"];
|
33
32
|
|
34
33
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
35
34
|
var componentName = 'NotificationsPanel';
|
36
35
|
var blockClass = "".concat(pkg.prefix, "--notifications-panel");
|
37
|
-
|
38
36
|
// Default values for props
|
39
37
|
var defaults = {
|
40
38
|
daysAgoText: function daysAgoText(value) {
|
@@ -50,6 +48,7 @@ var defaults = {
|
|
50
48
|
hoursAgoText: function hoursAgoText(value) {
|
51
49
|
return "".concat(value, " hours ago");
|
52
50
|
},
|
51
|
+
illustrationTheme: 'light',
|
53
52
|
minuteAgoText: function minuteAgoText(value) {
|
54
53
|
return "".concat(value, " minute ago");
|
55
54
|
},
|
@@ -106,6 +105,8 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
106
105
|
hourAgoText = _ref$hourAgoText === undefined ? defaults.hourAgoText : _ref$hourAgoText,
|
107
106
|
_ref$hoursAgoText = _ref.hoursAgoText,
|
108
107
|
hoursAgoText = _ref$hoursAgoText === undefined ? defaults.hoursAgoText : _ref$hoursAgoText,
|
108
|
+
_ref$illustrationThem = _ref.illustrationTheme,
|
109
|
+
illustrationTheme = _ref$illustrationThem === undefined ? defaults.illustrationTheme : _ref$illustrationThem,
|
109
110
|
_ref$minuteAgoText = _ref.minuteAgoText,
|
110
111
|
minuteAgoText = _ref$minuteAgoText === undefined ? defaults.minuteAgoText : _ref$minuteAgoText,
|
111
112
|
_ref$minutesAgoText = _ref.minutesAgoText,
|
@@ -363,17 +364,6 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
363
364
|
onDismissSingleNotification(notification);
|
364
365
|
};
|
365
366
|
var mainSectionClassName = cx(["".concat(blockClass, "__main-section"), _defineProperty({}, "".concat(blockClass, "__main-section-empty"), allNotifications && !allNotifications.length)]);
|
366
|
-
useIsomorphicEffect(function () {
|
367
|
-
// setTimeout ensures that this gets run
|
368
|
-
var timeout = setTimeout(function () {
|
369
|
-
if (notificationPanelRef.current && !reducedMotion) {
|
370
|
-
notificationPanelRef.current.style.animation = open ? 'fade-in 250ms' : 'fade-out forwards 250ms';
|
371
|
-
}
|
372
|
-
}, 0);
|
373
|
-
return function () {
|
374
|
-
return clearTimeout(timeout);
|
375
|
-
};
|
376
|
-
}, [open, reducedMotion]);
|
377
367
|
return shouldRender ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("button", {
|
378
368
|
type: "button",
|
379
369
|
className: "".concat(carbonPrefix, "--visually-hidden"),
|
@@ -385,7 +375,7 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
385
375
|
tabIndex: 0
|
386
376
|
}, rest, {
|
387
377
|
id: blockClass,
|
388
|
-
className: cx(blockClass, className, "".concat(blockClass, "__container")),
|
378
|
+
className: cx(blockClass, className, "".concat(blockClass, "__container"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__entrance"), open), "".concat(blockClass, "__exit"), !open)),
|
389
379
|
onAnimationEnd: onAnimationEnd,
|
390
380
|
ref: ref || notificationPanelRef
|
391
381
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement("div", {
|
@@ -428,7 +418,7 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
428
418
|
}, previousLabel), previousNotifications.map(function (notification, index) {
|
429
419
|
return renderNotification('previous', notification, index);
|
430
420
|
})) : null, !allNotifications.length && /*#__PURE__*/React__default.createElement(NotificationsEmptyState, {
|
431
|
-
illustrationTheme:
|
421
|
+
illustrationTheme: illustrationTheme,
|
432
422
|
title: "",
|
433
423
|
subtitle: emptyStateLabel
|
434
424
|
})), onViewAllClick && onSettingsClick && allNotifications && allNotifications.length > 0 && /*#__PURE__*/React__default.createElement("div", {
|
@@ -521,6 +511,10 @@ NotificationsPanel.propTypes = {
|
|
521
511
|
* Sets the `hours ago` label text
|
522
512
|
*/
|
523
513
|
hoursAgoText: PropTypes.func,
|
514
|
+
/**
|
515
|
+
* Determines the theme of the empty state's illustration.
|
516
|
+
*/
|
517
|
+
illustrationTheme: PropTypes.oneOf(['light', 'dark']),
|
524
518
|
/**
|
525
519
|
* Sets the `minute ago` label text
|
526
520
|
*/
|
@@ -37,8 +37,7 @@ export interface OptionsTileProps {
|
|
37
37
|
*/
|
38
38
|
lockedText?: string;
|
39
39
|
/**
|
40
|
-
*
|
41
|
-
* toggles the open state of the OptionsTile.
|
40
|
+
* A handler for managing the controlled state of open prop. If not passed the open prop will not be honored and an uncontrolled state will be used.
|
42
41
|
*/
|
43
42
|
onChange?: (value: boolean) => void;
|
44
43
|
/**
|
@@ -47,7 +46,7 @@ export interface OptionsTileProps {
|
|
47
46
|
*/
|
48
47
|
onToggle?: (value: boolean) => void;
|
49
48
|
/**
|
50
|
-
*
|
49
|
+
* For controlled usage of the tile open state. This prop only works when an onChange prop is also passed, otherwise an uncontrolled state is used.
|
51
50
|
*/
|
52
51
|
open?: boolean;
|
53
52
|
/**
|
@@ -26,64 +26,43 @@ var componentName = 'OptionsTile';
|
|
26
26
|
var defaults = {
|
27
27
|
size: 'lg'
|
28
28
|
};
|
29
|
-
var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (
|
30
|
-
var children =
|
31
|
-
className =
|
32
|
-
enabled =
|
33
|
-
invalid =
|
34
|
-
invalidText =
|
35
|
-
locked =
|
36
|
-
lockedText =
|
37
|
-
|
38
|
-
onToggle =
|
39
|
-
|
40
|
-
|
41
|
-
size =
|
42
|
-
summary =
|
43
|
-
title =
|
44
|
-
userDefinedTitleId =
|
45
|
-
warn =
|
46
|
-
warnText =
|
47
|
-
rest = _objectWithoutProperties(
|
48
|
-
var _useState = useState(
|
29
|
+
var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
30
|
+
var children = props.children,
|
31
|
+
className = props.className,
|
32
|
+
enabled = props.enabled,
|
33
|
+
invalid = props.invalid,
|
34
|
+
invalidText = props.invalidText,
|
35
|
+
locked = props.locked,
|
36
|
+
lockedText = props.lockedText,
|
37
|
+
onChange = props.onChange,
|
38
|
+
onToggle = props.onToggle,
|
39
|
+
userOpen = props.open,
|
40
|
+
_props$size = props.size,
|
41
|
+
size = _props$size === undefined ? defaults.size : _props$size,
|
42
|
+
summary = props.summary,
|
43
|
+
title = props.title,
|
44
|
+
userDefinedTitleId = props.titleId,
|
45
|
+
warn = props.warn,
|
46
|
+
warnText = props.warnText,
|
47
|
+
rest = _objectWithoutProperties(props, _excluded);
|
48
|
+
var _useState = useState(false),
|
49
49
|
_useState2 = _slicedToArray(_useState, 2),
|
50
|
-
|
51
|
-
|
52
|
-
var
|
53
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
54
|
-
closing = _useState4[0],
|
55
|
-
setClosing = _useState4[1];
|
56
|
-
var _useControllableState = useControllableState({
|
57
|
-
defaultValue: open || null,
|
58
|
-
name: 'OptionsTile',
|
59
|
-
onChange: function onChange(value) {
|
60
|
-
return _onChange === null || _onChange === undefined ? undefined : _onChange(value);
|
61
|
-
},
|
62
|
-
value: open
|
63
|
-
}),
|
50
|
+
closing = _useState2[0],
|
51
|
+
setClosing = _useState2[1];
|
52
|
+
var _useControllableState = useControllableState(userOpen !== null && userOpen !== undefined ? userOpen : false, onChange),
|
64
53
|
_useControllableState2 = _slicedToArray(_useControllableState, 2),
|
65
|
-
|
66
|
-
|
54
|
+
open = _useControllableState2[0],
|
55
|
+
setOpen = _useControllableState2[1];
|
67
56
|
var detailsRef = useRef(null);
|
68
57
|
var contentRef = useRef(null);
|
69
|
-
var
|
70
|
-
var titleId = userDefinedTitleId !== null && userDefinedTitleId !== undefined ? userDefinedTitleId : "".concat(id, "-title");
|
58
|
+
var titleId = userDefinedTitleId !== null && userDefinedTitleId !== undefined ? userDefinedTitleId : "".concat(uuidv4(), "-title");
|
71
59
|
var isExpandable = children !== undefined;
|
72
|
-
var
|
73
|
-
var
|
74
|
-
var isLocked = !isInvalid && !isWarn && locked;
|
60
|
+
var isWarn = !invalid && warn;
|
61
|
+
var isLocked = !invalid && !isWarn && locked;
|
75
62
|
var shouldReduceMotion = usePrefersReducedMotion();
|
76
|
-
|
77
|
-
if (isOpen && !open) {
|
78
|
-
collapse();
|
79
|
-
} else if (!isOpen && open) {
|
80
|
-
expand();
|
81
|
-
}
|
82
|
-
setPrevIsOpen(open);
|
83
|
-
}
|
84
|
-
function expand() {
|
63
|
+
var expand = function expand() {
|
85
64
|
if (detailsRef.current && contentRef.current && !shouldReduceMotion) {
|
86
|
-
|
65
|
+
setOpen(true);
|
87
66
|
detailsRef.current.open = true;
|
88
67
|
var _getComputedStyle = getComputedStyle(contentRef.current),
|
89
68
|
paddingTop = _getComputedStyle.paddingTop,
|
@@ -106,11 +85,10 @@ var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
106
85
|
easing: carbonMotion.easings.entrance.productive
|
107
86
|
});
|
108
87
|
} else {
|
109
|
-
|
110
|
-
setIsOpen(true);
|
88
|
+
setOpen(true);
|
111
89
|
}
|
112
|
-
}
|
113
|
-
function collapse() {
|
90
|
+
};
|
91
|
+
var collapse = function collapse() {
|
114
92
|
if (contentRef.current && !shouldReduceMotion) {
|
115
93
|
setClosing(true);
|
116
94
|
var _getComputedStyle2 = getComputedStyle(contentRef.current),
|
@@ -133,76 +111,57 @@ var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
133
111
|
easing: carbonMotion.easings.entrance.productive
|
134
112
|
});
|
135
113
|
var callback = function callback() {
|
136
|
-
|
114
|
+
setOpen(false);
|
137
115
|
setClosing(false);
|
138
116
|
};
|
139
|
-
|
140
|
-
//This is to fix the flicking issue while collapsing.
|
141
|
-
//root cause : after the animation is finished , isOpen is still true until onFinish callback is triggered.For that minute duration , collapsed content will again show.
|
142
|
-
// To avoid this , isOpen is set to false after the 90% of animation duration.
|
143
117
|
setTimeout(function () {
|
144
118
|
callback();
|
145
119
|
}, animationDuration * 0.9);
|
146
|
-
|
147
|
-
// animation.onfinish = callback;
|
148
120
|
animation.oncancel = callback;
|
149
121
|
} else {
|
150
|
-
|
151
|
-
setIsOpen(false);
|
122
|
+
setOpen(false);
|
152
123
|
}
|
153
|
-
}
|
154
|
-
function toggle(
|
155
|
-
|
156
|
-
if (
|
124
|
+
};
|
125
|
+
var toggle = function toggle(evt) {
|
126
|
+
evt.preventDefault();
|
127
|
+
if (open) {
|
157
128
|
collapse();
|
158
129
|
} else {
|
159
130
|
expand();
|
160
131
|
}
|
161
|
-
}
|
162
|
-
function renderTitle() {
|
132
|
+
};
|
133
|
+
var renderTitle = function renderTitle() {
|
163
134
|
var Icon = null;
|
164
135
|
var text = summary;
|
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
|
-
}
|
172
136
|
if (invalid) {
|
173
137
|
Icon = WarningFilled;
|
174
138
|
text = invalidText;
|
175
|
-
summaryClasses.push("".concat(blockClass, "__summary--invalid"));
|
176
139
|
} else if (warn) {
|
177
140
|
Icon = WarningAltFilled;
|
178
141
|
text = warnText;
|
179
|
-
summaryClasses.push("".concat(blockClass, "__summary--warn"));
|
180
142
|
} else if (locked) {
|
181
143
|
Icon = Locked;
|
182
|
-
summaryClasses.push("".concat(blockClass, "__summary--locked"));
|
183
144
|
if (!text) {
|
184
145
|
text = lockedText;
|
185
146
|
}
|
186
147
|
}
|
187
148
|
var hasValidationState = invalid || warn || locked;
|
188
149
|
var summaryHidden = !hasValidationState && enabled === false;
|
189
|
-
|
190
|
-
summaryClasses.push("".concat(blockClass, "__summary--hidden"));
|
191
|
-
}
|
150
|
+
var summaryClasses = cx("".concat(blockClass, "__summary"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__summary--closing"), closing), "".concat(blockClass, "__summary--open"), open), "".concat(blockClass, "__summary--invalid"), invalid), "".concat(blockClass, "__summary--warn"), warn), "".concat(blockClass, "__summary--locked"), locked), "".concat(blockClass, "__summary--hidden"), summaryHidden));
|
192
151
|
return /*#__PURE__*/React__default.createElement("div", {
|
193
152
|
className: "".concat(blockClass, "__heading")
|
194
153
|
}, /*#__PURE__*/React__default.createElement("h6", {
|
195
154
|
id: titleId,
|
196
155
|
className: "".concat(blockClass, "__title")
|
197
156
|
}, title), text && /*#__PURE__*/React__default.createElement("span", {
|
198
|
-
className:
|
157
|
+
className: summaryClasses,
|
199
158
|
"aria-hidden": summaryHidden
|
200
159
|
}, Icon && /*#__PURE__*/React__default.createElement(Icon, {
|
201
160
|
size: 16
|
202
161
|
}), /*#__PURE__*/React__default.createElement("span", {
|
203
162
|
className: "".concat(blockClass, "__summary-text")
|
204
163
|
}, text)));
|
205
|
-
}
|
164
|
+
};
|
206
165
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
207
166
|
className: cx(blockClass, className, "".concat(blockClass, "--").concat(size), _defineProperty({}, "".concat(blockClass, "--closing"), closing)),
|
208
167
|
ref: ref
|
@@ -218,20 +177,14 @@ var OptionsTile = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
218
177
|
size: "sm",
|
219
178
|
disabled: isLocked
|
220
179
|
})), isExpandable ? /*#__PURE__*/React__default.createElement("details", {
|
221
|
-
open:
|
180
|
+
open: open,
|
222
181
|
ref: detailsRef
|
223
|
-
},
|
224
|
-
/*#__PURE__*/
|
225
|
-
/* summary should not be considered non-interactive
|
226
|
-
* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/656
|
227
|
-
* https://github.com/A11yance/axobject-query/issues/319
|
228
|
-
*/
|
229
|
-
React__default.createElement("summary", {
|
182
|
+
}, /*#__PURE__*/React__default.createElement("summary", {
|
230
183
|
className: "".concat(blockClass, "__header"),
|
231
184
|
onClick: toggle
|
232
185
|
}, /*#__PURE__*/React__default.createElement(ChevronDown, {
|
233
186
|
size: 16,
|
234
|
-
className: cx("".concat(blockClass, "__chevron"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__chevron--open"),
|
187
|
+
className: cx("".concat(blockClass, "__chevron"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__chevron--open"), open), "".concat(blockClass, "__chevron--closing"), closing))
|
235
188
|
}), renderTitle()), /*#__PURE__*/React__default.createElement("div", {
|
236
189
|
className: "".concat(blockClass, "__content"),
|
237
190
|
ref: contentRef
|
@@ -286,8 +239,7 @@ OptionsTile.propTypes = {
|
|
286
239
|
*/
|
287
240
|
lockedText: PropTypes.string,
|
288
241
|
/**
|
289
|
-
*
|
290
|
-
* toggles the open state of the OptionsTile.
|
242
|
+
* A handler for managing the controlled state of open prop. If not passed the open prop will not be honored and an uncontrolled state will be used.
|
291
243
|
*/
|
292
244
|
onChange: PropTypes.func,
|
293
245
|
/**
|
@@ -296,7 +248,7 @@ OptionsTile.propTypes = {
|
|
296
248
|
*/
|
297
249
|
onToggle: PropTypes.func,
|
298
250
|
/**
|
299
|
-
*
|
251
|
+
* For controlled usage of the tile open state. This prop only works when an onChange prop is also passed, otherwise an uncontrolled state is used.
|
300
252
|
*/
|
301
253
|
open: PropTypes.bool,
|
302
254
|
/**
|
@@ -19,7 +19,7 @@ import cx from 'classnames';
|
|
19
19
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
20
20
|
import { pkg } from '../../settings.js';
|
21
21
|
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
|
22
|
-
import {
|
22
|
+
import { useOverflowStringHeight } from '../../global/js/hooks/useOverflowString.js';
|
23
23
|
import { useNearestScroll } from '../../global/js/hooks/useWindowScroll.js';
|
24
24
|
import { useWindowResize } from '../../global/js/hooks/useWindowResize.js';
|
25
25
|
import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
|
@@ -173,21 +173,23 @@ var PageHeader = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
173
173
|
|
174
174
|
// handlers
|
175
175
|
var handleActionBarWidthChange = function handleActionBarWidthChange(_ref2) {
|
176
|
-
var _overflowMenuRef$curr;
|
177
176
|
var minWidth = _ref2.minWidth,
|
178
177
|
maxWidth = _ref2.maxWidth;
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
178
|
+
if (minWidth !== actionBarMinWidth || maxWidth !== actionBarMaxWidth) {
|
179
|
+
var _overflowMenuRef$curr;
|
180
|
+
var overflowMenuWidth = 0;
|
181
|
+
var overflowMenu = overflowMenuRef === null || overflowMenuRef === undefined || (_overflowMenuRef$curr = overflowMenuRef.current) === null || _overflowMenuRef$curr === undefined ? undefined : _overflowMenuRef$curr.querySelector(".".concat(prefix, "--overflow-menu"));
|
182
|
+
if (overflowMenu) {
|
183
|
+
overflowMenuWidth = overflowMenu.offsetWidth;
|
184
|
+
}
|
184
185
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
186
|
+
/* don't know how to test resize */
|
187
|
+
/* istanbul ignore next */
|
188
|
+
setActionBarMaxWidth(maxWidth + overflowMenuWidth);
|
189
|
+
/* don't know how to test resize */
|
190
|
+
/* istanbul ignore next */
|
191
|
+
setActionBarMinWidth(minWidth);
|
192
|
+
}
|
191
193
|
};
|
192
194
|
var handlePageActionWidthChange = function handlePageActionWidthChange(_ref3) {
|
193
195
|
var minWidth = _ref3.minWidth,
|
@@ -373,7 +375,7 @@ var PageHeader = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
373
375
|
});
|
374
376
|
}, [headerRef, pageHeaderStyles]);
|
375
377
|
var subtitleRef = useRef(null);
|
376
|
-
var isOverflowing =
|
378
|
+
var isOverflowing = useOverflowStringHeight(subtitleRef);
|
377
379
|
var subtitleContent = /*#__PURE__*/React__default.createElement("span", {
|
378
380
|
ref: subtitleRef,
|
379
381
|
className: "".concat(blockClass, "__subtitle-text")
|
@@ -11,7 +11,7 @@ import PropTypes from '../../_virtual/index.js';
|
|
11
11
|
import cx from 'classnames';
|
12
12
|
import { SkeletonText, DefinitionTooltip } from '@carbon/react';
|
13
13
|
import { EditInPlace } from '../EditInPlace/EditInPlace.js';
|
14
|
-
import {
|
14
|
+
import { useOverflowStringWidth } from '../../global/js/hooks/useOverflowString.js';
|
15
15
|
|
16
16
|
var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "onSave", "editDescription", "editableLabel", "cancelDescription", "saveDescription", "tooltipAlignment"];
|
17
17
|
|
@@ -45,7 +45,7 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
|
|
45
45
|
var titleText;
|
46
46
|
var isEditable = !!onSave;
|
47
47
|
var titleRef = useRef();
|
48
|
-
var isEllipsisApplied =
|
48
|
+
var isEllipsisApplied = useOverflowStringWidth(titleRef);
|
49
49
|
if (text || !content) {
|
50
50
|
if (text === undefined && typeof title === 'string') {
|
51
51
|
text = title;
|
@@ -6,13 +6,12 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default, { useRef, useState,
|
9
|
+
import React__default, { useRef, useState, useEffect } from 'react';
|
10
10
|
import PropTypes from '../../_virtual/index.js';
|
11
11
|
import cx from 'classnames';
|
12
12
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
13
13
|
import { carbon, pkg } from '../../settings.js';
|
14
|
-
import {
|
15
|
-
import { useIsOverflow, ScrollStates, getScrollState, ScrollDirection } from './constants.js';
|
14
|
+
import { useIsOverflow, ScrollStates } from './constants.js';
|
16
15
|
import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
|
17
16
|
|
18
17
|
var _excluded = ["children", "className", "color", "onScroll", "scrollElementClassName", "getScrollElementRef", "hideStartGradient"];
|
@@ -43,6 +42,10 @@ var ScrollGradient = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
43
42
|
_ref$hideStartGradien = _ref.hideStartGradient,
|
44
43
|
hideStartGradient = _ref$hideStartGradien === undefined ? defaults.hideStartGradient : _ref$hideStartGradien,
|
45
44
|
rest = _objectWithoutProperties(_ref, _excluded);
|
45
|
+
var intersectionStartRef = useRef();
|
46
|
+
var intersectionEndRef = useRef();
|
47
|
+
var intersectionLeftRef = useRef();
|
48
|
+
var intersectionRightRef = useRef();
|
46
49
|
var scrollContainer = useRef(undefined);
|
47
50
|
var contentChildrenContainer = useRef(undefined);
|
48
51
|
var _useIsOverflow = useIsOverflow(scrollContainer),
|
@@ -51,13 +54,11 @@ var ScrollGradient = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
51
54
|
var gradientRight = yScrollable && scrollContainer.current && contentChildrenContainer.current ? scrollContainer.current.offsetWidth - contentChildrenContainer.current.offsetWidth : 0;
|
52
55
|
var gradientBottom = xScrollable && scrollContainer.current && contentChildrenContainer.current ? scrollContainer.current.offsetHeight - contentChildrenContainer.current.offsetHeight : 0;
|
53
56
|
var _useState = useState(ScrollStates.NONE),
|
54
|
-
_useState2 = _slicedToArray(_useState,
|
55
|
-
verticalPosition = _useState2[0]
|
56
|
-
setVerticalPosition = _useState2[1];
|
57
|
+
_useState2 = _slicedToArray(_useState, 1),
|
58
|
+
verticalPosition = _useState2[0];
|
57
59
|
var _useState3 = useState(ScrollStates.NONE),
|
58
|
-
_useState4 = _slicedToArray(_useState3,
|
59
|
-
horizontalPosition = _useState4[0]
|
60
|
-
setHorizontalPosition = _useState4[1];
|
60
|
+
_useState4 = _slicedToArray(_useState3, 1),
|
61
|
+
horizontalPosition = _useState4[0];
|
61
62
|
var startVerticalRef = useRef(null);
|
62
63
|
var startHorizontalRef = useRef(null);
|
63
64
|
var endVerticalRef = useRef(null);
|
@@ -78,36 +79,84 @@ var ScrollGradient = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
78
79
|
endHorizontalRef.current.style.bottom = gradientBottom;
|
79
80
|
endHorizontalRef.current.style.backgroundImage = "linear-gradient(-90deg, ".concat(color, " 10%, transparent)");
|
80
81
|
}, [color, gradientRight, gradientBottom]);
|
81
|
-
var
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
82
|
+
var setGradientOnIntersection = function setGradientOnIntersection(entry, gradientRef) {
|
83
|
+
if (gradientRef.current) {
|
84
|
+
if (entry.isIntersecting) {
|
85
|
+
gradientRef.current.style.opacity = 0;
|
86
|
+
gradientRef.current.style.display = 'none';
|
87
|
+
gradientRef === null || gradientRef === undefined || gradientRef.current.setAttribute('aria-hidden', false);
|
88
|
+
} else {
|
89
|
+
gradientRef.current.style.opacity = 1;
|
90
|
+
gradientRef.current.style.display = 'block';
|
91
|
+
gradientRef === null || gradientRef === undefined || gradientRef.current.setAttribute('aria-hidden', true);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
};
|
95
|
+
useEffect(function () {
|
96
|
+
var observer = new IntersectionObserver(function (entries) {
|
97
|
+
entries.forEach(function (entry) {
|
98
|
+
if (entry.target.hasAttribute('data-start-vertical')) {
|
99
|
+
setGradientOnIntersection(entry, startVerticalRef);
|
100
|
+
}
|
101
|
+
if (entry.target.hasAttribute('data-end-vertical')) {
|
102
|
+
setGradientOnIntersection(entry, endVerticalRef);
|
103
|
+
}
|
104
|
+
if (entry.target.hasAttribute('data-start-horizontal')) {
|
105
|
+
setGradientOnIntersection(entry, startHorizontalRef);
|
106
|
+
}
|
107
|
+
if (entry.target.hasAttribute('data-end-horizontal')) {
|
108
|
+
setGradientOnIntersection(entry, endHorizontalRef);
|
109
|
+
}
|
110
|
+
});
|
111
|
+
}, {
|
112
|
+
root: null,
|
113
|
+
rootMargin: '0px',
|
114
|
+
threshold: 0.1
|
115
|
+
});
|
116
|
+
observer.observe(intersectionStartRef.current);
|
117
|
+
observer.observe(intersectionEndRef.current);
|
118
|
+
observer.observe(intersectionLeftRef.current);
|
119
|
+
observer.observe(intersectionRightRef.current);
|
120
|
+
var startVerticalRefValue = intersectionStartRef.current;
|
121
|
+
var endVerticalRefValue = intersectionEndRef.current;
|
122
|
+
var startHorizontalRefValue = intersectionLeftRef.current;
|
123
|
+
var endHorizontalRefValue = intersectionRightRef.current;
|
124
|
+
return function () {
|
125
|
+
observer.unobserve(startVerticalRefValue);
|
126
|
+
observer.unobserve(endVerticalRefValue);
|
127
|
+
observer.unobserve(startHorizontalRefValue);
|
128
|
+
observer.unobserve(endHorizontalRefValue);
|
129
|
+
};
|
130
|
+
}, []);
|
91
131
|
var setRefs = function setRefs(element) {
|
92
132
|
scrollContainer.current = element;
|
93
133
|
getScrollElementRef(element);
|
94
134
|
};
|
95
|
-
useEffect(function () {
|
96
|
-
scrollHandler();
|
97
|
-
}, [scrollHandler]);
|
98
135
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
99
136
|
className: cx(blockClass, "".concat(blockClass, "--x-").concat(horizontalPosition.toLowerCase()), "".concat(blockClass, "--y-").concat(verticalPosition.toLowerCase()), _defineProperty(_defineProperty({}, "".concat(blockClass, "--x-scrollable"), xScrollable), "".concat(blockClass, "--y-scrollable"), yScrollable), className),
|
100
137
|
ref: ref,
|
101
138
|
role: "presentation"
|
102
139
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement("div", {
|
103
|
-
onScroll:
|
140
|
+
onScroll: onScroll,
|
104
141
|
ref: setRefs,
|
105
142
|
className: cx("".concat(blockClass, "__content"), scrollElementClassName),
|
106
143
|
tabIndex: 0
|
107
|
-
}, /*#__PURE__*/React__default.createElement("
|
144
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
145
|
+
ref: intersectionStartRef,
|
146
|
+
"data-start-vertical": true
|
147
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
148
|
+
ref: intersectionLeftRef,
|
149
|
+
"data-start-horizontal": true
|
150
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
108
151
|
ref: contentChildrenContainer,
|
109
152
|
className: "".concat(blockClass, "__content-children")
|
110
|
-
}, children)
|
153
|
+
}, children), /*#__PURE__*/React__default.createElement("span", {
|
154
|
+
ref: intersectionEndRef,
|
155
|
+
"data-end-vertical": true
|
156
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
157
|
+
ref: intersectionRightRef,
|
158
|
+
"data-end-horizontal": true
|
159
|
+
})), !hideStartGradient && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
111
160
|
ref: startVerticalRef,
|
112
161
|
className: "".concat(blockClass, "__start-vertical"),
|
113
162
|
role: "presentation",
|
@@ -1,14 +1,9 @@
|
|
1
|
-
export namespace ScrollDirection {
|
2
|
-
let X: string;
|
3
|
-
let Y: string;
|
4
|
-
}
|
5
1
|
export namespace ScrollStates {
|
6
2
|
let NONE: string;
|
7
3
|
let INITIAL: string;
|
8
4
|
let STARTED: string;
|
9
5
|
let END: string;
|
10
6
|
}
|
11
|
-
export function getScrollState(element: any, scrollDirection: any): string;
|
12
7
|
export function useIsOverflow(ref: any): {
|
13
8
|
xScrollable: undefined;
|
14
9
|
yScrollable: undefined;
|