Skip to content

Commit

Permalink
DataViews: remove onDetailsChange event (#60387)
Browse files Browse the repository at this point in the history
Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
  • Loading branch information
3 people authored Apr 3, 2024
1 parent 6b78b7d commit 5406de6
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 43 deletions.
4 changes: 4 additions & 0 deletions packages/dataviews/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Breaking changes

- Removed the `onDetailsChange` event only available for the list layout. We are looking into adding actions to the list layout, including primary ones.

## 0.9.0 (2024-04-03)

### Enhancement
Expand Down
4 changes: 0 additions & 4 deletions packages/dataviews/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,6 @@ Whether the items should be rendered asynchronously. Useful when there's a field

Callback that signals the user selected one of more items, and takes them as parameter. So far, only the `list` view implements it.

### `onDetailsChange`: `function`

Callback that signals the user triggered the details for one of more items, and takes them as paremeter. So far, only the `list` view implements it.

## Types

### Layouts
Expand Down
2 changes: 0 additions & 2 deletions packages/dataviews/src/dataviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default function DataViews( {
paginationInfo,
supportedLayouts,
onSelectionChange = defaultOnSelectionChange,
onDetailsChange = null,
deferredRendering = false,
} ) {
const [ selection, setSelection ] = useState( [] );
Expand Down Expand Up @@ -136,7 +135,6 @@ export default function DataViews( {
getItemId={ getItemId }
isLoading={ isLoading }
onSelectionChange={ onSetSelection }
onDetailsChange={ onDetailsChange }
selection={ selection }
deferredRendering={ deferredRendering }
setOpenedFilter={ setOpenedFilter }
Expand Down
20 changes: 0 additions & 20 deletions packages/dataviews/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -492,26 +492,6 @@
justify-content: space-between;
}

.dataviews-view-list__details-button {
align-self: center;
opacity: 0;
}

li.is-selected,
li:hover,
li:focus-within {
.dataviews-view-list__details-button {
opacity: 1;
}
}

li.is-selected {
.dataviews-view-list__details-button {
&:focus {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) currentColor;
}
}
}
}

.dataviews-action-modal {
Expand Down
17 changes: 0 additions & 17 deletions packages/dataviews/src/view-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ import {
__experimentalHStack as HStack,
__experimentalVStack as VStack,
privateApis as componentsPrivateApis,
Button,
Spinner,
VisuallyHidden,
} from '@wordpress/components';
import { useCallback, useEffect, useRef } from '@wordpress/element';
import { info } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';

/**
Expand All @@ -36,7 +34,6 @@ function ListItem( {
item,
isSelected,
onSelect,
onDetailsChange,
mediaField,
primaryField,
visibleFields,
Expand Down Expand Up @@ -118,18 +115,6 @@ function ListItem( {
</HStack>
</CompositeItem>
</div>
{ onDetailsChange && (
<div role="gridcell">
<CompositeItem
render={ <Button /> }
className="dataviews-view-list__details-button"
onClick={ () => onDetailsChange( [ item ] ) }
icon={ info }
label={ __( 'View details' ) }
size="compact"
/>
</div>
) }
</HStack>
</CompositeRow>
);
Expand All @@ -142,7 +127,6 @@ export default function ViewList( {
isLoading,
getItemId,
onSelectionChange,
onDetailsChange,
selection,
deferredRendering,
id: preferredId,
Expand Down Expand Up @@ -215,7 +199,6 @@ export default function ViewList( {
item={ item }
isSelected={ item === selectedItem }
onSelect={ onSelect }
onDetailsChange={ onDetailsChange }
mediaField={ mediaField }
primaryField={ primaryField }
visibleFields={ visibleFields }
Expand Down

1 comment on commit 5406de6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 5406de6.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8535188800
📝 Reported issues:

Please sign in to comment.