@carbon/ibm-products 1.22.0 → 1.23.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.
Files changed (71) hide show
  1. package/css/components/Datagrid/styles/datagrid.css +4 -0
  2. package/css/components/Datagrid/styles/datagrid.css.map +1 -1
  3. package/css/components/Datagrid/styles/index.css +15 -0
  4. package/css/components/Datagrid/styles/index.css.map +1 -1
  5. package/css/components/Datagrid/styles/useExpandedRow.css +12 -0
  6. package/css/components/Datagrid/styles/useExpandedRow.css.map +1 -0
  7. package/css/index-full-carbon.css +46 -143
  8. package/css/index-full-carbon.css.map +1 -1
  9. package/css/index-full-carbon.min.css +3 -3
  10. package/css/index-full-carbon.min.css.map +1 -1
  11. package/css/index-without-carbon-released-only.css +25 -16
  12. package/css/index-without-carbon-released-only.css.map +1 -1
  13. package/css/index-without-carbon-released-only.min.css +2 -2
  14. package/css/index-without-carbon-released-only.min.css.map +1 -1
  15. package/css/index-without-carbon.css +41 -16
  16. package/css/index-without-carbon.css.map +1 -1
  17. package/css/index-without-carbon.min.css +2 -2
  18. package/css/index-without-carbon.min.css.map +1 -1
  19. package/css/index.css +44 -139
  20. package/css/index.css.map +1 -1
  21. package/css/index.min.css +3 -3
  22. package/css/index.min.css.map +1 -1
  23. package/es/components/AddSelect/AddSelect.js +57 -422
  24. package/es/components/AddSelect/AddSelectBody.js +349 -0
  25. package/es/components/AddSelect/AddSelectBreadcrumbs.js +11 -31
  26. package/es/components/AddSelect/AddSelectColumn.js +91 -41
  27. package/es/components/AddSelect/AddSelectFilter.js +1 -2
  28. package/es/components/AddSelect/AddSelectList.js +10 -61
  29. package/es/components/AddSelect/AddSelectMetaPanel.js +1 -1
  30. package/es/components/AddSelect/AddSelectSidebar.js +20 -13
  31. package/es/components/AddSelect/AddSelectSort.js +2 -2
  32. package/es/components/AddSelect/add-select-utils.js +85 -59
  33. package/es/components/AddSelect/hooks/useParentSelect.js +16 -0
  34. package/es/components/AddSelect/hooks/usePath.js +66 -0
  35. package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +1 -5
  36. package/es/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +1 -5
  37. package/es/components/Datagrid/Datagrid/Datagrid.js +1 -1
  38. package/es/components/Datagrid/useExpandedRow.js +12 -4
  39. package/es/components/PageHeader/PageHeaderUtils.js +5 -0
  40. package/es/components/TagSet/TagSet.js +15 -5
  41. package/lib/components/AddSelect/AddSelect.js +54 -430
  42. package/lib/components/AddSelect/AddSelectBody.js +384 -0
  43. package/lib/components/AddSelect/AddSelectBreadcrumbs.js +11 -30
  44. package/lib/components/AddSelect/AddSelectColumn.js +90 -39
  45. package/lib/components/AddSelect/AddSelectFilter.js +1 -2
  46. package/lib/components/AddSelect/AddSelectList.js +11 -60
  47. package/lib/components/AddSelect/AddSelectMetaPanel.js +1 -1
  48. package/lib/components/AddSelect/AddSelectSidebar.js +20 -13
  49. package/lib/components/AddSelect/AddSelectSort.js +2 -2
  50. package/lib/components/AddSelect/add-select-utils.js +88 -64
  51. package/lib/components/AddSelect/hooks/useParentSelect.js +27 -0
  52. package/lib/components/AddSelect/hooks/usePath.js +75 -0
  53. package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +1 -5
  54. package/lib/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +1 -5
  55. package/lib/components/Datagrid/Datagrid/Datagrid.js +1 -1
  56. package/lib/components/Datagrid/useExpandedRow.js +20 -4
  57. package/lib/components/PageHeader/PageHeaderUtils.js +5 -0
  58. package/lib/components/TagSet/TagSet.js +15 -5
  59. package/package.json +16 -16
  60. package/scss/components/Cascade/_cascade.scss +2 -1
  61. package/scss/components/CreateInfluencer/_create-influencer.scss +0 -2
  62. package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -1
  63. package/scss/components/Datagrid/_storybook-styles.scss +4 -0
  64. package/scss/components/Datagrid/styles/datagrid.scss +4 -0
  65. package/scss/components/Datagrid/styles/index.scss +1 -0
  66. package/scss/components/Datagrid/styles/useExpandedRow.scss +13 -0
  67. package/scss/components/InlineEdit/_inline-edit.scss +2 -1
  68. package/scss/components/OptionsTile/_options-tile.scss +1 -0
  69. package/scss/components/PageHeader/_page-header.scss +9 -4
  70. package/scss/components/SidePanel/_side-panel.scss +1 -2
  71. package/scss/components/TagSet/_tag-set.scss +4 -0
