@equinor/eds-core-react 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -9
- package/dist/eds-core-react.cjs +1 -15
- package/dist/esm/components/Typography/Typography.js +1 -15
- package/dist/esm/components/Typography/Typography.new.js +1 -1
- package/dist/types/components/Typography/Typography.d.ts +0 -13
- package/dist/types/components/Typography/Typography.new.d.ts +2 -6
- package/dist/types/components/Typography/Typography.new.types.d.ts +2 -2
- package/dist/types/components/Typography/Typography.stories.shared.d.ts +1 -22
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Read the [changelog](https://github.com/equinor/design-system/blob/main/packages
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
|
-
npm install @equinor/eds-core-react
|
|
11
|
+
npm install @equinor/eds-core-react styled-components
|
|
12
12
|
```
|
|
13
13
|
If you use Typescript, make sure you have typescript >= 3.8 as a devDependency:
|
|
14
14
|
```sh
|
|
@@ -20,23 +20,17 @@ npm install typescript --save-dev
|
|
|
20
20
|
The Equinor typeface is not included and needs to be added to the head of your project. Its available from the EDS CDN:
|
|
21
21
|
|
|
22
22
|
```html
|
|
23
|
-
<link rel="stylesheet" href="https://cdn.eds.equinor.com/font/
|
|
23
|
+
<link rel="stylesheet" href="https://cdn.eds.equinor.com/font/eds-uprights-vf.css" />
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### Required Stylesheets
|
|
27
27
|
|
|
28
|
-
EDS Core React components require css variables
|
|
28
|
+
EDS Core React components require css variables (colors, spacing and typography).
|
|
29
29
|
|
|
30
30
|
```css
|
|
31
31
|
@import '@equinor/eds-tokens/css/variables';
|
|
32
|
-
@import '@equinor/eds-tokens/css/foundation';
|
|
33
32
|
```
|
|
34
33
|
|
|
35
|
-
**Why both?**
|
|
36
|
-
- **Variables CSS** (`/css/variables`) provides all design tokens (colors, spacing, typography variables)
|
|
37
|
-
- **Foundation CSS** (`/css/foundation`) provides typography and spacing utility classes used in our components.
|
|
38
|
-
|
|
39
|
-
For more information about the typography system, see the [Typography component documentation](./src/components/Typography/README.md).
|
|
40
34
|
|
|
41
35
|
## Usage
|
|
42
36
|
|
package/dist/eds-core-react.cjs
CHANGED
|
@@ -1443,19 +1443,6 @@ const StyledTypography$1 = styled__default.default.p.withConfig({
|
|
|
1443
1443
|
}) => $lines && styled.css(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;"], $lines), ({
|
|
1444
1444
|
$link
|
|
1445
1445
|
}) => $link && styled.css(["&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}"], edsUtils.outlineTemplate(link.states.focus.outline), edsUtils.outlineTemplate(link.states.focus.outline)));
|
|
1446
|
-
/**
|
|
1447
|
-
* @deprecated Typography component is deprecated and will be removed in a future version.
|
|
1448
|
-
* Please use the new Typography, Heading, or Paragraph components instead.
|
|
1449
|
-
*
|
|
1450
|
-
* Migration guide:
|
|
1451
|
-
* - For headings: Use `<Heading as="h1|h2|h3|h4|h5|h6">` instead of `<Typography variant="h1|h2|h3|h4|h5|h6">`
|
|
1452
|
-
* - For paragraphs: Use `<Paragraph>` instead of `<Typography variant="body_short|body_long">`
|
|
1453
|
-
* - For inline text: Use `<Typography>` for more flexible text styling
|
|
1454
|
-
*
|
|
1455
|
-
* @see {@link TypographyNext}
|
|
1456
|
-
* @see {@link Heading}
|
|
1457
|
-
* @see {@link Paragraph}
|
|
1458
|
-
*/
|
|
1459
1446
|
const Typography = /*#__PURE__*/react.forwardRef(function Typography({
|
|
1460
1447
|
variant = 'body_short',
|
|
1461
1448
|
children,
|
|
@@ -1469,7 +1456,6 @@ const Typography = /*#__PURE__*/react.forwardRef(function Typography({
|
|
|
1469
1456
|
as: providedAs,
|
|
1470
1457
|
...other
|
|
1471
1458
|
}, ref) {
|
|
1472
|
-
edsUtils.useDeprecationWarning('The Typography component is deprecated and will be removed in a future version. ' + 'Please migrate to the new TypographyNext, Heading, or Paragraph component. ' + 'See the documentation for migration details.', 'Typography');
|
|
1473
1459
|
const as = providedAs ? providedAs : getElementType(variant, link);
|
|
1474
1460
|
const variantName = toVariantName(variant, bold, italic, link);
|
|
1475
1461
|
const typography = findTypography(variantName, group);
|
|
@@ -1545,7 +1531,7 @@ const TypographyNext = /*#__PURE__*/react.forwardRef(({
|
|
|
1545
1531
|
return /*#__PURE__*/jsxRuntime.jsx(Component, {
|
|
1546
1532
|
ref: ref,
|
|
1547
1533
|
"data-font-family": family,
|
|
1548
|
-
"data-
|
|
1534
|
+
"data-font-size": size,
|
|
1549
1535
|
"data-baseline": baseline || undefined,
|
|
1550
1536
|
"data-line-height": lineHeight || undefined,
|
|
1551
1537
|
"data-font-weight": weight || undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
|
-
import {
|
|
3
|
+
import { typographyTemplate, outlineTemplate } from '@equinor/eds-utils';
|
|
4
4
|
import { quickVariants, typography, colors, link } from './Typography.tokens.js';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
|
|
@@ -53,19 +53,6 @@ const StyledTypography = styled.p.withConfig({
|
|
|
53
53
|
}) => $lines && css(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;"], $lines), ({
|
|
54
54
|
$link
|
|
55
55
|
}) => $link && css(["&:focus{outline:none;}&[data-focus-visible-added]:focus{", "}&:focus-visible{", "}"], outlineTemplate(link.states.focus.outline), outlineTemplate(link.states.focus.outline)));
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated Typography component is deprecated and will be removed in a future version.
|
|
58
|
-
* Please use the new Typography, Heading, or Paragraph components instead.
|
|
59
|
-
*
|
|
60
|
-
* Migration guide:
|
|
61
|
-
* - For headings: Use `<Heading as="h1|h2|h3|h4|h5|h6">` instead of `<Typography variant="h1|h2|h3|h4|h5|h6">`
|
|
62
|
-
* - For paragraphs: Use `<Paragraph>` instead of `<Typography variant="body_short|body_long">`
|
|
63
|
-
* - For inline text: Use `<Typography>` for more flexible text styling
|
|
64
|
-
*
|
|
65
|
-
* @see {@link TypographyNext}
|
|
66
|
-
* @see {@link Heading}
|
|
67
|
-
* @see {@link Paragraph}
|
|
68
|
-
*/
|
|
69
56
|
const Typography = /*#__PURE__*/forwardRef(function Typography({
|
|
70
57
|
variant = 'body_short',
|
|
71
58
|
children,
|
|
@@ -79,7 +66,6 @@ const Typography = /*#__PURE__*/forwardRef(function Typography({
|
|
|
79
66
|
as: providedAs,
|
|
80
67
|
...other
|
|
81
68
|
}, ref) {
|
|
82
|
-
useDeprecationWarning('The Typography component is deprecated and will be removed in a future version. ' + 'Please migrate to the new TypographyNext, Heading, or Paragraph component. ' + 'See the documentation for migration details.', 'Typography');
|
|
83
69
|
const as = providedAs ? providedAs : getElementType(variant, link);
|
|
84
70
|
const variantName = toVariantName(variant, bold, italic, link);
|
|
85
71
|
const typography = findTypography(variantName, group);
|
|
@@ -53,7 +53,7 @@ const TypographyNext = /*#__PURE__*/forwardRef(({
|
|
|
53
53
|
return /*#__PURE__*/jsx(Component, {
|
|
54
54
|
ref: ref,
|
|
55
55
|
"data-font-family": family,
|
|
56
|
-
"data-
|
|
56
|
+
"data-font-size": size,
|
|
57
57
|
"data-baseline": baseline || undefined,
|
|
58
58
|
"data-line-height": lineHeight || undefined,
|
|
59
59
|
"data-font-weight": weight || undefined,
|
|
@@ -20,17 +20,4 @@ export type TypographyProps = {
|
|
|
20
20
|
/** Number of lines. */
|
|
21
21
|
lines?: number;
|
|
22
22
|
} & (HTMLAttributes<HTMLElement> | AnchorHTMLAttributes<HTMLAnchorElement>);
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated Typography component is deprecated and will be removed in a future version.
|
|
25
|
-
* Please use the new Typography, Heading, or Paragraph components instead.
|
|
26
|
-
*
|
|
27
|
-
* Migration guide:
|
|
28
|
-
* - For headings: Use `<Heading as="h1|h2|h3|h4|h5|h6">` instead of `<Typography variant="h1|h2|h3|h4|h5|h6">`
|
|
29
|
-
* - For paragraphs: Use `<Paragraph>` instead of `<Typography variant="body_short|body_long">`
|
|
30
|
-
* - For inline text: Use `<Typography>` for more flexible text styling
|
|
31
|
-
*
|
|
32
|
-
* @see {@link TypographyNext}
|
|
33
|
-
* @see {@link Heading}
|
|
34
|
-
* @see {@link Paragraph}
|
|
35
|
-
*/
|
|
36
23
|
export declare const Typography: OverridableComponent<TypographyProps, HTMLElement>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TypographyNextProps } from './Typography.new.types';
|
|
1
2
|
/**
|
|
2
3
|
* TypographyNext component for flexible typography with baseline grid support.
|
|
3
4
|
*
|
|
@@ -35,9 +36,4 @@
|
|
|
35
36
|
* </Typography>
|
|
36
37
|
* ```
|
|
37
38
|
*/
|
|
38
|
-
export declare const TypographyNext: import("react").ForwardRefExoticComponent<
|
|
39
|
-
family: import("./types").FontFamily;
|
|
40
|
-
size: import("./types").FontSize;
|
|
41
|
-
baseline: import("./types").BaselineAlignment;
|
|
42
|
-
as?: import("react").ElementType;
|
|
43
|
-
} & import("./Typography.new.types").BaseTypographyProps & import("react").HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>;
|
|
39
|
+
export declare const TypographyNext: import("react").ForwardRefExoticComponent<TypographyNextProps & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, ElementType } from 'react';
|
|
1
|
+
import { HTMLAttributes, AnchorHTMLAttributes, ElementType } from 'react';
|
|
2
2
|
import { FontFamily, FontSize, LineHeight, BaselineAlignment, FontWeight, Tracking } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Base typography props shared across typography components.
|
|
@@ -25,4 +25,4 @@ export type TypographyNextProps = {
|
|
|
25
25
|
baseline: BaselineAlignment;
|
|
26
26
|
/** Semantic HTML element to render. Defaults to 'span' */
|
|
27
27
|
as?: ElementType;
|
|
28
|
-
} & BaseTypographyProps & HTMLAttributes<HTMLElement
|
|
28
|
+
} & BaseTypographyProps & (HTMLAttributes<HTMLElement> | AnchorHTMLAttributes<HTMLAnchorElement>);
|
|
@@ -9,22 +9,7 @@ export declare const LINE_HEIGHTS: readonly ["default", "squished"];
|
|
|
9
9
|
export declare const HEADING_LEVELS: readonly ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
10
10
|
export declare const ComparisonGrid: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
11
11
|
export declare const ComparisonRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
|
-
export declare const Label: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<{
|
|
13
|
-
family: import("./types").FontFamily;
|
|
14
|
-
size: import("./types").FontSize;
|
|
15
|
-
baseline: import("./types").BaselineAlignment;
|
|
16
|
-
as?: import("react").ElementType;
|
|
17
|
-
} & import("./Typography.new.types").BaseTypographyProps & import("react").HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>, {
|
|
18
|
-
family: import("./types").FontFamily;
|
|
19
|
-
size: import("./types").FontSize;
|
|
20
|
-
baseline: import("./types").BaselineAlignment;
|
|
21
|
-
as?: import("react").ElementType;
|
|
22
|
-
} & import("./Typography.new.types").BaseTypographyProps & import("react").HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>, Partial<TypographyNextProps>>, Partial<TypographyNextProps>>> & string & Omit<import("react").ForwardRefExoticComponent<{
|
|
23
|
-
family: import("./types").FontFamily;
|
|
24
|
-
size: import("./types").FontSize;
|
|
25
|
-
baseline: import("./types").BaselineAlignment;
|
|
26
|
-
as?: import("react").ElementType;
|
|
27
|
-
} & import("./Typography.new.types").BaseTypographyProps & import("react").HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>, keyof import("react").Component<any, {}, any>>;
|
|
12
|
+
export declare const Label: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<(TypographyNextProps & import("react").RefAttributes<HTMLElement>) & import("styled-components/dist/types").BaseObject, TypographyNextProps & import("react").RefAttributes<HTMLElement>>, Partial<TypographyNextProps>>, Partial<TypographyNextProps>>> & string & Omit<import("react").ForwardRefExoticComponent<TypographyNextProps & import("react").RefAttributes<HTMLElement>>, keyof import("react").Component<any, {}, any>>;
|
|
28
13
|
export declare const GridBackground: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
29
14
|
export declare const RealWorldGrid: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
|
|
30
15
|
export declare const IntroductionGrid: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, never>> & string;
|
|
@@ -66,12 +51,6 @@ export declare const SizeComparison: ({ component: Component, text, ...component
|
|
|
66
51
|
export declare const LineHeightComparison: ({ text, }: {
|
|
67
52
|
text?: string;
|
|
68
53
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
69
|
-
export declare const IconTextRow: ({ label, size, text, iconName, }: {
|
|
70
|
-
label: string;
|
|
71
|
-
size: (typeof SIZES)[number];
|
|
72
|
-
text?: string;
|
|
73
|
-
iconName?: string;
|
|
74
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
75
54
|
export declare const ButtonRow: ({ label, size, children, ...extraProps }: {
|
|
76
55
|
label: string;
|
|
77
56
|
size: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/eds-core-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "The React implementation of the Equinor Design System",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -82,8 +82,7 @@
|
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"react": "^19",
|
|
84
84
|
"react-dom": "^19",
|
|
85
|
-
"styled-components": "^6"
|
|
86
|
-
"@equinor/eds-tokens": "^2"
|
|
85
|
+
"styled-components": "^6"
|
|
87
86
|
},
|
|
88
87
|
"dependencies": {
|
|
89
88
|
"@babel/runtime": "^7.28.4",
|
|
@@ -97,12 +96,12 @@
|
|
|
97
96
|
"downshift": "9.0.10",
|
|
98
97
|
"react-aria": "^3.44.0",
|
|
99
98
|
"@equinor/eds-icons": "^1.0.1",
|
|
100
|
-
"@equinor/eds-
|
|
101
|
-
"@equinor/eds-
|
|
99
|
+
"@equinor/eds-tokens": "^2.1.0",
|
|
100
|
+
"@equinor/eds-utils": "^2.0.0"
|
|
102
101
|
},
|
|
103
102
|
"scripts": {
|
|
104
103
|
"build": "rollup -c && tsc -p tsconfig.build.json",
|
|
105
|
-
"test": "tsc -p tsconfig.test.json && jest",
|
|
104
|
+
"test": "tsc -p tsconfig.test.json && jest --ci",
|
|
106
105
|
"test:watch": "tsc-watch -p tsconfig.test.json --onFirstSuccess \"jest --watch\"",
|
|
107
106
|
"test:update-snapshots": "jest --updateSnapshot",
|
|
108
107
|
"test:visual": "playwright test",
|