@carbon/ibm-products 2.3.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/README.md +38 -0
  2. package/css/index-full-carbon.css +235 -110
  3. package/css/index-full-carbon.css.map +1 -1
  4. package/css/index-full-carbon.min.css +2 -2
  5. package/css/index-full-carbon.min.css.map +1 -1
  6. package/css/index-without-carbon-released-only.css +24 -24
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon.css +59 -54
  9. package/css/index-without-carbon.css.map +1 -1
  10. package/css/index-without-carbon.min.css +2 -2
  11. package/css/index-without-carbon.min.css.map +1 -1
  12. package/css/index.css +122 -38
  13. package/css/index.css.map +1 -1
  14. package/css/index.min.css +3 -3
  15. package/css/index.min.css.map +1 -1
  16. package/es/components/APIKeyModal/APIKeyModal.js +25 -21
  17. package/es/components/ActionBar/ActionBar.js +5 -5
  18. package/es/components/CreateFullPage/CreateFullPage.js +4 -2
  19. package/es/components/CreateModal/CreateModal.docs-page.js +1 -1
  20. package/es/components/CreateModal/CreateModal.js +2 -1
  21. package/es/components/CreateSidePanel/CreateSidePanel.docs-page.js +1 -1
  22. package/es/components/CreateSidePanel/CreateSidePanel.js +6 -2
  23. package/es/components/CreateTearsheet/CreateTearsheet.js +3 -1
  24. package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +6 -2
  25. package/es/components/Datagrid/Datagrid/Datagrid.js +5 -1
  26. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +15 -21
  27. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +6 -20
  28. package/es/components/Datagrid/Datagrid.docs-page.js +123 -0
  29. package/es/components/Datagrid/Extensions/ColumnAlignment/ColumnAlignment.docs-page.js +13 -0
  30. package/es/components/Datagrid/Extensions/ColumnCustomization/ColumnCustomization.docs-page.js +13 -0
  31. package/es/components/Datagrid/Extensions/EditableCell/EditableCell.docs-page.js +47 -0
  32. package/es/components/Datagrid/Extensions/ExpandableRow/ExpandableRow.docs-page.js +13 -0
  33. package/es/components/Datagrid/Extensions/Filtering/Filtering.docs-page.js +57 -0
  34. package/es/components/Datagrid/Extensions/RowActionButtons/RowActionButtons.docs-page.js +13 -0
  35. package/es/components/Datagrid/utils/DatagridActions.js +1 -1
  36. package/es/components/Datagrid/utils/getArgTypes.js +4 -0
  37. package/es/components/EditSidePanel/EditSidePanel.js +6 -2
  38. package/es/components/FilterSummary/FilterSummary.js +7 -3
  39. package/es/components/OptionsTile/OptionsTile.js +8 -1
  40. package/es/components/Tearsheet/TearsheetShell.js +2 -1
  41. package/es/global/js/hooks/useResizeObserver.js +1 -1
  42. package/es/global/js/utils/StoryDocsPage.js +6 -2
  43. package/lib/components/APIKeyModal/APIKeyModal.js +25 -21
  44. package/lib/components/ActionBar/ActionBar.js +5 -5
  45. package/lib/components/CreateFullPage/CreateFullPage.js +4 -2
  46. package/lib/components/CreateModal/CreateModal.docs-page.js +1 -1
  47. package/lib/components/CreateModal/CreateModal.js +2 -1
  48. package/lib/components/CreateSidePanel/CreateSidePanel.docs-page.js +1 -1
  49. package/lib/components/CreateSidePanel/CreateSidePanel.js +6 -2
  50. package/lib/components/CreateTearsheet/CreateTearsheet.js +3 -1
  51. package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +6 -2
  52. package/lib/components/Datagrid/Datagrid/Datagrid.js +5 -1
  53. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +14 -20
  54. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +6 -23
  55. package/lib/components/Datagrid/Datagrid.docs-page.js +134 -0
  56. package/lib/components/Datagrid/Extensions/ColumnAlignment/ColumnAlignment.docs-page.js +21 -0
  57. package/lib/components/Datagrid/Extensions/ColumnCustomization/ColumnCustomization.docs-page.js +21 -0
  58. package/lib/components/Datagrid/Extensions/EditableCell/EditableCell.docs-page.js +55 -0
  59. package/lib/components/Datagrid/Extensions/ExpandableRow/ExpandableRow.docs-page.js +21 -0
  60. package/lib/components/Datagrid/Extensions/Filtering/Filtering.docs-page.js +65 -0
  61. package/lib/components/Datagrid/Extensions/RowActionButtons/RowActionButtons.docs-page.js +21 -0
  62. package/lib/components/Datagrid/utils/DatagridActions.js +1 -1
  63. package/lib/components/Datagrid/utils/getArgTypes.js +4 -0
  64. package/lib/components/EditSidePanel/EditSidePanel.js +6 -2
  65. package/lib/components/FilterSummary/FilterSummary.js +7 -3
  66. package/lib/components/OptionsTile/OptionsTile.js +8 -1
  67. package/lib/components/Tearsheet/TearsheetShell.js +2 -1
  68. package/lib/global/js/hooks/useResizeObserver.js +1 -1
  69. package/lib/global/js/utils/StoryDocsPage.js +6 -2
  70. package/package.json +16 -16
  71. package/scss/components/Datagrid/_datagrid.scss +17 -10
  72. package/scss/components/FilterSummary/_storybook-styles.scss +2 -0
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DocsPage = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _StoryDocsPage = require("../../../../global/js/utils/StoryDocsPage");
10
+ var DocsPage = function DocsPage() {
11
+ return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
12
+ blocks: [{
13
+ title: 'Customizing columns',
14
+ 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 ",
15
+ source: {
16
+ 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 "
17
+ }
18
+ }]
19
+ });
20
+ };
21
+ exports.DocsPage = DocsPage;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DocsPage = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _StoryDocsPage = require("../../../../global/js/utils/StoryDocsPage");
10
+ var _EditableCell = require("./EditableCell.stories");
11
+ var DocsPage = function DocsPage() {
12
+ return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
13
+ blocks: [{
14
+ 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)."
15
+ }, {
16
+ description: "Below are example column configurations for the supported inline edit data types:\n \nDefault/string:\n ",
17
+ source: {
18
+ language: 'json',
19
+ 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 "
20
+ }
21
+ }, {
22
+ description: 'Number',
23
+ source: {
24
+ language: 'json',
25
+ 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 "
26
+ }
27
+ }, {
28
+ description: 'Date',
29
+ source: {
30
+ language: 'json',
31
+ 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 "
32
+ }
33
+ }, {
34
+ description: 'Selection',
35
+ source: {
36
+ language: 'json',
37
+ 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 "
38
+ }
39
+ }, {
40
+ 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:",
41
+ source: {
42
+ 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 "
43
+ },
44
+ story: _EditableCell.EditableCellUsageStory
45
+ }, {
46
+ title: 'Using deprecated useInlineEdit hook',
47
+ description: "At this time, it is possible to still use the deprecated `useInlineEdit` hook but requires setting a feature flag. See example below:",
48
+ source: {
49
+ 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 "
50
+ },
51
+ story: _EditableCell.InlineEditUsageStory
52
+ }]
53
+ });
54
+ };
55
+ exports.DocsPage = DocsPage;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DocsPage = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _StoryDocsPage = require("../../../../global/js/utils/StoryDocsPage");
10
+ var DocsPage = function DocsPage() {
11
+ return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
12
+ blocks: [{
13
+ description: "The `Datagrid` supports expandable rows with the use of the `useExpandedRow` hook.",
14
+ source: {
15
+ language: 'jsx',
16
+ 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 "
17
+ }
18
+ }]
19
+ });
20
+ };
21
+ exports.DocsPage = DocsPage;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DocsPage = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _StoryDocsPage = require("../../../../global/js/utils/StoryDocsPage");
10
+ var DocsPage = function DocsPage() {
11
+ return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
12
+ blocks: [{
13
+ title: 'Filtering',
14
+ 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 "
15
+ }, {
16
+ 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."
17
+ }, {
18
+ 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."
19
+ }, {
20
+ description: "[Check out the Guidance here.](https://pages.github.ibm.com/cdai-design/pal/components/data-table/filters/)"
21
+ }, {
22
+ subTitle: 'Preparing your column headers'
23
+ }, {
24
+ description: 'To utilize filtering, you have to add some extra properties into your headers that are going to be filtered.'
25
+ }, {
26
+ 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 "
27
+ }, {
28
+ 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)",
29
+ source: {
30
+ code: "\n{\n Header: 'Joined',\n accessor: 'joined',\n filter: 'date',\n Cell: ({ cell: { value } }) => <span>{value.toLocaleDateString()}</span>,\n},\n "
31
+ }
32
+ }, {
33
+ description: "The different types of filters are:\n- text (default)\n- date\n- number\n- checkbox\n- radio\n- dropdown\n ",
34
+ source: {
35
+ 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 "
36
+ }
37
+ }, {
38
+ subTitle: 'Store you data into state, this can also come from an API',
39
+ source: {
40
+ 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 "
41
+ }
42
+ }, {
43
+ subTitle: 'Create your filters for flyout variant',
44
+ 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 ",
45
+ source: {
46
+ 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 "
47
+ }
48
+ }, {
49
+ subTitle: 'Create your filters for panel variant',
50
+ description: 'Filter panel coming soon.'
51
+ }, {
52
+ subTitle: 'Putting it all together',
53
+ source: {
54
+ 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 "
55
+ }
56
+ }, {
57
+ subTitle: "`filterProps` types",
58
+ source: {
59
+ language: 'json',
60
+ 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 "
61
+ }
62
+ }]
63
+ });
64
+ };
65
+ exports.DocsPage = DocsPage;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.DocsPage = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _StoryDocsPage = require("../../../../global/js/utils/StoryDocsPage");
10
+ var DocsPage = function DocsPage() {
11
+ return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
12
+ blocks: [{
13
+ title: 'Actions column',
14
+ 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 ",
15
+ source: {
16
+ 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} />;"
17
+ }
18
+ }]
19
+ });
20
+ };
21
+ exports.DocsPage = DocsPage;
@@ -134,7 +134,7 @@ var DatagridActions = function DatagridActions(datagridState) {
134
134
  hasDivider: true,
135
135
  requireTitle: true
136
136
  }))) : !mobileToolbar ? /*#__PURE__*/_react2.default.createElement(_react.TableToolbarContent, null, renderFilterPanelButton(), /*#__PURE__*/_react2.default.createElement(_react.TableToolbarSearch, {
137
- size: "xl",
137
+ size: "lg",
138
138
  id: "columnSearch",
139
139
  persistent: true,
140
140
  placeHolderText: searchForAColumn,
@@ -52,6 +52,10 @@ var ARG_TYPES = {
52
52
  control: 'select',
53
53
  options: ['sm', 'lg']
54
54
  },
55
+ isFetching: {
56
+ control: 'radio',
57
+ options: [true, false]
58
+ },
55
59
  useDenseHeader: {
56
60
  control: {
57
61
  type: 'radio'
@@ -16,6 +16,7 @@ var _settings = require("../../settings");
16
16
  var _react2 = require("@carbon/react");
17
17
  var _SidePanel = require("../SidePanel");
18
18
  require("../../global/js/utils/props-helper");
19
+ var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
19
20
  var _excluded = ["children", "className", "disableSubmit", "formTitle", "formDescription", "onRequestClose", "onRequestSubmit", "open", "placement", "primaryButtonText", "secondaryButtonText", "selectorPrimaryFocus", "selectorPageContent", "size", "slideIn", "subtitle", "title"];
20
21
  /**
21
22
  * Copyright IBM Corp. 2021, 2021
@@ -78,6 +79,7 @@ var EditSidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
78
79
  onClick: onRequestClose,
79
80
  kind: 'secondary'
80
81
  }];
82
+ var formTitleId = (0, _uuidv.default)();
81
83
  return /*#__PURE__*/_react.default.createElement(_SidePanel.SidePanel, (0, _extends2.default)({}, rest, _objectSpread({
82
84
  open: open,
83
85
  ref: ref,
@@ -95,11 +97,13 @@ var EditSidePanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
95
97
  preventCloseOnClickOutside: true,
96
98
  actions: actions
97
99
  }), formTitle && /*#__PURE__*/_react.default.createElement("h3", {
100
+ id: formTitleId,
98
101
  className: "".concat(blockClass, "__form-title-text ").concat(blockClass, "__content-text")
99
102
  }, formTitle), formDescription && /*#__PURE__*/_react.default.createElement("p", {
100
103
  className: "".concat(blockClass, "__form-description-text ").concat(blockClass, "__content-text")
101
104
  }, formDescription), /*#__PURE__*/_react.default.createElement(_react2.Form, {
102
- className: "".concat(blockClass, "__form")
105
+ className: "".concat(blockClass, "__form"),
106
+ "aria-labelledby": formTitleId
103
107
  }, children));
104
108
  });
105
109
 
@@ -135,7 +139,7 @@ EditSidePanel.propTypes = {
135
139
  /**
136
140
  * Specifies a required field that provides a title for a form
137
141
  */
138
- formTitle: _propTypes.default.node,
142
+ formTitle: _propTypes.default.node.isRequired,
139
143
  /**
140
144
  * Specifies an optional handler which is called when the CreateSidePanel
141
145
  * is closed.
@@ -27,13 +27,16 @@ var FilterSummary = /*#__PURE__*/_react2.default.forwardRef(function (_ref, ref)
27
27
  _ref$clearFilters = _ref.clearFilters,
28
28
  clearFilters = _ref$clearFilters === void 0 ? function () {} : _ref$clearFilters,
29
29
  _ref$filters = _ref.filters,
30
- filters = _ref$filters === void 0 ? [] : _ref$filters;
30
+ filters = _ref$filters === void 0 ? [] : _ref$filters,
31
+ _ref$renderLabel = _ref.renderLabel,
32
+ renderLabel = _ref$renderLabel === void 0 ? null : _ref$renderLabel;
31
33
  var tagFilters = filters.map(function (_ref2) {
34
+ var _renderLabel;
32
35
  var key = _ref2.key,
33
36
  value = _ref2.value;
34
37
  return {
35
38
  type: 'gray',
36
- label: "".concat(key, ": ").concat(value)
39
+ label: (_renderLabel = renderLabel === null || renderLabel === void 0 ? void 0 : renderLabel(key, value)) !== null && _renderLabel !== void 0 ? _renderLabel : "".concat(key, ": ").concat(value)
37
40
  };
38
41
  });
39
42
  return /*#__PURE__*/_react2.default.createElement("div", {
@@ -57,7 +60,8 @@ FilterSummary.propTypes = {
57
60
  className: _propTypes.default.string,
58
61
  clearFilters: _propTypes.default.func.isRequired,
59
62
  clearFiltersText: _propTypes.default.string,
60
- filters: _propTypes.default.arrayOf(_propTypes.default.object).isRequired
63
+ filters: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
64
+ renderLabel: _propTypes.default.func
61
65
  };
62
66
  var _default = FilterSummary;
63
67
  exports.default = _default;
@@ -233,7 +233,14 @@ var OptionsTile = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
233
233
  })), isExpandable ? /*#__PURE__*/_react.default.createElement("details", {
234
234
  open: isOpen,
235
235
  ref: detailsRef
236
- }, /*#__PURE__*/_react.default.createElement("summary", {
236
+ },
237
+ /*#__PURE__*/
238
+ /* summary should not be considered non-interactive
239
+ * https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/656
240
+ * https://github.com/A11yance/axobject-query/issues/319
241
+ */
242
+ /* eslint-disable jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */
243
+ _react.default.createElement("summary", {
237
244
  className: "".concat(blockClass, "__header"),
238
245
  onClick: toggle
239
246
  }, /*#__PURE__*/_react.default.createElement(_icons.ChevronDown, {
@@ -270,7 +270,8 @@ var TearsheetShell = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
270
270
  actions: actions,
271
271
  buttonSize: wide ? '2xl' : null,
272
272
  className: "".concat(bc, "__buttons"),
273
- size: wide ? '2xl' : 'lg'
273
+ size: wide ? '2xl' : 'lg',
274
+ "aria-hidden": !open
274
275
  })))), /*#__PURE__*/_react.default.createElement("div", {
275
276
  className: "".concat(bc, "__resize-detector"),
276
277
  ref: resizer
@@ -60,7 +60,7 @@ var useResizeObserver = function useResizeObserver(ref, callback) {
60
60
  observer = null;
61
61
  };
62
62
  // eslint-disable-next-line react-hooks/exhaustive-deps
63
- }, [ref]);
63
+ }, [ref.current]);
64
64
  return {
65
65
  width: width,
66
66
  height: height
@@ -30,7 +30,7 @@ var CustomBlocks = function CustomBlocks(_ref) {
30
30
  key: "block-index--".concat(index)
31
31
  }, block.title && /*#__PURE__*/_react.default.createElement("h3", {
32
32
  id: (0, _changeCase.paramCase)(block.title)
33
- }, block.title), block.subTitle && /*#__PURE__*/_react.default.createElement("h4", null, block.subTitle), block.description && typeof block.description === 'string' ? /*#__PURE__*/_react.default.createElement(_blocks.Description, null, block.description) : block.description, block.story && /*#__PURE__*/_react.default.createElement(_blocks.Canvas, {
33
+ }, block.title), block.subTitle && /*#__PURE__*/_react.default.createElement("h4", null, block.subTitle), block.image, block.description && typeof block.description === 'string' ? /*#__PURE__*/_react.default.createElement(_blocks.Description, null, block.description) : block.description, block.story && /*#__PURE__*/_react.default.createElement(_blocks.Canvas, {
34
34
  of: block.story
35
35
  }), block.source && /*#__PURE__*/_react.default.createElement(_blocks.Source, source));
36
36
  });
@@ -201,6 +201,10 @@ StoryDocsPage.propTypes = {
201
201
  * Optional description, strings treated as markdown.
202
202
  */
203
203
  description: _propTypes.default.node,
204
+ /**
205
+ * Optional block image
206
+ */
207
+ image: _propTypes.default.node,
204
208
  /**
205
209
  * Story imported from story file
206
210
  */
@@ -210,7 +214,7 @@ StoryDocsPage.propTypes = {
210
214
  * default language `jsx`
211
215
  */
212
216
  source: _propTypes.default.shape({
213
- language: _propTypes.default.oneOf('javascript', 'css', 'jsx'),
217
+ language: _propTypes.default.oneOf('javascript', 'css', 'jsx', 'json'),
214
218
  code: _propTypes.default.string
215
219
  })
216
220
  })),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.3.1",
