diff --git a/.changeset/dull-rats-fry.md b/.changeset/dull-rats-fry.md new file mode 100644 index 0000000000..4c94fb398b --- /dev/null +++ b/.changeset/dull-rats-fry.md @@ -0,0 +1,5 @@ +--- +'@sumup/design-tokens': major +--- + +Removed the deprecated `success`, `warning` and `danger` legacy color names. Use `confirm`, `notify` and `alert` instead. diff --git a/.changeset/olive-pears-sniff.md b/.changeset/olive-pears-sniff.md new file mode 100644 index 0000000000..8e7d600b9e --- /dev/null +++ b/.changeset/olive-pears-sniff.md @@ -0,0 +1,5 @@ +--- +'@sumup/circuit-ui': major +--- + +Removed the deprecated `success`, `warning` and `danger` color variants. Use `confirm`, `notify` and `alert` instead. diff --git a/packages/circuit-ui/components/Badge/Badge.spec.tsx b/packages/circuit-ui/components/Badge/Badge.spec.tsx index cbedae039b..907776b0c3 100644 --- a/packages/circuit-ui/components/Badge/Badge.spec.tsx +++ b/packages/circuit-ui/components/Badge/Badge.spec.tsx @@ -28,16 +28,7 @@ describe('Badge', () => { expect(actual).toMatchSnapshot(); }); - const variants = [ - 'neutral', - 'success', - 'confirm', - 'warning', - 'notify', - 'danger', - 'alert', - 'promo', - ] as const; + const variants = ['neutral', 'confirm', 'notify', 'alert', 'promo'] as const; it.each(variants)('should render with %s styles', (variant) => { const actual = create(); diff --git a/packages/circuit-ui/components/Badge/Badge.tsx b/packages/circuit-ui/components/Badge/Badge.tsx index edaaa3b41f..deb0a90a1a 100644 --- a/packages/circuit-ui/components/Badge/Badge.tsx +++ b/packages/circuit-ui/components/Badge/Badge.tsx @@ -17,21 +17,12 @@ import { Ref, forwardRef, HTMLAttributes } from 'react'; import { css } from '@emotion/react'; import styled, { StyleProps } from '../../styles/styled'; -import { deprecate } from '../../util/logger'; export interface BadgeProps extends HTMLAttributes { /** * Choose from 4 style variants. Default: 'neutral'. */ - variant?: - | 'neutral' - | 'success' - | 'confirm' - | 'warning' - | 'notify' - | 'danger' - | 'alert' - | 'promo'; + variant?: 'neutral' | 'confirm' | 'notify' | 'alert' | 'promo'; /** * Use the circular badge to indicate a count of items related to an element. */ @@ -80,53 +71,6 @@ const variantStyles = ({ theme, variant = 'neutral', }: StyleProps & BadgeProps) => { - // TODO: remove the legacy variants and this switch statement in v5 - /* eslint-disable no-param-reassign */ - switch (variant) { - case 'success': - if ( - process.env.NODE_ENV !== 'production' && - process.env.NODE_ENV !== 'test' - ) { - deprecate( - 'Badge', - "The Badge's `success` variant is deprecated.", - 'Use the `confirm` variant instead.', - ); - } - variant = 'confirm'; - break; - case 'warning': - if ( - process.env.NODE_ENV !== 'production' && - process.env.NODE_ENV !== 'test' - ) { - deprecate( - 'Badge', - "The Badge's `warning` variant is deprecated.", - 'Use the `notify` variant instead.', - ); - } - variant = 'notify'; - break; - case 'danger': - if ( - process.env.NODE_ENV !== 'production' && - process.env.NODE_ENV !== 'test' - ) { - deprecate( - 'Badge', - "The Badge's `danger` variant is deprecated.", - 'Use the `alert` variant instead.', - ); - } - variant = 'alert'; - break; - default: - break; - } - /* eslint-enable no-param-reassign */ - const currentColor = COLOR_MAP[variant]; return css` background-color: ${theme.colors[currentColor.background]}; diff --git a/packages/circuit-ui/components/Badge/__snapshots__/Badge.spec.tsx.snap b/packages/circuit-ui/components/Badge/__snapshots__/Badge.spec.tsx.snap index a139a067b2..d296417a6c 100644 --- a/packages/circuit-ui/components/Badge/__snapshots__/Badge.spec.tsx.snap +++ b/packages/circuit-ui/components/Badge/__snapshots__/Badge.spec.tsx.snap @@ -72,25 +72,6 @@ exports[`Badge should render with confirm styles 1`] = ` /> `; -exports[`Badge should render with danger styles 1`] = ` -.circuit-0 { - border-radius: 999999px; - display: inline-block; - padding: 2px 8px; - font-size: 14px; - line-height: 20px; - font-weight: 700; - text-align: center; - letter-spacing: 0.25px; - background-color: #D23F47; - color: #FFF; -} - -
-`; - exports[`Badge should render with default styles 1`] = ` .circuit-0 { border-radius: 999999px; @@ -166,41 +147,3 @@ exports[`Badge should render with promo styles 1`] = ` class="circuit-0" /> `; - -exports[`Badge should render with success styles 1`] = ` -.circuit-0 { - border-radius: 999999px; - display: inline-block; - padding: 2px 8px; - font-size: 14px; - line-height: 20px; - font-weight: 700; - text-align: center; - letter-spacing: 0.25px; - background-color: #138849; - color: #FFF; -} - -
-`; - -exports[`Badge should render with warning styles 1`] = ` -.circuit-0 { - border-radius: 999999px; - display: inline-block; - padding: 2px 8px; - font-size: 14px; - line-height: 20px; - font-weight: 700; - text-align: center; - letter-spacing: 0.25px; - background-color: #F6CC1B; - color: #1A1A1A; -} - -
-`; diff --git a/packages/circuit-ui/components/Body/Body.spec.tsx b/packages/circuit-ui/components/Body/Body.spec.tsx index fe24b32d15..244a508da4 100644 --- a/packages/circuit-ui/components/Body/Body.spec.tsx +++ b/packages/circuit-ui/components/Body/Body.spec.tsx @@ -39,9 +39,7 @@ describe('Body', () => { const variants = [ 'highlight', 'quote', - 'success', 'confirm', - 'error', 'alert', 'subtle', ] as BodyProps['variant'][]; diff --git a/packages/circuit-ui/components/Body/Body.tsx b/packages/circuit-ui/components/Body/Body.tsx index 40b6f70103..91d01a9730 100644 --- a/packages/circuit-ui/components/Body/Body.tsx +++ b/packages/circuit-ui/components/Body/Body.tsx @@ -18,18 +18,10 @@ import { css } from '@emotion/react'; import isPropValid from '@emotion/is-prop-valid'; import styled, { StyleProps } from '../../styles/styled'; -import { deprecate } from '../../util/logger'; import { AsPropType } from '../../types/prop-types'; type Size = 'one' | 'two'; -type Variant = - | 'highlight' - | 'quote' - | 'success' - | 'confirm' - | 'error' - | 'alert' - | 'subtle'; +type Variant = 'highlight' | 'quote' | 'confirm' | 'alert' | 'subtle'; export interface BodyProps extends HTMLAttributes { /** @@ -65,40 +57,6 @@ const sizeStyles = ({ theme, size = 'one' }: BodyProps & StyleProps) => css` `; const variantStyles = ({ theme, variant }: BodyProps & StyleProps) => { - // TODO: remove the legacy variants and this switch statement in v5 - /* eslint-disable no-param-reassign */ - switch (variant) { - case 'success': - if ( - process.env.NODE_ENV !== 'production' && - process.env.NODE_ENV !== 'test' - ) { - deprecate( - 'Body', - "The Body's `success` variant is deprecated.", - 'Use the `confirm` variant instead.', - ); - } - variant = 'confirm'; - break; - case 'error': - if ( - process.env.NODE_ENV !== 'production' && - process.env.NODE_ENV !== 'test' - ) { - deprecate( - 'Body', - "The Body's `error` variant is deprecated.", - 'Use the `alert` variant instead.', - ); - } - variant = 'alert'; - break; - default: - break; - } - /* eslint-enable no-param-reassign */ - switch (variant) { default: { return null; diff --git a/packages/circuit-ui/components/Body/__snapshots__/Body.spec.tsx.snap b/packages/circuit-ui/components/Body/__snapshots__/Body.spec.tsx.snap index 2f9d1360ae..4ae56b1a4b 100644 --- a/packages/circuit-ui/components/Body/__snapshots__/Body.spec.tsx.snap +++ b/packages/circuit-ui/components/Body/__snapshots__/Body.spec.tsx.snap @@ -32,22 +32,6 @@ exports[`Body should render as a "confirm" variant 1`] = `

`; -exports[`Body should render as a "error" variant 1`] = ` -.circuit-0 { - font-weight: 400; - font-size: 16px; - line-height: 24px; - color: #D23F47; -} - -

- error - Body -

-`; - exports[`Body should render as a "highlight" variant 1`] = ` .circuit-0 { font-weight: 400; @@ -98,22 +82,6 @@ exports[`Body should render as a "subtle" variant 1`] = `

`; -exports[`Body should render as a "success" variant 1`] = ` -.circuit-0 { - font-weight: 400; - font-size: 16px; - line-height: 24px; - color: #138849; -} - -

- success - Body -

-`; - exports[`Body should render with default styles 1`] = ` .circuit-0 { font-weight: 400; diff --git a/packages/circuit-ui/components/BodyLarge/BodyLarge.spec.tsx b/packages/circuit-ui/components/BodyLarge/BodyLarge.spec.tsx index e44e4081e7..4053405f7a 100644 --- a/packages/circuit-ui/components/BodyLarge/BodyLarge.spec.tsx +++ b/packages/circuit-ui/components/BodyLarge/BodyLarge.spec.tsx @@ -29,9 +29,7 @@ describe('BodyLarge', () => { const variants = [ 'highlight', 'quote', - 'success', 'confirm', - 'error', 'alert', 'subtle', ] as BodyLargeProps['variant'][]; diff --git a/packages/circuit-ui/components/BodyLarge/BodyLarge.tsx b/packages/circuit-ui/components/BodyLarge/BodyLarge.tsx index 8c545d08a3..11288b8f82 100644 --- a/packages/circuit-ui/components/BodyLarge/BodyLarge.tsx +++ b/packages/circuit-ui/components/BodyLarge/BodyLarge.tsx @@ -19,16 +19,8 @@ import isPropValid from '@emotion/is-prop-valid'; import styled, { StyleProps } from '../../styles/styled'; import { AsPropType } from '../../types/prop-types'; -import { deprecate } from '../../util/logger'; -type Variant = - | 'highlight' - | 'quote' - | 'success' - | 'confirm' - | 'error' - | 'alert' - | 'subtle'; +type Variant = 'highlight' | 'quote' | 'confirm' | 'alert' | 'subtle'; export interface BodyLargeProps extends HTMLAttributes { /** @@ -53,40 +45,6 @@ const baseStyles = ({ theme }: StyleProps) => css` `; const variantStyles = ({ theme, variant }: BodyLargeProps & StyleProps) => { - // TODO: remove the legacy variants and this switch statement in v5 - /* eslint-disable no-param-reassign */ - switch (variant) { - case 'success': - if ( - process.env.NODE_ENV !== 'production' && - process.env.NODE_ENV !== 'test' - ) { - deprecate( - 'BodyLarge', - "The BodyLarge's `success` variant is deprecated.", - 'Use the `confirm` variant instead.', - ); - } - variant = 'confirm'; - break; - case 'error': - if ( - process.env.NODE_ENV !== 'production' && - process.env.NODE_ENV !== 'test' - ) { - deprecate( - 'BodyLarge', - "The BodyLarge's `error` variant is deprecated.", - 'Use the `alert` variant instead.', - ); - } - variant = 'alert'; - break; - default: - break; - } - /* eslint-enable no-param-reassign */ - switch (variant) { default: { return null; diff --git a/packages/circuit-ui/components/BodyLarge/__snapshots__/BodyLarge.spec.tsx.snap b/packages/circuit-ui/components/BodyLarge/__snapshots__/BodyLarge.spec.tsx.snap index e4ea850889..95aa3797e9 100644 --- a/packages/circuit-ui/components/BodyLarge/__snapshots__/BodyLarge.spec.tsx.snap +++ b/packages/circuit-ui/components/BodyLarge/__snapshots__/BodyLarge.spec.tsx.snap @@ -32,22 +32,6 @@ exports[`BodyLarge should render as a "confirm" variant 1`] = `

`; -exports[`BodyLarge should render as a "error" variant 1`] = ` -.circuit-0 { - font-weight: 400; - font-size: 20px; - line-height: 28px; - color: #D23F47; -} - -

- error - BodyLarge -

-`; - exports[`BodyLarge should render as a "highlight" variant 1`] = ` .circuit-0 { font-weight: 400; @@ -98,22 +82,6 @@ exports[`BodyLarge should render as a "subtle" variant 1`] = `

`; -exports[`BodyLarge should render as a "success" variant 1`] = ` -.circuit-0 { - font-weight: 400; - font-size: 20px; - line-height: 28px; - color: #138849; -} - -

- success - BodyLarge -

-`; - exports[`BodyLarge should render with default styles 1`] = ` .circuit-0 { font-weight: 400; diff --git a/packages/circuit-ui/components/ListItem/ListItem.spec.tsx b/packages/circuit-ui/components/ListItem/ListItem.spec.tsx index 43f61145c5..1a4308b852 100644 --- a/packages/circuit-ui/components/ListItem/ListItem.spec.tsx +++ b/packages/circuit-ui/components/ListItem/ListItem.spec.tsx @@ -65,7 +65,7 @@ describe('ListItem', () => { const wrapper = renderListItem(create, { ...baseProps, prefix: ( - + 3 ), diff --git a/packages/circuit-ui/components/ListItem/ListItem.stories.tsx b/packages/circuit-ui/components/ListItem/ListItem.stories.tsx index 1ff1381aa8..e18a3a5e00 100644 --- a/packages/circuit-ui/components/ListItem/ListItem.stories.tsx +++ b/packages/circuit-ui/components/ListItem/ListItem.stories.tsx @@ -57,7 +57,7 @@ const item: Item = { }; const PrefixBadge = ( - + 3 ); @@ -69,7 +69,7 @@ const detailsStyles = css` const statusIconStyles = (theme: Theme) => css` margin-right: ${theme.spacings.bit}; - color: ${theme.colors.success}; + color: ${theme.colors.confirm}; `; const Details = ( diff --git a/packages/circuit-ui/components/ListItemGroup/ListItemGroup.stories.tsx b/packages/circuit-ui/components/ListItemGroup/ListItemGroup.stories.tsx index 088a201d0d..05cb140d03 100644 --- a/packages/circuit-ui/components/ListItemGroup/ListItemGroup.stories.tsx +++ b/packages/circuit-ui/components/ListItemGroup/ListItemGroup.stories.tsx @@ -75,12 +75,12 @@ const detailsStyles = css` const successfulIconStyles = (theme: Theme) => css` margin-right: ${theme.spacings.bit}; - color: ${theme.colors.success}; + color: ${theme.colors.confirm}; `; const failedIconStyles = (theme: Theme) => css` margin-right: ${theme.spacings.bit}; - color: ${theme.colors.danger}; + color: ${theme.colors.alert}; `; const Details = ({ item }: { item: Item }) => ( diff --git a/packages/design-tokens/tests/__snapshots__/index.spec.ts.snap b/packages/design-tokens/tests/__snapshots__/index.spec.ts.snap index d4d566548a..11790142ef 100644 --- a/packages/design-tokens/tests/__snapshots__/index.spec.ts.snap +++ b/packages/design-tokens/tests/__snapshots__/index.spec.ts.snap @@ -40,7 +40,6 @@ Object { "bodyBg": "#FFF", "bodyColor": "#1A1A1A", "confirm": "#138849", - "danger": "#D23F47", "g100": "#E4EABB", "g200": "#D4DB8F", "g300": "#BED630", @@ -77,14 +76,12 @@ Object { "r700": "#B22426", "r900": "#941618", "shadow": "rgba(12, 15, 20, 0.07)", - "success": "#138849", "v100": "#E9CFF2", "v200": "#D7A9DC", "v300": "#C781C9", "v500": "#CA58FF", "v700": "#8928A2", "v900": "#5F1D6B", - "warning": "#F5C625", "white": "#FFF", "y100": "#F2E9C7", "y200": "#EDDD8E", diff --git a/packages/design-tokens/themes/light.ts b/packages/design-tokens/themes/light.ts index d1c1203e71..c04c546d02 100644 --- a/packages/design-tokens/themes/light.ts +++ b/packages/design-tokens/themes/light.ts @@ -102,18 +102,6 @@ const misc = { overlay: 'rgba(0, 0, 0, 0.4)', bodyBg: white, bodyColor: neutrals.n900, - /** - * @deprecated Use `alert` color instead. - */ - danger: '#D23F47', - /** - * @deprecated Use `confirm` color instead. - */ - success: '#138849', - /** - * @deprecated Use `notify` color instead. - */ - warning: '#F5C625', info: '#3063E9', confirm: '#138849', alert: '#D23F47', diff --git a/packages/design-tokens/types/index.ts b/packages/design-tokens/types/index.ts index 77ed7d640b..b1b9ebe26b 100644 --- a/packages/design-tokens/types/index.ts +++ b/packages/design-tokens/types/index.ts @@ -80,9 +80,6 @@ export type Colors = { overlay: string; bodyBg: string; bodyColor: string; - danger: string; - success: string; - warning: string; info: string; confirm: string; alert: string; diff --git a/packages/design-tokens/utils/theme-prop-type.ts b/packages/design-tokens/utils/theme-prop-type.ts index 8ffc068abb..193d6c3f72 100644 --- a/packages/design-tokens/utils/theme-prop-type.ts +++ b/packages/design-tokens/utils/theme-prop-type.ts @@ -120,9 +120,6 @@ export const themePropType = PropTypes.shape({ overlay: PropTypes.string.isRequired, bodyBg: PropTypes.string.isRequired, bodyColor: PropTypes.string.isRequired, - danger: PropTypes.string.isRequired, - success: PropTypes.string.isRequired, - warning: PropTypes.string.isRequired, info: PropTypes.string.isRequired, alert: PropTypes.string.isRequired, confirm: PropTypes.string.isRequired,