Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
34 changes: 34 additions & 0 deletions .changeset/better-impalas-open.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
"@sumup-oss/circuit-ui": major
---

Removed the following deprecated icons:

| icon | replacement |
|-------------------|------------------------------------|
| AddItems | Add, Items |
| Copy | CopyPaste |
| SumUpLogo | SumupLogo (`sumup-oss/circuit-ui)` |
| SumUpLogomark | SumupLogo (`sumup-oss/circuit-ui) |
| Apm | AlternativePaymentMethod |
| EmailChat | Email |
| phone_chat | Phone |
| PhoneChat | Mobile |
| ColorCorrection | ColorPicker |
| CookiePreferences | Cookie |
| Customize | Customise |
| Favorite | Favourite |
| NoSim | NoSimcard |
| PrintFailed | PrinterFailed |
| Unfavorite | Unfavourite |
| Contractors | Contractor |
| notify_circle | Notify |
| general_settings | Settings |
| gift_card | GiftCards |
| payment_link | PaymentLinks |
| refer | ReferAFriend, Reward |
| sales | Receipt |
| messenger | FacebookMessenger |
|

Use the `no-deprecated-icons` to automatically apply the replacements.
5 changes: 5 additions & 0 deletions .changeset/fancy-weeks-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sumup-oss/icons": major
---

Removed the deprecated Country Flag icons. Use the Flag component instead or load the icon with its URL using the [`getIconUrl()`](https://circuit.sumup.com/?path=/docs/packages-icons--docs#load-from-a-url) helper.
5 changes: 5 additions & 0 deletions .changeset/lovely-bears-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sumup-oss/icons": major
---

Removed the deprecated Card Scheme icons. Use the new CardScheme component instead or load the icon with its URL using the [`getIconUrl()`](https://circuit.sumup.com/?path=/docs/packages-icons--docs#load-from-a-url) helper.
5 changes: 5 additions & 0 deletions .changeset/thin-grapes-take.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sumup-oss/icons": major
---

Remove the deprecated Payment Method icons. Use the new PaymentMethod component instead or load the icon with its URL using the [`getIconUrl()`](https://circuit.sumup.com/?path=/docs/packages-icons--docs#load-from-a-url) helper.
41 changes: 23 additions & 18 deletions .storybook/components/Icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function Icons() {
},
);
const matchesSize = size === 'all' || size === icon.size;
return matchesKeyword && matchesSize;
return !icon.inactive && matchesKeyword && matchesSize;
}) as IconsManifest['icons'];

return (
Expand Down Expand Up @@ -189,7 +189,7 @@ export function Icons() {
);
}

const DEPRECATED_CATEGORIES = ['Card scheme', 'Payment method'];
const URL_ONLY_CATEGORIES = ['Flag', 'Payment method', 'Card scheme'];

function Icon({
icon,
Expand All @@ -208,6 +208,7 @@ function Icon({
) as keyof typeof iconComponents;
// eslint-disable-next-line import-x/namespace
const IconComponent = iconComponents[componentName] as IconComponentType;
const isFlag = icon.category === 'Flag';

const copyIconURL = () => {
const iconURL = `https://circuit.sumup.com/icons/v2/${icon.name}_${icon.size}.svg`;
Expand Down Expand Up @@ -246,16 +247,21 @@ function Icon({
});
};

const flagDimensions = {
height: scale === 'one-x' ? 15 : 30,
width: scale === 'one-x' ? 20 : 40,
};

return (
<div className={classes.wrapper}>
<div className={clsx(classes['icon-wrapper'], classes[scale])}>
{icon.skipComponentFile ? (
{URL_ONLY_CATEGORIES.includes(icon.category) ? (
<img
src={getIconURL(icon.name)}
src={getIconURL(icon.name, icon.size)}
className={classes.icon}
aria-labelledby={id}
alt={icon.name}
height={scale === 'one-x' ? 15 : 30}
width={scale === 'one-x' ? 20 : 40}
{...(isFlag ? flagDimensions : {})}
/>
) : (
<IconComponent
Expand Down Expand Up @@ -303,18 +309,17 @@ function Icon({
Copy URL
</IconButton>
)}
{!icon.skipComponentFile &&
!DEPRECATED_CATEGORIES.includes(icon.category) && (
<IconButton
variant="tertiary"
size="s"
// @ts-expect-error ReactIcon is a React component
icon={ReactIcon}
onClick={copyIconReactName}
>
Copy React component name
</IconButton>
)}
{!URL_ONLY_CATEGORIES.includes(icon.category) && (
<IconButton
variant="tertiary"
size="s"
// @ts-expect-error ReactIcon is a React component
icon={ReactIcon}
onClick={copyIconReactName}
>
Copy React component name
</IconButton>
)}
</div>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions .storybook/components/Theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { useEffect, useState, type ComponentType } from 'react';
import { ThemeProvider, useTheme } from '@emotion/react';
import { Unstyled } from '@storybook/blocks';
import { light, schema } from '@sumup-oss/design-tokens';
import { SumUpLogomark } from '@sumup-oss/icons';
import { Home } from '@sumup-oss/icons';
import { Anchor } from '../../packages/circuit-ui/components/Anchor/Anchor.js';
import { Body } from '../../packages/circuit-ui/components/Body/Body.js';
import { Badge } from '../../packages/circuit-ui/components/Badge/Badge.js';
Expand Down Expand Up @@ -274,7 +274,7 @@ export function Typography({ name }: PreviewProps) {

export function IconSize({ name }: PreviewProps) {
return (
<SumUpLogomark
<Home
style={{
width: `var(${name})`,
height: `var(${name})`,
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default defineConfig([
'circuit-ui/no-deprecated-props': 'error',
'circuit-ui/no-renamed-props': 'error',
'circuit-ui/prefer-custom-properties': 'warn',
'circuit-ui/no-deprecated-icons': 'warn',
'circuit-ui/no-deprecated-icons': 'error',
},
},
configs.browser,
Expand Down
20 changes: 11 additions & 9 deletions package-lock.json

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 @@ -14,7 +14,7 @@
*/

import { describe, expect, it, vi } from 'vitest';
import { Favorite } from '@sumup-oss/icons';
import { Favourite } from '@sumup-oss/icons';

import { render, screen, userEvent } from '../../../../util/test-utils.js';

Expand All @@ -35,7 +35,7 @@ const props: OptionProps = {

describe('Option', () => {
it('should render with leading icon', () => {
render(<Option {...props} image={Favorite} />);
render(<Option {...props} image={Favourite} />);

expect(screen.getByText(props.label)).toBeVisible();
expect(screen.getByText(description)).toBeVisible();
Expand Down
27 changes: 11 additions & 16 deletions packages/circuit-ui/components/Select/Select.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@
*/

import { useState } from 'react';
import {
FlagDe,
FlagUs,
FlagFr,
type IconComponentType,
} from '@sumup-oss/icons';

import { Select, type SelectProps } from './Select.js';
import { Stack } from '../../../../.storybook/components/index.js';
import { Flag, type FlagProps } from '../Flag/Flag.js';

export default {
title: 'Forms/Select',
Expand Down Expand Up @@ -50,12 +45,6 @@ const baseArgs = {
],
};

const flagIconMap: { [key: string]: IconComponentType<'16'> } = {
DE: FlagDe,
US: FlagUs,
FR: FlagFr,
};

export const Base = (args: SelectProps) => <Select {...args} />;

Base.args = baseArgs;
Expand Down Expand Up @@ -90,10 +79,16 @@ export const WithPrefix = (args: SelectProps) => {
onChange={(event) => {
setValue(event.target.value);
}}
renderPrefix={(props) => {
const Icon = props.value && flagIconMap[props.value];
return Icon ? <Icon {...props} aria-hidden="true" /> : null;
}}
renderPrefix={(props) =>
props.value ? (
<Flag
{...props}
alt=""
countryCode={props.value as FlagProps['countryCode']}
size="s"
/>
) : null
}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import { useState, type ChangeEvent } from 'react';
import { action } from 'storybook/actions';
import { CardReaderAir, CardReaderSolo, MobilePhone } from '@sumup-oss/icons';
import { CardReaderAir, CardReaderSolo, Phone } from '@sumup-oss/icons';

import { Stack } from '../../../../.storybook/components/index.js';
import { Selector, type SelectorProps } from '../Selector/Selector.js';
Expand Down Expand Up @@ -146,7 +146,7 @@ WithIcons.args = {
description: 'Requires the free SumUp app to accept payments',
},
{
icon: MobilePhone,
icon: Phone,
label: 'Phone',
value: 'phone',
description: 'Accept payments using the free SumUp app',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
*/

import { describe, expect, it, vi } from 'vitest';
import { Shop, SumUpLogo } from '@sumup-oss/icons';
import { Shop } from '@sumup-oss/icons';

import { axe, render, screen } from '../../util/test-utils.js';

import { TopNavigation, type TopNavigationProps } from './TopNavigation.js';
import { SumUpLogo } from '../SumUpLogo/SumUpLogo.js';

describe('TopNavigation', () => {
const baseProps: TopNavigationProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import { useState } from 'react';
import { action } from 'storybook/actions';
import { Shop, SumUpLogo } from '@sumup-oss/icons';
import { Shop } from '@sumup-oss/icons';

import { modes } from '../../../../.storybook/modes.js';
import { SideNavigation } from '../SideNavigation/index.js';
Expand All @@ -25,6 +25,7 @@ import type { HamburgerProps } from '../Hamburger/Hamburger.js';
import { Headline } from '../Headline/index.js';

import { TopNavigation, type TopNavigationProps } from './TopNavigation.js';
import { SumUpLogo } from '../SumUpLogo/SumUpLogo.js';

export default {
title: 'Navigation/TopNavigation',
Expand Down
1 change: 0 additions & 1 deletion packages/icons/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const CATEGORIES = [
'Communication',
'Payment method',
'Card scheme',
'Country flag',
'Flag',
'Device',
'File',
Expand Down
Loading
Loading