4
+ "version": "2.4.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -54,27 +54,27 @@
54
54
  "upgrade-dependencies": "npm-check-updates -u --dep dev,peer,prod --color --reject '/(carbon|^react$|^react-dom$|^chalk$|^react-dnd|^namor)/'"
55
55
  },
56
56
  "devDependencies": {
57
- "@babel/cli": "^7.21.5",
58
- "@babel/core": "^7.22.1",
59
- "babel-preset-ibm-cloud-cognitive": "^0.14.36",
57
+ "@babel/cli": "^7.22.5",
58
+ "@babel/core": "^7.22.5",
59
+ "babel-preset-ibm-cloud-cognitive": "^0.14.37",
60
60
  "chalk": "^4.1.2",
61
61
  "change-case": "^4.1.2",
62
62
  "copyfiles": "^2.4.1",
63
63
  "cross-env": "^7.0.3",
64
64
  "fs-extra": "^11.1.1",
65
- "glob": "^10.2.6",
65
+ "glob": "^10.3.1",
66
66
  "jest": "^29.5.0",
67
- "jest-config-ibm-cloud-cognitive": "^0.24.23",
67
+ "jest-config-ibm-cloud-cognitive": "^0.24.24",
68
68
  "jest-environment-jsdom": "^29.5.0",
69
69
  "namor": "^1.1.2",
70
- "npm-check-updates": "^16.10.12",
70
+ "npm-check-updates": "^16.10.13",
71
71
  "npm-run-all": "^4.1.5",
72
72
  "rimraf": "^5.0.1",
73
- "sass": "^1.62.1",
73
+ "sass": "^1.63.6",
74
74
  "yargs": "^17.7.2"
75
75
  },
