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

refactor: [M3-8707] - Move Tooltip component to UI package #11125

Merged
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions packages/manager/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const config: StorybookConfig = {
stories: [
'../src/components/**/*.@(mdx|stories.@(js|ts|jsx|tsx))',
'../src/features/**/*.@(mdx|stories.@(js|ts|jsx|tsx))',
'../../ui/src/components/**/*.@(mdx|stories.@(js|ts|jsx|tsx))',
],
addons: [
'@storybook/addon-docs',
Expand Down
14 changes: 7 additions & 7 deletions packages/manager/.storybook/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import globby from 'globby';

const PATTERN = 'src/**/*.stories.tsx';
const PATTERN = '../**/src/**/*.stories.tsx';

/**
* Find all storybook files, then return the glob containing the parent component/feature.
Expand All @@ -11,18 +11,18 @@ const PATTERN = 'src/**/*.stories.tsx';
*/
export const getReactDocgenTSFileGlobs = () => {
const filesWithStories = globby.sync(PATTERN);
const files: string[] = [];
const files = new Set<string>();

filesWithStories.forEach((file) => {
const execArr = /(src\/(components|features)\/[a-zA-Z]*(.|\/))/.exec(file);
const execArr = /^(.*src\/(components|features)\/[a-zA-Z]*(.|\/))/.exec(
file
);
if (execArr) {
const isDirectory = execArr[3] === '/';
const fileBlob = `${execArr[0]}${isDirectory ? '**/*.' : ''}{ts,tsx}`;
if (!files.includes(fileBlob)) {
files.push(fileBlob);
}
files.add(fileBlob);
}
});

return files;
return Array.from(files);
};
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ import { Interception } from 'cypress/types/net-stubbing';
const expectedGranularityArray = ['Auto', '1 day', '1 hr', '5 min'];
const timeDurationToSelect = 'Last 24 Hours';

const { metrics, id, serviceType, dashboardName, region, resource } =
widgetDetails.linode;
const {
metrics,
id,
serviceType,
dashboardName,
region,
resource,
} = widgetDetails.linode;

const dashboard = dashboardFactory.build({
label: dashboardName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { Tooltip } from '@linode/ui';
import Backup from '@mui/icons-material/Backup';
import { Theme } from '@mui/material/styles';
import * as React from 'react';
import { Link as RouterLink } from 'react-router-dom';
import { makeStyles } from 'tss-react/mui';

import { DateTimeDisplay } from 'src/components/DateTimeDisplay';
import { Link } from 'src/components/Link';
import { Tooltip } from 'src/components/Tooltip';
import { TooltipIcon } from 'src/components/TooltipIcon';
import { Typography } from 'src/components/Typography';

import type { Theme } from '@mui/material/styles';

const useStyles = makeStyles<void, 'icon'>()(
(theme: Theme, _params, classes) => ({
backupLink: {
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Tooltip } from '@linode/ui';
import HelpOutline from '@mui/icons-material/HelpOutline';
import _Button from '@mui/material/Button';
import { styled } from '@mui/material/styles';
import * as React from 'react';

import Reload from 'src/assets/icons/reload.svg';
import { Tooltip } from 'src/components/Tooltip';

import { rotate360 } from '../../styles/keyframes';
import { omittedProps } from '../../utilities/omittedProps';
Expand Down
4 changes: 2 additions & 2 deletions packages/manager/src/components/CopyTooltip/CopyTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Tooltip } from '@linode/ui';
import { styled } from '@mui/material/styles';
import copy from 'copy-to-clipboard';
import * as React from 'react';

import FileCopy from 'src/assets/icons/copy.svg';
import { Tooltip } from 'src/components/Tooltip';
import { omittedProps } from 'src/utilities/omittedProps';

import type { TooltipProps } from 'src/components/Tooltip';
import type { TooltipProps } from '@linode/ui';

export interface CopyTooltipProps {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/DownloadTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Tooltip } from '@linode/ui';
import * as React from 'react';

import FileDownload from 'src/assets/icons/download.svg';
import { StyledIconButton } from 'src/components/CopyTooltip/CopyTooltip';
import { Tooltip } from 'src/components/Tooltip';
import { Typography } from 'src/components/Typography';
import { downloadFile } from 'src/utilities/downloadFile';

Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/GroupByTagToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Tooltip } from '@linode/ui';
import * as React from 'react';

import GroupByTag from 'src/assets/icons/group-by-tag.svg';
import { Tooltip } from 'src/components/Tooltip';
import { StyledToggleButton } from 'src/features/Linodes/LinodesLanding/DisplayLinodes.styles';

interface GroupByTagToggleProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Tooltip } from '@linode/ui';
import React from 'react';
import { makeStyles } from 'tss-react/mui';

Expand All @@ -8,7 +9,6 @@ import { Option } from 'src/components/EnhancedSelect/components/Option';
import { useFlags } from 'src/hooks/useFlags';

import { Stack } from '../Stack';
import { Tooltip } from '../Tooltip';

import type { ImageItem } from './ImageSelect';
import type { Theme } from '@mui/material/styles';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Tooltip } from '@linode/ui';
import React from 'react';

import CloudInitIcon from 'src/assets/icons/cloud-init.svg';
Expand All @@ -7,7 +8,6 @@ import { useFlags } from 'src/hooks/useFlags';
import { SelectedIcon } from '../Autocomplete/Autocomplete.styles';
import { OSIcon } from '../OSIcon';
import { Stack } from '../Stack';
import { Tooltip } from '../Tooltip';
import { Typography } from '../Typography';
import { isImageDeprecated } from './utilities';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { PLACEMENT_GROUP_TYPES, PlacementGroup } from '@linode/api-v4';
import { PLACEMENT_GROUP_TYPES } from '@linode/api-v4';
import { Tooltip } from '@linode/ui';
import { visuallyHidden } from '@mui/utils';
import React from 'react';

import { Box } from 'src/components/Box';
import { Stack } from 'src/components/Stack';
import { Tooltip } from 'src/components/Tooltip';
import { PLACEMENT_GROUP_HAS_NO_CAPACITY } from 'src/features/PlacementGroups/constants';

import {
SelectedIcon,
StyledListItem,
} from '../RegionSelect/RegionSelect.styles';

import type { PlacementGroup } from '@linode/api-v4';
import type { ListItemComponentsPropsOverrides } from '@mui/material/ListItem';

interface PlacementGroupSelectOptionProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/PrimaryNav/NavItem.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Tooltip } from '@linode/ui';
import * as React from 'react';
import { Link } from 'react-router-dom';
import { useStyles } from 'tss-react/mui';

import { Divider } from 'src/components/Divider';
import { ListItem } from 'src/components/ListItem';
import { ListItemText } from 'src/components/ListItemText';
import { Tooltip } from 'src/components/Tooltip';

interface Props extends PrimaryLink {
closeMenu: () => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Tooltip } from '@linode/ui';
import { visuallyHidden } from '@mui/utils';
import React from 'react';

Expand All @@ -6,7 +7,6 @@ import { Box } from 'src/components/Box';
import { Flag } from 'src/components/Flag';
import { useIsGeckoEnabled } from 'src/components/RegionSelect/RegionSelect.utils';
import { Stack } from 'src/components/Stack';
import { Tooltip } from 'src/components/Tooltip';
import { TooltipIcon } from 'src/components/TooltipIcon';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Tooltip } from '@linode/ui';
import { styled } from '@mui/material/styles';
import Grid from '@mui/material/Unstable_Grid2';
import * as React from 'react';

import { Tooltip } from 'src/components/Tooltip';

import { CardBase } from './CardBase';

import type { SxProps, Theme } from '@mui/material/styles';
Expand Down Expand Up @@ -148,9 +147,9 @@ export const SelectionCard = React.memo((props: SelectionCardProps) => {
const cardGrid = (
<StyledGrid
className={className}
data-testid="selection-card"
data-qa-selection-card
data-qa-selection-card-checked={checked}
data-testid="selection-card"
disabled={disabled}
id={id}
lg={4}
Expand Down
4 changes: 2 additions & 2 deletions packages/manager/src/components/TabbedPanel/TabbedPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Tooltip } from '@linode/ui';
import HelpOutline from '@mui/icons-material/HelpOutline';
import { styled } from '@mui/material/styles';
import React, { useEffect, useState } from 'react';
Expand All @@ -9,7 +10,6 @@ import { TabList } from 'src/components/Tabs/TabList';
import { TabPanel } from 'src/components/Tabs/TabPanel';
import { TabPanels } from 'src/components/Tabs/TabPanels';
import { Tabs } from 'src/components/Tabs/Tabs';
import { Tooltip } from 'src/components/Tooltip';
import { Typography } from 'src/components/Typography';

import { Box } from '../Box';
Expand Down Expand Up @@ -119,8 +119,8 @@ const TabbedPanel = React.memo((props: TabbedPanelProps) => {
<TabPanels>
{tabs.map((tab, idx) => (
<TabPanel
key={`tabs-panel-${tab.title}-${idx}`}
data-qa-tp-tab={tab.title}
key={`tabs-panel-${tab.title}-${idx}`}
>
{tab.render(rest.children)}
</TabPanel>
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import { InputLabel } from 'src/components/InputLabel';
import { TooltipIcon } from 'src/components/TooltipIcon';
import { convertToKebabCase } from 'src/utilities/convertToKebobCase';

import type { TooltipProps } from '@linode/ui';
import type { Theme } from '@mui/material/styles';
import type { StandardTextFieldProps } from '@mui/material/TextField';
import type { BoxProps } from 'src/components/Box';
import type { TooltipProps } from 'src/components/Tooltip';

const useStyles = makeStyles()((theme: Theme) => ({
absolute: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Tooltip } from '@linode/ui';
import { styled } from '@mui/material/styles';
import * as React from 'react';

import { Tooltip } from 'src/components/Tooltip';
import { Typography } from 'src/components/Typography';

import type { SxProps, Theme } from '@mui/material';
Expand Down
4 changes: 2 additions & 2 deletions packages/manager/src/components/TooltipIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styled from '@emotion/styled';
import { Tooltip, tooltipClasses } from '@linode/ui';
import SuccessOutline from '@mui/icons-material/CheckCircleOutlined';
import ErrorOutline from '@mui/icons-material/ErrorOutline';
import HelpOutline from '@mui/icons-material/HelpOutline';
Expand All @@ -8,11 +9,10 @@ import { useTheme } from '@mui/material/styles';
import * as React from 'react';

import { IconButton } from 'src/components/IconButton';
import { Tooltip, tooltipClasses } from 'src/components/Tooltip';
import { omittedProps } from 'src/utilities/omittedProps';

import type { TooltipProps } from '@linode/ui';
import type { SxProps, Theme } from '@mui/material/styles';
import type { TooltipProps } from 'src/components/Tooltip';

type TooltipIconStatus =
| 'error'
Expand Down
5 changes: 3 additions & 2 deletions packages/manager/src/components/Uploaders/FileUpload.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Tooltip } from '@linode/ui';
import * as React from 'react';

import CautionIcon from 'src/assets/icons/caution.svg';
import FileUploadComplete from 'src/assets/icons/fileUploadComplete.svg';
import { Button } from 'src/components/Button/Button';
import { LinearProgress } from 'src/components/LinearProgress';
import { Tooltip } from 'src/components/Tooltip';
import { Typography } from 'src/components/Typography';
import { readableBytes } from 'src/utilities/unitConversions';

Expand All @@ -18,7 +18,8 @@ import {
StyledUploadPending,
useStyles,
} from './FileUpload.styles';
import { ObjectUploaderAction } from './reducer';

import type { ObjectUploaderAction } from './reducer';

export interface FileUploadProps {
dispatch: React.Dispatch<ObjectUploaderAction>;
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/dev-tools/ServiceWorkerTool.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Tooltip } from '@linode/ui';
import * as React from 'react';

import { Tooltip } from 'src/components/Tooltip';
import { mswDB } from 'src/mocks/indexedDB';
import { extraMockPresets } from 'src/mocks/presets';
import { dbSeeders } from 'src/mocks/presets/crud/seeds';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { AccountMaintenance } from '@linode/api-v4/lib/account/types';
import { Tooltip } from '@linode/ui';
import * as React from 'react';

import { Hidden } from 'src/components/Hidden';
import { HighlightedMarkdown } from 'src/components/HighlightedMarkdown/HighlightedMarkdown';
import { Link } from 'src/components/Link';
import { Status, StatusIcon } from 'src/components/StatusIcon/StatusIcon';
import { StatusIcon } from 'src/components/StatusIcon/StatusIcon';
import { TableCell } from 'src/components/TableCell';
import { TableRow } from 'src/components/TableRow';
import { Tooltip } from 'src/components/Tooltip';
import { useProfile } from 'src/queries/profile/profile';
import { capitalize } from 'src/utilities/capitalize';
import { parseAPIDate } from 'src/utilities/date';
import { formatDate } from 'src/utilities/formatDate';
import { truncate } from 'src/utilities/truncate';

import type { AccountMaintenance } from '@linode/api-v4/lib/account/types';
import type { Status } from 'src/components/StatusIcon/StatusIcon';

const statusTextMap: Record<AccountMaintenance['status'], string> = {
completed: 'Completed',
pending: 'Scheduled',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import { APIWarning } from '@linode/api-v4/lib/types';
import { Tooltip } from '@linode/ui';
import Grid from '@mui/material/Unstable_Grid2';
import { Theme } from '@mui/material/styles';
import { useQueryClient } from '@tanstack/react-query';
import * as React from 'react';
import { QueryClient, useQueryClient } from '@tanstack/react-query';
import { makeStyles } from 'tss-react/mui';

import GooglePayIcon from 'src/assets/icons/payment/gPayButton.svg';
import { CircleProgress } from 'src/components/CircleProgress';
import { Tooltip } from 'src/components/Tooltip';
import { PaymentMessage } from 'src/features/Billing/BillingPanels/PaymentInfoPanel/AddPaymentMethodDrawer/AddPaymentMethodDrawer';
import { getPaymentLimits } from 'src/features/Billing/billingUtils';
import {
gPay,
initGooglePaymentInstance,
} from 'src/features/Billing/GooglePayProvider';
import { getPaymentLimits } from 'src/features/Billing/billingUtils';
import { useScript } from 'src/hooks/useScript';
import { useAccount } from 'src/queries/account/account';
import { useClientToken } from 'src/queries/account/payment';

import { SetSuccess } from './types';
import type { SetSuccess } from './types';
import type { APIWarning } from '@linode/api-v4/lib/types';
import type { Theme } from '@mui/material/styles';
import type { QueryClient } from '@tanstack/react-query';
import type { PaymentMessage } from 'src/features/Billing/BillingPanels/PaymentInfoPanel/AddPaymentMethodDrawer/AddPaymentMethodDrawer';

const useStyles = makeStyles()((theme: Theme) => ({
button: {
Expand Down
Loading
Loading