@carbon/ibm-products 1.20.3 → 1.23.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/components/Datagrid/styles/datagrid.css +4 -0
- package/css/components/Datagrid/styles/datagrid.css.map +1 -1
- package/css/components/Datagrid/styles/index.css +32 -0
- package/css/components/Datagrid/styles/index.css.map +1 -1
- package/css/components/Datagrid/styles/useColumnCenterAlign.css +18 -0
- package/css/components/Datagrid/styles/useColumnCenterAlign.css.map +1 -0
- package/css/components/Datagrid/styles/useExpandedRow.css +12 -0
- package/css/components/Datagrid/styles/useExpandedRow.css.map +1 -0
- package/css/index-full-carbon.css +67 -147
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +25 -16
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +2 -2
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +62 -20
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +65 -143
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelect.js +57 -422
- package/es/components/AddSelect/AddSelectBody.js +349 -0
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +11 -31
- package/es/components/AddSelect/AddSelectColumn.js +91 -41
- package/es/components/AddSelect/AddSelectFilter.js +1 -2
- package/es/components/AddSelect/AddSelectList.js +10 -61
- package/es/components/AddSelect/AddSelectMetaPanel.js +1 -1
- package/es/components/AddSelect/AddSelectSidebar.js +20 -13
- package/es/components/AddSelect/AddSelectSort.js +2 -2
- package/es/components/AddSelect/add-select-utils.js +85 -59
- package/es/components/AddSelect/hooks/useParentSelect.js +16 -0
- package/es/components/AddSelect/hooks/usePath.js +66 -0
- package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +1 -5
- package/es/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +1 -5
- package/es/components/Datagrid/Datagrid/Datagrid.js +1 -1
- package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +92 -92
- package/es/components/Datagrid/index.js +2 -1
- package/es/components/Datagrid/useColumnCenterAlign.js +52 -0
- package/es/components/Datagrid/useExpandedRow.js +12 -4
- package/es/components/Datagrid/utils/makeData.js +155 -0
- package/es/components/PageHeader/PageHeaderUtils.js +5 -0
- package/es/components/TagSet/TagSet.js +15 -5
- package/lib/components/AddSelect/AddSelect.js +54 -430
- package/lib/components/AddSelect/AddSelectBody.js +384 -0
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +11 -30
- package/lib/components/AddSelect/AddSelectColumn.js +90 -39
- package/lib/components/AddSelect/AddSelectFilter.js +1 -2
- package/lib/components/AddSelect/AddSelectList.js +11 -60
- package/lib/components/AddSelect/AddSelectMetaPanel.js +1 -1
- package/lib/components/AddSelect/AddSelectSidebar.js +20 -13
- package/lib/components/AddSelect/AddSelectSort.js +2 -2
- package/lib/components/AddSelect/add-select-utils.js +88 -64
- package/lib/components/AddSelect/hooks/useParentSelect.js +27 -0
- package/lib/components/AddSelect/hooks/usePath.js +75 -0
- package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +1 -5
- package/lib/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +1 -5
- package/lib/components/Datagrid/Datagrid/Datagrid.js +1 -1
- package/lib/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +93 -112
- package/lib/components/Datagrid/index.js +9 -1
- package/lib/components/Datagrid/useColumnCenterAlign.js +59 -0
- package/lib/components/Datagrid/useExpandedRow.js +20 -4
- package/lib/components/Datagrid/utils/makeData.js +167 -0
- package/lib/components/PageHeader/PageHeaderUtils.js +5 -0
- package/lib/components/TagSet/TagSet.js +15 -5
- package/package.json +16 -16
- package/scss/components/Cascade/_cascade.scss +2 -1
- package/scss/components/CreateInfluencer/_create-influencer.scss +0 -2
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -1
- package/scss/components/Datagrid/_storybook-styles.scss +4 -0
- package/scss/components/Datagrid/styles/datagrid.scss +4 -0
- package/scss/components/Datagrid/styles/index.scss +2 -0
- package/scss/components/Datagrid/styles/useColumnCenterAlign.scss +19 -0
- package/scss/components/Datagrid/styles/useExpandedRow.scss +13 -0
- package/scss/components/InlineEdit/_inline-edit.scss +2 -1
- package/scss/components/OptionsTile/_options-tile.scss +1 -0
- package/scss/components/PageHeader/_page-header.scss +9 -4
- package/scss/components/SidePanel/_side-panel.scss +1 -2
- package/scss/components/TagSet/_tag-set.scss +4 -0
- package/scss/components/WebTerminal/_web-terminal.scss +1 -1
@@ -1,92 +1,92 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
};
|
92
|
-
export default StickyActionsColumn;
|
1
|
+
// import React, { useState, useEffect } from 'react';
|
2
|
+
// import { Datagrid, useActionsColumn, useDatagrid, useStickyColumn } from '..';
|
3
|
+
// import { defaultHeader, makeData, Wrapper } from './common';
|
4
|
+
// StickyActionsColumn.story = {
|
5
|
+
// parameters: {
|
6
|
+
// notes: `
|
7
|
+
// Sticky column and actions column can be used at the same time like the demo above. Following is the doc for each of them.
|
8
|
+
// # Sticky column
|
9
|
+
// This will make the column mark with \`sticky: "right"\` to be sticky on the right.
|
10
|
+
// ## Incompatible with following plugins:
|
11
|
+
// - \`useInfiniteScroll\`
|
12
|
+
// ## Sample usage:
|
13
|
+
// 1. include the \`useStickyColumn\` hook
|
14
|
+
// 2. add \`sticky="right"\` to the column object
|
15
|
+
// \`\`\`js
|
16
|
+
// const columns = [
|
17
|
+
// ... // other columns
|
18
|
+
// {
|
19
|
+
// Header: "",
|
20
|
+
// accessor: "actions",
|
21
|
+
// sticky: "right",
|
22
|
+
// width: 60,
|
23
|
+
// },
|
24
|
+
// ]
|
25
|
+
// const datagridState = useDatagrid(
|
26
|
+
// {
|
27
|
+
// columns,
|
28
|
+
// data,
|
29
|
+
// },
|
30
|
+
// useStickyColumn
|
31
|
+
// );
|
32
|
+
// \`\`\`
|
33
|
+
// \`\`\`html
|
34
|
+
// <Datagrid {...datagridState} />
|
35
|
+
// \`\`\`
|
36
|
+
// # Actions column
|
37
|
+
// This will add OverflowMenu component to the cells on the column mark with \`isAction: true\`. Each action button callback will include the actionId and row object
|
38
|
+
// ## Sample usage:
|
39
|
+
// 1. include \`useActionsColumn\` hook
|
40
|
+
// 2. add \`isAction = true\` to the column object in which you which to add the overflow menu actions
|
41
|
+
// 3. add \`rowActions = []\` array to the props
|
42
|
+
// - \`rowActions[].id\` for callback to identify the action is called
|
43
|
+
// - \`rowActions[].onClick(actionId: string, row: Row, event: ClickEvent)\` callback on menuitem clicked. [Row properties](https://react-table.tanstack.com/docs/api/useTable#row-properties)
|
44
|
+
// - \`rowActions[].shouldHideMenuItem(row: Row)\` callback to hide this menuitem. [Row properties](https://react-table.tanstack.com/docs/api/useTable#row-properties)
|
45
|
+
// - \`rowActions[].shouldDisableMenuItem(row: Row)\` callback to disable this menuitem. [Row properties](https://react-table.tanstack.com/docs/api/useTable#row-properties)
|
46
|
+
// - This will override \`rowActions[].disabled\` (from Carbon) because \`shouldDisableMenuItem\` is more specific to the row.
|
47
|
+
// - each action object can take all the props from \`OverflowMenuItem\` props, see [carbon docs](https://react.carbondesignsystem.com/?path=/docs/components-overflowmenu--default#overflowmenu)
|
48
|
+
// \`\`\`js
|
49
|
+
// const columns = [
|
50
|
+
// ... // other columns
|
51
|
+
// {
|
52
|
+
// Header: "",
|
53
|
+
// accessor: "actions",
|
54
|
+
// isAction: true,
|
55
|
+
// },
|
56
|
+
// ]
|
57
|
+
// const onActionClick = (actionId, row, event) => {};
|
58
|
+
// const datagridState = useDatagrid(
|
59
|
+
// {
|
60
|
+
// columns,
|
61
|
+
// data,
|
62
|
+
// rowActions: [
|
63
|
+
// {
|
64
|
+
// id: 'edit',
|
65
|
+
// itemText: 'Edit',
|
66
|
+
// onClick: onActionClick
|
67
|
+
// },
|
68
|
+
// {
|
69
|
+
// id: 'hidden',
|
70
|
+
// itemText: 'Hidden item',
|
71
|
+
// onClick: onActionClick,
|
72
|
+
// shouldHideMenuItem: () => true,
|
73
|
+
// },
|
74
|
+
// {
|
75
|
+
// id: 'delete',
|
76
|
+
// itemText: 'Delete',
|
77
|
+
// hasDivider: true,
|
78
|
+
// isDelete: true,
|
79
|
+
// onClick: onActionClick
|
80
|
+
// },
|
81
|
+
// ]
|
82
|
+
// },
|
83
|
+
// useActionsColumn,
|
84
|
+
// );
|
85
|
+
// \`\`\`
|
86
|
+
// \`\`\`html
|
87
|
+
// <Datagrid {...datagridState} />
|
88
|
+
// \`\`\`
|
89
|
+
// `,
|
90
|
+
// },
|
91
|
+
// };
|
92
|
+
// export default StickyActionsColumn;
|
@@ -19,4 +19,5 @@ export { default as useDisableSelectRows } from './useDisableSelectRows';
|
|
19
19
|
export { default as useStickyColumn } from './useStickyColumn';
|
20
20
|
export { default as useActionsColumn } from './useActionsColumn';
|
21
21
|
export { default as useCustomizeColumns } from './useCustomizeColumns';
|
22
|
-
export { default as useSelectAllWithToggle } from './useSelectAllToggle';
|
22
|
+
export { default as useSelectAllWithToggle } from './useSelectAllToggle';
|
23
|
+
export { default as useColumnCenterAlign } from './useColumnCenterAlign';
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
|
+
|
4
|
+
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; }
|
5
|
+
|
6
|
+
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; }
|
7
|
+
|
8
|
+
/*
|
9
|
+
* Licensed Materials - Property of IBM
|
10
|
+
* 5724-Q36
|
11
|
+
* (c) Copyright IBM Corp. 2020
|
12
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
13
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
14
|
+
*/
|
15
|
+
import React from 'react';
|
16
|
+
import cx from 'classnames';
|
17
|
+
import { pkg } from '../../settings';
|
18
|
+
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
19
|
+
|
20
|
+
var useColumnCenterAlign = function useColumnCenterAlign(hooks) {
|
21
|
+
var centerAlignRenderer = function centerAlignRenderer(tableProps, column) {
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
23
|
+
className: cx("".concat(blockClass, "__center-align-cell-renderer"), {
|
24
|
+
sortDisabled: !tableProps.isTableSortable || tableProps.column.disableSortBy === true
|
25
|
+
})
|
26
|
+
}, column.Cell(tableProps));
|
27
|
+
};
|
28
|
+
|
29
|
+
var centerAlignHeader = function centerAlignHeader(headerProp, column) {
|
30
|
+
return /*#__PURE__*/React.createElement("div", {
|
31
|
+
className: "".concat(blockClass, "__center-align-header")
|
32
|
+
}, typeof column.Header === 'function' ? column.Header(headerProp) : column.Header);
|
33
|
+
};
|
34
|
+
|
35
|
+
var centerAlignedColumns = function centerAlignedColumns(columns) {
|
36
|
+
var columnsWithDefaultCells = columns.map(function (column) {
|
37
|
+
return _objectSpread(_objectSpread({}, column), {}, {
|
38
|
+
Cell: column.centerAlignedColumn ? function (tableProp) {
|
39
|
+
return centerAlignRenderer(tableProp, column);
|
40
|
+
} : column.Cell,
|
41
|
+
Header: column.centerAlignedColumn ? function (headerProp) {
|
42
|
+
return centerAlignHeader(headerProp, column);
|
43
|
+
} : column.Header
|
44
|
+
});
|
45
|
+
});
|
46
|
+
return _toConsumableArray(columnsWithDefaultCells);
|
47
|
+
};
|
48
|
+
|
49
|
+
hooks.visibleColumns.push(centerAlignedColumns);
|
50
|
+
};
|
51
|
+
|
52
|
+
export default useColumnCenterAlign;
|
@@ -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,
|
48
|
+
RowRenderer: DatagridExpandedRow(row.RowRenderer, expansionRenderer)
|
41
49
|
});
|
42
50
|
});
|
43
51
|
Object.assign(instance, {
|
@@ -0,0 +1,155 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
|
3
|
+
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; }
|
4
|
+
|
5
|
+
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; }
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Copyright IBM Corp. 2022, 2022
|
9
|
+
*
|
10
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
12
|
+
*/
|
13
|
+
import React from 'react';
|
14
|
+
import namor from 'namor';
|
15
|
+
export var makeData = function makeData() {
|
16
|
+
for (var _len = arguments.length, lens = new Array(_len), _key = 0; _key < _len; _key++) {
|
17
|
+
lens[_key] = arguments[_key];
|
18
|
+
}
|
19
|
+
|
20
|
+
var makeDataLevel = function makeDataLevel() {
|
21
|
+
var depth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
22
|
+
var len = lens[depth];
|
23
|
+
return range(len).map(function () {
|
24
|
+
return _objectSpread(_objectSpread({}, newPerson()), {}, {
|
25
|
+
subRows: lens[depth + 1] ? makeDataLevel(depth + 1) : undefined
|
26
|
+
});
|
27
|
+
});
|
28
|
+
};
|
29
|
+
|
30
|
+
return makeDataLevel();
|
31
|
+
};
|
32
|
+
export var range = function range(len) {
|
33
|
+
var arr = [];
|
34
|
+
|
35
|
+
for (var i = 0; i < len; i++) {
|
36
|
+
arr.push(i);
|
37
|
+
}
|
38
|
+
|
39
|
+
return arr;
|
40
|
+
};
|
41
|
+
|
42
|
+
var newPerson = function newPerson() {
|
43
|
+
var statusChance = Math.random();
|
44
|
+
return {
|
45
|
+
firstName: namor.generate({
|
46
|
+
words: 1,
|
47
|
+
numbers: 0
|
48
|
+
}),
|
49
|
+
lastName: namor.generate({
|
50
|
+
words: 1,
|
51
|
+
numbers: 0
|
52
|
+
}),
|
53
|
+
age: Math.floor(Math.random() * 30),
|
54
|
+
visits: Math.floor(Math.random() * 100),
|
55
|
+
progress: Math.floor(Math.random() * 100),
|
56
|
+
someone1: namor.generate({
|
57
|
+
words: 1,
|
58
|
+
numbers: 0
|
59
|
+
}),
|
60
|
+
someone2: namor.generate({
|
61
|
+
words: 1,
|
62
|
+
numbers: 0
|
63
|
+
}),
|
64
|
+
someone3: namor.generate({
|
65
|
+
words: 1,
|
66
|
+
numbers: 0
|
67
|
+
}),
|
68
|
+
someone4: namor.generate({
|
69
|
+
words: 1,
|
70
|
+
numbers: 0
|
71
|
+
}),
|
72
|
+
someone5: namor.generate({
|
73
|
+
words: 1,
|
74
|
+
numbers: 0
|
75
|
+
}),
|
76
|
+
someone6: namor.generate({
|
77
|
+
words: 1,
|
78
|
+
numbers: 0
|
79
|
+
}),
|
80
|
+
someone7: namor.generate({
|
81
|
+
words: 1,
|
82
|
+
numbers: 0
|
83
|
+
}),
|
84
|
+
someone8: namor.generate({
|
85
|
+
words: 1,
|
86
|
+
numbers: 0
|
87
|
+
}),
|
88
|
+
someone9: namor.generate({
|
89
|
+
words: 1,
|
90
|
+
numbers: 0
|
91
|
+
}),
|
92
|
+
someone10: namor.generate({
|
93
|
+
words: 1,
|
94
|
+
numbers: 0
|
95
|
+
}),
|
96
|
+
someone11: namor.generate({
|
97
|
+
words: 1,
|
98
|
+
numbers: 0
|
99
|
+
}),
|
100
|
+
someone12: namor.generate({
|
101
|
+
words: 1,
|
102
|
+
numbers: 0
|
103
|
+
}),
|
104
|
+
someone13: namor.generate({
|
105
|
+
words: 1,
|
106
|
+
numbers: 0
|
107
|
+
}),
|
108
|
+
someone14: namor.generate({
|
109
|
+
words: 1,
|
110
|
+
numbers: 0
|
111
|
+
}),
|
112
|
+
someone15: namor.generate({
|
113
|
+
words: 1,
|
114
|
+
numbers: 0
|
115
|
+
}),
|
116
|
+
someone16: namor.generate({
|
117
|
+
words: 1,
|
118
|
+
numbers: 0
|
119
|
+
}),
|
120
|
+
someone17: namor.generate({
|
121
|
+
words: 1,
|
122
|
+
numbers: 0
|
123
|
+
}),
|
124
|
+
someone18: namor.generate({
|
125
|
+
words: 1,
|
126
|
+
numbers: 0
|
127
|
+
}),
|
128
|
+
someone19: namor.generate({
|
129
|
+
words: 1,
|
130
|
+
numbers: 0
|
131
|
+
}),
|
132
|
+
someone20: namor.generate({
|
133
|
+
words: 1,
|
134
|
+
numbers: 0
|
135
|
+
}),
|
136
|
+
status: statusChance > 0.66 ? 'relationship' : statusChance > 0.33 ? 'complicated' : 'single'
|
137
|
+
};
|
138
|
+
};
|
139
|
+
|
140
|
+
export var newPersonWithTwoLines = function newPersonWithTwoLines() {
|
141
|
+
return {
|
142
|
+
firstName: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, namor.generate({
|
143
|
+
words: 1,
|
144
|
+
numbers: 0
|
145
|
+
})), /*#__PURE__*/React.createElement("div", null, namor.generate({
|
146
|
+
words: 1,
|
147
|
+
numbers: 0
|
148
|
+
}))),
|
149
|
+
lastName: namor.generate({
|
150
|
+
words: 1,
|
151
|
+
numbers: 0
|
152
|
+
}),
|
153
|
+
age: Math.floor(Math.random() * 30)
|
154
|
+
};
|
155
|
+
};
|
@@ -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
|
-
|
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
|
*/
|