@@ -11,8 +11,9 @@ import { Button, Checkbox, RadioButton, StructuredListRow, StructuredListWrapper
11
11
  import { ChevronRight16, View16 } from '@carbon/icons-react';
12
12
  import PropTypes from 'prop-types';
13
13
  import cx from 'classnames';
14
- import { UserProfileImage } from '../UserProfileImage';
15
14
  import { pkg } from '../../settings';
15
+ import { UserProfileImage } from '../UserProfileImage';
16
+ var blockClass = "".concat(pkg.prefix, "--add-select__selections");
16
17
  var componentName = 'AddSelectList';
17
18
  export var AddSelectList = function AddSelectList(_ref) {
18
19
  var _modifiers$options;
@@ -24,14 +25,13 @@ export var AddSelectList = function AddSelectList(_ref) {
24
25
  multi = _ref.multi,
25
26
  multiSelection = _ref.multiSelection,
26
27
  navIconDescription = _ref.navIconDescription,
27
- path = _ref.path,
28
+ parentId = _ref.parentId,
28
29
  setAppliedModifiers = _ref.setAppliedModifiers,
29
30
  setDisplayMetaPanel = _ref.setDisplayMetaPanel,
30
31
  setMultiSelection = _ref.setMultiSelection,
31
- setPath = _ref.setPath,
32
+ setParentSelected = _ref.setParentSelected,
32
33
  setSingleSelection = _ref.setSingleSelection,
33
34
  singleSelection = _ref.singleSelection;
34
- var blockClass = "".concat(pkg.prefix, "--add-select__selections");
35
35
  var hasModifiers = (modifiers === null || modifiers === void 0 ? void 0 : (_modifiers$options = modifiers.options) === null || _modifiers$options === void 0 ? void 0 : _modifiers$options.length) > 0;
36
36
 
37
37
  var handleSingleSelection = function handleSingleSelection(value) {
@@ -53,61 +53,8 @@ export var AddSelectList = function AddSelectList(_ref) {
53
53
 
54
54
  var onNavigateItem = function onNavigateItem(_ref2) {
55
55
  var id = _ref2.id,
56
- title = _ref2.title,
57
- parent = _ref2.parent;
58
-
59
- // if multi select
60
- if (multi) {
61
- // if top level reset the path
62
- if (!parent) {
63
- setPath([{
64
- id: id,
65
- title: title
66
- }]);
67
- } else {
68
- var pathIds = path.map(function (p) {
69
- return p.id;
70
- }); // if item is already selected somewhere go back to that item
71
-
72
- if (pathIds.includes(id)) {
73
- var pathIdx = pathIds.findIndex(function (pathId) {
74
- return pathId === id;
75
- });
76
-
77
- var newPath = _toConsumableArray(path).splice(0, pathIdx + 1);
78
-
79
- setPath(_toConsumableArray(newPath));
80
- } else {
81
- // if the item is on the same level as another selected item start from the parent level
82
- if (path.find(function (p) {
83
- return p.parent === parent;
84
- })) {
85
- var parentIdx = path.findIndex(function (p) {
86
- return p.id === parent;
87
- });
88
-
89
- var _newPath = _toConsumableArray(path).splice(0, parentIdx + 1);
90
-
91
- setPath([].concat(_toConsumableArray(_newPath), [{
92
- id: id,
93
- title: title,
94
- parent: parent
95
- }]));
96
- } else {
97
- setPath([].concat(_toConsumableArray(path), [{
98
- id: id,
99
- title: title,
100
- parent: parent
101
- }]));
102
- }
103
- }
104
- }
105
- } else {
106
- setPath([].concat(_toConsumableArray(path), [{
107
- id: id,
108
- title: title
109
- }]));
110
- }
56
+ title = _ref2.title;
57
+ setParentSelected(id, title, parentId);
111
58
  };
112
59
 
113
60
  var isSelected = function isSelected(id) {
@@ -204,6 +151,7 @@ export var AddSelectList = function AddSelectList(_ref) {
204
151
  },
205
152
  selected: item.id === singleSelection
206
153
  }), item.children && /*#__PURE__*/React.createElement(Button, {
154
+ className: "".concat(blockClass, "-view-children"),
207
155
  renderIcon: ChevronRight16,
208
156
  iconDescription: navIconDescription,
209
157
  tooltipPosition: "left",
@@ -217,6 +165,7 @@ export var AddSelectList = function AddSelectList(_ref) {
217
165
  }), item.meta && /*#__PURE__*/React.createElement("div", {
218
166
  className: "".concat(blockClass, "-hidden-hover")
219
167
  }, /*#__PURE__*/React.createElement(Button, {
168
+ className: "".concat(blockClass, "-view-meta"),
220
169
  renderIcon: View16,
221
170
  iconDescription: metaIconDescription,
222
171
  tooltipPosition: "left",
@@ -238,11 +187,11 @@ AddSelectList.propTypes = {
238
187
  multi: PropTypes.bool,
239
188
  multiSelection: PropTypes.array,
240
189
  navIconDescription: PropTypes.string,
241
- path: PropTypes.array,
190
+ parentId: PropTypes.string,
242
191
  setAppliedModifiers: PropTypes.func,
243
192
  setDisplayMetaPanel: PropTypes.func,
244
193
  setMultiSelection: PropTypes.func,
245
- setPath: PropTypes.func,
194
+ setParentSelected: PropTypes.func,
246
195
  setSingleSelection: PropTypes.func,
247
196
  singleSelection: PropTypes.string
248
197
  };
@@ -3,13 +3,13 @@ import PropTypes from 'prop-types';
3
3
  import { Close16 } from '@carbon/icons-react';
4
4
  import { Button } from 'carbon-components-react';
5
5
  import { pkg } from '../../settings';
6
+ var blockClass = "".concat(pkg.prefix, "--add-select__meta-panel");
6
7
  var componentName = 'AddSelectMetaPanel';
7
8
  export var AddSelectMetaPanel = function AddSelectMetaPanel(_ref) {
8
9
  var closeIconDescription = _ref.closeIconDescription,
9
10
  meta = _ref.meta,
10
11
  setDisplayMetaPanel = _ref.setDisplayMetaPanel,
11
12
  title = _ref.title;
12
- var blockClass = "".concat(pkg.prefix, "--add-select__meta-panel");
13
13
 
14
14
  var onCloseHandler = function onCloseHandler() {
15
15
  setDisplayMetaPanel({});
@@ -13,6 +13,7 @@ import PropTypes from 'prop-types';
13
13
  import { NoDataEmptyState } from '../../components/EmptyStates/NoDataEmptyState';
14
14
  import { pkg } from '../../settings';
15
15
  import { AddSelectMetaPanel } from './AddSelectMetaPanel';
16
+ var blockClass = "".concat(pkg.prefix, "--add-select__sidebar");
16
17
  var componentName = 'AddSelectSidebar';
17
18
  export var AddSelectSidebar = function AddSelectSidebar(_ref) {
18
19
  var _modifiers$options;
@@ -30,7 +31,6 @@ export var AddSelectSidebar = function AddSelectSidebar(_ref) {
30
31
  removeIconDescription = _ref.removeIconDescription,
31
32
  setDisplayMetaPanel = _ref.setDisplayMetaPanel,
32
33
  setMultiSelection = _ref.setMultiSelection;
33
- var blockClass = "".concat(pkg.prefix, "--add-select__sidebar");
34
34
  var hasModifiers = (modifiers === null || modifiers === void 0 ? void 0 : (_modifiers$options = modifiers.options) === null || _modifiers$options === void 0 ? void 0 : _modifiers$options.length) > 0;
35
35
  var hasSelections = multiSelection.length > 0;
36
36
 
@@ -41,20 +41,27 @@ export var AddSelectSidebar = function AddSelectSidebar(_ref) {
41
41
  setMultiSelection(newSelections);
42
42
  };
43
43
 
44
- var sidebarItems = multiSelection.reduce(function (acc, cur) {
45
- var selectedItem = items.find(function (item) {
46
- return item.id === cur;
47
- }); // certain properties should not be displayed in the sidebar
44
+ var getNewItem = function getNewItem(item) {
45
+ // certain properties should not be displayed in the sidebar
48
46
  // eslint-disable-next-line no-unused-vars
47
+ var meta = item.meta,
48
+ icon = item.icon,
49
+ avatar = item.avatar,
50
+ newItem = _objectWithoutProperties(item, _excluded);
49
51
 
50
- var meta = selectedItem.meta,
51
- icon = selectedItem.icon,
52
- avatar = selectedItem.avatar,
53
- newItem = _objectWithoutProperties(selectedItem, _excluded);
52
+ return newItem;
53
+ };
54
+
55
+ var sidebarItems = multiSelection.map(function (selectionId) {
56
+ if (Array.isArray(items)) {
57
+ var selectedItem = items.find(function (item) {
58
+ return item.id === selectionId;
59
+ });
60
+ return getNewItem(selectedItem);
61
+ }
54
62
 
55
- acc.push(newItem);
56
- return acc;
57
- }, []);
63
+ return getNewItem(items[selectionId]);
64
+ });
58
65
 
59
66
  var getTitle = function getTitle(item) {
60
67
  return /*#__PURE__*/React.createElement("div", {
@@ -127,7 +134,7 @@ AddSelectSidebar.propTypes = {
127
134
  closeIconDescription: PropTypes.string,
128
135
  displayMetalPanel: PropTypes.object,
129
136
  influencerTitle: PropTypes.string,
130
- items: PropTypes.array,
137
+ items: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
131
138
  metaPanelTitle: PropTypes.string,
132
139
  modifiers: PropTypes.object,
133
140
  multiSelection: PropTypes.array,
@@ -10,12 +10,12 @@ import PropTypes from 'prop-types';
10
10
  import { OverflowMenu, OverflowMenuItem } from 'carbon-components-react';
11
11
  import { ArrowsVertical32, ArrowUp16, ArrowDown16 } from '@carbon/icons-react';
12
12
  import { pkg } from '../../settings';
13
- var componentName = 'AddSelect';
13
+ var blockClass = "".concat(pkg.prefix, "--add-select-sort");
14
+ var componentName = 'AddSelectSort';
14
15
  export var AddSelectSort = function AddSelectSort(_ref) {
15
16
  var setSortAttribute = _ref.setSortAttribute,
16
17
  setSortDirection = _ref.setSortDirection,
17
18
  sortBy = _ref.sortBy;
18
- var blockClass = "".concat(pkg.prefix, "--add-select-sort");
19
19
  var sortByOpts = sortBy ? sortBy.reduce(function (acc, cur) {
20
20
  var opts = [{
21
21
  id: "".concat(cur, "-asc"),
@@ -1,66 +1,33 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children"],
4
- _excluded2 = ["children"];
3
+ var _excluded = ["children"];
5
4
 
6
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
6
 
8
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
8
 
10
9
  /**
11
- * used to normalize nested data into a single object
12
- * @param {Array} items - list of entries
13
- * @returns an object of normalized item data
10
+ * to be able to more easily and efficiently the child entries the data needs to be
11
+ * normalized. this function recursively goes through the data array to build a single
12
+ * object who's keys are the id's of every single entry
13
+ * @param {object} data
14
+ * @returns an object of normalized data
14
15
  */
15
- export var normalize = function normalize(items) {
16
- var entries = items.entries,
17
- parentId = items.parentId,
18
- sortBy = items.sortBy,
19
- filterBy = items.filterBy;
20
- return entries.reduce(function (acc, cur) {
16
+ export var normalize = function normalize(data) {
17
+ var items = data.entries.reduce(function (prev, cur) {
21
18
  var children = cur.children,
22
- entry = _objectWithoutProperties(cur, _excluded);
19
+ item = _objectWithoutProperties(cur, _excluded);
23
20
 
24
- acc[cur.id] = _objectSpread({}, entry);
25
-
26
- if (parentId) {
27
- acc[cur.id].parent = parentId;
28
- }
29
-
30
- if (sortBy !== null && sortBy !== void 0 && sortBy.length) {
31
- acc[cur.id].sortBy = sortBy;
32
- }
33
-
34
- if (filterBy) {
35
- acc[cur.id].filterBy = filterBy;
36
- }
21
+ prev[item.id] = item;
37
22
 
38
23
  if (children) {
39
- acc[cur.id].children = children.entries.map(function (child) {
40
- return child.id;
41
- });
42
- var child = normalize(_objectSpread(_objectSpread({}, children), {}, {
43
- parentId: cur.id
44
- }));
45
- return _objectSpread(_objectSpread({}, acc), child);
24
+ var childItems = normalize(children);
25
+ return _objectSpread(_objectSpread({}, prev), childItems);
46
26
  }
47
27
 
48
- return acc;
28
+ return prev;
49
29
  }, {});
50
- };
51
- /**
52
- * used to create a single searchable array of nested items
53
- * @param {Array} entries - list of entries
54
- * @returns an array of items
55
- */
56
-
57
- export var flatten = function flatten(entries) {
58
- return entries.reduce(function (prev, cur) {
59
- var children = cur.children,
60
- item = _objectWithoutProperties(cur, _excluded2);
61
-
62
- return prev.concat(item).concat(children ? flatten(children.entries) : []);
63
- }, []);
30
+ return items;
64
31
  };
65
32
  /**
66
33
  * takes in a global filters array and a flat list of items
@@ -74,23 +41,25 @@ export var flatten = function flatten(entries) {
74
41
  */
75
42
 
76
43
  export var getGlobalFilterValues = function getGlobalFilterValues(globalFilters, items) {
77
- var filterOpts = globalFilters.reduce(function (prevFilter, curFilter) {
44
+ var itemIds = Object.keys(items);
45
+ var results = globalFilters.reduce(function (prevFilter, curFilter) {
78
46
  var filterId = curFilter.id;
79
- var opts = items.reduce(function (prevItem, curItem) {
47
+ var filterOpts = itemIds.reduce(function (prevId, curId) {
48
+ var curItem = items[curId];
80
49
  var value = curItem[filterId];
81
50
 
82
- if (value && !prevItem.includes(value)) {
83
- prevItem.push(value);
51
+ if (value && !prevId.includes(value)) {
52
+ prevId.push(value);
84
53
  }
85
54
 
86
- return prevItem;
55
+ return prevId;
87
56
  }, []);
88
57
  prevFilter.push(_objectSpread({
89
- opts: opts
58
+ opts: filterOpts
90
59
  }, curFilter));
91
60
  return prevFilter;
92
61
  }, []);
93
- return filterOpts;
62
+ return results;
94
63
  };
95
64
  export var sortItems = function sortItems(attribute, direction) {
96
65
  return function (a, b) {
@@ -106,10 +75,67 @@ export var sortItems = function sortItems(attribute, direction) {
106
75
  return valueA < valueB ? -1 : 1;
107
76
  };
108
77
  };
109
- export var getSortBy = function getSortBy(items) {
110
- var _items$find;
78
+ export var getFilteredItems = function getFilteredItems(useNormalizedItems, normalizedItems, searchTerm, globalFiltersApplied, globalFilterKeys, appliedGlobalFilters, sortFn, multi, items, path) {
79
+ /**
80
+ * useNormalizedItems just specifies if the data is hierarchical. the data structure
81
+ * is an object and not an array.
82
+ */
83
+ if (useNormalizedItems) {
84
+ var itemIds = Object.keys(normalizedItems);
85
+
86
+ if (searchTerm || globalFiltersApplied) {
87
+ var results = itemIds.reduce(function (prev, cur) {
88
+ if (normalizedItems[cur].title.toLowerCase().includes(searchTerm)) {
89
+ prev.push(normalizedItems[cur]);
90
+ }
91
+
92
+ return prev;
93
+ }, []).filter(function (item) {
94
+ return globalFilterKeys.every(function (filter) {
95
+ return item[filter] === appliedGlobalFilters[filter];
96
+ });
97
+ }).sort(sortFn);
98
+ return results;
99
+ }
100
+ /**
101
+ * multi select with hierarchy requires special consideration because columns
102
+ * are built recursively, so the items are just returned
103
+ */
104
+
105
+
106
+ if (multi) {
107
+ return items;
108
+ }
109
+ /**
110
+ * because single add select with hierarchy isn't recursively built the data
111
+ * structure has to be built around the path to maintain the folder structure
112
+ */
113
+
114
+
115
+ if (path.length > 1) {
116
+ return path.reduce(function (prev, cur, curIdx) {
117
+ var _prev$find, _prev$find$children;
118
+
119
+ // because the root of the path never changes we can skip it
120
+ if (curIdx === 0) {
121
+ return prev;
122
+ }
123
+
124
+ var item = (_prev$find = prev.find(function (item) {
125
+ return item.id === cur.id;
126
+ })) === null || _prev$find === void 0 ? void 0 : (_prev$find$children = _prev$find.children) === null || _prev$find$children === void 0 ? void 0 : _prev$find$children.entries;
127
+ return item;
128
+ }, items.entries);
129
+ }
130
+
131
+ return items.entries;
132
+ } else {
133
+ if (searchTerm) {
134
+ return items.entries.filter(function (item) {
135
+ return item.title.toLowerCase().includes(searchTerm);
136
+ });
137
+ }
111
138
 
112
- return (_items$find = items.find(function (item) {
113
- return item.sortBy;
114
- })) === null || _items$find === void 0 ? void 0 : _items$find.sortBy;
139
+ return items.entries;
140
+ }
115
141
  };
@@ -0,0 +1,16 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useState } from 'react';
3
+
4
+ var useParentSelect = function useParentSelect() {
5
+ var _useState = useState(null),
6
+ _useState2 = _slicedToArray(_useState, 2),
7
+ parentSelected = _useState2[0],
8
+ setParentSelected = _useState2[1];
9
+
10
+ return {
11
+ parentSelected: parentSelected,
12
+ setParentSelected: setParentSelected
13
+ };
14
+ };
15
+
16
+ export default useParentSelect;
@@ -0,0 +1,66 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+
5
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
+
7
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
+
9
+ import { useState } from 'react';
10
+
11
+ var usePath = function usePath() {
12
+ var itemsLabel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
13
+
14
+ var _useState = useState([{
15
+ id: 'base_of_path',
16
+ title: itemsLabel
17
+ }]),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ path = _useState2[0],
20
+ setPath = _useState2[1];
21
+
22
+ var handler = function handler(id, title, parentId) {
23
+ if (path.find(function (entry) {
24
+ return entry.id === id;
25
+ })) {
26
+ return;
27
+ }
28
+
29
+ var pathEntry = _objectSpread({
30
+ id: id,
31
+ title: title
32
+ }, parentId && {
33
+ parentId: parentId
34
+ });
35
+
36
+ if (path.find(function (entry) {
37
+ return entry.parentId === parentId;
38
+ })) {
39
+ var parentIdx = path.findIndex(function (entry) {
40
+ return entry.id === parentId;
41
+ });
42
+
43
+ var pathCopy = _toConsumableArray(path);
44
+
45
+ pathCopy.length = parentIdx + 1;
46
+ setPath([].concat(_toConsumableArray(pathCopy), [pathEntry]));
47
+ } else {
48
+ setPath([].concat(_toConsumableArray(path), [pathEntry]));
49
+ }
50
+ };
51
+
52
+ var pathClickHandler = function pathClickHandler(idx) {
53
+ var pathCopy = _toConsumableArray(path);
54
+
55
+ pathCopy.length = idx + 1;
56
+ setPath(_toConsumableArray(pathCopy));
57
+ };
58
+
59
+ return {
60
+ path: path,
61
+ setPath: handler,
62
+ pathOnclick: pathClickHandler
63
+ };
64
+ };
65
+
66
+ export default usePath;
@@ -189,11 +189,7 @@ export var MultiStepTearsheet = function MultiStepTearsheet(_ref2) {
189
189
  },
190
190
  invalid: isInvalid,
191
191
  invalidText: "This is a required field",
192
- onBlur: function onBlur() {
193
- if (!stepOneTextInputValue.length) {
194
- setIsInvalid(true);
195
- }
196
- }
192
+ onBlur: function onBlur() {}
197
193
  }), /*#__PURE__*/React.createElement(TextInput, {
198
194
  labelText: "Topic description (optional)",
199
195
  id: "tearsheet-multi-step-story-text-input-multi-step-1-input-2",
@@ -203,11 +203,7 @@ export var MultiStepWithIntro = function MultiStepWithIntro(_ref) {
203
203
  },
204
204
  invalid: isInvalid,
205
205
  invalidText: "This is a required field",
206
- onBlur: function onBlur() {
207
- if (!stepOneTextInputValue.length) {
208
- setIsInvalid(true);
209
- }
210
- }
206
+ onBlur: function onBlur() {}
211
207
  }), /*#__PURE__*/React.createElement(TextInput, {
212
208
  labelText: "Topic description (optional)",
213
209
  id: "tearsheet-multi-step-story-text-input-multi-step-1-input-2",
@@ -62,7 +62,7 @@ export var Datagrid = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
62
62
  ref: ref,
63
63
  className: cx(className, blockClass, withVirtualScroll ? "".concat(blockClass, "__datagridWrap") : "".concat(blockClass, "__datagridWrap-simple"), !isFetching && rows.length === 0 ? "".concat(blockClass, "__empty-state") : '')
64
64
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(DatagridToolbar, datagridState), leftPanel && /*#__PURE__*/React.createElement("div", {
65
- className: "".concat(blockClass, "__grid-container ").concat(blockClass, "__displayFlex")
65
+ className: "".concat(blockClass, "__grid-container ").concat(blockClass, "__displayFlex ").concat(blockClass, "__leftPanel-position")
66
66
  }, leftPanel && leftPanel.isOpen && /*#__PURE__*/React.createElement("div", {
67
67
  className: "".concat(blockClass, "__datagridLeftPanel")
68
68
  }, leftPanel.panelContent), /*#__PURE__*/React.createElement("div", {
@@ -12,17 +12,25 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
12
  * US Government Users Restricted Rights - Use, duplication or disclosure
13
13
  * restricted by GSA ADP Schedule Contract with IBM Corp.
14
14
  */
15
- import { useState } from 'react';
15
+ import React, { useState } from 'react';
16
16
  import DatagridExpandedRow from './Datagrid/DatagridExpandedRow';
17
17
  import useRowExpander from './useRowExpander';
18
+ import { pkg } from '../../settings';
19
+ var blockClass = "".concat(pkg.prefix, "--datagrid");
20
+
21
+ var expansionRenderer = function expansionRenderer(_ref) {
22
+ var row = _ref.row;
23
+ return /*#__PURE__*/React.createElement("div", {
24
+ className: "".concat(blockClass, "__expanded-row-content")
25
+ }, "Content for ", row.id);
26
+ };
18
27
 
19
28
  var useExpandedRow = function useExpandedRow(hooks) {
20
29
  useRowExpander(hooks);
21
30
 
22
31
  var useInstance = function useInstance(instance) {
23
32
  var rows = instance.rows,
24
- expandedContentHeight = instance.expandedContentHeight,
25
- ExpandedRowContentComponent = instance.ExpandedRowContentComponent;
33
+ expandedContentHeight = instance.expandedContentHeight;
26
34
 
27
35
  var _useState = useState({}),
28
36
  _useState2 = _slicedToArray(_useState, 2),
@@ -37,7 +45,7 @@ var useExpandedRow = function useExpandedRow(hooks) {
37
45
  return _objectSpread(_objectSpread({}, row), {}, {
38
46
  canExpand: row.original && !row.original.notExpandable,
39
47
  expandedContentHeight: expandedRowsHeight[row.index] || expandedContentHeight,
40
- RowRenderer: DatagridExpandedRow(row.RowRenderer, ExpandedRowContentComponent)
48
+ RowRenderer: DatagridExpandedRow(row.RowRenderer, expansionRenderer)
41
49
  });
42
50
  });
43
51
  Object.assign(instance, {
@@ -118,6 +118,11 @@ export var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(
118
118
  if (!enableBreadcrumbScroll || !navigation) {
119
119
  // adjust sticky top if no navigation or breadcrumb is to stay on screen
120
120
  update.headerTopValue += update.breadcrumbRowHeight;
121
+ }
122
+
123
+ if (enableBreadcrumbScroll) {
124
+ // adjust header top value when scroll enabled for breadcrumb
125
+ update.headerTopValue -= navigation ? hasActionBar ? 0 : 10 : update.headerHeight;
121
126
  } // if (window) {
122
127
 
123
128
 
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "overflowAlign", "overflowClassName", "overflowDirection", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags"],
5
+ var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowDirection", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags"],
6
6
  _excluded2 = ["label", "id"],
7
7
  _excluded3 = ["label"];
8
8
 
@@ -43,6 +43,7 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
43
43
  allTagsModalTargetIn = _ref.allTagsModalTarget,
44
44
  className = _ref.className,
45
45
  maxVisible = _ref.maxVisible,
46
+ multiline = _ref.multiline,
46
47
  _ref$overflowAlign = _ref.overflowAlign,
47
48
  overflowAlign = _ref$overflowAlign === void 0 ? defaults.overflowAlign : _ref$overflowAlign,
48
49
  overflowClassName = _ref.overflowClassName,
@@ -161,7 +162,11 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
161
162
  setDisplayedTags(newDisplayedTags);
162
163
  }, [displayCount, overflowAlign, overflowClassName, overflowDirection, showAllTagsLabel, tags]);
163
164
  var checkFullyVisibleTags = useCallback(function () {
164
- // how many will fit?
165
+ if (multiline) {
166
+ return setDisplayCount(maxVisible);
167
+ } // how many will fit?
168
+
169
+
165
170
  var willFit = 0;
166
171
 
167
172
  if (sizingTags.length > 0) {
@@ -193,10 +198,10 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
193
198
  } else {
194
199
  setDisplayCount(maxVisible ? Math.min(willFit, maxVisible) : willFit);
195
200
  }
196
- }, [maxVisible, sizingTags, tagSetRef]);
201
+ }, [maxVisible, multiline, sizingTags, tagSetRef]);
197
202
  useEffect(function () {
198
203
  checkFullyVisibleTags();
199
- }, [checkFullyVisibleTags, maxVisible, sizingTags]);
204
+ }, [checkFullyVisibleTags, maxVisible, multiline, sizingTags]);
200
205
  /* don't know how to test resize */
201
206
 
202
207
  /* istanbul ignore next */
@@ -239,7 +244,7 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
239
244
  "aria-hidden": true,
240
245
  ref: sizingContainerRef
241
246
  }, hiddenSizingTags), /*#__PURE__*/React.createElement("div", {
242
- className: "".concat(blockClass, "__tag-container"),
247
+ className: cx(["".concat(blockClass, "__tag-container"), multiline && "".concat(blockClass, "__tag-container--multiline")]),
243
248
  ref: displayedArea
244
249
  }, displayedTags)), (allTagsModalTarget ? createPortal : function (children) {
245
250
  return children;
@@ -316,6 +321,11 @@ TagSet.propTypes = {
316
321
  */
317
322
  maxVisible: PropTypes.number,
318
323
 
324
+ /**
325
+ * display tags in multiple lines
326
+ */
327
+ multiline: PropTypes.bool,
328
+
319
329
  /**
320
330
  * overflowAlign from the standard tooltip. Default center.
321
331
  */