@carbon/ibm-products 2.3.2 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/css/index-full-carbon.css +262 -110
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +3 -3
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +40 -24
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +2 -2
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +86 -54
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +3 -3
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +145 -38
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +3 -3
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/Card/Card.js +11 -1
  18. package/es/components/Card/CardFooter.js +4 -2
  19. package/es/components/Card/CardHeader.js +20 -2
  20. package/es/components/Datagrid/Datagrid/Datagrid.js +5 -1
  21. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +15 -21
  22. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +6 -20
  23. package/es/components/Datagrid/Datagrid.docs-page.js +123 -0
  24. package/es/components/Datagrid/Extensions/ColumnAlignment/ColumnAlignment.docs-page.js +13 -0
  25. package/es/components/Datagrid/Extensions/ColumnCustomization/ColumnCustomization.docs-page.js +13 -0
  26. package/es/components/Datagrid/Extensions/EditableCell/EditableCell.docs-page.js +47 -0
  27. package/es/components/Datagrid/Extensions/ExpandableRow/ExpandableRow.docs-page.js +13 -0
  28. package/es/components/Datagrid/Extensions/Filtering/Filtering.docs-page.js +57 -0
  29. package/es/components/Datagrid/Extensions/RowActionButtons/RowActionButtons.docs-page.js +13 -0
  30. package/es/components/Datagrid/utils/DatagridActions.js +1 -1
  31. package/es/components/Datagrid/utils/getArgTypes.js +4 -0
  32. package/es/components/EditUpdateCards/EditUpdateCards.js +66 -4
  33. package/es/components/FilterSummary/FilterSummary.js +7 -3
  34. package/es/components/OptionsTile/OptionsTile.js +8 -1
  35. package/es/components/ProductiveCard/ProductiveCard.js +21 -1
  36. package/es/global/js/utils/StoryDocsPage.js +6 -2
  37. package/lib/components/Card/Card.js +11 -1
  38. package/lib/components/Card/CardFooter.js +4 -2
  39. package/lib/components/Card/CardHeader.js +20 -2
  40. package/lib/components/Datagrid/Datagrid/Datagrid.js +5 -1
  41. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +14 -20
  42. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +6 -23
  43. package/lib/components/Datagrid/Datagrid.docs-page.js +134 -0
  44. package/lib/components/Datagrid/Extensions/ColumnAlignment/ColumnAlignment.docs-page.js +21 -0
  45. package/lib/components/Datagrid/Extensions/ColumnCustomization/ColumnCustomization.docs-page.js +21 -0
  46. package/lib/components/Datagrid/Extensions/EditableCell/EditableCell.docs-page.js +55 -0
  47. package/lib/components/Datagrid/Extensions/ExpandableRow/ExpandableRow.docs-page.js +21 -0
  48. package/lib/components/Datagrid/Extensions/Filtering/Filtering.docs-page.js +65 -0
  49. package/lib/components/Datagrid/Extensions/RowActionButtons/RowActionButtons.docs-page.js +21 -0
  50. package/lib/components/Datagrid/utils/DatagridActions.js +1 -1
  51. package/lib/components/Datagrid/utils/getArgTypes.js +4 -0
  52. package/lib/components/EditUpdateCards/EditUpdateCards.js +66 -4
  53. package/lib/components/FilterSummary/FilterSummary.js +7 -3
  54. package/lib/components/OptionsTile/OptionsTile.js +8 -1
  55. package/lib/components/ProductiveCard/ProductiveCard.js +21 -1
  56. package/lib/global/js/utils/StoryDocsPage.js +6 -2
  57. package/package.json +16 -16
  58. package/scss/components/Datagrid/_datagrid.scss +17 -10
  59. package/scss/components/Datagrid/_storybook-styles.scss +5 -0
  60. package/scss/components/EditUpdateCards/_edit-update-cards.scss +10 -0
  61. package/scss/components/FilterSummary/_storybook-styles.scss +2 -0
  62. package/scss/components/ProductiveCard/_productive-card.scss +15 -0
  63. package/scss/components/Tearsheet/_tearsheet.scss +6 -0
@@ -12,14 +12,13 @@ var _excluded = ["align", "legendText"];
12
12
  import * as React from 'react';
13
13
  import PropTypes from 'prop-types';
14
14
  import { Settings } from '@carbon/react/icons';
15
- import { IconButton, Toggletip, ToggletipContent, ToggletipButton } from '@carbon/react';
16
- import cx from 'classnames';
15
+ import { IconButton, Layer, Popover, PopoverContent } from '@carbon/react';
17
16
  import RowSizeRadioGroup from './RowSizeRadioGroup';
18
17
  import { pkg } from '../../../../../settings';
19
18
  var blockClass = "".concat(pkg.prefix, "--datagrid");
