diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 524ba16e6e..0000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,2 +0,0 @@ -# https://github.com/probot/stale#usage cspell:words wontfix -staleLabel: 'status: wontfix' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000000..8d141cba82 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,23 @@ +name: Stale # close stale issues +on: + schedule: + - cron: '30 7 * * 4' # runs 7:30 on Thursdays + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v8 + with: + any-of-labels: + 'status: needs reproduction,status: waiting for author πŸ’¬' + stale-issue-message: | + This issue is stale because it has been open for 30 days with no activity. + Remove the stale label or add a comment, otherwise this issue will be closed in 14 days. + close-issue-message: | + This issue was closed because it has received no activity for 14 days. + stale-issue-label: 'stale 🍞' + close-issue-label: 'status: won’t fix πŸ”š' + days-before-stale: 30 + days-before-close: 14 + days-before-pr-close: -1 diff --git a/packages/ibm-products/package.json b/packages/ibm-products/package.json index ebe7ee2ab6..6eabf29fde 100644 --- a/packages/ibm-products/package.json +++ b/packages/ibm-products/package.json @@ -57,9 +57,6 @@ "devDependencies": { "@babel/cli": "^7.22.10", "@babel/core": "^7.22.10", - "@dnd-kit/core": "^6.0.8", - "@dnd-kit/sortable": "^7.0.2", - "@dnd-kit/utilities": "^3.2.1", "babel-preset-ibm-cloud-cognitive": "^0.14.39", "chalk": "^4.1.2", "change-case": "^4.1.2", @@ -80,6 +77,9 @@ "dependencies": { "@babel/runtime": "^7.22.10", "@carbon/telemetry": "^0.1.0", + "@dnd-kit/core": "^6.0.8", + "@dnd-kit/sortable": "^7.0.2", + "@dnd-kit/utilities": "^3.2.1", "framer-motion": "^6.5.1 < 7", "immutability-helper": "^3.1.1", "lodash": "^4.17.21", diff --git a/packages/ibm-products/src/components/Datagrid/Datagrid.test.js b/packages/ibm-products/src/components/Datagrid/Datagrid.test.js index 400b2afc78..f7cf1c61b2 100644 --- a/packages/ibm-products/src/components/Datagrid/Datagrid.test.js +++ b/packages/ibm-products/src/components/Datagrid/Datagrid.test.js @@ -2239,6 +2239,10 @@ describe('batch action testing', () => { screen.getByLabelText(getBatchActions()[0].label); screen.getByLabelText(getBatchActions()[1].label); const menuButton = screen.getByRole('button', { name: /More/i }); + const cancelButton = screen.getByRole('button', { name: /Cancel/i }); + const selectAllButton = screen.getByRole('button', { + name: /Select all/i, + }); expect(menuButton).toBeInTheDocument(); await act(() => click(menuButton)); const options = Array.from( @@ -2254,6 +2258,11 @@ describe('batch action testing', () => { remainingBatchActions.forEach((batchAction, index) => { expect(batchAction.label).toEqual(optionsText[index]); }); + + //coverage + fireEvent.click(options[0]); + fireEvent.click(cancelButton); + fireEvent.click(selectAllButton); }); }); }); diff --git a/packages/ibm-products/src/components/Datagrid/Datagrid/DatagridToolbar.js b/packages/ibm-products/src/components/Datagrid/Datagrid/DatagridToolbar.js index eb17d62758..7014c9ab58 100644 --- a/packages/ibm-products/src/components/Datagrid/Datagrid/DatagridToolbar.js +++ b/packages/ibm-products/src/components/Datagrid/Datagrid/DatagridToolbar.js @@ -1,5 +1,5 @@ /** - * Copyright IBM Corp. 2022, 2023 + * Copyright IBM Corp. 2021, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. @@ -80,9 +80,17 @@ const DatagridBatchActionsToolbar = (datagridState, width, ref) => { // Do not render ButtonMenu when there are 3 or less items // and if there is enough available space to render all the items if (toolbarBatchActions?.length <= 3 && !displayAllInMenu) { - return null; + return; } + const renderItem = (batchAction, index) => ( + onClickHandler(event, batchAction)} + /> + ); + return ( { > {toolbarBatchActions && toolbarBatchActions.map((batchAction, index) => { - if (index < 2) { - if (displayAllInMenu) { - return ( - { - batchAction.onClick(getSelectedRowData(), event); - if (batchAction.type === 'select_all') { - toggleAllRowsSelected(true); - } - }} - /> - ); - } - return null; + if (index < 2 && !displayAllInMenu) { + return; } - return ( - { - batchAction.onClick(getSelectedRowData(), event); - if (batchAction.type === 'select_all') { - toggleAllRowsSelected(true); - } - }} - /> - ); + return renderItem(batchAction, index); })} ); }; + const onClickHandler = (event, batchAction) => { + batchAction.onClick(getSelectedRowData(), event); + if (batchAction.type === 'select_all') { + toggleAllRowsSelected(true); + } + }; + + const onCancelHandler = () => { + toggleAllRowsSelected(false); + setGlobalFilter(null); + }; + + const onSelectAllHandler = () => { + toggleAllRowsSelected(true); + onSelectAllRows?.(true); + }; + // Only display the first two batch actions, the rest are // displayed inside of the ButtonMenu if there are more than // 3 batch actions @@ -134,14 +134,8 @@ const DatagridBatchActionsToolbar = (datagridState, width, ref) => { 0} totalSelected={totalSelected} - onCancel={() => { - toggleAllRowsSelected(false); - setGlobalFilter(null); - }} - onSelectAll={() => { - toggleAllRowsSelected(true); - onSelectAllRows?.(true); - }} + onCancel={onCancelHandler} + onSelectAll={onSelectAllHandler} totalCount={rows && rows.length} > {!displayAllInMenu && @@ -155,12 +149,7 @@ const DatagridBatchActionsToolbar = (datagridState, width, ref) => { { - batchAction.onClick(getSelectedRowData(), event); - if (batchAction.type === 'select_all') { - toggleAllRowsSelected(true); - } - }} + onClick={(event) => onClickHandler(batchAction, event)} iconDescription={batchAction.label} > {batchAction.label} diff --git a/packages/ibm-products/src/components/Datagrid/_datagrid.scss b/packages/ibm-products/src/components/Datagrid/_datagrid.scss index e77288d002..f93d19bb6b 100644 --- a/packages/ibm-products/src/components/Datagrid/_datagrid.scss +++ b/packages/ibm-products/src/components/Datagrid/_datagrid.scss @@ -31,6 +31,7 @@ $block-class: #{c4p-settings.$pkg-prefix}--datagrid; .#{$block-class}__datagridWrap { display: block; width: 100%; + :global(.#{c4p-settings.$carbon-prefix}--checkbox) { display: none; } @@ -70,3 +71,11 @@ $block-class: #{c4p-settings.$pkg-prefix}--datagrid; } } } + +// firefox fix for issue mentioned in 3442 +.#{$block-class} + .#{c4p-settings.$carbon-prefix}--menu-button__trigger:not( + .#{c4p-settings.$carbon-prefix}--btn--ghost + ) { + min-width: auto; +} diff --git a/packages/ibm-products/src/components/Datagrid/styles/_datagrid.scss b/packages/ibm-products/src/components/Datagrid/styles/_datagrid.scss index db5c5c474c..66ac139296 100644 --- a/packages/ibm-products/src/components/Datagrid/styles/_datagrid.scss +++ b/packages/ibm-products/src/components/Datagrid/styles/_datagrid.scss @@ -6,6 +6,7 @@ // @use '@carbon/styles/scss/theme' as *; +@use '@carbon/layout/scss/convert' as *; @use '@carbon/styles/scss/spacing' as *; @use '@carbon/react/scss/components/button/tokens' as *; @use '../../../global/styles/project-settings' as c4p-settings; diff --git a/packages/ibm-products/src/components/Datagrid/styles/addons/_FilterFlyout.scss b/packages/ibm-products/src/components/Datagrid/styles/addons/_FilterFlyout.scss index 3f1b3e361f..c3641383b2 100644 --- a/packages/ibm-products/src/components/Datagrid/styles/addons/_FilterFlyout.scss +++ b/packages/ibm-products/src/components/Datagrid/styles/addons/_FilterFlyout.scss @@ -9,6 +9,7 @@ // stylelint-disable carbon/layout-token-use @use '@carbon/styles/scss/theme' as *; +@use '@carbon/layout/scss/convert' as *; @use '@carbon/styles/scss/spacing' as *; @use '@carbon/styles/scss/type' as *; @use '@carbon/layout' as *; diff --git a/packages/ibm-products/src/components/Datagrid/styles/addons/_FilterPanel.scss b/packages/ibm-products/src/components/Datagrid/styles/addons/_FilterPanel.scss index c7c9634c74..fea6b0256e 100644 --- a/packages/ibm-products/src/components/Datagrid/styles/addons/_FilterPanel.scss +++ b/packages/ibm-products/src/components/Datagrid/styles/addons/_FilterPanel.scss @@ -8,6 +8,7 @@ @use '../variables' as *; @use '@carbon/styles/scss/theme' as *; +@use '@carbon/layout/scss/convert' as *; @use '@carbon/styles/scss/spacing' as *; @use '@carbon/styles/scss/type' as *; @use '../../../../global/styles/project-settings' as c4p-settings; diff --git a/packages/ibm-products/src/components/Datagrid/utils/DatagridActions.js b/packages/ibm-products/src/components/Datagrid/utils/DatagridActions.js index 9977896965..211815f931 100644 --- a/packages/ibm-products/src/components/Datagrid/utils/DatagridActions.js +++ b/packages/ibm-products/src/components/Datagrid/utils/DatagridActions.js @@ -1,5 +1,5 @@ /** - * Copyright IBM Corp. 2020, 2022 + * Copyright IBM Corp. 2020, 2023 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/ibm-products/src/components/FilterSummary/_filter-summary.scss b/packages/ibm-products/src/components/FilterSummary/_filter-summary.scss index f99d8baffe..dcbf10c4c9 100644 --- a/packages/ibm-products/src/components/FilterSummary/_filter-summary.scss +++ b/packages/ibm-products/src/components/FilterSummary/_filter-summary.scss @@ -5,6 +5,7 @@ // LICENSE file in the root directory of this source tree. // @use '../../global/styles/project-settings' as *; +@use '@carbon/layout/scss/convert' as *; @use '@carbon/styles/scss/spacing' as *; @use '@carbon/styles/scss/theme' as *; diff --git a/packages/ibm-products/src/components/Tearsheet/Tearsheet.js b/packages/ibm-products/src/components/Tearsheet/Tearsheet.js index 441f9216ce..1af6fd9679 100644 --- a/packages/ibm-products/src/components/Tearsheet/Tearsheet.js +++ b/packages/ibm-products/src/components/Tearsheet/Tearsheet.js @@ -204,9 +204,9 @@ Tearsheet.propTypes = { open: PropTypes.bool, /** - * The DOM node the tearsheet should be rendered within. Defaults to document.body. + * The DOM element that the tearsheet should be rendered within. Defaults to document.body. */ - portalTarget: PropTypes.node, + portalTarget: PropTypes.instanceOf(Element), /** * Specify a CSS selector that matches the DOM element that should be focused when the Modal opens diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.js b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.js index 7353ca6d1e..71819f7161 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.js +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.js @@ -166,9 +166,9 @@ TearsheetNarrow.propTypes = { open: PropTypes.bool, /** - * The DOM node the tearsheet should be rendered within. Defaults to document.body. + * The DOM element that the tearsheet should be rendered within. Defaults to document.body. */ - portalTarget: PropTypes.node, + portalTarget: PropTypes.instanceOf(Element), /** * The main title of the tearsheet, displayed in the header area. diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.js b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.js index 27294f8f3a..23009e14ee 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.js +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.js @@ -476,9 +476,9 @@ TearsheetShell.propTypes = { open: PropTypes.bool, /** - * The DOM node the tearsheet should be rendered within. Defaults to document.body. + * The DOM element that the tearsheet should be rendered within. Defaults to document.body. */ - portalTarget: PropTypes.node, + portalTarget: PropTypes.instanceOf(Element), /** * Specifies the width of the tearsheet, 'narrow' or 'wide'.