@carbon/ibm-products 2.60.0-rc.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
@@ -5,21 +5,22 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties,
|
9
|
-
import React__default, {
|
8
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
+
import React__default, { useRef } from 'react';
|
10
10
|
import PropTypes from '../../_virtual/index.js';
|
11
11
|
import cx from 'classnames';
|
12
12
|
import { pkg } from '../../settings.js';
|
13
|
-
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
|
14
13
|
import { Button } from '@carbon/react';
|
15
14
|
import uuidv4 from '../../global/js/utils/uuidv4.js';
|
16
15
|
import { prepareProps } from '../../global/js/utils/props-helper.js';
|
17
16
|
import { ActionBarItem } from './ActionBarItem.js';
|
18
17
|
import { ActionBarOverflowItems } from './ActionBarOverflowItems.js';
|
18
|
+
import { useOverflowItems } from '../../global/js/hooks/useOverflowItems.js';
|
19
19
|
|
20
20
|
var _excluded = ["actions", "className", "maxVisible", "menuOptionsClass", "onWidthChange", "overflowAriaLabel", "overflowMenuRef", "rightAlign"],
|
21
|
-
_excluded2 = ["
|
22
|
-
_excluded3 = ["key"];
|
21
|
+
_excluded2 = ["id"],
|
22
|
+
_excluded3 = ["key", "id"];
|
23
|
+
|
23
24
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
24
25
|
var blockClass = "".concat(pkg.prefix, "--action-bar");
|
25
26
|
var componentName = 'ActionBar';
|
@@ -44,160 +45,56 @@ var ActionBar = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
44
45
|
overflowMenuRef = _ref.overflowMenuRef,
|
45
46
|
rightAlign = _ref.rightAlign,
|
46
47
|
rest = _objectWithoutProperties(_ref, _excluded);
|
47
|
-
var _useState = useState(0),
|
48
|
-
_useState2 = _slicedToArray(_useState, 2),
|
49
|
-
displayCount = _useState2[0],
|
50
|
-
setDisplayCount = _useState2[1];
|
51
|
-
var _useState3 = useState([]),
|
52
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
53
|
-
displayedItems = _useState4[0],
|
54
|
-
setDisplayedItems = _useState4[1];
|
55
|
-
var _useState5 = useState(null),
|
56
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
57
|
-
hiddenSizingItems = _useState6[0],
|
58
|
-
setHiddenSizingItems = _useState6[1];
|
59
48
|
var internalId = useRef(uuidv4());
|
60
49
|
var refDisplayedItems = useRef(null);
|
61
|
-
var sizingRef = useRef(null);
|
62
|
-
var sizes = useRef({});
|
63
50
|
var backupRef = useRef(null);
|
64
51
|
var localRef = ref || backupRef;
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
return /*#__PURE__*/React__default.createElement(ActionBarItem, _extends({}, rest, {
|
85
|
-
// ensure id is not duplicated
|
86
|
-
"data-original-id": id,
|
87
|
-
key: "hidden-item-".concat(key),
|
88
|
-
className: "".concat(blockClass, "__hidden-sizing-item"),
|
89
|
-
tabIndex: -1
|
90
|
-
}));
|
91
|
-
}))));
|
92
|
-
}, [actions, overflowMenuRef]);
|
93
|
-
|
94
|
-
// creates displayed items based on actions, displayCount and alignment
|
95
|
-
useEffect(function () {
|
96
|
-
// Calculate the displayed items
|
97
|
-
var newDisplayedItems = actions.map(function (_ref3) {
|
98
|
-
var key = _ref3.key,
|
99
|
-
rest = _objectWithoutProperties(_ref3, _excluded3);
|
100
|
-
return /*#__PURE__*/React__default.createElement(ActionBarItem, _extends({}, rest, {
|
101
|
-
key: key
|
102
|
-
}));
|
103
|
-
});
|
104
|
-
|
105
|
-
// extract any there is not enough room for into newOverflowItems
|
106
|
-
var newOverflowItems = newDisplayedItems.splice(displayCount);
|
107
|
-
|
108
|
-
// add overflow menu if needed
|
109
|
-
if (newOverflowItems.length) {
|
110
|
-
newDisplayedItems.push(/*#__PURE__*/React__default.createElement(ActionBarOverflowItems, {
|
111
|
-
menuOptionsClass: menuOptionsClass,
|
112
|
-
overflowAriaLabel: overflowAriaLabel,
|
113
|
-
overflowMenuRef: overflowMenuRef,
|
114
|
-
overflowItems: newOverflowItems,
|
115
|
-
key: "overflow-menu-".concat(internalId.current)
|
116
|
-
}));
|
117
|
-
}
|
118
|
-
setDisplayedItems(newDisplayedItems);
|
119
|
-
}, [actions, displayCount, overflowAriaLabel, menuOptionsClass, overflowMenuRef]);
|
120
|
-
|
121
|
-
// determine display count based on space available and width of pageActions
|
122
|
-
var checkFullyVisibleItems = function checkFullyVisibleItems() {
|
123
|
-
/* istanbul ignore if */
|
124
|
-
if (sizingRef.current) {
|
125
|
-
var _refDisplayedItems$cu;
|
126
|
-
var sizingItems = Array.from(sizingRef.current.querySelectorAll(".".concat(blockClass, "__hidden-sizing-item")));
|
127
|
-
|
128
|
-
// first item is always the overflow even if nothing else is rendered
|
129
|
-
var overflowItem = sizingItems.shift();
|
130
|
-
|
131
|
-
// determine how many will fit
|
132
|
-
var spaceAvailable = (_refDisplayedItems$cu = refDisplayedItems.current) === null || _refDisplayedItems$cu === undefined ? undefined : _refDisplayedItems$cu.offsetWidth;
|
133
|
-
var willFit = 0;
|
134
|
-
var maxVisibleWidth = 0;
|
135
|
-
var fitLimit = maxVisible ? Math.min(maxVisible, sizingItems.length) : sizingItems.length;
|
136
|
-
|
137
|
-
// loop checking the space available
|
138
|
-
for (var i = 0; i < fitLimit; i++) {
|
139
|
-
var newSpaceAvailable = spaceAvailable && spaceAvailable - sizingItems[i].offsetWidth;
|
140
|
-
|
141
|
-
// update maxVisibleWidth for later use by onWidthChange
|
142
|
-
maxVisibleWidth += sizingItems[i].offsetWidth;
|
143
|
-
if (newSpaceAvailable && newSpaceAvailable >= 0) {
|
144
|
-
spaceAvailable = newSpaceAvailable;
|
145
|
-
willFit += 1;
|
146
|
-
}
|
147
|
-
}
|
148
|
-
|
149
|
-
// if not enough space for all items then make room for the overflow
|
150
|
-
var overflowWidth = overflowItem.offsetWidth;
|
151
|
-
if (willFit < sizingItems.length) {
|
152
|
-
// Check space for overflow
|
153
|
-
while (willFit > 0 && spaceAvailable && spaceAvailable < overflowWidth) {
|
154
|
-
willFit -= 1;
|
155
|
-
|
156
|
-
// Highly unlikely that any action bar item is narrower than the overflow item
|
157
|
-
|
158
|
-
// Make sure by removing items in reverse order
|
159
|
-
spaceAvailable += sizingItems[willFit].offsetWidth;
|
160
|
-
}
|
161
|
-
}
|
162
|
-
if (onWidthChange && (sizes.current.minWidth !== overflowWidth || sizes.current.maxWidth !== maxVisibleWidth)) {
|
163
|
-
sizes.current.minWidth = overflowWidth;
|
164
|
-
sizes.current.maxWidth = maxVisibleWidth;
|
165
|
-
// emit onWidthChange
|
166
|
-
onWidthChange({
|
167
|
-
minWidth: overflowWidth,
|
168
|
-
maxWidth: maxVisibleWidth
|
169
|
-
});
|
170
|
-
}
|
171
|
-
if (willFit < 1) {
|
172
|
-
setDisplayCount(0);
|
173
|
-
} else {
|
174
|
-
setDisplayCount(willFit);
|
175
|
-
}
|
176
|
-
}
|
177
|
-
};
|
178
|
-
useEffect(function () {
|
179
|
-
checkFullyVisibleItems();
|
180
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
181
|
-
}, [maxVisible, hiddenSizingItems]);
|
182
|
-
|
183
|
-
// /* istanbul ignore next */ // not sure how to fake window resize
|
184
|
-
var handleResize = function handleResize() {
|
185
|
-
// when the hidden sizing items change size
|
186
|
-
/* istanbul ignore next */
|
187
|
-
// not sure how to fake window resize
|
188
|
-
checkFullyVisibleItems();
|
189
|
-
};
|
190
|
-
|
191
|
-
// // resize of the items
|
192
|
-
useResizeObserver(sizingRef, handleResize);
|
193
|
-
useResizeObserver(localRef, handleResize);
|
52
|
+
var _offsetRef = useRef(null);
|
53
|
+
var offsetRef = overflowMenuRef || _offsetRef;
|
54
|
+
var _items = actions.map(function (action) {
|
55
|
+
return _objectSpread2({
|
56
|
+
id: action === null || action === undefined ? undefined : action.key
|
57
|
+
}, action);
|
58
|
+
});
|
59
|
+
var _useOverflowItems = useOverflowItems(_items, localRef, offsetRef, maxVisible, onWidthChange),
|
60
|
+
visibleItems = _useOverflowItems.visibleItems,
|
61
|
+
hiddenItems = _useOverflowItems.hiddenItems,
|
62
|
+
itemRefHandler = _useOverflowItems.itemRefHandler,
|
63
|
+
offsetRefHandler = _useOverflowItems.offsetRefHandler;
|
64
|
+
var overflowMenuItems = hiddenItems === null || hiddenItems === undefined ? undefined : hiddenItems.map(function (_ref2) {
|
65
|
+
var key = _ref2.id,
|
66
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
67
|
+
return /*#__PURE__*/React__default.createElement(ActionBarItem, _extends({}, rest, {
|
68
|
+
key: key
|
69
|
+
}));
|
70
|
+
});
|
194
71
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, {
|
195
72
|
className: cx([blockClass, className]),
|
196
73
|
ref: localRef
|
197
|
-
}),
|
74
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
198
75
|
ref: refDisplayedItems,
|
199
76
|
className: cx(["".concat(blockClass, "__displayed-items"), _defineProperty({}, "".concat(blockClass, "__displayed-items--right"), rightAlign)])
|
200
|
-
},
|
77
|
+
}, visibleItems.map(function (_ref4) {
|
78
|
+
var key = _ref4.key,
|
79
|
+
id = _ref4.id,
|
80
|
+
rest = _objectWithoutProperties(_ref4, _excluded3);
|
81
|
+
return /*#__PURE__*/React__default.createElement(ActionBarItem, _extends({}, _objectSpread2({
|
82
|
+
id: id
|
83
|
+
}, rest), {
|
84
|
+
key: key,
|
85
|
+
ref: function ref(node) {
|
86
|
+
itemRefHandler(id, node);
|
87
|
+
}
|
88
|
+
}));
|
89
|
+
}), (overflowMenuItems === null || overflowMenuItems === undefined ? undefined : overflowMenuItems.length) > 0 && /*#__PURE__*/React__default.createElement(ActionBarOverflowItems, {
|
90
|
+
menuOptionsClass: menuOptionsClass,
|
91
|
+
overflowAriaLabel: overflowAriaLabel,
|
92
|
+
overflowMenuRef: function overflowMenuRef(node) {
|
93
|
+
return offsetRef.current = offsetRefHandler(node);
|
94
|
+
},
|
95
|
+
overflowItems: overflowMenuItems,
|
96
|
+
key: "overflow-menu-".concat(internalId.current)
|
97
|
+
})));
|
201
98
|
});
|
202
99
|
ActionBar = pkg.checkComponentEnabled(ActionBar, componentName);
|
203
100
|
ActionBar.displayName = componentName;
|
@@ -9,11 +9,11 @@ import { objectWithoutProperties as _objectWithoutProperties, createForOfIterato
|
|
9
9
|
import React__default, { useEffect } from 'react';
|
10
10
|
import PropTypes from '../../_virtual/index.js';
|
11
11
|
import cx from 'classnames';
|
12
|
-
import clamp from 'lodash/clamp';
|
13
12
|
import { purple50, gray20, gray70 } from '../../node_modules/@carbon/colors/es/index.js';
|
14
13
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
15
14
|
import { pkg } from '../../settings.js';
|
16
15
|
import { Themes } from './Checklist.types.js';
|
16
|
+
import { clamp } from '../../global/js/utils/clamp.js';
|
17
17
|
|
18
18
|
var _excluded = ["className", "value", "theme"];
|
19
19
|
var blockClass = "".concat(pkg.prefix, "--checklist__chart");
|
@@ -16,7 +16,7 @@ import { createPortal } from 'react-dom';
|
|
16
16
|
import cx from 'classnames';
|
17
17
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
18
18
|
import { pkg } from '../../settings.js';
|
19
|
-
import { throttle } from '
|
19
|
+
import { throttle } from '../../global/js/utils/throttle.js';
|
20
20
|
import { Popover, PopoverContent } from '@carbon/react';
|
21
21
|
import { useIsomorphicEffect } from '../../global/js/hooks/useIsomorphicEffect.js';
|
22
22
|
|
@@ -12,7 +12,7 @@ import { Carousel } from '../Carousel/Carousel.js';
|
|
12
12
|
import '../Carousel/CarouselItem.js';
|
13
13
|
import PropTypes from '../../_virtual/index.js';
|
14
14
|
import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia/SteppedAnimatedMedia.js';
|
15
|
-
import { clamp } from '
|
15
|
+
import { clamp } from '../../global/js/utils/clamp.js';
|
16
16
|
import cx from 'classnames';
|
17
17
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
18
18
|
import pconsole from '../../global/js/utils/pconsole.js';
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { useRef, useState, useContext, useEffect } from 'react';
|
10
|
-
import { Popover, PopoverContent, Layer } from '@carbon/react';
|
10
|
+
import { Popover, PopoverContent, Layer, Section, Heading } from '@carbon/react';
|
11
11
|
import PropTypes from '../../../_virtual/index.js';
|
12
12
|
import { Add } from '@carbon/react/icons';
|
13
13
|
import { ConditionBuilderButton } from '../ConditionBuilderButton/ConditionBuilderButton.js';
|
@@ -189,11 +189,11 @@ var ConditionBuilderItem = function ConditionBuilderItem(_ref) {
|
|
189
189
|
role: "dialog",
|
190
190
|
"aria-label": title,
|
191
191
|
onKeyDown: handleKeyDownHandler
|
192
|
-
}, /*#__PURE__*/React__default.createElement(Layer, null, /*#__PURE__*/React__default.createElement(
|
192
|
+
}, /*#__PURE__*/React__default.createElement(Layer, null, /*#__PURE__*/React__default.createElement(Section, null, /*#__PURE__*/React__default.createElement(Heading, {
|
193
193
|
className: "".concat(blockClass, "__item__title")
|
194
194
|
}, title), /*#__PURE__*/React__default.createElement("div", {
|
195
195
|
className: "".concat(blockClass, "__popover-content")
|
196
|
-
}, renderChildren ? renderChildren(popoverRef) : children))));
|
196
|
+
}, renderChildren ? renderChildren(popoverRef) : children)))));
|
197
197
|
};
|
198
198
|
ConditionBuilderItem.propTypes = {
|
199
199
|
/**
|
@@ -6,11 +6,12 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray } from '../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default, { useRef } from 'react';
|
9
|
+
import React__default, { useRef, useContext } from 'react';
|
10
10
|
import { DatePicker, DatePickerInput } from '@carbon/react';
|
11
11
|
import PropTypes from '../../../../_virtual/index.js';
|
12
12
|
import { useTranslations } from '../../utils/useTranslations.js';
|
13
13
|
import { blockClass } from '../../utils/util.js';
|
14
|
+
import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
|
14
15
|
|
15
16
|
var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
|
16
17
|
var conditionState = _ref.conditionState,
|
@@ -21,6 +22,8 @@ var ConditionBuilderItemDate = function ConditionBuilderItemDate(_ref) {
|
|
21
22
|
_useTranslations2 = _slicedToArray(_useTranslations, 2),
|
22
23
|
startText = _useTranslations2[0],
|
23
24
|
endText = _useTranslations2[1];
|
25
|
+
var _useContext = useContext(ConditionBuilderContext);
|
26
|
+
_useContext.conditionBuilderRef;
|
24
27
|
var datePickerType = conditionState.operator == 'between' ? 'range' : 'single';
|
25
28
|
var onCloseHandler = function onCloseHandler(selectedDate) {
|
26
29
|
onChange(selectedDate && selectedDate.length > 0 ? selectedDate : 'INVALID');
|
package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js
CHANGED
@@ -12,7 +12,7 @@ import { Checkmark } from '@carbon/react/icons';
|
|
12
12
|
import PropTypes from '../../../../_virtual/index.js';
|
13
13
|
import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
|
14
14
|
import { useTranslations } from '../../utils/useTranslations.js';
|
15
|
-
import { blockClass } from '../../utils/util.js';
|
15
|
+
import { blockClass, onKeyDownHandlerForSearch } from '../../utils/util.js';
|
16
16
|
|
17
17
|
var ItemOption = function ItemOption(_ref) {
|
18
18
|
var _ref$conditionState = _ref.conditionState,
|
@@ -27,6 +27,8 @@ var ItemOption = function ItemOption(_ref) {
|
|
27
27
|
_useTranslations2 = _slicedToArray(_useTranslations, 2),
|
28
28
|
propertyText = _useTranslations2[0],
|
29
29
|
clearSearchText = _useTranslations2[1];
|
30
|
+
var _useContext2 = useContext(ConditionBuilderContext),
|
31
|
+
conditionBuilderRef = _useContext2.conditionBuilderRef;
|
30
32
|
var allOptions = config.options;
|
31
33
|
var _useState = useState(''),
|
32
34
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -75,7 +77,10 @@ var ItemOption = function ItemOption(_ref) {
|
|
75
77
|
size: "sm",
|
76
78
|
labelText: clearSearchText,
|
77
79
|
closeButtonLabelText: clearSearchText,
|
78
|
-
onChange: onSearchChangeHandler
|
80
|
+
onChange: onSearchChangeHandler,
|
81
|
+
onKeyDown: function onKeyDown(evt) {
|
82
|
+
return onKeyDownHandlerForSearch(evt, conditionBuilderRef);
|
83
|
+
}
|
79
84
|
})), /*#__PURE__*/React__default.createElement("ul", {
|
80
85
|
"aria-label": getAriaLabel(),
|
81
86
|
role: "listbox"
|
@@ -12,7 +12,7 @@ import { CheckboxCheckedFilled, Checkbox, Checkmark } from '@carbon/react/icons'
|
|
12
12
|
import PropTypes from '../../../../_virtual/index.js';
|
13
13
|
import { ConditionBuilderContext } from '../../ConditionBuilderContext/ConditionBuilderProvider.js';
|
14
14
|
import { useTranslations } from '../../utils/useTranslations.js';
|
15
|
-
import { checkForMultiSelectOperator, blockClass } from '../../utils/util.js';
|
15
|
+
import { checkForMultiSelectOperator, blockClass, onKeyDownHandlerForSearch } from '../../utils/util.js';
|
16
16
|
|
17
17
|
var _SelectSkeleton, _CheckboxCheckedFille, _Checkbox;
|
18
18
|
var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
@@ -30,6 +30,8 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
30
30
|
_useTranslations2 = _slicedToArray(_useTranslations, 2),
|
31
31
|
propertyText = _useTranslations2[0],
|
32
32
|
clearSearchText = _useTranslations2[1];
|
33
|
+
var _useContext2 = useContext(ConditionBuilderContext),
|
34
|
+
conditionBuilderRef = _useContext2.conditionBuilderRef;
|
33
35
|
var contentRef = useRef(null);
|
34
36
|
var _useState = useState(config.options),
|
35
37
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -149,7 +151,10 @@ var ItemOptionForValueField = function ItemOptionForValueField(_ref) {
|
|
149
151
|
size: "sm",
|
150
152
|
labelText: clearSearchText,
|
151
153
|
closeButtonLabelText: clearSearchText,
|
152
|
-
onChange: onSearchChangeHandler
|
154
|
+
onChange: onSearchChangeHandler,
|
155
|
+
onKeyDown: function onKeyDown(evt) {
|
156
|
+
return onKeyDownHandlerForSearch(evt, conditionBuilderRef);
|
157
|
+
}
|
153
158
|
})), multiSelectable && /*#__PURE__*/React__default.createElement("div", {
|
154
159
|
className: "".concat(blockClass, "__multiselectSelectionStatusContainer")
|
155
160
|
}, /*#__PURE__*/React__default.createElement("label", null, selection.length, "/", allOptions.length, " Selected"), /*#__PURE__*/React__default.createElement(Button, {
|
@@ -24,7 +24,7 @@ var handleKeyDownForPopover = function handleKeyDownForPopover(evt, conditionBui
|
|
24
24
|
|
25
25
|
//skipping keyboard handling for date and time fields to get take carbon's
|
26
26
|
var excludeKeyPress = function excludeKeyPress(evt) {
|
27
|
-
return !['Escape'].includes(evt.key) &&
|
27
|
+
return !['Escape'].includes(evt.key) && evt.target.closest(".".concat(blockClass, "__item-date"));
|
28
28
|
};
|
29
29
|
var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentContainer, conditionBuilderRef) {
|
30
30
|
var _parentContainer$quer, _parentContainer$quer2, _evt$target$closest$q, _evt$target$closest;
|
@@ -80,23 +80,23 @@ var handleKeyPressForPopover = function handleKeyPressForPopover(evt, parentCont
|
|
80
80
|
}
|
81
81
|
break;
|
82
82
|
case 'Enter':
|
83
|
-
if (
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
(_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === undefined || _document$activeEleme2.click();
|
89
|
-
}
|
90
|
-
} else {
|
91
|
-
if (document.activeElement.type !== 'button') {
|
92
|
-
var _document$activeEleme3;
|
93
|
-
//for button , enter key is click which already handled by framework, else trigger click
|
94
|
-
focusThisField(evt, conditionBuilderRef);
|
95
|
-
(_document$activeEleme3 = document.activeElement) === null || _document$activeEleme3 === undefined || _document$activeEleme3.click();
|
96
|
-
}
|
83
|
+
if (document.activeElement.type !== 'button') {
|
84
|
+
var _document$activeEleme2;
|
85
|
+
//for button , enter key is click which already handled by framework, else trigger click
|
86
|
+
focusThisField(evt, conditionBuilderRef);
|
87
|
+
(_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === undefined || _document$activeEleme2.click();
|
97
88
|
}
|
98
89
|
break;
|
99
90
|
}
|
91
|
+
} else {
|
92
|
+
if (key === 'Enter' && !isHoldingShiftKey) {
|
93
|
+
if (document.activeElement.type !== 'button') {
|
94
|
+
var _document$activeEleme3;
|
95
|
+
//for button , enter key is click which already handled by framework, else trigger click
|
96
|
+
focusThisField(evt, conditionBuilderRef);
|
97
|
+
(_document$activeEleme3 = document.activeElement) === null || _document$activeEleme3 === undefined || _document$activeEleme3.click();
|
98
|
+
}
|
99
|
+
}
|
100
100
|
}
|
101
101
|
};
|
102
102
|
var handleKeyPressForMainContent = function handleKeyPressForMainContent(evt, conditionBuilderRef, variant) {
|
@@ -10,3 +10,4 @@ export function checkIsValid(item: any): any;
|
|
10
10
|
export function manageTabIndexAndFocus(currentElement: any, conditionBuilderRef: any): void;
|
11
11
|
export function getValue(type: any, value: any, config: any): any;
|
12
12
|
export function checkForMultiSelectOperator(condition: any, config: any): any;
|
13
|
+
export function onKeyDownHandlerForSearch(evt: any, conditionBuilderRef: any): void;
|
@@ -121,5 +121,11 @@ var checkForMultiSelectOperator = function checkForMultiSelectOperator(condition
|
|
121
121
|
return (condition === null || condition === undefined ? undefined : condition.operator) === operator.id && operator.isMultiSelect;
|
122
122
|
}));
|
123
123
|
};
|
124
|
+
//this will close the popover on escape key on search box
|
125
|
+
var onKeyDownHandlerForSearch = function onKeyDownHandlerForSearch(evt, conditionBuilderRef) {
|
126
|
+
if (!evt.currentTarget.value && evt.key === 'Escape') {
|
127
|
+
focusThisField(evt, conditionBuilderRef);
|
128
|
+
}
|
129
|
+
};
|
124
130
|
|
125
|
-
export { HIERARCHICAL_VARIANT, NON_HIERARCHICAL_VARIANT, blockClass, checkForHoldingKey, checkForMultiSelectOperator, checkIsValid, focusThisField, focusThisItem, getValue, manageTabIndexAndFocus, traverseClockVise, traverseReverse };
|
131
|
+
export { HIERARCHICAL_VARIANT, NON_HIERARCHICAL_VARIANT, blockClass, checkForHoldingKey, checkForMultiSelectOperator, checkIsValid, focusThisField, focusThisItem, getValue, manageTabIndexAndFocus, onKeyDownHandlerForSearch, traverseClockVise, traverseReverse };
|
@@ -5,10 +5,8 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import isBoolean from 'lodash/isBoolean';
|
9
|
-
|
10
8
|
var isColumnVisible = function isColumnVisible(colDef) {
|
11
|
-
return
|
9
|
+
return typeof colDef.isVisible === 'boolean' ? colDef.isVisible : true;
|
12
10
|
};
|
13
11
|
|
14
12
|
export { isColumnVisible };
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { useState, useEffect } from 'react';
|
10
|
-
import
|
10
|
+
import { deepCompareObject as _deepCompareObject } from '../../../../../../global/js/utils/deepCompareObject.js';
|
11
11
|
|
12
12
|
/**
|
13
13
|
* Keeps track of the button disabled state
|
@@ -25,7 +25,7 @@ var useShouldDisableButtons = function useShouldDisableButtons(_ref) {
|
|
25
25
|
shouldDisableButtons = _useState2[0],
|
26
26
|
setShouldDisableButtons = _useState2[1];
|
27
27
|
useEffect(function updateDisabledButtonsState() {
|
28
|
-
setShouldDisableButtons(
|
28
|
+
setShouldDisableButtons(_deepCompareObject(filtersState, JSON.parse(prevFiltersRef.current)));
|
29
29
|
}, [filtersState, prevFiltersRef]);
|
30
30
|
return [shouldDisableButtons, setShouldDisableButtons];
|
31
31
|
};
|
@@ -8,7 +8,6 @@
|
|
8
8
|
import React__default, { forwardRef } from 'react';
|
9
9
|
import PropTypes from '../../../../../_virtual/index.js';
|
10
10
|
import { RadioButtonGroup, RadioButton } from '@carbon/react';
|
11
|
-
import isArray from 'lodash/isArray';
|
12
11
|
import { pkg } from '../../../../../settings.js';
|
13
12
|
|
14
13
|
var blockClass = "".concat(pkg.prefix, "--datagrid__row-size");
|
@@ -36,7 +35,7 @@ var RowSizeRadioGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
36
35
|
orientation: "vertical",
|
37
36
|
defaultSelected: getBackwardCompatibleRowSize(selectedOption),
|
38
37
|
onChange: onChange
|
39
|
-
}, rowSizes && isArray(rowSizes) && rowSizes.map(function (option) {
|
38
|
+
}, rowSizes && Array.isArray(rowSizes) && rowSizes.map(function (option) {
|
40
39
|
var labelText;
|
41
40
|
try {
|
42
41
|
labelText = option.labelText || rowSizeLabels[option.value];
|
@@ -8,7 +8,6 @@
|
|
8
8
|
import { objectSpread2 as _objectSpread2, toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { useMemo } from 'react';
|
10
10
|
import { useFlexLayout, useResizeColumns, useFilters, useGlobalFilter, useSortBy, useExpanded, useTable, usePagination, useRowSelect } from 'react-table';
|
11
|
-
import uniqueId from 'lodash/uniqueId';
|
12
11
|
import useSkeletons from './useSkeletonRows.js';
|
13
12
|
import useDefaultStringRenderer from './useDefaultStringRenderer.js';
|
14
13
|
import useRowRenderer from './useRowRenderer.js';
|
@@ -17,6 +16,7 @@ import useHeaderRow from './Datagrid/DatagridHeaderRow.js';
|
|
17
16
|
import useFlexResize from './useFlexResize.js';
|
18
17
|
import useFloatingScroll from './useFloatingScroll.js';
|
19
18
|
import { stateReducer } from './Datagrid/addons/stateReducer.js';
|
19
|
+
import uuidv4 from '../../global/js/utils/uuidv4.js';
|
20
20
|
|
21
21
|
var useDatagrid = function useDatagrid(params) {
|
22
22
|
var defaultPlugins = [useFlexLayout, useHeaderRow, useSkeletons, useResizeColumns, useRowRenderer, useDefaultStringRenderer, useRowSize, useFilters, useGlobalFilter, useSortBy, useExpanded];
|
@@ -34,7 +34,7 @@ var useDatagrid = function useDatagrid(params) {
|
|
34
34
|
minWidth: 50
|
35
35
|
};
|
36
36
|
var tableId = useMemo(function () {
|
37
|
-
return
|
37
|
+
return uuidv4('datagrid-table-id');
|
38
38
|
}, []);
|
39
39
|
for (var _len = arguments.length, plugins = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
40
40
|
plugins[_key - 1] = arguments[_key];
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { useCallback } from 'react';
|
9
|
-
import debounce from '
|
9
|
+
import { debounce } from '../../global/js/utils/debounce.js';
|
10
10
|
import useParentDimensions from './useParentDimensions.js';
|
11
11
|
import useResizeTable from './useResizeTable.js';
|
12
12
|
|
@@ -30,10 +30,7 @@ var useInfiniteScroll = function useInfiniteScroll(hooks) {
|
|
30
30
|
var loadMoreThresholdValue = typeof loadMoreThreshold === 'number' ? loadMoreThreshold : 200;
|
31
31
|
var emptyFetchData = function emptyFetchData() {};
|
32
32
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
33
|
-
var fetchMore = useCallback(debounce(fetchMoreData || emptyFetchData, 3000,
|
34
|
-
leading: true,
|
35
|
-
trailing: false
|
36
|
-
}), [fetchMoreData]);
|
33
|
+
var fetchMore = useCallback(debounce(fetchMoreData || emptyFetchData, 3000), [fetchMoreData]);
|
37
34
|
var onScroll = function onScroll(_ref2) {
|
38
35
|
var scrollDirection = _ref2.scrollDirection,
|
39
36
|
scrollOffset = _ref2.scrollOffset;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { useState, useCallback } from 'react';
|
10
|
-
import debounce from '
|
10
|
+
import { debounce } from '../../global/js/utils/debounce.js';
|
11
11
|
|
12
12
|
var useRowIsMouseOver = function useRowIsMouseOver(hooks) {
|
13
13
|
var useInstance = function useInstance(instance) {
|
@@ -20,6 +20,7 @@ var useRowIsMouseOver = function useRowIsMouseOver(hooks) {
|
|
20
20
|
setMouseOverRowIndex(row === null || row === undefined ? undefined : row.index);
|
21
21
|
}, 100);
|
22
22
|
var getRowProps = function getRowProps(props, datagridState) {
|
23
|
+
// @ts-expect-error
|
23
24
|
var onMouseOver = function onMouseOver() {
|
24
25
|
return onMouseChange(datagridState);
|
25
26
|
};
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
import { slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import { useRef, useState, useEffect, useLayoutEffect } from 'react';
|
10
|
-
import debounce from '
|
10
|
+
import { debounce } from '../../global/js/utils/debounce.js';
|
11
11
|
import cx from 'classnames';
|
12
12
|
import { pkg } from '../../settings.js';
|
13
13
|
|
@@ -14,7 +14,7 @@ import { ChevronDown } from '@carbon/react/icons';
|
|
14
14
|
import PropTypes from '../../_virtual/index.js';
|
15
15
|
import { TagSet } from '../TagSet/TagSet.js';
|
16
16
|
import cx from 'classnames';
|
17
|
-
import debounce from '
|
17
|
+
import { debounce } from '../../global/js/utils/debounce.js';
|
18
18
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
19
19
|
import { pkg } from '../../settings.js';
|
20
20
|
import uuidv4 from '../../global/js/utils/uuidv4.js';
|
@@ -13,8 +13,8 @@ import { Carousel } from '../Carousel/Carousel.js';
|
|
13
13
|
import '../Carousel/CarouselItem.js';
|
14
14
|
import PropTypes from '../../_virtual/index.js';
|
15
15
|
import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia/SteppedAnimatedMedia.js';
|
16
|
-
import { clamp } from 'lodash';
|
17
16
|
import cx from 'classnames';
|
17
|
+
import { clamp } from '../../global/js/utils/clamp.js';
|
18
18
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
19
19
|
import { pkg } from '../../settings.js';
|
20
20
|
|
@@ -12,7 +12,7 @@ import cx from 'classnames';
|
|
12
12
|
import { pkg } from '../../settings.js';
|
13
13
|
import uuidv4 from '../../global/js/utils/uuidv4.js';
|
14
14
|
import NavItemLink from './NavItemLink.js';
|
15
|
-
import { Launch } from '../../node_modules/@carbon/icons-react/es/generated/bucket-
|
15
|
+
import { Launch } from '../../node_modules/@carbon/icons-react/es/generated/bucket-10.js';
|
16
16
|
|
17
17
|
var _excluded = ["activeHref", "children", "className", "current", "disabled", "element", "href", "id", "label", "onClick", "tabIndex"];
|
18
18
|
|