76
76
  "dependencies": {
77
- "@babel/runtime": "^7.22.3",
77
+ "@babel/runtime": "^7.22.5",
78
78
  "@carbon/telemetry": "^0.1.0",
79
79
  "framer-motion": "^6.5.1 < 7",
80
80
  "immutability-helper": "^3.1.1",
@@ -85,14 +85,14 @@
85
85
  "react-window": "^1.8.9"
86
86
  },
87
87
  "peerDependencies": {
88
- "@carbon/grid": "^11.15.0",
89
- "@carbon/layout": "^11.15.0",
90
- "@carbon/motion": "^11.12.0",
91
- "@carbon/react": "^1.31.3",
92
- "@carbon/themes": "^11.20.0",
93
- "@carbon/type": "^11.19.0",
88
+ "@carbon/grid": "^11.16.1",
89
+ "@carbon/layout": "^11.16.1",
90
+ "@carbon/motion": "^11.13.1",
91
+ "@carbon/react": "^1.33.2",
92
+ "@carbon/themes": "^11.21.1",
93
+ "@carbon/type": "^11.20.1",
94
94
  "react": "^16.8.6 || ^17.0.1",
95
95
  "react-dom": "^16.8.6 || ^17.0.1"
96
96
  },
97
- "gitHead": "65c475a4fc38ce8ba3cc285e9f646df8d4bc2499"
97
+ "gitHead": "ce43460f28f908aeb8ec4bfb2c501dd457d11a58"
98
98
  }
