@carbon/ibm-products 2.20.0 → 2.22.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +8 -5
- package/css/index-full-carbon.css +548 -253
- 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 +208 -177
- 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 +252 -189
- 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 +233 -193
- 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/ActionSet/ActionSet.js +3 -4
- package/es/components/AddSelect/AddSelectBody.js +2 -2
- package/es/components/AddSelect/AddSelectRow.js +2 -2
- package/es/components/Card/Card.js +1 -2
- package/es/components/Card/CardHeader.js +1 -2
- package/es/components/CreateFullPage/CreateFullPageStep.js +1 -2
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +1 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +1 -2
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -2
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +1 -2
- package/es/components/Datagrid/Datagrid/DatagridContent.js +10 -10
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -11
- package/es/components/Datagrid/Datagrid/DatagridRow.js +15 -11
- package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +21 -11
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +22 -12
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +31 -74
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +2 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/utils.js +1 -5
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +2 -3
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +2 -2
- package/es/components/Datagrid/useActionsColumn.js +1 -2
- package/es/components/Datagrid/useDefaultStringRenderer.js +1 -2
- package/es/components/Datagrid/useFiltering.js +1 -0
- package/es/components/Datagrid/useNestedRowExpander.js +1 -2
- package/es/components/Datagrid/useNestedRows.js +49 -33
- package/es/components/Datagrid/useOnRowClick.js +1 -1
- package/es/components/Datagrid/useRowIsMouseOver.js +3 -1
- package/es/components/Datagrid/useSelectRows.js +1 -2
- package/es/components/Datagrid/useSortableColumns.js +1 -2
- package/es/components/Datagrid/useStickyColumn.js +3 -4
- package/es/components/Datagrid/utils/filterPropsForTesting.js +149 -0
- package/es/components/DelimitedList/DelimitedList.docs-page.js +15 -0
- package/es/components/DelimitedList/DelimitedList.js +73 -0
- package/es/components/DelimitedList/index.js +8 -0
- package/es/components/EditInPlace/EditInPlace.js +1 -2
- package/es/components/EditTearsheet/EditTearsheetForm.js +1 -2
- package/es/components/FilterSummary/FilterSummary.js +15 -12
- package/es/components/NotificationsPanel/NotificationsPanel.js +2 -3
- package/es/components/PageHeader/PageHeader.js +9 -11
- package/es/components/Saving/Saving.js +6 -6
- package/es/components/SidePanel/SidePanel.js +147 -191
- package/es/components/TagSet/TagSet.js +21 -5
- package/es/components/TagSet/TagSetOverflow.js +14 -10
- package/es/components/Tearsheet/Tearsheet.js +5 -0
- package/es/components/Tearsheet/TearsheetNarrow.js +5 -0
- package/es/components/Tearsheet/TearsheetShell.js +9 -9
- package/es/components/WebTerminal/WebTerminal.js +1 -2
- package/es/components/index.js +2 -1
- package/es/global/js/hooks/useResizeObserver.js +5 -2
- package/es/global/js/package-settings.js +1 -0
- package/lib/components/ActionSet/ActionSet.js +3 -4
- package/lib/components/AddSelect/AddSelectBody.js +2 -2
- package/lib/components/AddSelect/AddSelectRow.js +2 -2
- package/lib/components/Card/Card.js +1 -2
- package/lib/components/Card/CardHeader.js +1 -2
- package/lib/components/CreateFullPage/CreateFullPageStep.js +1 -2
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +1 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +1 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +1 -2
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +10 -10
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +6 -11
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +15 -11
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +21 -11
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +22 -12
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +31 -74
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useShouldDisableButtons.js +2 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/utils.js +1 -5
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +2 -3
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +2 -2
- package/lib/components/Datagrid/useActionsColumn.js +1 -2
- package/lib/components/Datagrid/useDefaultStringRenderer.js +1 -2
- package/lib/components/Datagrid/useFiltering.js +1 -0
- package/lib/components/Datagrid/useNestedRowExpander.js +1 -2
- package/lib/components/Datagrid/useNestedRows.js +49 -33
- package/lib/components/Datagrid/useOnRowClick.js +1 -1
- package/lib/components/Datagrid/useRowIsMouseOver.js +3 -1
- package/lib/components/Datagrid/useSelectRows.js +1 -2
- package/lib/components/Datagrid/useSortableColumns.js +1 -2
- package/lib/components/Datagrid/useStickyColumn.js +3 -4
- package/lib/components/Datagrid/utils/filterPropsForTesting.js +156 -0
- package/lib/components/DelimitedList/DelimitedList.docs-page.js +25 -0
- package/lib/components/DelimitedList/DelimitedList.js +78 -0
- package/lib/components/DelimitedList/index.js +12 -0
- package/lib/components/EditInPlace/EditInPlace.js +1 -2
- package/lib/components/EditTearsheet/EditTearsheetForm.js +1 -2
- package/lib/components/FilterSummary/FilterSummary.js +15 -12
- package/lib/components/NotificationsPanel/NotificationsPanel.js +2 -3
- package/lib/components/PageHeader/PageHeader.js +9 -11
- package/lib/components/Saving/Saving.js +6 -6
- package/lib/components/SidePanel/SidePanel.js +147 -191
- package/lib/components/TagSet/TagSet.js +21 -5
- package/lib/components/TagSet/TagSetOverflow.js +13 -9
- package/lib/components/Tearsheet/Tearsheet.js +5 -0
- package/lib/components/Tearsheet/TearsheetNarrow.js +5 -0
- package/lib/components/Tearsheet/TearsheetShell.js +9 -9
- package/lib/components/WebTerminal/WebTerminal.js +1 -2
- package/lib/components/index.js +8 -1
- package/lib/global/js/hooks/useResizeObserver.js +5 -2
- package/lib/global/js/package-settings.js +1 -0
- package/package.json +9 -8
- package/scss/components/Datagrid/_datagrid.scss +4 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +9 -1
- package/scss/components/Datagrid/styles/_useStickyColumn.scss +2 -0
- package/scss/components/DelimitedList/_carbon-imports.scss +9 -0
- package/scss/components/DelimitedList/_delimited-list.scss +27 -0
- package/scss/components/DelimitedList/_index-with-carbon.scss +9 -0
- package/scss/components/DelimitedList/_index.scss +8 -0
- package/scss/components/Saving/_saving.scss +6 -0
- package/scss/components/SidePanel/_side-panel-variables.scss +5 -1
- package/scss/components/SidePanel/_side-panel.scss +158 -186
- package/scss/components/TagSet/_tag-set.scss +4 -1
- package/scss/components/_index-with-carbon.scss +1 -0
- package/scss/components/_index.scss +1 -0
- package/telemetry.yml +790 -0
@@ -23,7 +23,7 @@ import { usePreviousValue } from '../../../../../../global/js/hooks';
|
|
23
23
|
import { prepareProps } from '../../../../../../global/js/utils/props-helper';
|
24
24
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
25
25
|
export var InlineEditCell = function InlineEditCell(_ref) {
|
26
|
-
var _config$validator,
|
26
|
+
var _config$validator, _value$text;
|
27
27
|
var cell = _ref.cell,
|
28
28
|
config = _ref.config,
|
29
29
|
instance = _ref.instance,
|
@@ -438,7 +438,7 @@ export var InlineEditCell = function InlineEditCell(_ref) {
|
|
438
438
|
"data-inline-type": type,
|
439
439
|
onClick: !nonEditCell ? handleInlineCellClick : addActiveState,
|
440
440
|
onKeyDown: !nonEditCell ? handleKeyDown : null,
|
441
|
-
className: cx("".concat(blockClass, "__inline-edit--outer-cell-button"), (
|
441
|
+
className: cx("".concat(blockClass, "__inline-edit--outer-cell-button"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__inline-edit--outer-cell-button--").concat(rowSize), rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--lg"), !rowSize), "".concat(blockClass, "__inline-edit--outer-cell-button--invalid"), config === null || config === void 0 || (_config$validator = config.validator) === null || _config$validator === void 0 ? void 0 : _config$validator.call(config, cellValue)))
|
442
442
|
}, !inEditMode && /*#__PURE__*/React.createElement(InlineEditButton, {
|
443
443
|
isActiveCell: cellId === activeCellId,
|
444
444
|
renderIcon: setRenderIcon(),
|
@@ -37,7 +37,6 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
37
37
|
var row = cell.row,
|
38
38
|
column = cell.column;
|
39
39
|
if (column.isAction) {
|
40
|
-
var _cx3;
|
41
40
|
var isColumnSticky = !!column.sticky;
|
42
41
|
return [props, {
|
43
42
|
children: /*#__PURE__*/React.createElement("div", {
|
@@ -109,7 +108,7 @@ var useActionsColumn = function useActionsColumn(hooks) {
|
|
109
108
|
key: id
|
110
109
|
}));
|
111
110
|
})))),
|
112
|
-
className: cx((
|
111
|
+
className: cx(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__actions-column-cell"), true), "".concat(blockClass, "__cell"), true), "".concat(blockClass, "__actions-column-cell-non-sticky"), !isColumnSticky)),
|
113
112
|
style: {
|
114
113
|
width: rowActions.length > 2 || isColumnSticky ? 48 : 96
|
115
114
|
}
|
@@ -17,8 +17,7 @@ var useDefaultStringRenderer = function useDefaultStringRenderer(hooks) {
|
|
17
17
|
var StringRenderer = function StringRenderer(tableProps) {
|
18
18
|
var _tableProps$column;
|
19
19
|
return /*#__PURE__*/React.createElement("div", {
|
20
|
-
className: cx("".concat(blockClass, "__defaultStringRenderer"), _defineProperty({}, "".concat(blockClass, "__defaultStringRenderer--multiline"), ((_tableProps$column = tableProps.column) === null || _tableProps$column === void 0 ? void 0 : _tableProps$column.multiLineWrap) || (tableProps === null || tableProps === void 0 ? void 0 : tableProps.multiLineWrapAll)))
|
21
|
-
title: tableProps.value
|
20
|
+
className: cx("".concat(blockClass, "__defaultStringRenderer"), _defineProperty({}, "".concat(blockClass, "__defaultStringRenderer--multiline"), ((_tableProps$column = tableProps.column) === null || _tableProps$column === void 0 ? void 0 : _tableProps$column.multiLineWrap) || (tableProps === null || tableProps === void 0 ? void 0 : tableProps.multiLineWrapAll)))
|
22
21
|
}, tableProps.value);
|
23
22
|
};
|
24
23
|
var HeaderRenderer = function HeaderRenderer(header) {
|
@@ -18,6 +18,7 @@ var useFiltering = function useFiltering(hooks) {
|
|
18
18
|
useEffect(function () {
|
19
19
|
pkg.checkReportFeatureEnabled('Datagrid.useFiltering');
|
20
20
|
}, []);
|
21
|
+
/* istanbul ignore next */
|
21
22
|
var filterTypes = useMemo(function () {
|
22
23
|
return {
|
23
24
|
date: function date(rows, id, _ref) {
|
@@ -33,7 +33,6 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
33
33
|
var expanderColumn = {
|
34
34
|
id: 'expander',
|
35
35
|
Cell: function Cell(_ref) {
|
36
|
-
var _cx;
|
37
36
|
var row = _ref.row;
|
38
37
|
var expanderButtonProps = _objectSpread(_objectSpread({}, row.getToggleRowExpandedProps()), {}, {
|
39
38
|
onClick: function onClick(event) {
|
@@ -56,7 +55,7 @@ var useNestedRowExpander = function useNestedRowExpander(hooks) {
|
|
56
55
|
}, expanderButtonProps, {
|
57
56
|
title: expanderTitle
|
58
57
|
}), /*#__PURE__*/React.createElement(ChevronRight, {
|
59
|
-
className: cx("".concat(blockClass, "__expander-icon"), (
|
58
|
+
className: cx("".concat(blockClass, "__expander-icon"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__expander-icon--not-open"), !row.isExpanded), "".concat(blockClass, "__expander-icon--open"), row.isExpanded))
|
60
59
|
}));
|
61
60
|
},
|
62
61
|
width: 48,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
2
|
/**
|
3
|
-
* Copyright IBM Corp. 2020,
|
3
|
+
* Copyright IBM Corp. 2020, 2024
|
4
4
|
*
|
5
5
|
* This source code is licensed under the Apache-2.0 license found in the
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
@@ -9,46 +9,62 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
9
|
import cx from 'classnames';
|
10
10
|
import { pkg } from '../../settings';
|
11
11
|
import useNestedRowExpander from './useNestedRowExpander';
|
12
|
+
import { useEffect } from 'react';
|
12
13
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
13
14
|
var useNestedRows = function useNestedRows(hooks) {
|
14
15
|
useNestedRowExpander(hooks);
|
15
|
-
var marginLeft = 24;
|
16
|
-
var getRowProps = function getRowProps(props, _ref) {
|
17
|
-
var _cx;
|
18
|
-
var row = _ref.row;
|
19
|
-
return [props, {
|
20
|
-
className: cx((_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__carbon-nested-row"), row.depth > 0), _defineProperty(_cx, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), _cx))
|
21
|
-
}];
|
22
|
-
};
|
23
|
-
var getRowStyles = function getRowStyles(props, _ref2) {
|
24
|
-
var row = _ref2.row;
|
25
|
-
return [props, {
|
26
|
-
style: {
|
27
|
-
paddingLeft: "".concat(row.depth > 1 ? marginLeft * 2 + (row.depth - 1) * (marginLeft + marginLeft / 3) : row.depth === 1 ? marginLeft * 2 : 0, "px")
|
28
|
-
}
|
29
|
-
}];
|
30
|
-
};
|
31
|
-
var getCellProps = function getCellProps(props, _ref3) {
|
32
|
-
var cell = _ref3.cell,
|
33
|
-
instance = _ref3.instance;
|
34
|
-
// reduce the "first cell"s width to compensate added (left) margin
|
35
|
-
var isFirstCell = instance.columns.findIndex(function (c) {
|
36
|
-
return c.id === cell.column.id;
|
37
|
-
}) === 0;
|
38
|
-
return [props, {
|
39
|
-
style: {
|
40
|
-
marginRight: "".concat(isFirstCell && cell.row.depth > 0 ? "".concat(-32 * cell.row.depth - 18, "px") : '')
|
41
|
-
}
|
42
|
-
}];
|
43
|
-
};
|
44
16
|
var useInstance = function useInstance(instance) {
|
17
|
+
// This useEffect will expand rows if they exist in the initialState obj
|
18
|
+
useEffect(function () {
|
19
|
+
var rows = instance.rows,
|
20
|
+
initialState = instance.initialState;
|
21
|
+
var expandedRowIds = initialState.expandedRowIds;
|
22
|
+
if (expandedRowIds) {
|
23
|
+
Object.keys(expandedRowIds).forEach(function (key) {
|
24
|
+
var row = rows.filter(function (r) {
|
25
|
+
return r.id.toString() === key.toString();
|
26
|
+
});
|
27
|
+
if (row.length && key.toString() === row[0].id.toString()) {
|
28
|
+
row[0].toggleRowExpanded();
|
29
|
+
}
|
30
|
+
});
|
31
|
+
}
|
32
|
+
}, [instance]);
|
33
|
+
var marginLeft = 24;
|
34
|
+
var getRowProps = function getRowProps(props, _ref) {
|
35
|
+
var row = _ref.row;
|
36
|
+
return [props, {
|
37
|
+
className: cx(_defineProperty(_defineProperty({}, "".concat(blockClass, "__carbon-nested-row"), row.depth > 0), "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded))
|
38
|
+
}];
|
39
|
+
};
|
40
|
+
var getRowStyles = function getRowStyles(props, _ref2) {
|
41
|
+
var row = _ref2.row;
|
42
|
+
return [props, {
|
43
|
+
style: {
|
44
|
+
paddingLeft: "".concat(row.depth > 1 ? marginLeft * 2 + (row.depth - 1) * (marginLeft + marginLeft / 3) : row.depth === 1 ? marginLeft * 2 : 0, "px")
|
45
|
+
}
|
46
|
+
}];
|
47
|
+
};
|
48
|
+
var getCellProps = function getCellProps(props, _ref3) {
|
49
|
+
var cell = _ref3.cell,
|
50
|
+
instance = _ref3.instance;
|
51
|
+
// reduce the "first cell"s width to compensate added (left) margin
|
52
|
+
var isFirstCell = instance.columns.findIndex(function (c) {
|
53
|
+
return c.id === cell.column.id;
|
54
|
+
}) === 0;
|
55
|
+
return [props, {
|
56
|
+
style: {
|
57
|
+
marginRight: "".concat(isFirstCell && cell.row.depth > 0 ? "".concat(-32 * cell.row.depth - 18, "px") : '')
|
58
|
+
}
|
59
|
+
}];
|
60
|
+
};
|
45
61
|
Object.assign(instance, {
|
46
62
|
withNestedRows: true
|
47
63
|
});
|
64
|
+
hooks.getRowProps.push(getRowProps);
|
65
|
+
hooks.getRowProps.push(getRowStyles);
|
66
|
+
hooks.getCellProps.push(getCellProps);
|
48
67
|
};
|
49
|
-
hooks.getRowProps.push(getRowProps);
|
50
|
-
hooks.getRowProps.push(getRowStyles);
|
51
|
-
hooks.getCellProps.push(getCellProps);
|
52
68
|
hooks.useInstance.push(useInstance);
|
53
69
|
};
|
54
70
|
export default useNestedRows;
|
@@ -29,7 +29,7 @@ var useOnRowClick = function useOnRowClick(hooks) {
|
|
29
29
|
row.classList.remove("".concat(carbon.prefix, "--data-table--selected"));
|
30
30
|
});
|
31
31
|
}
|
32
|
-
var closestRow = event.
|
32
|
+
var closestRow = event.currentTarget.closest('tr');
|
33
33
|
closestRow.classList.add("".concat(carbon.prefix, "--data-table--selected"));
|
34
34
|
if (!withSelectRows) {
|
35
35
|
instance.selectedFlatRows && instance.selectedFlatRows.map(function (toggleRow) {
|
@@ -37,7 +37,9 @@ var useRowIsMouseOver = function useRowIsMouseOver(hooks) {
|
|
37
37
|
});
|
38
38
|
});
|
39
39
|
Object.assign(instance, {
|
40
|
-
rows: rowsWithMouseOver
|
40
|
+
rows: rowsWithMouseOver,
|
41
|
+
withMouseHover: true,
|
42
|
+
setMouseOverRowIndex: setMouseOverRowIndex
|
41
43
|
});
|
42
44
|
hooks.getRowProps.push(getRowProps);
|
43
45
|
};
|
@@ -62,12 +62,11 @@ var useSelectRows = function useSelectRows(hooks) {
|
|
62
62
|
};
|
63
63
|
var useHighlightSelection = function useHighlightSelection(hooks) {
|
64
64
|
var getRowProps = function getRowProps(props, _ref) {
|
65
|
-
var _ref2;
|
66
65
|
var row = _ref.row;
|
67
66
|
var _row$getToggleRowSele = row.getToggleRowSelectedProps(),
|
68
67
|
checked = _row$getToggleRowSele.checked;
|
69
68
|
return [props, {
|
70
|
-
className: cx(["".concat(blockClass, "__carbon-row"), (
|
69
|
+
className: cx(["".concat(blockClass, "__carbon-row"), _defineProperty(_defineProperty({}, "".concat(carbon.prefix, "--data-table--selected"), checked), "".concat(blockClass, "__active-row"), checked)])
|
71
70
|
}];
|
72
71
|
};
|
73
72
|
hooks.getRowProps.push(getRowProps);
|
@@ -89,7 +89,6 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
89
89
|
return /*#__PURE__*/React.createElement(ArrowsVertical, iconProps);
|
90
90
|
};
|
91
91
|
var Header = function Header(headerProp) {
|
92
|
-
var _cx;
|
93
92
|
return column.disableSortBy === true || column.id === 'datagridSelection' ? column.disableSortBy ? column.Header : /*#__PURE__*/React.createElement(SelectAll, instance) : /*#__PURE__*/React.createElement(Button, {
|
94
93
|
"aria-sort": getAriaSortValue(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column, {
|
95
94
|
ascendingSortableLabelText: ascendingSortableLabelText,
|
@@ -104,7 +103,7 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
104
103
|
renderIcon: function renderIcon(props) {
|
105
104
|
return icon(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column, props);
|
106
105
|
},
|
107
|
-
className: cx("".concat(carbon.prefix, "--table-sort ").concat(blockClass, "--table-sort"), (
|
106
|
+
className: cx("".concat(carbon.prefix, "--table-sort ").concat(blockClass, "--table-sort"), _defineProperty(_defineProperty({}, "".concat(blockClass, "--table-sort--desc"), headerProp === null || headerProp === void 0 ? void 0 : headerProp.column.isSortedDesc), "".concat(blockClass, "--table-sort--asc"), (headerProp === null || headerProp === void 0 ? void 0 : headerProp.column.isSortedDesc) === false))
|
108
107
|
}, column.Header);
|
109
108
|
};
|
110
109
|
return _objectSpread(_objectSpread({}, column), {}, {
|
@@ -143,17 +143,16 @@ var addTableBodyProps = function addTableBodyProps(tableBodyRef, props) {
|
|
143
143
|
var changeProps = function changeProps(elementName, headerCellRef, windowSize, props, data) {
|
144
144
|
var column = data.column || data.cell.column;
|
145
145
|
if (column.sticky === 'right') {
|
146
|
-
var _cx;
|
147
146
|
return [props, _objectSpread({
|
148
|
-
className: cx((
|
147
|
+
className: cx(_defineProperty(_defineProperty(_defineProperty({}, "".concat(styleClassPrefix, "-").concat(elementName), true), "".concat(blockClass, "__resizableColumn"), false), "".concat(blockClass, "__sortableColumn"), false))
|
149
148
|
}, headerCellRef && {
|
150
149
|
ref: headerCellRef
|
151
150
|
})];
|
152
151
|
}
|
153
152
|
if (column.sticky === 'left') {
|
154
|
-
var _data$instance
|
153
|
+
var _data$instance;
|
155
154
|
return [props, _objectSpread({
|
156
|
-
className: cx((
|
155
|
+
className: cx(_defineProperty(_defineProperty({}, "".concat(leftStickyStyleClassPrefix, "-").concat(elementName), true && windowSize > 671), "".concat(leftStickyStyleClassPrefix, "-").concat(elementName, "--with-extra-select-column"), (data === null || data === void 0 || (_data$instance = data.instance) === null || _data$instance === void 0 ? void 0 : _data$instance.withSelectRows) && windowSize > 671))
|
157
156
|
}, headerCellRef && {
|
158
157
|
ref: headerCellRef
|
159
158
|
})];
|
@@ -0,0 +1,149 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
3
|
+
/**
|
4
|
+
* Copyright IBM Corp. 2024, 2024
|
5
|
+
*
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
|
+
|
10
|
+
import { handleFilterTagLabelText } from './handleFilterTagLabelText';
|
11
|
+
export var generateDummyCheckboxes = Array(25).fill(null).map(function (_, index) {
|
12
|
+
return {
|
13
|
+
id: "".concat(index),
|
14
|
+
labelText: "Dummy checkbox ".concat(index + 1),
|
15
|
+
value: 'dummy-checkbox',
|
16
|
+
disabled: true
|
17
|
+
};
|
18
|
+
});
|
19
|
+
export var filterProps = function filterProps() {
|
20
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
21
|
+
_ref$includeManyCheck = _ref.includeManyCheckboxes,
|
22
|
+
includeManyCheckboxes = _ref$includeManyCheck === void 0 ? false : _ref$includeManyCheck,
|
23
|
+
_ref$dropdownOnChange = _ref.dropdownOnChange,
|
24
|
+
dropdownOnChange = _ref$dropdownOnChange === void 0 ? function () {} : _ref$dropdownOnChange;
|
25
|
+
var checkboxList = [{
|
26
|
+
id: 'normal',
|
27
|
+
labelText: 'Normal',
|
28
|
+
value: 'normal'
|
29
|
+
}, {
|
30
|
+
id: 'minor-warning',
|
31
|
+
labelText: 'Minor warning',
|
32
|
+
value: 'minor-warning'
|
33
|
+
}, {
|
34
|
+
id: 'critical',
|
35
|
+
labelText: 'Critical',
|
36
|
+
value: 'critical'
|
37
|
+
}].concat(_toConsumableArray(includeManyCheckboxes ? generateDummyCheckboxes : []));
|
38
|
+
return {
|
39
|
+
autoHideFilters: includeManyCheckboxes ? false : true,
|
40
|
+
variation: 'panel',
|
41
|
+
panelIconDescription: 'Open filters',
|
42
|
+
sections: [{
|
43
|
+
categoryTitle: 'Category title',
|
44
|
+
hasAccordion: true,
|
45
|
+
filters: [{
|
46
|
+
filterLabel: 'Joined',
|
47
|
+
filter: {
|
48
|
+
type: 'date',
|
49
|
+
column: 'joined',
|
50
|
+
props: {
|
51
|
+
DatePicker: {
|
52
|
+
datePickerType: 'range'
|
53
|
+
},
|
54
|
+
DatePickerInput: {
|
55
|
+
start: {
|
56
|
+
id: 'date-picker-input-id-start',
|
57
|
+
placeholder: 'mm/dd/yyyy',
|
58
|
+
labelText: 'Joined start date'
|
59
|
+
},
|
60
|
+
end: {
|
61
|
+
id: 'date-picker-input-id-end',
|
62
|
+
placeholder: 'mm/dd/yyyy',
|
63
|
+
labelText: 'Joined end date'
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
}, {
|
69
|
+
filterLabel: 'Status',
|
70
|
+
filter: {
|
71
|
+
type: 'dropdown',
|
72
|
+
column: 'status',
|
73
|
+
props: {
|
74
|
+
Dropdown: _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
75
|
+
id: 'marital-status-dropdown'
|
76
|
+
}, 'aria-label', 'Marital status dropdown'), "items", ['relationship', 'complicated', 'single']), "label", 'Marital status'), "titleText", 'Marital status'), "onChange", dropdownOnChange)
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}]
|
80
|
+
}, {
|
81
|
+
categoryTitle: 'Category title',
|
82
|
+
filters: [{
|
83
|
+
filterLabel: 'Role',
|
84
|
+
filter: {
|
85
|
+
type: 'radio',
|
86
|
+
column: 'role',
|
87
|
+
props: {
|
88
|
+
FormGroup: {
|
89
|
+
legendText: 'Role'
|
90
|
+
},
|
91
|
+
RadioButtonGroup: {
|
92
|
+
orientation: 'vertical',
|
93
|
+
legend: 'Role legend',
|
94
|
+
name: 'role-radio-button-group'
|
95
|
+
},
|
96
|
+
RadioButton: [{
|
97
|
+
id: 'developer',
|
98
|
+
labelText: 'Developer',
|
99
|
+
value: 'developer'
|
100
|
+
}, {
|
101
|
+
id: 'designer',
|
102
|
+
labelText: 'Designer',
|
103
|
+
value: 'designer'
|
104
|
+
}, {
|
105
|
+
id: 'researcher',
|
106
|
+
labelText: 'Researcher',
|
107
|
+
value: 'researcher'
|
108
|
+
}]
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}, {
|
112
|
+
filterLabel: 'Visits',
|
113
|
+
filter: {
|
114
|
+
type: 'number',
|
115
|
+
column: 'visits',
|
116
|
+
props: {
|
117
|
+
NumberInput: {
|
118
|
+
min: 0,
|
119
|
+
id: 'visits-number-input',
|
120
|
+
invalidText: 'A valid value is required',
|
121
|
+
label: 'Visits',
|
122
|
+
placeholder: 'Type a number amount of visits'
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}, {
|
127
|
+
filterLabel: 'Password strength',
|
128
|
+
filter: {
|
129
|
+
type: 'checkbox',
|
130
|
+
column: 'passwordStrength',
|
131
|
+
props: {
|
132
|
+
FormGroup: {
|
133
|
+
legendText: 'Password strength'
|
134
|
+
},
|
135
|
+
Checkbox: checkboxList
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}]
|
139
|
+
}],
|
140
|
+
renderLabel: function renderLabel(key, value) {
|
141
|
+
return handleFilterTagLabelText(key, value);
|
142
|
+
},
|
143
|
+
renderDateLabel: function renderDateLabel(start, end) {
|
144
|
+
var startDateObj = new Date(start);
|
145
|
+
var endDateObj = new Date(end);
|
146
|
+
return "".concat(startDateObj.toLocaleDateString(), " - ").concat(endDateObj.toLocaleDateString());
|
147
|
+
}
|
148
|
+
};
|
149
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { StoryDocsPage } from '../../global/js/utils/StoryDocsPage';
|
3
|
+
import * as stories from './DelimitedList.stories';
|
4
|
+
var DocsPage = function DocsPage() {
|
5
|
+
return /*#__PURE__*/React.createElement(StoryDocsPage, {
|
6
|
+
blocks: [{
|
7
|
+
story: stories.delimited
|
8
|
+
}, {
|
9
|
+
story: stories.notDelimited
|
10
|
+
}, {
|
11
|
+
story: stories.empty
|
12
|
+
}]
|
13
|
+
});
|
14
|
+
};
|
15
|
+
export default DocsPage;
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _excluded = ["className", "delimiter", "items", "truncate"];
|
4
|
+
/**
|
5
|
+
* Copyright IBM Corp. 2024, 2024
|
6
|
+
*
|
7
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/
|
10
|
+
|
11
|
+
// Import portions of React that are needed.
|
12
|
+
import React from 'react';
|
13
|
+
|
14
|
+
// Other standard imports.
|
15
|
+
import PropTypes from 'prop-types';
|
16
|
+
import cx from 'classnames';
|
17
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
18
|
+
import { pkg } from '../../settings';
|
19
|
+
var blockClass = "".concat(pkg.prefix, "--delimited-list");
|
20
|
+
var componentName = 'DelimitedList';
|
21
|
+
var defaults = {
|
22
|
+
delimiter: ', ',
|
23
|
+
items: [],
|
24
|
+
truncate: true
|
25
|
+
};
|
26
|
+
|
27
|
+
/**
|
28
|
+
* `DelimitedList` converts an array of items into a single line of
|
29
|
+
* comma-separated values.
|
30
|
+
*/
|
31
|
+
export var DelimitedList = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
32
|
+
var className = _ref.className,
|
33
|
+
_ref$delimiter = _ref.delimiter,
|
34
|
+
delimiter = _ref$delimiter === void 0 ? defaults.delimiter : _ref$delimiter,
|
35
|
+
_ref$items = _ref.items,
|
36
|
+
items = _ref$items === void 0 ? defaults.items : _ref$items,
|
37
|
+
_ref$truncate = _ref.truncate,
|
38
|
+
truncate = _ref$truncate === void 0 ? defaults.truncate : _ref$truncate,
|
39
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
40
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
41
|
+
className: cx(blockClass, className, [truncate && "".concat(blockClass, "-truncate")]),
|
42
|
+
ref: ref
|
43
|
+
}, getDevtoolsProps(componentName)), items.length > 0 ? items.join(delimiter) : '–');
|
44
|
+
});
|
45
|
+
|
46
|
+
// Return a placeholder if not released and not enabled by feature flag
|
47
|
+
DelimitedList = pkg.checkComponentEnabled(DelimitedList, componentName);
|
48
|
+
|
49
|
+
// The display name of the component, used by React. Note that displayName
|
50
|
+
// is used in preference to relying on function.name.
|
51
|
+
DelimitedList.displayName = componentName;
|
52
|
+
|
53
|
+
// The types and DocGen commentary for the component props,
|
54
|
+
// in alphabetical order (for consistency).
|
55
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
56
|
+
DelimitedList.propTypes = {
|
57
|
+
/**
|
58
|
+
* Provide an optional class to be applied to the containing node.
|
59
|
+
*/
|
60
|
+
className: PropTypes.string,
|
61
|
+
/**
|
62
|
+
* The character(s) used to separate the items.
|
63
|
+
*/
|
64
|
+
delimiter: PropTypes.string,
|
65
|
+
/**
|
66
|
+
* Array of items to be listed.
|
67
|
+
*/
|
68
|
+
items: PropTypes.arrayOf(PropTypes.any),
|
69
|
+
/**
|
70
|
+
* Toggle the component's ability to truncate or not.
|
71
|
+
*/
|
72
|
+
truncate: PropTypes.bool
|
73
|
+
};
|
@@ -29,7 +29,6 @@ var defaults = {
|
|
29
29
|
size: 'sm'
|
30
30
|
};
|
31
31
|
export var EditInPlace = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
32
|
-
var _cx;
|
33
32
|
var cancelLabel = _ref.cancelLabel,
|
34
33
|
editAlwaysVisible = _ref.editAlwaysVisible,
|
35
34
|
editLabel = _ref.editLabel,
|
@@ -148,7 +147,7 @@ export var EditInPlace = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
148
147
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
149
148
|
ref: ref
|
150
149
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement("div", {
|
151
|
-
className: cx(blockClass, "".concat(blockClass, "--").concat(size), (
|
150
|
+
className: cx(blockClass, "".concat(blockClass, "--").concat(size), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "--focused"), focused), "".concat(blockClass, "--invalid"), invalid), "".concat(blockClass, "--inherit-type"), inheritTypography), "".concat(blockClass, "--overflows"), inputRef.current && inputRef.current.scrollWidth > inputRef.current.offsetWidth)),
|
152
151
|
onFocus: onFocusHandler,
|
153
152
|
onBlur: onBlurHandler
|
154
153
|
}, /*#__PURE__*/React.createElement("label", {
|
@@ -25,7 +25,6 @@ var defaults = {
|
|
25
25
|
hasFieldset: true
|
26
26
|
};
|
27
27
|
export var EditTearsheetForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
28
|
-
var _cx;
|
29
28
|
var children = _ref.children,
|
30
29
|
className = _ref.className,
|
31
30
|
description = _ref.description,
|
@@ -43,7 +42,7 @@ export var EditTearsheetForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
43
42
|
title: title
|
44
43
|
});
|
45
44
|
return formContext ? /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
46
|
-
className: cx(blockClass, className, (
|
45
|
+
className: cx(blockClass, className, _defineProperty(_defineProperty({}, "".concat(blockClass, "__form--hidden-form"), formNumber !== (formContext === null || formContext === void 0 ? void 0 : formContext.currentForm)), "".concat(blockClass, "__form--visible-form"), formNumber === (formContext === null || formContext === void 0 ? void 0 : formContext.currentForm))),
|
47
46
|
ref: ref
|
48
47
|
}), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Column, {
|
49
48
|
xlg: 12,
|
@@ -1,6 +1,8 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["
|
4
|
+
var _excluded = ["className", "clearFiltersText", "clearFilters", "filters", "renderLabel", "overflowType", "clearButtonInline"],
|
5
|
+
_excluded2 = ["key", "value"];
|
4
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
5
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
6
8
|
/**
|
@@ -16,6 +18,7 @@ import cx from 'classnames';
|
|
16
18
|
import { TagSet } from '../TagSet';
|
17
19
|
import { pkg } from '../../settings';
|
18
20
|
import uuidv4 from '../../global/js/utils/uuidv4';
|
21
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
19
22
|
var blockClass = "".concat(pkg.prefix, "--filter-summary");
|
20
23
|
var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
21
24
|
var _filterSummaryClearBu;
|
@@ -23,22 +26,21 @@ var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
23
26
|
className = _ref$className === void 0 ? '' : _ref$className,
|
24
27
|
_ref$clearFiltersText = _ref.clearFiltersText,
|
25
28
|
clearFiltersText = _ref$clearFiltersText === void 0 ? 'Clear filters' : _ref$clearFiltersText,
|
26
|
-
|
27
|
-
|
28
|
-
_ref$filters = _ref.filters,
|
29
|
-
filters = _ref$filters === void 0 ? [] : _ref$filters,
|
29
|
+
clearFilters = _ref.clearFilters,
|
30
|
+
filters = _ref.filters,
|
30
31
|
_ref$renderLabel = _ref.renderLabel,
|
31
32
|
renderLabel = _ref$renderLabel === void 0 ? null : _ref$renderLabel,
|
32
33
|
_ref$overflowType = _ref.overflowType,
|
33
34
|
overflowType = _ref$overflowType === void 0 ? 'default' : _ref$overflowType,
|
34
35
|
_ref$clearButtonInlin = _ref.clearButtonInline,
|
35
|
-
clearButtonInline = _ref$clearButtonInlin === void 0 ? true : _ref$clearButtonInlin
|
36
|
+
clearButtonInline = _ref$clearButtonInlin === void 0 ? true : _ref$clearButtonInlin,
|
37
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
36
38
|
var filterSummaryId = "".concat(blockClass, "__").concat(uuidv4());
|
37
39
|
var tagFilters = filters.map(function (_ref2) {
|
38
40
|
var _renderLabel;
|
39
41
|
var key = _ref2.key,
|
40
42
|
value = _ref2.value,
|
41
|
-
rest = _objectWithoutProperties(_ref2,
|
43
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
42
44
|
return _objectSpread(_objectSpread({}, rest), {}, {
|
43
45
|
type: 'gray',
|
44
46
|
label: (_renderLabel = renderLabel === null || renderLabel === void 0 ? void 0 : renderLabel(key, value)) !== null && _renderLabel !== void 0 ? _renderLabel : "".concat(key, ": ").concat(value)
|
@@ -46,12 +48,13 @@ var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
46
48
|
});
|
47
49
|
var filterSummaryClearButton = useRef();
|
48
50
|
var filterSummaryRef = useRef();
|
49
|
-
var localRef =
|
50
|
-
return /*#__PURE__*/React.createElement("div", {
|
51
|
-
ref: localRef,
|
52
|
-
className: cx([blockClass, className]),
|
51
|
+
var localRef = ref || filterSummaryRef;
|
52
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, getDevtoolsProps(componentName), {
|
53
53
|
id: filterSummaryId
|
54
|
-
},
|
54
|
+
}, rest, {
|
55
|
+
ref: localRef,
|
56
|
+
className: cx([blockClass, className])
|
57
|
+
}), /*#__PURE__*/React.createElement(TagSet, {
|
55
58
|
allTagsModalSearchLabel: "Search all tags",
|
56
59
|
allTagsModalSearchPlaceholderText: "Search all tags",
|
57
60
|
allTagsModalTitle: "All tags",
|
@@ -212,14 +212,13 @@ export var NotificationsPanel = /*#__PURE__*/React.forwardRef(function (_ref, re
|
|
212
212
|
});
|
213
213
|
previousNotifications = sortChronologically(previousNotifications);
|
214
214
|
var renderDescription = function renderDescription(id) {
|
215
|
-
var _ref2, _ref3;
|
216
215
|
var notification = allNotifications && allNotifications.length && allNotifications.filter(function (item) {
|
217
216
|
return item.id === id;
|
218
217
|
})[0];
|
219
218
|
var trimLength = 88;
|
220
219
|
var description = notification.description;
|
221
|
-
var descriptionClassName = cx(["".concat(blockClass, "__notification-description"), (
|
222
|
-
var showMoreButtonClassName = cx([(
|
220
|
+
var descriptionClassName = cx(["".concat(blockClass, "__notification-description"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__notification-long-description"), notification.showAll), "".concat(blockClass, "__notification-short-description"), !notification.showAll)]);
|
221
|
+
var showMoreButtonClassName = cx([_defineProperty(_defineProperty({}, "".concat(blockClass, "__notification-read-less-button"), notification.showAll), "".concat(blockClass, "__notification-read-more-button"), !notification.showAll)]);
|
223
222
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
|
224
223
|
className: descriptionClassName
|
225
224
|
}, description), description.length > trimLength && /*#__PURE__*/React.createElement(Button, {
|