Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UnifiedFieldList] Show drag handle on item hover #173673

Merged
merged 6 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,38 @@
background: lightOrDarkTheme(transparentize($euiColorMediumShade, .9), $euiColorEmptyShade);
color: $euiColorDarkShade;
}

.unifiedFieldListItemButton__fieldIconContainer {
position: relative;
}

.unifiedFieldListItemButton__fieldIcon {
transition: opacity $euiAnimSpeedNormal ease-in-out;
}

.unifiedFieldListItemButton__fieldIconDrag {
visibility: hidden;
position: absolute;
top: 0;
left: 0;
transition: opacity $euiAnimSpeedNormal ease-in-out;
}

// A drag handle will appear only on item hover/focus
.unifiedFieldListItemButton--withDragIcon {
.unifiedFieldListItemButton__fieldIconDrag {
visibility: visible;
opacity: 0;
}

&:hover,
&[class*='-isActive'],
.domDragDrop__keyboardHandler:focus + & {
.unifiedFieldListItemButton__fieldIcon {
opacity: 0;
}
.unifiedFieldListItemButton__fieldIconDrag {
opacity: 1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const bytesField = dataView.getFieldByName('bytes')!;
const scriptedField = dataView.getFieldByName('script date')!;
const conflictField = dataView.getFieldByName('custom_user_field')!;

describe('UnifiedFieldList <FieldItemButton />', () => {
describe('UnifiedFieldList FieldItemButton', () => {
test('renders properly', () => {
const component = shallow(
<FieldItemButton
Expand Down Expand Up @@ -115,13 +115,13 @@ describe('UnifiedFieldList <FieldItemButton />', () => {
expect(component).toMatchSnapshot();
});

test('renders properly with a drag handle', () => {
test('renders properly with a drag icon', () => {
const component = shallow(
<FieldItemButton
size="xs"
className="custom"
dataTestSubj="test-subj"
dragHandle={<span>dragHandle</span>}
withDragIcon={true}
field={bytesField}
fieldSearchHighlight={undefined}
isEmpty={false}
Expand Down
Loading