@@ -7,6 +7,7 @@
7
7
 
8
8
  // Standard imports.
9
9
  @use '@carbon/styles/scss/spacing' as *;
10
+ @use '@carbon/styles/scss/theme' as *;
10
11
  @use '../../global/styles/project-settings' as c4p-settings;
11
12
  @use '../../global/styles/mixins';
12
13
 
@@ -33,19 +34,25 @@ $block-class: #{c4p-settings.$pkg-prefix}--datagrid;
33
34
  :global(.#{c4p-settings.$carbon-prefix}--checkbox) {
34
35
  display: none;
35
36
  }
37
+ }
36
38
 
37
- .#{c4p-settings.$carbon-prefix}--overflow-menu-options
38
- > .#{c4p-settings.$pkg-prefix}--datagrid__row-size-dropdown {
39
- left: $spacing-01;
40
- width: 112px;
41
- }
39
+ .#{$block-class}
40
+ .#{c4p-settings.$pkg-prefix}--datagrid__row-size-options-container
41
+ .#{c4p-settings.$carbon-prefix}--popover-container
42
+ .#{c4p-settings.$carbon-prefix}--btn--icon-only {
43
+ display: flex;
44
+ width: $spacing-09;
45
+ height: $spacing-09;
46
+ align-items: center;
47
+ justify-content: center;
48
+ padding-top: 0;
42
49
  }
43
50
 
44
- .#{$block-class}__datagridWrap
45
- .#{c4p-settings.$carbon-prefix}--overflow-menu-options
46
- > .#{c4p-settings.$pkg-prefix}--datagrid__row-size-dropdown {
47
- left: $spacing-01;
48
- width: 112px;
51
+ .#{$block-class}
52
+ .#{c4p-settings.$pkg-prefix}--datagrid__row-size-options-container
53
+ .#{c4p-settings.$pkg-prefix}--datagrid__row-size-dropdown {
54
+ padding: $spacing-05;
55
+ background-color: $layer;
49
56
  }
50
57
 
51
58
  .#{$block-class}__datagridWrap-simple {
@@ -4,6 +4,8 @@
4
4
  // This source code is licensed under the Apache-2.0 license found in the
5
5
  // LICENSE file in the root directory of this source tree.
6
6
  //
7
+ @use '../../global/styles/display-box' as *;
8
+
7
9
  #root {
8
10
  width: 100%;
9
11
  }