Skip to content

Commit b1e4c68

Browse files
authored
#1117 Update spectrum (#1020)
1 parent fa85073 commit b1e4c68

File tree

67 files changed

+2139
-2271
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2139
-2271
lines changed

web_ui/package-lock.json

Lines changed: 1765 additions & 1762 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web_ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"polylabel": "^1.1.0",
4646
"react": "^18.3.1",
4747
"react-app-polyfill": "^3.0.0",
48-
"react-aria": "^3.39.0",
48+
"react-aria": "^3.42.0",
4949
"react-colorful": "^5.6.1",
5050
"react-cool-virtual": "^0.7.0",
5151
"react-countup": "^6.5.3",
@@ -55,7 +55,7 @@
5555
"react-notifications-component": "^4.0.1",
5656
"react-oidc-context": "^2.3.1",
5757
"react-router-dom": "^6.30.0",
58-
"react-stately": "^3.37.0",
58+
"react-stately": "^3.40.0",
5959
"react-webcam": "^7.2.0",
6060
"react-zoom-pan-pinch": "^3.7.0",
6161
"recharts": "^2.15.1",

web_ui/packages/ui/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"main": "index.ts",
66
"type": "module",
77
"dependencies": {
8-
"@adobe/react-spectrum": "^3.41.0",
9-
"react-aria-components": "^1.8.0",
10-
"@spectrum-icons/illustrations": "^3.6.17",
11-
"@spectrum-icons/workflow": "^4.2.16"
8+
"@adobe/react-spectrum": "^3.43.0",
9+
"@spectrum-icons/illustrations": "^3.6.24",
10+
"@spectrum-icons/workflow": "^4.2.23",
11+
"react-aria-components": "^1.11.0"
1212
},
1313
"devDependencies": {
1414
"@geti/config": "*",

web_ui/src/intel-admin-app/pages/organizations/organizations-statuses-picker.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const OrganizationsStatusesPicker: FC<OrganizationStatusesPickerProps> =
4646
items={STATUSES.filter(
4747
(status) => FEATURE_FLAG_REQ_ACCESS || status.name !== AccountStatus.REQUESTED_ACCESS
4848
)}
49-
onSelectionChange={handleChangedSelectedOrgStatus}
49+
onSelectionChange={(key) => key !== null && handleChangedSelectedOrgStatus(key)}
5050
aria-label={'Organizations status'}
5151
id={'organizations-filter-status-picker'}
5252
>

web_ui/src/intel-admin-app/pages/user/membership-actions/change-role-dialog.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const ChangeRoleDialogInner: FC<ChangeRoleDialogInnerProps> = ({ membership, onC
7171
items={roles}
7272
width={'100%'}
7373
selectedKey={selectedRole}
74-
onSelectionChange={handleChangeRole}
74+
onSelectionChange={(key) => key !== null && handleChangeRole(key)}
7575
>
7676
{(item) => <Item key={item.role}>{item.role}</Item>}
7777
</Picker>

web_ui/src/pages/annotator/annotation/list-item-grid.component.tsx

Lines changed: 17 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// Copyright (C) 2022-2025 Intel Corporation
22
// LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE
33

4-
import { createContext, ReactNode, RefObject, useContext, useRef, useState } from 'react';
4+
import { ReactNode } from 'react';
55

6-
import { Flex, Grid, useUnwrapDOMRef, type FlexProps } from '@geti/ui';
7-
import { useInteractOutside } from '@react-aria/interactions';
6+
import { Flex, Grid, type FlexProps } from '@geti/ui';
87
import { clsx } from 'clsx';
98

109
import classes from './list-item-grid.module.scss';
@@ -19,35 +18,6 @@ interface ListItemGridProps {
1918
onHoverStart: () => void;
2019
}
2120

22-
interface ListItemGridContextProps {
23-
isHovered: boolean;
24-
setIsHovered: (isHovered: boolean) => void;
25-
}
26-
27-
interface InteractOutsideProps {
28-
containerRef: RefObject<HTMLElement | null>;
29-
onClickOutside: () => void;
30-
}
31-
32-
const ListItemGridContext = createContext<ListItemGridContextProps>({ isHovered: false, setIsHovered: () => {} });
33-
34-
const useListItemGridContext = () => useContext(ListItemGridContext);
35-
36-
const InteractOutside = ({ containerRef, onClickOutside }: InteractOutsideProps) => {
37-
useInteractOutside({
38-
ref: containerRef,
39-
onInteractOutside: (event) => {
40-
const target = event.target as Element;
41-
if (containerRef.current?.contains(target)) {
42-
return;
43-
}
44-
// add a timeout to ensure this executes after menu-related events are processed
45-
setTimeout(onClickOutside, 0);
46-
},
47-
});
48-
return <></>;
49-
};
50-
5121
export const ListItemGrid = ({
5222
id,
5323
isLast,
@@ -57,42 +27,29 @@ export const ListItemGrid = ({
5727
onHoverStart,
5828
onHoverEnd,
5929
}: ListItemGridProps) => {
60-
const [isHovered, setIsHovered] = useState(false);
61-
62-
const handlePointerOver = () => {
63-
onHoverStart();
64-
setIsHovered(true);
65-
};
66-
67-
const handlePointerOut = () => {
68-
onHoverEnd();
69-
setIsHovered(false);
70-
};
71-
7230
return (
7331
<div
7432
id={id}
75-
onPointerOver={handlePointerOver}
76-
onPointerOut={handlePointerOut}
33+
onPointerOver={onHoverStart}
34+
onPointerOut={onHoverEnd}
7735
role={'listitem'}
7836
aria-label={ariaLabel}
7937
className={clsx({
8038
[classes.annotationItem]: true,
8139
[classes.lastAnnotationItem]: isLast,
82-
[classes.selectedAnnotation]: isSelected || isHovered,
40+
[classes.selectedAnnotation]: isSelected,
8341
})}
8442
>
85-
<ListItemGridContext.Provider value={{ isHovered, setIsHovered }}>
86-
<Grid
87-
justifyContent={'left'}
88-
alignItems={'center'}
89-
minHeight={'size-400'}
90-
columns={['auto', 'auto', '1fr', 'auto', 'auto']}
91-
areas={['checkbox color labels list-menu actions-menu']}
92-
>
93-
{children}
94-
</Grid>
95-
</ListItemGridContext.Provider>
43+
<Grid
44+
justifyContent={'left'}
45+
alignItems={'center'}
46+
minHeight={'size-400'}
47+
columns={['auto', 'auto', '1fr', 'auto', 'auto']}
48+
areas={['checkbox color labels list-menu actions-menu']}
49+
UNSAFE_className={classes.listItemGrid}
50+
>
51+
{children}
52+
</Grid>
9653
</div>
9754
);
9855
};
@@ -121,23 +78,8 @@ const Labels = ({ children, ...otherProps }: FlexProps) => {
12178
);
12279
};
12380

124-
const ListMenu = ({ children, ...otherProps }: FlexProps) => {
125-
const containerRef = useRef<null>(null);
126-
const unwrapContainerRef = useUnwrapDOMRef(containerRef);
127-
const { isHovered, setIsHovered } = useListItemGridContext();
128-
129-
if (!isHovered) {
130-
return <></>;
131-
}
132-
133-
return (
134-
<>
135-
<Flex {...otherProps} gridArea={'list-menu'} ref={containerRef}>
136-
{children}
137-
</Flex>
138-
<InteractOutside containerRef={unwrapContainerRef} onClickOutside={() => setIsHovered(false)} />
139-
</>
140-
);
81+
const ListMenu = ({ children }: FlexProps) => {
82+
return <Flex gridArea={'list-menu'}>{children}</Flex>;
14183
};
14284

14385
const ActionsMenu = ({ children, ...otherProps }: FlexProps) => {

web_ui/src/pages/annotator/annotation/list-item-grid.module.scss

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.selectedAnnotation {
1+
.selectedAnnotation,
2+
.annotationItem:hover {
23
background-color: var(--spectrum-global-color-gray-300);
34
}
45

@@ -16,3 +17,14 @@
1617
border-bottom: 1px solid var(--spectrum-global-color-gray-50);
1718
}
1819
}
20+
21+
.listItemGrid {
22+
&:not(:hover) button[aria-label='Show actions'] {
23+
visibility: hidden;
24+
}
25+
26+
&:hover button[aria-label='Show actions'],
27+
button[aria-label='Show actions'][aria-expanded='true'] {
28+
visibility: visible;
29+
}
30+
}

web_ui/src/pages/annotator/annotation/list-item-grid.test.tsx

Lines changed: 0 additions & 35 deletions
This file was deleted.

web_ui/src/pages/annotator/annotation/pose-list/content-menu.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const ContentMenu = ({ point, onUpdate }: ContentMenuProps) => {
2424
items={[option]}
2525
onAction={() => onUpdate({ ...point, isVisible: !point.isVisible })}
2626
>
27-
<ActionButton isQuiet aria-label='menu trigger'>
27+
<ActionButton isQuiet aria-label='Show actions'>
2828
<MoreMenu />
2929
</ActionButton>
3030
</MenuTrigger>

web_ui/src/pages/annotator/annotation/pose-list/content-menu.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('ContentMenu', () => {
1313

1414
render(<ContentMenu point={getMockedKeypointNode({ isVisible: true })} onUpdate={mockedOnUpdate} />);
1515

16-
fireEvent.click(screen.getByLabelText('menu trigger'));
16+
fireEvent.click(screen.getByLabelText('Show actions'));
1717
fireEvent.click(screen.getByRole('menuitem', { name: OPTION_OCCLUDED }));
1818

1919
expect(mockedOnUpdate).toHaveBeenCalledWith(expect.objectContaining({ isVisible: false }));
@@ -24,7 +24,7 @@ describe('ContentMenu', () => {
2424

2525
render(<ContentMenu point={getMockedKeypointNode({ isVisible: false })} onUpdate={mockedOnUpdate} />);
2626

27-
fireEvent.click(screen.getByLabelText('menu trigger'));
27+
fireEvent.click(screen.getByLabelText('Show actions'));
2828
fireEvent.click(screen.getByRole('menuitem', { name: OPTION_VISIBLE }));
2929

3030
expect(mockedOnUpdate).toHaveBeenCalledWith(expect.objectContaining({ isVisible: true }));

0 commit comments

Comments
 (0)