Skip to content

Commit 580815e

Browse files
chore: remove text-icon selector and remove deprecation warnings on typography (#4235)
* refactor(eds-core-react): remove text-icon className from variables * chore(eds-core-react): remove deprecated Typography component documentation and references * fix(eds-core-react): add typography link stories
1 parent 7397566 commit 580815e

10 files changed

Lines changed: 7 additions & 197 deletions

File tree

packages/eds-core-react/src/components/Typography/Typography.docs.mdx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,6 @@ import * as ComponentStories from './Typography.stories'
66

77
# Typography
88

9-
## ⚠️ Deprecated
10-
11-
**This component is deprecated and will be removed in a future version.**
12-
13-
14-
### The next-generation typography system is now available:
15-
16-
* **For headings**: Use `<Heading as="h1|h2|h3|h4|h5|h6">` instead of `<Typography variant="h1|h2|h3|h4|h5|h6">`
17-
* **For paragraphs**: Use `<Paragraph>` instead of `<Typography variant="body_short|body_long">`
18-
* **For inline text**: Use `<TypographyNext as Typography>` for flexible text styling with full typography control
19-
20-
```tsx
21-
import { TypographyNext as Typography, Heading, Paragraph } from '@equinor/eds-core-react'
22-
23-
<Heading as="h1">Welcome</Heading>
24-
<Paragraph>This uses the new typography system.</Paragraph>
25-
<Typography family="ui" size="md" lineHeight="default" baseline="grid" weight="normal" tracking="normal">
26-
Flexible inline text
27-
</Typography>
28-
```
29-
309
Presents hierarchy and organises information as clearly and efficiently as possible,
3110
therefore text sizes and styles were developed to balance content density and reading comfort.
3211

packages/eds-core-react/src/components/Typography/Typography.new.stories.tsx

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -90,102 +90,6 @@ Playground.parameters = {
9090
},
9191
}
9292