20
19
  var RowSizeDropdown = function RowSizeDropdown(_ref) {
21
20
  var _ref$align = _ref.align,
22
- align = _ref$align === void 0 ? 'bottom' : _ref$align,
21
+ align = _ref$align === void 0 ? 'bottom-right' : _ref$align,
23
22
  _ref$legendText = _ref.legendText,
24
23
  legendText = _ref$legendText === void 0 ? 'Row height' : _ref$legendText,
25
24
  props = _objectWithoutProperties(_ref, _excluded);
@@ -27,33 +26,28 @@ var RowSizeDropdown = function RowSizeDropdown(_ref) {
27
26
  _React$useState2 = _slicedToArray(_React$useState, 2),
28
27
  isOpen = _React$useState2[0],
29
28
  setIsOpen = _React$useState2[1];
30
- return /*#__PURE__*/React.createElement(React.Fragment, null, !isOpen && /*#__PURE__*/React.createElement(IconButton, {
31
- kind: "ghost",
29
+ return /*#__PURE__*/React.createElement(Popover, {
30
+ isTabTip: true,
31
+ align: "bottom-right",
32
+ open: isOpen,
33
+ onRequestClose: function onRequestClose() {
34
+ return setIsOpen(false);
35
+ },
36
+ className: "".concat(blockClass, "__row-size-options-container")
37
+ }, /*#__PURE__*/React.createElement(IconButton, {
32
38
  align: align,
39
+ kind: "ghost",
33
40
  onClick: function onClick() {
34
41
  return setIsOpen(function (prevOpen) {
35
42
  return !prevOpen;
36
43
  });
37
44
  },
38
45
  label: legendText,
39
- className: cx("".concat(blockClass, "__row-size-button"))
40
- }, /*#__PURE__*/React.createElement(Settings, {
41
- size: 16
42
- })), isOpen && /*#__PURE__*/React.createElement(Toggletip, {
43
- defaultOpen: true,
44
- className: "".concat(blockClass, "__row-size-toggle-tip")
45
- }, /*#__PURE__*/React.createElement(ToggletipButton, {
46
- className: cx("".concat(blockClass, "__row-size-toggle-tip-button"), "".concat(blockClass, "__row-size-button--open")),
47
- label: legendText
46
+ className: "".concat(blockClass, "__row-size-button")
48
47
  }, /*#__PURE__*/React.createElement(Settings, {
49
48
  size: 16
50
- })), /*#__PURE__*/React.createElement(ToggletipContent, {
51
- className: "".concat(blockClass, "__row-size-toggle-tip-content")
52
- }, /*#__PURE__*/React.createElement(RowSizeRadioGroup, _extends({}, props, {
53
- legendText: legendText,
54
- hideRadioGroup: function hideRadioGroup() {
55
- setIsOpen(false);
56
- }
49
+ })), /*#__PURE__*/React.createElement(PopoverContent, null, /*#__PURE__*/React.createElement(Layer, null, /*#__PURE__*/React.createElement(RowSizeRadioGroup, _extends({}, props, {
50
+ legendText: legendText
57
51
  })))));
58
52
  };
59
53
  RowSizeDropdown.propTypes = {
@@ -1,26 +1,21 @@
1
- /* eslint-disable react/default-props-match-prop-types */
2
- // @flow
3
- /*
4
- * Licensed Materials - Property of IBM
5
- * 5724-Q36
6
- * (c) Copyright IBM Corp. 2021
7
- * US Government Users Restricted Rights - Use, duplication or disclosure
8
- * restricted by GSA ADP Schedule Contract with IBM Corp.
1
+ /**
2
+ * Copyright IBM Corp. 2021, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
9
6
  */
10
7
 
11
- import React, { useRef } from 'react';
8
+ import React from 'react';
12
9
  import PropTypes from 'prop-types';
13
10
  import { RadioButtonGroup, RadioButton } from '@carbon/react';
14
11
  import isArray from 'lodash/isArray';
15
12
  import { pkg } from '../../../../../settings';
16
- import { useClickOutside } from '../../../../../global/js/hooks';
17
13
  var blockClass = "".concat(pkg.prefix, "--datagrid");
18
14
  var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
19
15
  var rowSizes = _ref.rowSizes,
20
16
  selectedOption = _ref.selectedOption,
21
17
  datagridName = _ref.datagridName,
22
18
  onChange = _ref.onChange,
23
- hideRadioGroup = _ref.hideRadioGroup,
24
19
  legendText = _ref.legendText,
25
20
  _ref$rowSizeLabels = _ref.rowSizeLabels,
26
21
  rowSizeLabels = _ref$rowSizeLabels === void 0 ? {
@@ -30,15 +25,7 @@ var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
30
25
  sm: 'Small',
31
26
  xs: 'Extra small'
32
27
  } : _ref$rowSizeLabels;
33
- var popoverContentRef = useRef();
34
- useClickOutside(popoverContentRef, function (target) {
35
- if (target.closest(".".concat(blockClass, "__row-size-button"))) {
36
- return;
37
- }
38
- hideRadioGroup();
39
- });
40
28
  return /*#__PURE__*/React.createElement("div", {
41
- ref: popoverContentRef,
42
29
  className: "".concat(blockClass, "__row-size-dropdown"),
43
30
  role: "presentation",
44
31
  onClick: function onClick(e) {
@@ -95,7 +82,6 @@ RowSizeRadioGroup.defaultProps = {
95
82
  };
96
83
  RowSizeRadioGroup.propTypes = {
97
84
  datagridName: PropTypes.string,
98
- hideRadioGroup: PropTypes.func.isRequired,
99
85
  legendText: PropTypes.string,
100
86
  onChange: PropTypes.func.isRequired,
101
87
  rowSizeLabels: PropTypes.object,
@@ -0,0 +1,123 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../global/js/utils/StoryDocsPage';
3
+ import * as stories from './Datagrid.stories';
4
+ import toolbarScreenshot from './storybook-assets/datagrid-actions-example.png';
5
+ export var DocsPage = function DocsPage() {
6
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
7
+ blocks: [{
8
+ title: 'Getting started',
9
+ description: "You can use the `Datagrid` component to create various kinds of Carbon data tables. Simply import the `Datagrid` along with any accompanying hooks (listed below) depending on what extensions you'd like to be included.",
10
+ source: {
11
+ code: "import {\n Datagrid,\n useDatagrid,\n useInfiniteScroll,\n useNestedRows,\n useSelectRows,\n useExpandedRow,\n useOnRowClick,\n useSortableColumns,\n useRowIsMouseOver,\n useColumnRightAlign,\n useDisableSelectRows,\n useStickyColumn,\n useActionsColumn,\n useCustomizeColumns,\n useSelectAllWithToggle,\n useColumnCenterAlign,\n useColumnOrder,\n useEditableCell,\n useFiltering,\n useFilterContext\n} from '@carbon/ibm-products';"
12
+ }
13
+ }, {
14
+ title: 'Basic',
15
+ description: "Here is a basic usage example. The following component will render the datagrid seen below, with pagination and some toolbar actions. One of the key pieces to building the `Datagrid` is the `useDatagrid` hook, this will give you all of the state/props required to render a `Datagrid`."
16
+ }, {
17
+ subTitle: 'Multi line wrap',
18
+ description: 'This setting enables the table cell text wrap to two lines. This can be turned on for only one column in the datagrid or for every column.',
19
+ source: {
20
+ language: 'jsx',
21
+ code: "\n import { Datagrid, useDatagrid } from '@carbon/ibm-products';\n\nconst App = () => {\n const columns = React.useMemo(() => defaultHeader, []); // These are the columns that will be used by the datagrid\n const [data] = useState(makeData(10)); // This is the data that will be rendered by the datagrid\n\n const columns = React.useMemo(\n () => [\n ...defaultHeader,\n {\n Header: 'Someone 11',\n accessor: 'someone11',\n multiLineWrap: true, //If `multiLineWrap` is required only for specific columns\n },\n ],\n []\n );\n\n const datagridState = useDatagrid({\n columns,\n data,\n multiLineWrapAll: true, // If `multiLineWrap` is required for all columns in data grid\n });\n\n return <Datagrid datagridState={datagridState} />;\n};\n "
22
+ }
23
+ }, {
24
+ story: stories.BasicUsage
25
+ }, {
26
+ title: 'Column structure',
27
+ description: "The columns that are passed to the `useDatagrid` hook will have the following structure:",
28
+ source: {
29
+ language: 'jsx',
30
+ code: "\n const columns = [\n {\n Header: 'First Name',\n accessor: 'firstName',\n },\n {\n Header: 'Last Name',\n accessor: 'lastName',\n },\n];"
31
+ }
32
+ }, {
33
+ description: "To change the default/initial width of a column, add a `width` property to the column.",
34
+ source: {
35
+ language: 'jsx',
36
+ code: "\n const columns = [\n {\n Header: 'First Name',\n accessor: 'firstName',\n width: 120,\n },\n {\n Header: 'Last Name',\n accessor: 'lastName',\n width: 180,\n },\n];\n "
37
+ }
38
+ }, {
39
+ description: 'If needed, it is also possible to wrap each cell in a containing element. See below:',
40
+ source: {
41
+ language: 'jsx',
42
+ code: "\n const columns = [\n {\n Header: 'First Name',\n accessor: 'firstName',\n },\n {\n Header: 'Last Name',\n accessor: 'lastName',\n Cell: ({ cell: { value } }) => (\n <span className=\"custom-cell-wrapper\">{value}</span>\n ),\n },\n];\n "
43
+ }
44
+ }, {
45
+ title: 'Rendering the table toolbar',
46
+ image: /*#__PURE__*/React.createElement("img", {
47
+ src: toolbarScreenshot,
48
+ alt: "Datagrid highlighting toolbar area"
49
+ }),
50
+ description: "In some of the examples you will see a component named `DatagridActions` passed to the `useDatagrid` hook. This component will render the table toolbar and is something that you will need to create on your own and then provide it to the `useDatagrid` hook. You can reference the `DatagridActions` that we have [created for our stories](https://github.com/carbon-design-system/ibm-products/blob/main/packages/ibm-products/src/components/Datagrid/utils/DatagridActions.js) when building your own."
51
+ }, {
52
+ title: 'Empty',
53
+ story: stories.EmptyState,
54
+ description: "The `Datagrid` supports empty states, when the data prop passed to the `useDatagrid` hook is an empty array.\n ",
55
+ source: {
56
+ language: 'jsx',
57
+ code: "\nimport { Datagrid, useDatagrid } from '@carbon/ibm-products';\n\nconst App = () => {\n const columns = React.useMemo(() => defaultHeader, []); // These are the columns that will be used by the datagrid\n const [data] = useState([]); // This is the data that will be rendered by the datagrid\n\n const datagridState = useDatagrid({\n columns,\n data,\n emptyStateTitle: 'Empty state title',\n emptyStateDescription: 'Description explaining why table is empty',\n emptyStateSize: 'lg', // See empty state size options from the EmptyState component\n });\n\n return <Datagrid datagridState={datagridState} />;\n};\n "
58
+ }
59
+ }, {
60
+ title: 'Auto size column to fit content',
61
+ description: "The `getAutoSizedColumnWidth` utility function can be used to auto size columns based on it's content. The width will be set to that of the largest cell in the column or the column header, whichever is greater. If this is not used, the width will be set to the default column width (150px) or the value passed to the `width` property in the column definition. See example below:",
62
+ source: {
63
+ code: "\nimport { Datagrid, useDatagrid, getAutoSizedColumnWidth } from '@carbon/ibm-products';\n\n...\n\nconst myColumns = [\n {\n Header: 'Column 1',\n accessor: 'column_1',\n width: getAutoSizedColumnWidth(rows, 'column_1', 'Column 1'),\n }\n]\n\n...\n "
64
+ }
65
+ }, {
66
+ title: 'Disabling select rows',
67
+ description: "\n Disabling select rows allows you to choose which rows will be disabled in the table.\n\n- Include the `useDisableSelectRows` hook in the `endPlugins` property of `useDatagrid`.\n- Add the `shouldDisableSelectRow` to the `useDatagrid` hook, this will be a function that returns the row indexes that will be disabled.\n ",
68
+ source: {
69
+ code: "\nconst [data] = useState(makeData(10));\nconst columns = React.useMemo(() => getColumns(data), []);\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n DatagridActions,\n DatagridBatchActions,\n endPlugins: [useDisableSelectRows],\n shouldDisableSelectRow: (row) => row.id % 2 === 0,\n disableSelectAll: true,\n },\n useSelectRows\n);\n\nreturn <Datagrid datagridState={datagridState} />;\n "
70
+ }
71
+ }, {
72
+ title: 'Infinite scroll',
73
+ description: "Infinite scroll is supported via the `useInfiniteScroll` hook. This hook will allow you to fetch more data to display to the user after a certain scroll threshold. The `useInfiniteScroll` hook can also be used to support virtualized data, this is required when working with large amounts of data, only rendering the rows that need to be visible in the component at a point in time."
74
+ }, {
75
+ description: "Infinite scroll:\n- Include `useInfiniteScroll` hook\n- Add `fetchMoreData` property to `useDatagrid`, this will be a function that is called when the scroll threshold is met. Optionally change the height of the grid with the `virtualHeight` property.",
76
+ source: {
77
+ code: "\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n isFetching,\n fetchMoreData: fetchData,\n virtualHeight: 540,\n emptyStateTitle: 'Empty state title',\n emptyStateDescription: 'Description explaining why the table is empty',\n },\n useInfiniteScroll\n);"
78
+ }
79
+ }, {
80
+ description: "Virtualized data:\n- Include `useInfiniteScroll` hook\n- The Datagrid will know to use virtualized data just by providing the `useInfiniteScroll` hook\n ",
81
+ source: {
82
+ code: "\nconst [data] = useState(makeData(10000));\nconst columns = React.useMemo(() => getColumns(data), []);\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n },\n useInfiniteScroll\n);\n "
83
+ }
84
+ }, {
85
+ title: 'Detect row hover',
86
+ description: "There may be cases when you want to detect if a user is hovering on a particular row. In this case, use the `useRowIsMouseOver` hook.\n- Include the `useRowIsMouseOver` hook\n- When hover is detected on a row, a property called `isMouseOver` is changed from `false` to `true` within that row.\n "
87
+ }, {
88
+ title: 'Select items across all pages',
89
+ description: "By default, selecting all items with paginated rows will result in just the current page rows being selected. Incorporating the `useSelectAllWithToggle` hook will provide the option to select all rows across all pages.\n- Include `useSelectAllWithToggle` and `useSelectRows` hook\n- Add the `selectAllToggle` property to the `useDatagrid` hook\n- Optionally pass in labels to ensure proper translation\n- Optionally pass in `onSelectAllRoss`, function that will be called via the select all rows checkbox `onChange`\n ",
90
+ source: {
91
+ code: "\nconst [data] = useState(makeData(100));\nconst columns = React.useMemo(() => getColumns(data), []);\nconst [areAllSelected, setAreAllSelected] = useState(false);\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n initialState: {\n pageSize: 10,\n pageSizes: [5, 10, 25, 50],\n },\n selectAllToggle: {\n labels: {\n allRows: 'Select all',\n allPageRows: 'Select all on page',\n },\n onSelectAllRows: setAreAllSelected,\n },\n DatagridPagination,\n DatagridActions,\n DatagridBatchActions,\n },\n useSelectRows,\n useSelectAllWithToggle\n);\n\nreturn (\n <Datagrid datagridState={datagridState} />\n);\n "
92
+ }
93
+ }, {
94
+ title: 'Selecting rows',
95
+ description: "When building a Datagrid that requires selectable rows, use the `useSelectRows` hook.\n- Include `useSelectRows` hook\n- Add `onRowSelect` to the `useDatagrid` hook, this is a callback function called when on a row's selection checkbox onChange, and sends back the row object and the event\n ",
96
+ source: {
97
+ code: "\nconst [data] = useState(makeData(10));\nconst columns = React.useMemo(() => getColumns(data), []);\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n onRowSelect: (row, event) => console.log(row, event),\n },\n useSelectRows\n);\n\nreturn <Datagrid datagridState={datagridState} />;\n "
98
+ }
99
+ }, {
100
+ description: "The select all checkbox can be optionally hidden by settings the `hideSelectAll` property to `true` in the `useDatagrid` hook.",
101
+ source: {
102
+ code: "\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n onRowSelect: (row, event) => console.log(row, event),\n hideSelectAll: true,\n },\n useSelectRows\n);\n "
103
+ }
104
+ }, {
105
+ description: "Datagrid also provides the option to use radio selection in cases where only one row should be selected at a time. Additionally, you can have preselected row/rows, see example below.",
106
+ source: {
107
+ code: "\nconst [data] = useState(makeData(10));\nconst columns = React.useMemo(() => getColumns(data), []);\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n radio: true,\n onRadioSelect: (row) => console.log(`Row clicked`),\n initialState: {\n selectedRowIds: {\n 3: true,\n },\n },\n },\n useSelectRows\n);\n\nreturn <Datagrid datagridState={datagridState} />;\n "
108
+ }
109
+ }, {
110
+ title: 'Sortable columns',
111
+ description: "To add sortable columns to your Datagrid, simply add the `useSortableColumns` hook. This will allow each column header to be clickable and sort each column in either ascending or descending order.\n- Include `useSortableColumns` hook\n ",
112
+ source: {
113
+ code: "\nconst [data] = useState(makeData(10));\nconst columns = React.useMemo(() => getColumns(data), []);\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n },\n useSortableColumns\n);\n\nreturn <Datagrid datagridState={datagridState} />;\n "
114
+ }
115
+ }, {
116
+ title: 'Sticky column',
117
+ description: "Sticky columns can be useful when you have many columns that create a horizontal scroll and you have important data in the first or last column that you always want to be visible.\n- Include the `useStickyColumn` hook\n- Sticky columns can _only_ be applied to the first and the last columns in the Datagrid. To have the first column stick, add `sticky: 'left'` to the first column definition. To have the last column stick, add `sticky: 'right'` to the last column definition.\n ",
118
+ source: {
119
+ code: "\nconst columns = [\n {\n Header: 'First column',\n accessor: 'first_column',\n sticky: 'left',\n },\n {\n ...\n },\n {\n ...\n }\n];\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n },\n useStickyColumn\n);\n\nreturn <Datagrid datagridState={datagridState} />;\n "
120
+ }
121
+ }]
122
+ });
123
+ };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../../../global/js/utils/StoryDocsPage';
3
+ export var DocsPage = function DocsPage() {
4
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
5
+ blocks: [{
6
+ description: "The default column alignment in the `Datagrid` is left, however there is support for center and right aligned as well. See [design guidance](https://pages.github.ibm.com/cdai-design/pal/components/data-table/column-alignment/usage) for details around when to change default column alignment.\n\nTo utilize center or right aligned columns refer to the steps below:\n\n - Include `useColumnCenterAlign` or `useColumnRightAlign` hook/s.\n - Add `rightAlignedColumn` or `centerAlignedColumn` to the column object in which you which to change the default column alignment.\n ",
7
+ source: {
8
+ language: 'jsx',
9
+ code: "\nimport {\n Datagrid,\n useDatagrid,\n useColumnCenterAlign,\n useColumnRightAlign,\n} from '@carbon/ibm-products';\n\nconst defaultColumns = [\n ...defaultCols,\n {\n Header: 'Bonus',\n accessor: 'bonus',\n width: 120,\n rightAlignedColumn: true,\n },\n {\n Header: 'Status',\n accessor: 'status_icon',\n width: 100,\n centerAlignedColumn: true,\n },\n];\n\nconst App = () => {\n const columns = React.useMemo(() => [...defaultHeader], []);\n const [data] = useState(makeData(10));\n\n const datagridState = useDatagrid(\n {\n columns,\n data,\n initialState: {\n pageSize: 10,\n pageSizes: [5, 10, 25, 50],\n },\n DatagridActions,\n DatagridPagination,\n },\n useColumnCenterAlign,\n useColumnRightAlign\n );\n\n return <Datagrid datagridState={datagridState} />;\n};\n "
10
+ }
11
+ }]
12
+ });
13
+ };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../../../global/js/utils/StoryDocsPage';
3
+ export var DocsPage = function DocsPage() {
4
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
5
+ blocks: [{
6
+ title: 'Customizing columns',
7
+ description: "Customizing columns allows user to reorder and hide certain columns of the datagrid. Consuming component can use the provided callback to save/update according to their persistent strategy.\n- Include `useCustomizeColumns` and `useColumnOrder` hooks (required)\n - `useColumnOrder` comes from `react-table` but is exported by `@carbon/ibm-products` to be used alongside `useCustomizeColumns`.\n- Implement `options.DatagridActions` component\n - this component will have props: `datagridState`\n - render `datagridState.CustomizeColumnsButton` component wherever makes sense.\n- Options available to set:\n - `options.initialState.hiddenColumns: Array<ColumnId: String>`\n - Array of column ids that will be hidden after initial render\n - [react-table doc](https://react-table.tanstack.com/docs/api/useTable#table-options)\n - `options.initialState.columnOrder: Array<ColumnId: String>`\n - Order of the columns. Any column ids not in this array will be ordered by their position in the `options.columns`\n - [react-table doc](https://react-table.tanstack.com/docs/api/useColumnOrder#table-options)\n - `options.customizeColumnsProps.onSaveColumnPrefs`\n - type: `Function(Columns: Array<{ColumnId: String, isVisible: Boolean}>) => void`\n - Callback function when 'Save' button clicked on the narrow tearsheet. It allows consumer to preserve the updated column preference. This output can also be used to compute the `hiddenColumns` and `columnOrder`\n - Reset to default (optional)\n - There is a reset to default button on the modal. It will use the `options.columns` as the default. If there are columns should be hidden by default, denote them with property: `isVisible: false` (undefined will be treated as `true`).\n ",
8
+ source: {
9
+ code: "\nconst columns = React.useMemo(() => defaultHeader, []);\nconst [data] = useState(makeData(10));\nconst DatagridActions = (datagridState) => (\n <TableToolbarContent>\n <TableToolbarSearch ... />\n <Button ... />\n <datagridState.CustomizeColumnsButton />\n </TableToolbarContent>\n)\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n initialState: {\n hiddenColumns: ['age'],\n columnOrder: [],\n },\n customizeColumnsProps: {\n onSaveColumnPrefs: (newColDefs) => {\n console.log(newColDefs);\n },\n },\n DatagridActions,\n },\n useCustomizeColumns,\n useColumnOrder,\n);\n\nreturn (\n <Datagrid datagridState={datagridState} />\n);\n "
10
+ }
11
+ }]
12
+ });
13
+ };
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../../../global/js/utils/StoryDocsPage';
3
+ import { EditableCellUsageStory, InlineEditUsageStory } from './EditableCell.stories';
4
+ export var DocsPage = function DocsPage() {
5
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
6
+ blocks: [{
7
+ description: "The `Datagrid` supports inline editing when used with the `useEditableCell` hook (previously named `useInlineEdit` in v1) and columns are provided the required configuration. The four data types supported are strings, numbers, dates, and\n selection (dropdown)."
8
+ }, {
9
+ description: "Below are example column configurations for the supported inline edit data types:\n \nDefault/string:\n ",
10
+ source: {
11
+ language: 'json',
12
+ code: "\n {\n Header: 'First Name',\n accessor: 'firstName',\n inlineEdit: {\n type: 'text',\n // required for including validation, this is used to set the invalid prop internally\n validator: (n) => n.length >= 40,\n // These props are passed to the Carbon component used for inline editing, in this case the TextInput\n inputProps: {\n invalidText: 'Invalid text, character count must be less than 40',\n },\n },\n }\n "
13
+ }
14
+ }, {
15
+ description: 'Number',
16
+ source: {
17
+ language: 'json',
18
+ code: "\n{\n Header: 'Age',\n accessor: 'age',\n width: 120,\n inlineEdit: {\n // required for including validation, this is used to set the invalid prop internally\n validator: (n) => n && n < 18,\n type: 'number',\n // These props are passed to the Carbon component used for inline editing, in this case NumberInput\n inputProps: {\n invalidText: 'Invalid number, must be 18 or greater',\n },\n },\n},\n "
19
+ }
20
+ }, {
21
+ description: 'Date',
22
+ source: {
23
+ language: 'json',
24
+ code: "\n{\n Header: 'Active since',\n accessor: 'activeSince',\n inlineEdit: {\n type: 'date',\n inputProps: {\n // optionally pass props here to be passed through to Carbon's DatePicker component\n onChange: (newDateObj, cell) => {\n console.log(newDateObj, cell);\n },\n labelText: 'Change active since date',\n // optionally pass props here to be passed through to Carbon's DatePickerInput component\n datePickerInputProps: {\n labelText: 'Change active since date',\n },\n },\n },\n},\n "
25
+ }
26
+ }, {
27
+ description: 'Selection',
28
+ source: {
29
+ language: 'json',
30
+ code: "\n{\n Header: 'Chart type',\n accessor: 'chartType',\n inlineEdit: {\n type: 'selection',\n inputProps: {\n // These props are passed to the Carbon component used for inline editing\n items: [\n {\n id: 'option-0',\n icon: ChartColumnFloating16,\n text: 'Column Chart',\n },\n {\n id: 'option-1',\n icon: ChartBubble16,\n text: 'Bubble Chart',\n },\n {\n id: 'option-2',\n icon: ChartVennDiagram16,\n text: 'Venn Diagram',\n },\n ],\n onChange: (item) => {\n console.log(item);\n },\n },\n },\n},\n "
31
+ }
32
+ }, {
33
+ description: "Using the column structure outlined above, along with the use of the `useEditableCell` hook (previously named `useInlineEdit` in v1), the `Datagrid` will support inline editing. See example below:",
34
+ source: {
35
+ code: "\nimport { Datagrid, useDatagrid, useEditableCell } from '@carbon/ibm-products';\nconst App = () => {\n const [data, setData] = useState(makeData(10));\n const columns = React.useMemo(() => getInlineEditColumns(), []); // These columns follow the inline edit column configuration detailed above\n const datagridState = useDatagrid(\n {\n columns,\n data,\n onDataUpdate: setData,\n },\n useEditableCell\n );\n return <Datagrid datagridState={datagridState} />;\n};\n "
36
+ },
37
+ story: EditableCellUsageStory
38
+ }, {
39
+ title: 'Using deprecated useInlineEdit hook',
40
+ description: "At this time, it is possible to still use the deprecated `useInlineEdit` hook but requires setting a feature flag. See example below:",
41
+ source: {
42
+ code: "\nimport {\n Datagrid,\n useDatagrid,\n useInlineEdit,\n pkg,\n} from '@carbon/ibm-products';\n\nconst MyInlineEditDatagrid = () => {\n pkg.feature['Datagrid.useInlineEdit'] = true;\n const [data, setData] = useState(gridData);\n const datagridState = useDatagrid(\n {\n columns,\n data,\n onDataUpdate: setData,\n },\n useInlineEdit\n );\n return <Datagrid datagridState={datagridState} />;\n};\n "
43
+ },
44
+ story: InlineEditUsageStory
45
+ }]
46
+ });
47
+ };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../../../global/js/utils/StoryDocsPage';
3
+ export var DocsPage = function DocsPage() {
4
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
5
+ blocks: [{
6
+ description: "The `Datagrid` supports expandable rows with the use of the `useExpandedRow` hook.",
7
+ source: {
8
+ language: 'jsx',
9
+ code: "\nimport { Datagrid, useDatagrid, useExpandedRow } from '@carbon/ibm-products';\n\nconst App = () => {\n const columns = React.useMemo(() => defaultHeader, []); // These are the columns that will be used by the datagrid\n const [data] = useState(makeData(10)); // This is the data that will be rendered by the datagrid\n\n const expansionRenderer = ({ row }) => {\n return <div>Content for row index: {row.id}</div>;\n };\n\n const datagridState = useDatagrid(\n {\n columns,\n data,\n ExpandedRowContentComponent: expansionRenderer,\n },\n useExpandedRow\n );\n\n return <Datagrid datagridState={datagridState} />;\n};\n "
10
+ }
11
+ }]
12
+ });
13
+ };
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../../../global/js/utils/StoryDocsPage';
3
+ export var DocsPage = function DocsPage() {
4
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
5
+ blocks: [{
6
+ title: 'Filtering',
7
+ description: "Table filtering allows a user to add or remove data items from a data table by selecting or clearing predefined attributes. Filters can help a user find something they're looking for, view available options within a certain set of criteria, and decide between many options. These guidelines are an extension of [Carbon's filter documentation](https://carbondesignsystem.com/patterns/filtering/).\n "
8
+ }, {
9
+ description: "Filtering results in a table is a different type of action from searching. While both actions can help the user narrow results down, searching is meant to help the user find a specific result, whereas filtering allows users to trim results according to its attributes."
10
+ }, {
11
+ description: "Applied filters can affect both the data that is visible in the table and also data that might not be displayed in the columns available in the table. Filter options can be displayed in many form components, including dropdowns, text inputs, checkboxes, radio buttons, and date range pickers."
12
+ }, {
13
+ description: "[Check out the Guidance here.](https://pages.github.ibm.com/cdai-design/pal/components/data-table/filters/)"
14
+ }, {
15
+ subTitle: 'Preparing your column headers'
16
+ }, {
17
+ description: 'To utilize filtering, you have to add some extra properties into your headers that are going to be filtered.'
18
+ }, {
19
+ description: "Two things you need to do is:\n- Specify a `filter` to use (unless it's text match which is default)\n- (Optional) Render the component with the `Cell` property to display the right information. Use this if the data you send into the table isn't how you want to display it, for example like Dates. See the example for `passwordStrength` below.\n "
20
+ }, {
21
+ description: "For example; here we are specifying that the `joined` header column should be filtered using a `filter: 'date'`, and render the cell using it's value and converting it to string. (Since the value of joined is a date object, react isn't going to allow you to render it as jsx so we have to convert it to string)",
22
+ source: {
23
+ code: "\n{\n Header: 'Joined',\n accessor: 'joined',\n filter: 'date',\n Cell: ({ cell: { value } }) => <span>{value.toLocaleDateString()}</span>,\n},\n "
24
+ }
25
+ }, {
26
+ description: "The different types of filters are:\n- text (default)\n- date\n- number\n- checkbox\n- radio\n- dropdown\n ",
27
+ source: {
28
+ code: "\nconst columns = [\n {\n Header: 'Row Index',\n accessor: (row, i) => i,\n sticky: 'left',\n id: 'rowIndex', // id is required when accessor is a function.\n },\n {\n Header: 'First Name',\n accessor: 'firstName',\n },\n {\n Header: 'Last Name',\n accessor: 'lastName',\n },\n {\n Header: 'Age',\n accessor: 'age',\n width: 50,\n },\n {\n Header: 'Visits',\n accessor: 'visits',\n filter: 'number',\n width: 60,\n },\n {\n Header: 'Status',\n accessor: 'status',\n filter: 'dropdown',\n },\n // Shows the date filter example\n {\n Header: 'Joined',\n accessor: 'joined',\n filter: 'date',\n Cell: ({ cell: { value } }) => <span>{value.toLocaleDateString()}</span>,\n },\n // Shows the checkbox filter example\n {\n Header: 'Password strength',\n accessor: 'passwordStrength',\n filter: 'checkbox',\n Cell: ({ cell: { value } }) => {\n const iconProps = {\n size: 'sm',\n theme: 'light',\n kind: value,\n iconDescription: value,\n };\n\n return (\n <span\n style={{\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n }}\n >\n <StatusIcon {...iconProps} />\n {iconProps.iconDescription}\n </span>\n );\n },\n },\n // Shows the checkbox filter example\n {\n Header: 'Role',\n accessor: 'role',\n filter: 'radio',\n },\n];\n "
29
+ }
30
+ }, {
31
+ subTitle: 'Store you data into state, this can also come from an API',
32
+ source: {
33
+ code: "\nconst [data] = useState([\n {\n activeSince: new Date('09/26/81'),\n age: 41,\n firstName: 'Joel',\n lastName: 'Miller',\n passwordStrength: 'normal',\n role: 'developer',\n visits: '81',\n },\n {\n activeSince: new Date('08/30/97'),\n age: 19,\n firstName: 'Ellie',\n lastName: 'N/A',\n passwordStrength: 'critical',\n role: 'designer',\n visits: '7',\n },\n {\n activeSince: new Date('01/26/03'),\n age: 39,\n firstName: 'Tommy',\n lastName: 'Miller',\n passwordStrength: 'minor-warning',\n role: 'researcher',\n visits: '25',\n },\n]);\n "
34
+ }
35
+ }, {
36
+ subTitle: 'Create your filters for flyout variant',
37
+ description: "To add filters to the flyout, you have to pass in an array of filters. These filters will be converted to it's respective component. Each filters has 3 important props, `type`, `column`, `props`.\n- `type`: the type of filter (this should be the same `filter` property in the headers)\n- `column`: the column that it should be filtered on\n- `props`: the props for the components needed to render the filter.\n\nPlease refer to all the available filters that you can use below.\n ",
38
+ source: {
39
+ code: "\nconst filters = [\n {\n type: 'date',\n column: 'joined',\n props: {\n DatePicker: {\n datePickerType: 'range',\n // Add any other Carbon DatePicker props here\n },\n DatePickerInput: {\n start: {\n id: 'date-picker-input-id-start',\n placeholder: 'mm/dd/yyyy',\n labelText: 'Joined start date',\n // Add any other Carbon DatePickerInput props here\n },\n end: {\n id: 'date-picker-input-id-end',\n placeholder: 'mm/dd/yyyy',\n labelText: 'Joined end date',\n // Add any other Carbon DatePickerInput props here\n },\n },\n },\n },\n {\n type: 'number',\n column: 'visits',\n props: {\n NumberInput: {\n min: 0,\n id: 'visits-number-input',\n invalidText: 'A valid value is required',\n label: 'Visits',\n placeholder: 'Type a number amount of visits',\n // Add any other Carbon NumberInput props here\n },\n },\n },\n {\n type: 'checkbox',\n column: 'passwordStrength',\n props: {\n FormGroup: {\n legendText: 'Password strength',\n // Add any other Carbon FormGroup props here\n },\n Checkbox: [\n {\n id: 'normal',\n labelText: 'Normal',\n value: 'normal',\n // Add any other Carbon Checkbox props here\n },\n {\n id: 'minor-warning',\n labelText: 'Minor warning',\n value: 'minor-warning',\n // Add any other Carbon Checkbox props here\n },\n {\n id: 'critical',\n labelText: 'Critical',\n value: 'critical',\n // Add any other Carbon Checkbox props here\n },\n ],\n },\n },\n {\n type: 'radio',\n column: 'role',\n props: {\n FormGroup: {\n legendText: 'Role',\n // Add any other Carbon FormGroup props here\n },\n RadioButtonGroup: {\n orientation: 'vertical',\n legend: 'Role legend',\n name: 'role-radio-button-group',\n // Add any other Carbon RadioButtonGroup props here\n },\n RadioButton: [\n {\n id: 'developer',\n labelText: 'Developer',\n value: 'developer',\n // Add any other Carbon RadioButton props here\n },\n {\n id: 'designer',\n labelText: 'Designer',\n value: 'designer',\n // Add any other Carbon RadioButton props here\n },\n {\n id: 'researcher',\n labelText: 'Researcher',\n value: 'researcher',\n // Add any other Carbon RadioButton props here\n },\n ],\n },\n },\n {\n type: 'dropdown',\n column: 'status',\n props: {\n Dropdown: {\n id: 'marital-status-dropdown',\n ariaLabel: 'Marital status dropdown',\n items: ['relationship', 'complicated', 'single'],\n label: 'Marital status',\n titleText: 'Marital status',\n // Add any other Carbon Dropdown props here\n },\n },\n },\n];\n "
40
+ }
41
+ }, {
42
+ subTitle: 'Create your filters for panel variant',
43
+ description: 'Filter panel coming soon.'
44
+ }, {
45
+ subTitle: 'Putting it all together',
46
+ source: {
47
+ code: "\nimport { Datagrid, useDatagrid, useFiltering } from '@carbon/ibm-products';\n\nconst App = () => {\n const columns = [...];\n const [data] = useState([...]);\n const filters = [...];\n\n\n const datagridState = useDatagrid(\n {\n columns,\n data,\n filterProps: {\n variation: 'flyout', // default\n updateMethod: 'batch', // default\n primaryActionLabel: 'Apply', // default\n secondaryActionLabel: 'Cancel', // default\n flyoutIconDescription: 'Open filters', // default\n shouldClickOutsideToClose: false, // default\n filters,\n },\n DatagridActions,\n batchActions: true,\n toolbarBatchActions: getBatchActions(),\n },\n useFiltering\n );\n\n return <Datagrid datagridState={datagridState} />;\n};\n "
48
+ }
49
+ }, {
50
+ subTitle: "`filterProps` types",
51
+ source: {
52
+ language: 'json',
53
+ code: "\nfilterProps: {\n /** The variation of filtering */\n variation: 'flyout'|'panel',\n /** The update method in which to filter, instant automatically\n applies the filters, batch the user has to click apply */\n updateMethod: 'batch'|'instant',\n /** Text for primary action button, default is 'Apply' */\n primaryActionLabel: string,\n /** Text for secondary action button, default is 'Cancel' */\n secondaryActionLabel: string,\n /** Text for flyout icon description */\n flyoutIconDescription: string,\n /** Array of objects to render filters in flyout */\n filters: object[]\n}\n "
54
+ }
55
+ }]
56
+ });
57
+ };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { StoryDocsPage } from '../../../../global/js/utils/StoryDocsPage';
3
+ export var DocsPage = function DocsPage() {
4
+ return /*#__PURE__*/React.createElement(StoryDocsPage, {
5
+ blocks: [{
6
+ title: 'Actions column',
7
+ description: "This will add row actions (if more than two actions are provided an OverflowMenu component will be used) to the cells on the column marked with `isAction: true`. Each action button callback will include the actionId and the row object.\n- Include useActionsColumn hook\n- Add `isAction = true` to the column object in which you which to add the overflow menu actions\n- Add `rowActions = []` array to the props\n - `rowActions[].id` for callback to identify the action is called\n - `rowActions[].onClick(actionId: string, row: Row, event: ClickEvent)` callback on menuitem clicked. [Row properties](https://react-table.tanstack.com/docs/api/useTable#row-properties)\n - `rowActions[].shouldHideMenuItem(row: Row)` callback to hide this menuitem. [Row properties](https://react-table.tanstack.com/docs/api/useTable#row-properties)\n - `rowActions[].shouldDisableMenuItem(row: Row)` callback to disable this menuitem. [Row properties](https://react-table.tanstack.com/docs/api/useTable#row-properties)\n - This will override `rowActions[].disabled` (from Carbon) because `shouldDisableMenuItem` is more specific to the row.\n - each action object can take all the props from OverflowMenuItem props, see [carbon docs](https://react.carbondesignsystem.com/?path=/docs/components-overflowmenu--default#overflowmenu)\n ",
8
+ source: {
9
+ code: "\nconst columns = [\n // other columns\n {\n Header: '',\n accessor: 'actions',\n isAction: true,\n },\n];\nconst onActionClick = (actionId, row, event) => {};\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n rowActions: [\n {\n id: 'edit',\n itemText: 'Edit',\n onClick: onActionClick,\n },\n {\n id: 'hidden',\n itemText: 'Hidden item',\n onClick: onActionClick,\n shouldHideMenuItem: () => true,\n },\n {\n id: 'delete',\n itemText: 'Delete',\n hasDivider: true,\n isDelete: true,\n onClick: onActionClick,\n },\n ],\n },\n useActionsColumn\n);\n\nreturn <Datagrid datagridState={datagridState} />;"
10
+ }
11
+ }]
12
+ });
13
+ };
@@ -124,7 +124,7 @@ export var DatagridActions = function DatagridActions(datagridState) {
124
124
  hasDivider: true,
125
125
  requireTitle: true
126
126
  }))) : !mobileToolbar ? /*#__PURE__*/React.createElement(TableToolbarContent, null, renderFilterPanelButton(), /*#__PURE__*/React.createElement(TableToolbarSearch, {
127
- size: "xl",
127
+ size: "lg",
128
128
  id: "columnSearch",
129
129
  persistent: true,
130
130
  placeHolderText: searchForAColumn,
@@ -46,6 +46,10 @@ export var ARG_TYPES = {
46
46
  control: 'select',
47
47
  options: ['sm', 'lg']
48
48
  },
49
+ isFetching: {
50
+ control: 'radio',
51
+ options: [true, false]
52
+ },
49
53
  useDenseHeader: {
50
54
  control: {
51
55
  type: 'radio'
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["actionIcons", "actionsPlacement", "className", "description", "editChildren", "editMode", "label", "previewChildren", "title", "titleSize"];
4
+ var _excluded = ["actionIcons", "actionsPlacement", "className", "description", "editChildren", "editMode", "label", "onPrimaryButtonClick", "onSecondaryButtonClick", "previewChildren", "title", "titleSize", "primaryButtonIcon", "primaryButtonText", "secondaryButtonIcon", "secondaryButtonText"];
5
5
  /**
6
6
  * Copyright IBM Corp. 2022, 2022
7
7
  *
@@ -56,12 +56,30 @@ export var EditUpdateCards = /*#__PURE__*/React.forwardRef(function (_ref, ref)
56
56
  editChildren = _ref.editChildren,
57
57
  editMode = _ref.editMode,
58
58
  label = _ref.label,
59
+ onPrimaryButtonClick = _ref.onPrimaryButtonClick,
60
+ onSecondaryButtonClick = _ref.onSecondaryButtonClick,
59
61
  previewChildren = _ref.previewChildren,
60
62
  title = _ref.title,
61
63
  titleSize = _ref.titleSize,
64
+ primaryButtonIcon = _ref.primaryButtonIcon,
65
+ primaryButtonText = _ref.primaryButtonText,
66
+ secondaryButtonIcon = _ref.secondaryButtonIcon,
67
+ secondaryButtonText = _ref.secondaryButtonText,
62
68
  rest = _objectWithoutProperties(_ref, _excluded);
63
- // const [editMode, setEditMode] = useState(false);
69
+ // const [editCardMode, setEditCardMode] = useState(editMode);
64
70
 
71
+ var conditionalProps = {
72
+ onPrimaryButtonClick: onPrimaryButtonClick,
73
+ onSecondaryButtonClick: onSecondaryButtonClick,
74
+ primaryButtonIcon: primaryButtonIcon,
75
+ primaryButtonKind: 'ghost',
76
+ primaryButtonPlacement: 'top',
77
+ primaryButtonText: primaryButtonText,
78
+ secondaryButtonIcon: secondaryButtonIcon,
79
+ secondaryButtonKind: 'ghost',
80
+ secondaryButtonPlacement: 'top',
81
+ secondaryButtonText: secondaryButtonText
82
+ };
65
83
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
66
84
  className: cx(blockClass,
67
85
  // Apply the block class to the main HTML element
@@ -70,7 +88,7 @@ export var EditUpdateCards = /*#__PURE__*/React.forwardRef(function (_ref, ref)
70
88
  _defineProperty({}, "".concat(blockClass, "__actions-bottom"), actionsPlacement === 'bottom')),
71
89
  ref: ref,
72
90
  role: "main"
73
- }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(ProductiveCard, {
91
+ }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(ProductiveCard, _extends({
74
92
  actionIcons: actionIcons,
75
93
  actionsPlacement: actionsPlacement,
76
94
  className: className,
@@ -78,7 +96,7 @@ export var EditUpdateCards = /*#__PURE__*/React.forwardRef(function (_ref, ref)
78
96
  label: label,
79
97
  title: title,
80
98
  titleSize: titleSize
81
- }, editMode === false && /*#__PURE__*/React.createElement("div", null, previewChildren), editMode && /*#__PURE__*/React.createElement("div", null, editChildren)));
99
+ }, editMode && conditionalProps), editMode === false && /*#__PURE__*/React.createElement("div", null, previewChildren), editMode && /*#__PURE__*/React.createElement("div", null, editChildren)));
82
100
  });
83
101
 
84
102
  // Return a placeholder if not released and not enabled by feature flag
@@ -127,10 +145,54 @@ EditUpdateCards.propTypes = {
127
145
  * Optional label for the top of the card
128
146
  */
129
147
  label: PropTypes.string,
148
+ /**
149
+ * Function that's called from the primary button or action icon
150
+ */
151
+ onPrimaryButtonClick: PropTypes.func,
152
+ /**
153
+ * Function that's called from the secondary button or action icon
154
+ */
155
+ onSecondaryButtonClick: PropTypes.func,
130
156
  /**
131
157
  * Preview mode children
132
158
  */
133
159
  previewChildren: PropTypes.node,
160
+ /**
161
+ * Optional prop to allow overriding the icon rendering. Can be a React component class
162
+ */
163
+ primaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
164
+ /**
165
+ * Establishes the kind of button displayed for the primary button
166
+ */
167
+ primaryButtonKind: PropTypes.oneOf(['primary', 'ghost']),
168
+ /**
169
+ * Determines if the primary button is on the top or bottom of the card
170
+ */
171
+ primaryButtonPlacement: PropTypes.oneOf(['top', 'bottom']),
172
+ /**
173
+ * The text that's displayed in the primary button
174
+ */
175
+ primaryButtonText: PropTypes.string,
176
+ /**
177
+ * Optionally specify an href for your Button to become an <a> element
178
+ */
179
+ secondaryButtonHref: PropTypes.string,
180
+ /**
181
+ * Optional prop to allow overriding the icon rendering. Can be a React component class
182
+ */
183
+ secondaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
184
+ /**
185
+ * Establishes the kind of button displayed for the secondary button
186
+ */
187
+ secondaryButtonKind: PropTypes.oneOf(['secondary', 'ghost']),
188
+ /**
189
+ * Determines if the secondary button is on the top or bottom of the card
190
+ */
191
+ secondaryButtonPlacement: PropTypes.oneOf(['top', 'bottom']),
192
+ /**
193
+ * The text that's displayed in the secondary button
194
+ */
195
+ secondaryButtonText: PropTypes.string,
134
196
  /**
135
197
  * Title that's displayed at the top of the card
136
198
  */
@@ -19,13 +19,16 @@ var FilterSummary = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
19
19
  _ref$clearFilters = _ref.clearFilters,
20
20
  clearFilters = _ref$clearFilters === void 0 ? function () {} : _ref$clearFilters,
21
21
  _ref$filters = _ref.filters,
22
- filters = _ref$filters === void 0 ? [] : _ref$filters;
22
+ filters = _ref$filters === void 0 ? [] : _ref$filters,
23
+ _ref$renderLabel = _ref.renderLabel,
24
+ renderLabel = _ref$renderLabel === void 0 ? null : _ref$renderLabel;
23
25
  var tagFilters = filters.map(function (_ref2) {
26
+ var _renderLabel;
24
27
  var key = _ref2.key,
25
28
  value = _ref2.value;
26
29
  return {
27
30
  type: 'gray',
28
- label: "".concat(key, ": ").concat(value)
31
+ label: (_renderLabel = renderLabel === null || renderLabel === void 0 ? void 0 : renderLabel(key, value)) !== null && _renderLabel !== void 0 ? _renderLabel : "".concat(key, ": ").concat(value)
29
32
  };
30
33
  });
31
34
  return /*#__PURE__*/React.createElement("div", {
@@ -49,6 +52,7 @@ FilterSummary.propTypes = {
49
52
  className: PropTypes.string,
50
53
  clearFilters: PropTypes.func.isRequired,
51
54
  clearFiltersText: PropTypes.string,
52
- filters: PropTypes.arrayOf(PropTypes.object).isRequired
55
+ filters: PropTypes.arrayOf(PropTypes.object).isRequired,
56
+ renderLabel: PropTypes.func
53
57
  };
54
58
  export default FilterSummary;
@@ -227,7 +227,14 @@ export var OptionsTile = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
227
227
  })), isExpandable ? /*#__PURE__*/React.createElement("details", {
228
228
  open: isOpen,
229
229
  ref: detailsRef
230
- }, /*#__PURE__*/React.createElement("summary", {
230
+ },
231
+ /*#__PURE__*/
232
+ /* summary should not be considered non-interactive
233
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/656
234
+ * https://github.com/A11yance/axobject-query/issues/319
235
+ */
236
+ /* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
237
+ React.createElement("summary", {
231
238
  className: "".concat(blockClass, "__header"),
232
239
  onClick: toggle
233
240
  }, /*#__PURE__*/React.createElement(ChevronDown, {