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

chore: update DS to 2.0.0-beta.4 #20301

Merged
merged 10 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ jobs:
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ce-playwright-trace
name: ce-${{ matrix.project }}--playwright-trace
path: test-apps/e2e/test-results/**/trace.zip
retention-days: 1

Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:
- uses: actions/upload-artifact@v4
if: failure()
with:
name: ee-playwright-trace
name: ee-${{ matrix.project }}--playwright-trace
path: test-apps/e2e/test-results/**/trace.zip
retention-days: 1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const MyComponent = ({ onMoveItem }) => {
role="button"
tabIndex={0}
aria-label="Drag"
noBorder
borderWidth={0}
onKeyDown={handleKeyDown}
>
<Drag />
Expand Down Expand Up @@ -103,7 +103,7 @@ const MyComponent = ({ onDropItem }) => {
role="button"
tabIndex={0}
aria-label="Drag"
noBorder
borderWidth={0}
onKeyDown={handleKeyDown}
>
<Drag />
Expand Down Expand Up @@ -157,7 +157,7 @@ const MyComponent = ({ onMoveItem }) => {
role="button"
tabIndex={0}
aria-label="Drag"
noBorder
borderWidth={0}
onKeyDown={handleKeyDown}
>
<Drag />
Expand Down Expand Up @@ -256,7 +256,7 @@ You might notice in the [basic usage](#basic-usage) section this piece of code:
role="button"
tabIndex={0}
aria-label="Drag"
noBorder
borderWidth={0}
onKeyDown={handleKeyDown}
>
<Drag />
Expand Down
2 changes: 1 addition & 1 deletion examples/getstarted/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"strapi": "strapi"
},
"dependencies": {
"@strapi/icons": "2.0.0-beta.3",
"@strapi/icons": "2.0.0-beta.4",
"@strapi/plugin-color-picker": "5.0.0-beta.7",
"@strapi/plugin-documentation": "5.0.0-beta.7",
"@strapi/plugin-graphql": "5.0.0-beta.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const DateInput = forwardRef<HTMLInputElement, InputProps>(
field.onChange(name, date);
}}
onClear={() => field.onChange(name, undefined)}
selectedDate={value}
value={value}
{...props}
/>
<Field.Hint />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ const GuidedTourModal = () => {
<Flex justifyContent="flex-end">
<IconButton
onClick={handleCtaClick}
aria-label={formatMessage({
withTooltip={false}
label={formatMessage({
id: 'app.utils.close-label',
defaultMessage: 'Close',
})}
Expand Down
14 changes: 10 additions & 4 deletions packages/core/admin/admin/src/components/MainNav/NavLink.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import * as React from 'react';

import { Tooltip, Badge, BadgeProps, AccessibleIcon } from '@strapi/design-system';
import {
Tooltip,
TooltipProps as DSTooltipProps,
Badge,
BadgeProps,
AccessibleIcon,
} from '@strapi/design-system';
import { NavLink as RouterLink, LinkProps } from 'react-router-dom';
import { styled } from 'styled-components';

Expand Down Expand Up @@ -49,7 +55,7 @@ const LinkImpl = ({ children, ...props }: LinkProps) => {
* -----------------------------------------------------------------------------------------------*/
const TooltipImpl = ({ children, label, position = 'right' }: NavLink.TooltipProps) => {
return (
<Tooltip position={position} label={label}>
<Tooltip side={position} label={label}>
<span>{children}</span>
</Tooltip>
);
Expand Down Expand Up @@ -111,9 +117,9 @@ namespace NavLink {
}

export interface TooltipProps {
position?: 'top' | 'bottom' | 'left' | 'right';
label?: string;
children: React.ReactNode;
label?: string;
position?: DSTooltipProps['side'];
joshuaellis marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
15 changes: 8 additions & 7 deletions packages/core/admin/admin/src/components/NpsSurvey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { Cross } from '@strapi/icons';
import { Formik, Form } from 'formik';
import { useIntl } from 'react-intl';
import { styled, useTheme } from 'styled-components';
import { styled } from 'styled-components';
import * as yup from 'yup';

import { useAppInfo } from '../features/AppInfo';
Expand Down Expand Up @@ -130,7 +130,6 @@ const checkIfShouldShowSurvey = (settings: NpsSurveySettings) => {
};

const NpsSurvey = () => {
const theme = useTheme();
const { formatMessage } = useIntl();
const { npsSurveySettings, setNpsSurveySettings } = useNpsSurveySettings();
const [isFeedbackResponse, setIsFeedbackResponse] = React.useState(false);
Expand Down Expand Up @@ -266,7 +265,7 @@ const NpsSurvey = () => {
bottom={0}
left="50%"
transform="translateX(-50%)"
zIndex={theme.zIndices[2]}
zIndex="popover"
width="50%"
>
{isFeedbackResponse ? (
Expand All @@ -277,7 +276,7 @@ const NpsSurvey = () => {
})}
</Typography>
) : (
<Box tag="fieldset" width="100%">
<Box tag="fieldset" width="100%" borderWidth={0}>
<Flex justifyContent="space-between" width="100%">
<Box marginLeft="auto" marginRight="auto">
<Typography fontWeight="semiBold" tag="legend">
Expand All @@ -290,12 +289,14 @@ const NpsSurvey = () => {
</Box>
<IconButton
onClick={handleDismiss}
aria-label={formatMessage({
withTooltip={false}
label={formatMessage({
id: 'app.components.NpsSurvey.dismiss-survey-label',
defaultMessage: 'Dismiss survey',
})}
icon={<Cross />}
/>
>
<Cross />
</IconButton>
</Flex>
<Flex gap={2} marginTop={2} marginBottom={2} justifyContent="center">
<Typography variant="pi" textColor="neutral600">
Expand Down
6 changes: 3 additions & 3 deletions packages/core/admin/admin/src/components/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const SearchInput = ({
value={value}
clearLabel={formatMessage({ id: 'clearLabel', defaultMessage: 'Clear' })}
onClear={handleClear}
size="S"
placeholder={placeholder}
>
{label}
Expand All @@ -84,10 +83,11 @@ const SearchInput = ({
<IconButton
ref={iconButtonRef}
disabled={disabled}
icon={<SearchIcon fill="neutral800" />}
label={formatMessage({ id: 'global.search', defaultMessage: 'Search' })}
onClick={handleToggle}
/>
>
<SearchIcon fill="neutral800" />
</IconButton>
);
};

Expand Down
9 changes: 3 additions & 6 deletions packages/core/admin/admin/src/components/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,9 @@ const HeaderCell = <TData, THead>({ name, label, sortable }: TableHeader<TData,
action={
isSorted &&
sortable && (
<IconButton
label={sortLabel}
onClick={handleClickSort}
icon={<SortIcon $isUp={sortOrder === 'ASC'} />}
borderStyle="none"
/>
<IconButton label={sortLabel} onClick={handleClickSort} borderStyle="none">
<SortIcon $isUp={sortOrder === 'ASC'} />
</IconButton>
)
}
>
Expand Down
15 changes: 2 additions & 13 deletions packages/core/admin/admin/src/components/tests/ContentBox.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { ExternalLink } from '@strapi/icons';
import { GlassesSquare } from '@strapi/icons/symbols';
import { render as renderRTL, screen } from '@testing-library/react';
import { IntlProvider } from 'react-intl';
import { render as renderRTL, screen } from '@tests/utils';

import { ContentBox, ContentBoxProps } from '../ContentBox';

Expand All @@ -27,16 +25,7 @@ describe('ContentBox', () => {
}
titleEllipsis={false}
{...props}
/>,
{
wrapper: ({ children }) => (
<ThemeProvider theme={lightTheme}>
<IntlProvider locale="en" messages={{}} textComponent="span">
{children}
</IntlProvider>
</ThemeProvider>
),
}
/>
),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ describe('Table', () => {
</Table.Root>
);

expect(screen.getByRole('button', { name: 'Sort on id' })).toBeInTheDocument();
expect(screen.getByRole('checkbox', { name: 'Select all entries' })).toBeInTheDocument();

expect(screen.getByRole('gridcell', { name: '1' })).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ const CardButton = ({
return (
<Tooltip
data-testid={`tooltip-${pluginName}`}
description={
label={
!versionRange
? formatMessage(
{
Expand All @@ -289,15 +289,17 @@ const CardButton = ({
)
}
>
<Button
size="S"
startIcon={<Duplicate />}
variant="secondary"
onClick={handleCopy}
disabled={!isCompatible}
>
{installMessage}
</Button>
<span>
<Button
size="S"
startIcon={<Duplicate />}
variant="secondary"
onClick={handleCopy}
disabled={!isCompatible}
>
{installMessage}
</Button>
</span>
</Tooltip>
);
}
Expand Down Expand Up @@ -345,7 +347,7 @@ const PackageStats = ({ githubStars = 0, npmDownloads = 0, npmPackageType }: Pac
{githubStars}
</Typography>
</p>
<VerticalDivider unsetMargin={false} />
<VerticalDivider />
</>
)}
<Download height="1.2rem" width="1.2rem" aria-hidden />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ const NpmPackagesFilters = ({
};

const ButtonToggle = styled(Button)`
height: ${({ theme }) => theme.sizes.input.S};
height: unset;
padding-block: 1.1rem;
`;

/* -------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -163,7 +164,6 @@ const FilterSelect = ({
data-testid={`${message}-button`}
aria-label={message}
placeholder={message}
size="M"
onChange={onChange}
onClear={onClear}
value={value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ const SortSelect = ({ sortQuery, handleSelectChange }: SortSelectProps) => {
return (
<SelectWrapper>
<SingleSelect
size="S"
id="sort-by-select"
value={sortQuery}
customizeContent={() => formatMessage(SORT_TYPES[sortQuery].selected)}
onChange={(sortName) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,18 @@ describe('Marketplace page - layout', () => {
expect(getByRole('button', { name: 'Filters' })).toBeVisible();
});

it('disables the button and shows compatibility tooltip message when version provided', async () => {
const { findByTestId, findAllByTestId } = render();
it('disables the button', async () => {
const { findAllByTestId } = render();

const alreadyInstalledCard = (await findAllByTestId('npm-package-card')).find((div) =>
div.innerHTML.includes('Transformer')
)!;

const button = within(alreadyInstalledCard)
.getByText(/copy install command/i)
.closest('button')!;
.closest('button');

// User event throws an error that there are no pointer events
fireEvent.mouseOver(button);
const tooltip = await findByTestId('tooltip-Transformer');
expect(button).toBeDisabled();
expect(tooltip).toBeInTheDocument();
expect(tooltip).toHaveTextContent('Update your Strapi version: "4.1.0" to: "4.0.7"');
});

it('shows compatibility tooltip message when no version provided', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ const DeleteButton = ({ tokenName, onClickDelete, tokenType }: DeleteButtonProps
)}
name="delete"
borderWidth={0}
icon={<Trash />}
/>
>
<Trash />
</IconButton>
<ConfirmDialog
onClose={() => setShowConfirmDialog(false)}
onConfirm={handleClickDelete}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ export const TokenBox = ({ token, tokenType }: TokenBoxProps) => {
})}
onClick={handleClick(token)}
borderWidth={0}
icon={<Duplicate />}
style={{ padding: 0, height: '1.6rem' }}
/>
>
<Duplicate />
</IconButton>
</span>
)
}
Expand Down