93-
export const WithIcons: StoryFn = () => {
94-
const iconTextStyle: React.CSSProperties = {
95-
display: 'grid',
96-
gridAutoFlow: 'column',
97-
gap: 'round(0.618em, 0.5px)',
98-
placeItems: 'center start',
99-
width: 'fit-content',
100-
}
101-
102-
return (
103-
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
104-
<TypographyNext
105-
family="ui"
106-
size="xs"
107-
baseline="grid"
108-
style={iconTextStyle}
109-
>
110-
<Icon name="save" className="eds-typography-text-icon" /> Extra small
111-
text with icon
112-
</TypographyNext>
113-
<TypographyNext
114-
family="ui"
115-
size="sm"
116-
baseline="grid"
117-
style={iconTextStyle}
118-
>
119-
<Icon name="save" className="eds-typography-text-icon" /> Small text
120-
with icon
121-
</TypographyNext>
122-
<TypographyNext
123-
family="ui"
124-
size="md"
125-
baseline="grid"
126-
style={iconTextStyle}
127-
>
128-
<Icon name="save" className="eds-typography-text-icon" /> Medium text
129-
with icon
130-
</TypographyNext>
131-
<TypographyNext
132-
family="ui"
133-
size="lg"
134-
baseline="grid"
135-
style={iconTextStyle}
136-
>
137-
<Icon name="save" className="eds-typography-text-icon" /> Large text
138-
with icon
139-
</TypographyNext>
140-
<TypographyNext
141-
family="ui"
142-
size="xl"
143-
baseline="grid"
144-
style={iconTextStyle}
145-
>
146-
<Icon name="save" className="eds-typography-text-icon" /> Extra large
147-
text with icon
148-
</TypographyNext>
149-
<TypographyNext
150-
family="ui"
151-
size="2xl"
152-
baseline="grid"
153-
style={iconTextStyle}
154-
>
155-
<Icon name="save" className="eds-typography-text-icon" /> 2XL heading
156-
text with icon
157-
</TypographyNext>
158-
<TypographyNext
159-
family="ui"
160-
size="3xl"
161-
baseline="grid"
162-
style={iconTextStyle}
163-
>
164-
<Icon name="save" className="eds-typography-text-icon" /> 3XL heading
165-
text with icon
166-
</TypographyNext>
167-
<TypographyNext
168-
family="ui"
169-
size="4xl"
170-
baseline="grid"
171-
style={iconTextStyle}
172-
>
173-
<Icon name="save" className="eds-typography-text-icon" /> 4XL heading
174-
text with icon
175-
</TypographyNext>
176-
</div>
177-
)
178-
}
179-
180-
WithIcons.parameters = {
181-
docs: {
182-
description: {
183-
story:
184-
"Icons can be used alongside TypographyNext by applying the `.eds-typography-text-icon` class. The icon will automatically adapt its size based on the typography component's font-size using CSS custom properties. The icon scales proportionally with the text size.",
185-
},
186-
},
187-
}
188-
18993
export const AsLink: StoryFn = () => {
19094
return (
19195
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>

packages/eds-core-react/src/components/Typography/Typography.stories.shared.tsx

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Icon } from '../Icon'
21
import { Heading } from './Heading'
32
import { Paragraph } from './Paragraph'
43
import { TypographyNext } from './Typography.new'
@@ -303,25 +302,6 @@ export const LineHeightComparison = ({
303302
</>
304303
)
305304

306-
export const IconTextRow = ({
307-
label,
308-
size,
309-
text = 'Save your work',
310-
iconName = 'save',
311-
}: {
312-
label: string
313-
size: (typeof SIZES)[number]
314-
text?: string
315-
iconName?: string
316-
}) => (
317-
<ComparisonRowItem label={label}>
318-
<IconTextContainer className={`font-ui text-${size}`}>
319-
<Icon name={iconName} className="eds-typography-text-icon" />
320-
<span className="text-baseline-center">{text}</span>
321-
</IconTextContainer>
322-
</ComparisonRowItem>
323-
)
324-
325305
export const ButtonRow = ({
326306
label,
327307
size,

packages/eds-core-react/src/components/Typography/Typography.stories.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const SBCard = styled(Card)`
1515
const meta: Meta<typeof Typography> = {
1616
title: 'Typography/Typography',
1717
component: Typography,
18-
tags: ['deprecated'],
1918
argTypes: {
2019
variant: { control: { type: null } },
2120
group: { control: { type: null } },
@@ -38,10 +37,6 @@ const meta: Meta<typeof Typography> = {
3837
excludeDecorators: true,
3938
},
4039
},
41-
status: {
42-
type: 'deprecated',
43-
},
44-
badges: ['deprecated'],
4540
},
4641
decorators: [
4742
(Story) => {

packages/eds-core-react/src/components/Typography/Typography.tsx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
typographyTemplate,
1010
outlineTemplate,
1111
OverridableComponent,
12-
useDeprecationWarning,
1312
} from '@equinor/eds-utils'
1413
import {
1514
quickVariants,
@@ -129,19 +128,6 @@ export type TypographyProps = {
129128
lines?: number
130129
} & (HTMLAttributes<HTMLElement> | AnchorHTMLAttributes<HTMLAnchorElement>)
131130

132-
/**
133-
* @deprecated Typography component is deprecated and will be removed in a future version.
134-
* Please use the new Typography, Heading, or Paragraph components instead.
135-
*
136-
* Migration guide:
137-
* - For headings: Use `<Heading as="h1|h2|h3|h4|h5|h6">` instead of `<Typography variant="h1|h2|h3|h4|h5|h6">`
138-
* - For paragraphs: Use `<Paragraph>` instead of `<Typography variant="body_short|body_long">`
139-
* - For inline text: Use `<Typography>` for more flexible text styling
140-
*
141-
* @see {@link TypographyNext}
142-
* @see {@link Heading}
143-
* @see {@link Paragraph}
144-
*/
145131
export const Typography: OverridableComponent<TypographyProps, HTMLElement> =
146132
forwardRef(function Typography(
147133
{
@@ -159,13 +145,6 @@ export const Typography: OverridableComponent<TypographyProps, HTMLElement> =
159145
},
160146
ref,
161147
) {
162-
useDeprecationWarning(
163-
'The Typography component is deprecated and will be removed in a future version. ' +
164-
'Please migrate to the new TypographyNext, Heading, or Paragraph component. ' +
165-
'See the documentation for migration details.',
166-
'Typography',
167-
)
168-
169148
const as: ElementType = providedAs
170149
? providedAs
171150
: getElementType(variant, link)

packages/eds-tokens/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ const darkSurface = darkSemanticNested.bg.neutral.surface // "#262626"
142142
* Font weight data attributes (`[data-font-weight='lighter']`, `[data-font-weight='normal']`, `[data-font-weight='bolder']`)
143143
* Letter spacing data attributes (`[data-tracking='tight']`, `[data-tracking='normal']`, `[data-tracking='wide']`)
144144
* Baseline grid alignment (`[data-baseline='grid']`, `[data-baseline='center']`)
145-
* Icon sizing utilities (`.eds-typography-text-icon`)
146145

147146

148147
#### Using Typography variables

packages/eds-tokens/build/css/typography.css

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* Registered custom property for font-size values
33
*
4-
* This @property declaration registers --font-size as a typed CSS custom property,
4+
* This @property declaration registers --eds-typography-font-size as a typed CSS custom property,
55
* enabling proper unit handling in calc() expressions. This is essential for the
6-
* .eds-typography-text-icon sizing calculations, which use tan(atan2(var(--font-size), 1px)) to
6+
* text-icon sizing calculations, which use tan(atan2(var(--eds-typography-font-size), 1px)) to
77
* extract the numeric value from the font-size for proportional icon scaling.
88
*
9-
* Without this registration, the browser would treat --font-size as an untyped string,
9+
* Without this registration, the browser would treat --eds-typography-font-size as an untyped string,
1010
* preventing the mathematical operations needed for responsive icon sizing based on
1111
* the current text size.
1212
*/
@@ -485,12 +485,3 @@
485485
padding-bottom: calc((round(1cap, 4px) - 1ex) / 2 - (1cap - 1ex) / 2);
486486
}
487487
}
488-
489-
/* Icon sizing within text elements - adjusts based on font-size */
490-
.eds-typography-text-icon {
491-
width: calc(24px * tan(atan2(var(--eds-typography-font-size), 1px)) / 16);
492-
height: auto;
493-
font-size: calc(24px * tan(atan2(var(--eds-typography-font-size), 1px)) / 16);
494-
margin-block: -0.5em;
495-
margin-inline: -0.2em;
496-
}

packages/eds-tokens/build/css/variables.css

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,11 +1268,3 @@
12681268
padding-bottom: calc(round(1cap, 4px) / 2 - .5cap);
12691269
}
12701270
}
1271-
1272-
.eds-typography-text-icon {
1273-
width: calc(24px * tan(atan2(var(--eds-typography-font-size), 1px)) / 16);
1274-
height: auto;
1275-
font-size: calc(24px * tan(atan2(var(--eds-typography-font-size), 1px)) / 16);
1276-
margin-block: -.5em;
1277-
margin-inline: -.2em;
1278-
}

packages/eds-tokens/build/css/variables.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/eds-tokens/src/css/typography.css

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* Registered custom property for font-size values
33
*
4-
* This @property declaration registers --font-size as a typed CSS custom property,
4+
* This @property declaration registers --eds-typography-font-size as a typed CSS custom property,
55
* enabling proper unit handling in calc() expressions. This is essential for the
6-
* .eds-typography-text-icon sizing calculations, which use tan(atan2(var(--font-size), 1px)) to
6+
* text-icon sizing calculations, which use tan(atan2(var(--eds-typography-font-size), 1px)) to
77
* extract the numeric value from the font-size for proportional icon scaling.
88
*
9-
* Without this registration, the browser would treat --font-size as an untyped string,
9+
* Without this registration, the browser would treat --eds-typography-font-size as an untyped string,
1010
* preventing the mathematical operations needed for responsive icon sizing based on
1111
* the current text size.
1212
*/
@@ -485,12 +485,3 @@
485485
padding-bottom: calc((round(1cap, 4px) - 1ex) / 2 - (1cap - 1ex) / 2);
486486
}
487487
}
488-
489-
/* Icon sizing within text elements - adjusts based on font-size */
490-
.eds-typography-text-icon {
491-
width: calc(24px * tan(atan2(var(--eds-typography-font-size), 1px)) / 16);
492-
height: auto;
493-
font-size: calc(24px * tan(atan2(var(--eds-typography-font-size), 1px)) / 16);
494-
margin-block: -0.5em;
495-
margin-inline: -0.2em;
496-
}

0 commit comments

Comments
 (0)