Skip to content

Commit bb447d1

Browse files
authored
ITEP-66301 Move a few components from shared/components to the @geti/ui [PART 3] (#231)
1 parent 17e163c commit bb447d1

File tree

98 files changed

+181
-186
lines changed

Some content is hidden

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

98 files changed

+181
-186
lines changed

web_ui/eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default [
3838
'Slider',
3939
'Switch',
4040
'SpectrumSwitchProps',
41+
'Breadcrumb',
4142
],
4243
message: 'Use component from the @geti/ui folder instead.',
4344
},

web_ui/packages/ui/eslint.config.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,38 @@ import sharedConfig from '@geti/config/lint';
66
export default [
77
...sharedConfig,
88
{
9+
files: ['./index.ts'],
910
rules: {
1011
'no-restricted-imports': [
1112
'error',
1213
{
1314
patterns: [
1415
{
15-
group: ['./index.ts'],
16-
message: 'Do not import from barrel file, use relative imports instead.',
16+
group: ['@geti/ui'],
17+
message: 'Importing files from @geti/ui is not allowed.',
1718
},
1819
{
19-
group: ['../*/**'],
20+
group: ['../**/*'],
21+
message: 'Importing files outside of the current package is not allowed.',
22+
},
23+
],
24+
},
25+
],
26+
},
27+
},
28+
{
29+
files: ['./src/**/*.{js,jsx,ts,tsx,css,scss}'],
30+
rules: {
31+
'no-restricted-imports': [
32+
'error',
33+
{
34+
patterns: [
35+
{
36+
group: ['@geti/ui'],
37+
message: 'Importing files from @geti/ui is not allowed.',
38+
},
39+
{
40+
group: ['../../**/*'],
2041
message: 'Importing files outside of the current package is not allowed.',
2142
},
2243
],

web_ui/packages/ui/geti-type.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (C) 2022-2025 Intel Corporation
22
// LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE
33

4-
import '@rsbuild/core/types';
4+
/// <reference types="@rsbuild/core/types" />
55

66
declare module '*.svg' {
77
export const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;

web_ui/packages/ui/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,11 @@ export { SearchField } from './src/search-field/search-field.component';
1212
export { Loading } from './src/loading/loading.component';
1313
export { LoadingIndicator } from './src/loading/loading-indicator.component';
1414
export { IntelBrandedLoading } from './src/loading/intel-branded-loading.component';
15+
export { Breadcrumbs } from './src/breadcrumbs/breadcrumbs.component';
16+
export { type BreadcrumbsProps } from './src/breadcrumbs/breadcrumbs.interface';
17+
export { type BreadcrumbItemProps } from './src/breadcrumbs/breadcrumb/breadcrumb.interface';
18+
export { PasswordField } from './src/password-field/password-field.component';
19+
export { CustomPopover } from './src/custom-popover/custom-popover.component';
20+
export { PressableElement } from './src/pressable-element/pressable-element.component';
21+
export { Tag } from './src/tag/tag.component';
22+
export { Skeleton } from './src/skeleton/skeleton.component';

web_ui/src/shared/components/password-field/password-field.component.tsx renamed to web_ui/packages/ui/src/password-field/password-field.component.tsx

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

4-
import { useState } from 'react';
4+
import { ComponentProps, useState } from 'react';
55

6-
import { Flex, TextField } from '@adobe/react-spectrum';
7-
import { ActionButton } from '@geti/ui';
8-
import { View } from '@react-spectrum/view';
9-
import { SpectrumTextFieldProps } from '@react-types/textfield';
6+
import { Flex, TextField, View } from '@adobe/react-spectrum';
107

11-
import { Alert, Invisible, Visible } from '../../../assets/icons';
12-
import { idMatchingFormat } from '../../../test-utils/id-utils';
13-
import { NEW_PASSWORD_ERROR_MESSAGE } from '../../utils';
8+
// eslint-disable-next-line no-restricted-imports
9+
import { Alert, Invisible, Visible } from '../../../../src/assets/icons';
10+
import { ActionButton } from '../button/button.component';
1411

15-
import textFieldClasses from '../../../pages/user-management/profile-page/profile-page.module.scss';
1612
import classes from './password-field.module.scss';
1713

18-
interface PasswordFieldProps extends SpectrumTextFieldProps {
14+
const NEW_PASSWORD_ERROR_MESSAGE =
15+
'Password must consist of 8 - 200 characters, at least one capital letter, lower letter, digit or symbol.';
16+
17+
type TextFieldProps = ComponentProps<typeof TextField>;
18+
19+
interface PasswordFieldProps extends Omit<TextFieldProps, 'label'> {
1920
isNewPassword?: boolean;
2021
error: string;
22+
label?: string;
2123
}
2224

2325
export const PasswordField = (props: PasswordFieldProps): JSX.Element => {
@@ -28,16 +30,17 @@ export const PasswordField = (props: PasswordFieldProps): JSX.Element => {
2830
setShowPassword((prev: boolean) => !prev);
2931
};
3032

31-
const errorId = label ? `${idMatchingFormat(label as string)}-error-msg` : 'password-error-msg';
33+
const errorId = label ? `${label.split(' ').join('-').toLocaleLowerCase()}-error-msg` : 'password-error-msg';
3234

3335
return (
3436
<View UNSAFE_className={classes.passwordFieldBox} marginBottom={'size-200'} position='relative'>
3537
<View position={'relative'}>
3638
<TextField
39+
label={label}
3740
type={showPassword ? 'text' : 'password'}
3841
width='100%'
3942
UNSAFE_className={[
40-
textFieldClasses.textField,
43+
classes.textField,
4144
classes.passwordField,
4245
error ? classes.passwordFieldError : '',
4346
].join(' ')}
@@ -56,16 +59,12 @@ export const PasswordField = (props: PasswordFieldProps): JSX.Element => {
5659
</Flex>
5760
</View>
5861
{error ? (
59-
<span className={[classes.tip, classes.errorMsg].join(' ')} data-testid={errorId} id={errorId}>
62+
<span className={[classes.tip, classes.errorMsg].join(' ')} data-testid={errorId}>
6063
{error}
6164
</span>
6265
) : (
6366
isNewPassword && (
64-
<span
65-
className={[classes.tip, classes.newPassword].join(' ')}
66-
data-testid='new-password-rule-msg'
67-
id='new-password-rule-msg'
68-
>
67+
<span className={[classes.tip, classes.newPassword].join(' ')} data-testid='new-password-rule-msg'>
6968
{NEW_PASSWORD_ERROR_MESSAGE}
7069
</span>
7170
)

web_ui/src/shared/components/password-field/password-field.module.scss renamed to web_ui/packages/ui/src/password-field/password-field.module.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
position: relative;
33
}
44

5+
.textField {
6+
min-width: 38.4rem;
7+
& input {
8+
padding-left: 0;
9+
font-size: 1.6rem;
10+
line-height: 2.4rem;
11+
}
12+
}
13+
514
.passwordField input {
615
padding-right: var(--spectrum-global-dimension-size-500) !important;
716
padding-left: var(--spectrum-global-dimension-size-125);

web_ui/src/intel-admin-app/pages/organization/organization-credit-accounts.component.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
import { useState } from 'react';
55

66
import { Flex, Text, View } from '@adobe/react-spectrum';
7-
import { Button, Loading } from '@geti/ui';
7+
import { Button, Loading, Skeleton } from '@geti/ui';
88
import { Navigate } from 'react-router-dom';
99

1010
import { NewCreditAccount } from '../../../core/credits/credits.interface';
1111
import { useCreditsQueries } from '../../../core/credits/hooks/use-credits-api.hook';
1212
import { useSubscriptions } from '../../../core/credits/subscriptions/hooks/use-subscription-api.hook';
1313
import { useFeatureFlags } from '../../../core/feature-flags/hooks/use-feature-flags.hook';
1414
import { paths } from '../../../core/services/routes';
15-
import { Skeleton } from '../../../shared/components/skeleton/skeleton.component';
1615
import { Header } from '../../shared/components/header/header.component';
1716
import { CreditAccountFormDialog } from './dialogs/credit-account-form-dialog.component';
1817
import { useOrganization } from './hooks/organization.hook';

web_ui/src/intel-admin-app/pages/organization/organization-layout.component.tsx

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

4+
import { Skeleton } from '@geti/ui';
5+
46
import { paths } from '../../../core/services/routes';
5-
import { Skeleton } from '../../../shared/components/skeleton/skeleton.component';
67
import { DetailsContentLayout } from '../../shared/components/details-content-layout/details-content-layout.component';
78
import { useOrganization } from './hooks/organization.hook';
89
import { OrganizationSidebar } from './organization-sidebar.component';

web_ui/src/intel-admin-app/pages/organizations/cells/organization-name-cell.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE
33

44
import { Flex, Tooltip, TooltipTrigger } from '@adobe/react-spectrum';
5+
import { PressableElement } from '@geti/ui';
56

67
import { PhotoPlaceholder } from '../../../../shared/components/photo-placeholder/photo-placeholder.component';
7-
import { PressableElement } from '../../../../shared/components/pressable-element/pressable-element.component';
88
import { TruncatedText } from '../../../../shared/components/truncated-text/truncated-text.component';
99
import { OrganizationAdminsCopyText } from './organization-admins-copy-text.component';
1010

web_ui/src/intel-admin-app/shared/components/breadcrumbs/breadcrumbs.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
import { Flex } from '@adobe/react-spectrum';
55

6+
import { Breadcrumbs as BreadcrumbsComponent } from '../../../../../packages/ui/src/breadcrumbs/breadcrumbs.component';
7+
import { BreadcrumbsProps } from '../../../../../packages/ui/src/breadcrumbs/breadcrumbs.interface';
68
import IntelAdminBackground from '../../../../assets/images/intel-admin-app-background.webp';
7-
import { Breadcrumbs as BreadcrumbsComponent } from '../../../../shared/components/breadcrumbs/breadcrumbs.component';
8-
import { BreadcrumbsProps } from '../../../../shared/components/breadcrumbs/breadcrumbs.interface';
99

1010
import classes from './breadcrumbs.module.scss';
1111

web_ui/src/intel-admin-app/shared/components/content-layout/content-layout.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import { FC, ReactNode } from 'react';
55

66
import { View } from '@adobe/react-spectrum';
7+
import { BreadcrumbItemProps } from '@geti/ui';
78

8-
import { BreadcrumbItemProps } from '../../../../shared/components/breadcrumbs/breadcrumb/breadcrumb.interface';
99
import { Breadcrumbs } from '../breadcrumbs/breadcrumbs.component';
1010

1111
import classes from './content-layout.module.scss';

web_ui/src/intel-admin-app/shared/components/details-content-layout/details-content-layout.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import { FC, ReactNode } from 'react';
55

66
import { Grid, View } from '@adobe/react-spectrum';
7+
import { BreadcrumbItemProps } from '@geti/ui';
78
import { Outlet } from 'react-router-dom';
89

9-
import { BreadcrumbItemProps } from '../../../../shared/components/breadcrumbs/breadcrumb/breadcrumb.interface';
1010
import { Breadcrumbs } from '../breadcrumbs/breadcrumbs.component';
1111

1212
interface DetailsContentLayoutProps {

web_ui/src/intel-admin-app/shared/components/sidebar/sidebar-header.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import { FC } from 'react';
55

66
import { Flex, View } from '@adobe/react-spectrum';
7+
import { Skeleton } from '@geti/ui';
78

89
import { PhotoPlaceholder } from '../../../../shared/components/photo-placeholder/photo-placeholder.component';
9-
import { Skeleton } from '../../../../shared/components/skeleton/skeleton.component';
1010
import { TruncatedTextWithTooltip } from '../../../../shared/components/truncated-text/truncated-text.component';
1111

1212
import classes from './sidebar.module.scss';

web_ui/src/pages/annotator/annotation/annotation-filter/annotation-filter-chips.component.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
// LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE
33

44
import { Flex } from '@adobe/react-spectrum';
5-
import { ActionButton } from '@geti/ui';
5+
import { ActionButton, Tag } from '@geti/ui';
66
import { isEmpty } from 'lodash-es';
77

88
import { BorderClose } from '../../../../assets/icons';
9-
import { Tag } from '../../../../shared/components/tag/tag.component';
109
import { hasEqualId } from '../../../../shared/utils';
1110
import { useAnnotationFilters } from './use-annotation-filters.hook';
1211
import { useTaskLabels } from './use-task-labels.hook';

web_ui/src/pages/annotator/annotation/labels/label.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE
33

44
import { Flex, Tooltip, TooltipTrigger } from '@adobe/react-spectrum';
5+
import { PressableElement } from '@geti/ui';
56
import { isFunction } from 'lodash-es';
67
import { useNumberFormatter, usePress } from 'react-aria';
78

@@ -10,7 +11,6 @@ import { AnnotationLabel } from '../../../../core/annotations/annotation.interfa
1011
import { isPrediction, showLabelScore } from '../../../../core/labels/utils';
1112
import { useUsers } from '../../../../core/users/hook/use-users.hook';
1213
import { useOrganizationIdentifier } from '../../../../hooks/use-organization-identifier/use-organization-identifier.hook';
13-
import { PressableElement } from '../../../../shared/components/pressable-element/pressable-element.component';
1414
import { TruncatedText } from '../../../../shared/components/truncated-text/truncated-text.component';
1515
import { FullnameWithLoading } from '../../../../shared/components/users/fullname.component';
1616
import { idMatchingFormat } from '../../../../test-utils/id-utils';

web_ui/src/pages/annotator/components/footer/media-name-and-resolution.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE
33

44
import { Tooltip, TooltipTrigger, View } from '@adobe/react-spectrum';
5+
import { PressableElement } from '@geti/ui';
56

6-
import { PressableElement } from '../../../../shared/components/pressable-element/pressable-element.component';
77
import { trimText } from '../../../../shared/utils';
88

99
import classes from './annotator-footer.module.scss';

web_ui/src/pages/annotator/components/labels/label-search/label-search.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
import { ComponentProps, ReactNode, RefObject, useEffect, useRef } from 'react';
55

66
import { TextField } from '@adobe/react-spectrum';
7+
import { CustomPopover } from '@geti/ui';
78
import { useUnwrapDOMRef } from '@react-spectrum/utils';
89
import { OverlayTriggerState, useOverlayTriggerState } from '@react-stately/overlays';
910
import { TextFieldRef } from '@react-types/textfield';
1011

1112
import { Label } from '../../../../../core/labels/label.interface';
12-
import { CustomPopover } from '../../../../../shared/components/custom-popover/custom-popover.component';
1313
import { BaseLabelSearch } from './base-label-search.component';
1414
import { SearchLabelTreeItemSuffix } from './search-label-tree-view-item.component';
1515

web_ui/src/pages/annotator/components/labels/label-tag/label-tag.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE
33

44
import { Flex, Tooltip, TooltipTrigger } from '@adobe/react-spectrum';
5+
import { PressableElement } from '@geti/ui';
56

67
import { Label } from '../../../../../core/labels/label.interface';
78
import { LabelColorThumb } from '../../../../../shared/components/label-color-thumb/label-color-thumb.component';
8-
import { PressableElement } from '../../../../../shared/components/pressable-element/pressable-element.component';
99
import { TruncatedText } from '../../../../../shared/components/truncated-text/truncated-text.component';
1010

1111
interface LabelTagProps {

web_ui/src/pages/annotator/components/main-content/labels-shortcuts/labels-shortcuts-popover.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import { Dispatch, SetStateAction, useRef } from 'react';
55

66
import { Flex, Text, View } from '@adobe/react-spectrum';
7+
import { CustomPopover } from '@geti/ui';
78
import { useOverlayTriggerState } from '@react-stately/overlays';
89

910
import { ChevronDownLight } from '../../../../../assets/icons';
1011
import { Label } from '../../../../../core/labels/label.interface';
11-
import { CustomPopover } from '../../../../../shared/components/custom-popover/custom-popover.component';
1212
import { TaskLabelTreeSearch } from '../../../../../shared/components/task-label-tree-search/task-label-tree-search.component';
1313
import { onEscape } from '../../../../../shared/utils';
1414
import { useTask } from '../../../providers/task-provider/task-provider.component';

web_ui/src/pages/annotator/components/navigation-toolbar/anomaly-project-performance-chart.component.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// LIMITED EDGE SOFTWARE DISTRIBUTION LICENSE
33

44
import { Flex, Heading } from '@adobe/react-spectrum';
5+
import { Link } from 'react-router-dom';
56

67
import { ProjectIdentifier } from '../../../../core/projects/core.interface';
78
import { paths } from '../../../../core/services/routes';
8-
import { RouterLink } from '../../../../shared/components/router-link/router-link.component';
99
import { AccuracyHalfDonutChart } from '../../../project-details/components/project-models/models-container/model-card/accuracy-container/accuracy-half-donut-chart';
1010

1111
import classes from './navigation-toolbar.module.scss';
@@ -30,15 +30,15 @@ export const AnomalyProjectPerformanceChart = ({
3030
}
3131

3232
return (
33-
<RouterLink to={paths.project.models.index(projectIdentifier)} height={'100%'}>
33+
<Link to={paths.project.models.index(projectIdentifier)} viewTransition>
3434
<Flex
3535
direction={'column'}
3636
height={'100%'}
3737
alignItems={'center'}
38-
UNSAFE_className={classes.anomalyPerformanceChart}
38+
UNSAFE_className={classes.performanceChart}
3939
>
4040
<AccuracyHalfDonutChart value={score} size={'XL'} title={label} ariaLabel={label} />
4141
</Flex>
42-
</RouterLink>
42+
</Link>
4343
);
4444
};

web_ui/src/pages/annotator/components/navigation-toolbar/default-label-combobox.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import { useRef, useState } from 'react';
55

66
import { TextField, View } from '@adobe/react-spectrum';
7+
import { CustomPopover } from '@geti/ui';
78
import { useOverlayTriggerState } from '@react-stately/overlays';
89

910
import { Label } from '../../../../core/labels/label.interface';
10-
import { CustomPopover } from '../../../../shared/components/custom-popover/custom-popover.component';
1111
import { TaskLabelTreeContainer } from '../../../../shared/components/task-label-tree-search/task-label-tree-container.component';
1212
import { useFilteredTaskMetadata } from '../../../../shared/components/task-label-tree-search/use-filtered-task-metadata.hook';
1313
import { getAvailableLabelsWithoutEmpty } from '../../annotation/labels/utils';

web_ui/src/pages/annotator/components/navigation-toolbar/navigation-toolbar.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
fill: currentColor !important;
3131
}
3232

33-
.anomalyPerformanceChart {
33+
.performanceChart {
3434
cursor: pointer;
3535

3636
& svg {

0 commit comments

Comments
 (0)