@entur/typography 3.0.6 → 3.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 +9 -38
- package/dist/beta/cjs/components/Heading.cjs +39 -29
- package/dist/beta/cjs/components/Heading.cjs.map +1 -1
- package/dist/beta/cjs/components/Label.cjs +22 -0
- package/dist/beta/cjs/components/Label.cjs.map +1 -0
- package/dist/beta/cjs/components/Link.cjs +18 -33
- package/dist/beta/cjs/components/Link.cjs.map +1 -1
- package/dist/beta/cjs/components/ListItem.cjs +29 -25
- package/dist/beta/cjs/components/ListItem.cjs.map +1 -1
- package/dist/beta/cjs/components/NumberedList.cjs +34 -24
- package/dist/beta/cjs/components/NumberedList.cjs.map +1 -1
- package/dist/beta/cjs/components/Text.cjs +40 -28
- package/dist/beta/cjs/components/Text.cjs.map +1 -1
- package/dist/beta/cjs/components/TextContainer.cjs +26 -0
- package/dist/beta/cjs/components/TextContainer.cjs.map +1 -0
- package/dist/beta/cjs/components/UnorderedList.cjs +19 -21
- package/dist/beta/cjs/components/UnorderedList.cjs.map +1 -1
- package/dist/beta/cjs/index.cjs +8 -3
- package/dist/beta/cjs/index.cjs.map +1 -1
- package/dist/beta/cjs/utils/utils.cjs +73 -41
- package/dist/beta/cjs/utils/utils.cjs.map +1 -1
- package/dist/beta/cjs/utils/warnAboutGlobalStyles.cjs +113 -0
- package/dist/beta/cjs/utils/warnAboutGlobalStyles.cjs.map +1 -0
- package/dist/beta/esm/components/Heading.mjs +40 -30
- package/dist/beta/esm/components/Heading.mjs.map +1 -1
- package/dist/beta/esm/components/Label.mjs +22 -0
- package/dist/beta/esm/components/Label.mjs.map +1 -0
- package/dist/beta/esm/components/Link.mjs +20 -35
- package/dist/beta/esm/components/Link.mjs.map +1 -1
- package/dist/beta/esm/components/ListItem.mjs +30 -26
- package/dist/beta/esm/components/ListItem.mjs.map +1 -1
- package/dist/beta/esm/components/NumberedList.mjs +35 -25
- package/dist/beta/esm/components/NumberedList.mjs.map +1 -1
- package/dist/beta/esm/components/Text.mjs +41 -29
- package/dist/beta/esm/components/Text.mjs.map +1 -1
- package/dist/beta/esm/components/TextContainer.mjs +26 -0
- package/dist/beta/esm/components/TextContainer.mjs.map +1 -0
- package/dist/beta/esm/components/UnorderedList.mjs +20 -22
- package/dist/beta/esm/components/UnorderedList.mjs.map +1 -1
- package/dist/beta/esm/index.mjs +8 -3
- package/dist/beta/esm/index.mjs.map +1 -1
- package/dist/beta/esm/utils/utils.mjs +73 -41
- package/dist/beta/esm/utils/utils.mjs.map +1 -1
- package/dist/beta/esm/utils/warnAboutGlobalStyles.mjs +113 -0
- package/dist/beta/esm/utils/warnAboutGlobalStyles.mjs.map +1 -0
- package/dist/beta/styles/index.css +878 -609
- package/dist/beta/types/components/Heading.d.ts +27 -11
- package/dist/beta/types/components/Label.d.ts +22 -0
- package/dist/beta/types/components/Link.d.ts +11 -9
- package/dist/beta/types/components/ListItem.d.ts +11 -7
- package/dist/beta/types/components/NumberedList.d.ts +15 -7
- package/dist/beta/types/components/Text.d.ts +33 -13
- package/dist/beta/types/components/TextContainer.d.ts +25 -0
- package/dist/beta/types/components/UnorderedList.d.ts +11 -7
- package/dist/beta/types/index.d.ts +11 -2
- package/dist/beta/types/tests/styles.test.d.ts +1 -0
- package/dist/beta/types/tests/warnAboutGlobalStyles.test.d.ts +1 -0
- package/dist/beta/types/types.d.ts +16 -5
- package/dist/beta/types/utils/utils.d.ts +15 -4
- package/dist/beta/types/utils/warnAboutGlobalStyles.d.ts +4 -0
- package/dist/styles.css +13 -5
- package/dist/styles.no-base-tokens.css +822 -0
- package/package.json +8 -12
- package/dist/beta/cjs/components/Blockquote.cjs +0 -29
- package/dist/beta/cjs/components/Blockquote.cjs.map +0 -1
- package/dist/beta/esm/components/Blockquote.mjs +0 -29
- package/dist/beta/esm/components/Blockquote.mjs.map +0 -1
- package/dist/beta/types/components/Blockquote.d.ts +0 -12
- package/scripts/migrate-typography.mjs +0 -1462
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { TypographySpacingProps } from '../types';
|
|
3
3
|
import { PolymorphicComponentProps } from '@entur/utils';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @beta Experimental component - may have breaking changes in future releases
|
|
6
|
+
*/
|
|
7
|
+
export type HeadingOwnProps = TypographySpacingProps & {
|
|
5
8
|
/** Visuell variant som bestemmer styling (anbefalt over size) */
|
|
6
|
-
variant?:
|
|
9
|
+
variant?: 'title-1' | 'title-2' | 'subtitle-1' | 'subtitle-2' | 'section-1' | 'section-2';
|
|
7
10
|
/** Visuell tekststørrelse som overstyrer variant-styling */
|
|
8
|
-
size?:
|
|
11
|
+
size?: 'xs' | 's' | 'm' | 'lg' | 'xl' | '2xl';
|
|
12
|
+
/** Dempet tekst for sekundære overskrifter. Velger riktig farge i kontrast- og mørk modus. */
|
|
13
|
+
tone?: 'subdued';
|
|
9
14
|
/** Innholdet som skal vises */
|
|
10
|
-
children
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
/** Fjerner luften over versalhøyden og under grunnlinjen, så teksten flukter med elementer ved siden av. Har ingen effekt i nettlesere uten støtte for `text-box`. */
|
|
17
|
+
trim?: boolean;
|
|
18
|
+
/** Kutter teksten etter så mange linjer og avslutter med «…». Hele teksten må kunne leses et annet sted, for eksempel på en egen side. */
|
|
19
|
+
maxLines?: number;
|
|
11
20
|
/** Ekstra klassenavn for tilpasset styling */
|
|
12
21
|
className?: string;
|
|
13
|
-
/** Inline CSS-stiler */
|
|
14
|
-
style?: React.CSSProperties;
|
|
15
|
-
/** Spacing around the component */
|
|
16
|
-
spacing?: TypographySpacing;
|
|
17
22
|
};
|
|
18
|
-
export type
|
|
19
|
-
export
|
|
23
|
+
export type TypographyHeadingVariant = NonNullable<HeadingOwnProps['variant']>;
|
|
24
|
+
export type TypographyHeadingSize = NonNullable<HeadingOwnProps['size']>;
|
|
25
|
+
export type HeadingProps<C extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<C, HeadingOwnProps>;
|
|
26
|
+
export type HeadingComponent = (<C extends React.ElementType = typeof defaultElement>(props: HeadingProps<C> & {
|
|
27
|
+
ref?: React.Ref<Element>;
|
|
28
|
+
}) => React.ReactElement | null) & {
|
|
29
|
+
displayName?: string;
|
|
30
|
+
};
|
|
31
|
+
declare const defaultElement = "h2";
|
|
32
|
+
/**
|
|
33
|
+
* @beta Experimental component - may have breaking changes in future releases
|
|
34
|
+
*/
|
|
35
|
+
export declare const Heading: HeadingComponent;
|
|
20
36
|
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TypographySpacingProps } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* @beta Experimental component - may have breaking changes in future releases
|
|
5
|
+
*/
|
|
6
|
+
export type LabelOwnProps = TypographySpacingProps & {
|
|
7
|
+
/** Ekstra klassenavn */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Innholdet */
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export type LabelProps = LabelOwnProps & Omit<React.LabelHTMLAttributes<HTMLLabelElement>, keyof LabelOwnProps>;
|
|
13
|
+
/**
|
|
14
|
+
* Ledetekst for et skjemafelt, koblet til feltet med `htmlFor` eller ved å ligge rundt det
|
|
15
|
+
* @beta Experimental component - may have breaking changes in future releases
|
|
16
|
+
*/
|
|
17
|
+
export declare const Label: React.ForwardRefExoticComponent<TypographySpacingProps & {
|
|
18
|
+
/** Ekstra klassenavn */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Innholdet */
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
} & Omit<React.LabelHTMLAttributes<HTMLLabelElement>, "spacing" | "children" | "className"> & React.RefAttributes<HTMLLabelElement>>;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { PolymorphicComponentProps } from '@entur/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { TypographySpacingProps } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* @beta Experimental component - may have breaking changes in future releases
|
|
6
6
|
*/
|
|
7
|
-
type
|
|
8
|
-
external?: boolean;
|
|
7
|
+
export type LinkOwnProps = TypographySpacingProps & {
|
|
9
8
|
/** Ekstra klassenavn */
|
|
10
9
|
className?: string;
|
|
11
10
|
/** Innholdet */
|
|
12
|
-
children
|
|
13
|
-
/** Spacing around the component (same as Text and Heading components) */
|
|
14
|
-
spacing?: TypographySpacing;
|
|
15
|
-
ariaLabelExternalIcon?: string;
|
|
11
|
+
children?: React.ReactNode;
|
|
16
12
|
};
|
|
17
|
-
export type LinkProps<C extends React.ElementType> = PolymorphicComponentProps<C,
|
|
13
|
+
export type LinkProps<C extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<C, LinkOwnProps>;
|
|
14
|
+
export type LinkComponent = (<C extends React.ElementType = typeof defaultElement>(props: LinkProps<C> & {
|
|
15
|
+
ref?: React.Ref<Element>;
|
|
16
|
+
}) => React.ReactElement | null) & {
|
|
17
|
+
displayName?: string;
|
|
18
|
+
};
|
|
19
|
+
declare const defaultElement = "a";
|
|
18
20
|
/**
|
|
19
21
|
* @beta Experimental component - may have breaking changes in future releases
|
|
20
22
|
*/
|
|
21
|
-
export declare const Link:
|
|
23
|
+
export declare const Link: LinkComponent;
|
|
22
24
|
export {};
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { PolymorphicComponentProps } from '@entur/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { TypographySpacingProps } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* @beta Experimental component - may have breaking changes in future releases
|
|
6
6
|
*/
|
|
7
|
-
type
|
|
7
|
+
export type ListItemOwnProps = TypographySpacingProps & {
|
|
8
8
|
/** Ekstra klassenavn */
|
|
9
9
|
className?: string;
|
|
10
10
|
/** Innholdet */
|
|
11
|
-
children
|
|
11
|
+
children?: React.ReactNode;
|
|
12
12
|
/** Tittel */
|
|
13
13
|
title?: React.ReactNode;
|
|
14
|
-
/** Spacing around the component (same as Text and Heading components) */
|
|
15
|
-
spacing?: TypographySpacing;
|
|
16
14
|
};
|
|
17
|
-
export type ListItemProps<C extends React.ElementType> = PolymorphicComponentProps<C,
|
|
15
|
+
export type ListItemProps<C extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<C, ListItemOwnProps>;
|
|
16
|
+
export type ListItemComponent = (<C extends React.ElementType = typeof defaultElement>(props: ListItemProps<C> & {
|
|
17
|
+
ref?: React.Ref<Element>;
|
|
18
|
+
}) => React.ReactElement | null) & {
|
|
19
|
+
displayName?: string;
|
|
20
|
+
};
|
|
21
|
+
declare const defaultElement = "li";
|
|
18
22
|
/**
|
|
19
23
|
* @beta Experimental component - may have breaking changes in future releases
|
|
20
24
|
*/
|
|
21
|
-
export declare const ListItem:
|
|
25
|
+
export declare const ListItem: ListItemComponent;
|
|
22
26
|
export {};
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { PolymorphicComponentProps } from '@entur/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { TypographySpacingProps } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* @beta Experimental component - may have breaking changes in future releases
|
|
6
6
|
*/
|
|
7
|
-
type
|
|
7
|
+
export type NumberedListOwnProps = TypographySpacingProps & {
|
|
8
8
|
/** Ekstra klassenavn */
|
|
9
9
|
className?: string;
|
|
10
10
|
/** Innholdet */
|
|
11
|
-
children
|
|
11
|
+
children?: React.ReactNode;
|
|
12
12
|
/** List type (1, A, a, I, i) */
|
|
13
13
|
type?: '1' | 'A' | 'a' | 'I' | 'i';
|
|
14
|
-
/**
|
|
15
|
-
|
|
14
|
+
/** `steps` viser numrene i merker, for steg-for-steg-instruksjoner
|
|
15
|
+
* @default 'default'
|
|
16
|
+
*/
|
|
17
|
+
variant?: 'default' | 'steps';
|
|
16
18
|
};
|
|
17
|
-
export type NumberedListProps<C extends React.ElementType> = PolymorphicComponentProps<C,
|
|
19
|
+
export type NumberedListProps<C extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<C, NumberedListOwnProps>;
|
|
20
|
+
export type NumberedListComponent = (<C extends React.ElementType = typeof defaultElement>(props: NumberedListProps<C> & {
|
|
21
|
+
ref?: React.Ref<Element>;
|
|
22
|
+
}) => React.ReactElement | null) & {
|
|
23
|
+
displayName?: string;
|
|
24
|
+
};
|
|
25
|
+
declare const defaultElement = "ol";
|
|
18
26
|
/**
|
|
19
27
|
* @beta Experimental component - may have breaking changes in future releases
|
|
20
28
|
*/
|
|
21
|
-
export declare const NumberedList:
|
|
29
|
+
export declare const NumberedList: NumberedListComponent;
|
|
22
30
|
export {};
|
|
@@ -1,20 +1,40 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { PolymorphicComponentProps } from '@entur/utils';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { TypographySpacingProps } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* @beta Experimental component - may have breaking changes in future releases
|
|
6
|
+
*/
|
|
7
|
+
export type TextOwnProps = TypographySpacingProps & {
|
|
5
8
|
/** Visuell tekststørrelse (typografi-token) */
|
|
6
|
-
size?:
|
|
7
|
-
/** Fontvekt */
|
|
8
|
-
weight?:
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
size?: 'xs' | 's' | 'm' | 'lg' | 'xl';
|
|
10
|
+
/** Fontvekt: `medium` (500) eller `bold` (600) */
|
|
11
|
+
weight?: 'medium' | 'bold';
|
|
12
|
+
/** Dempet tekst for sekundær informasjon, som metadata og hjelpetekst. Velger riktig farge i kontrast- og mørk modus. */
|
|
13
|
+
tone?: 'subdued';
|
|
14
|
+
/** Variant (kan brukes til spesielle typer tekst som for eksempel caption).
|
|
15
|
+
* Uten variant blir teksten `paragraph` når den står for seg selv (`p`, `div`, `li` …), og arver
|
|
16
|
+
* størrelse, farge og vekt når den står inne i annen tekst (`span`, `strong`, en komponent …). */
|
|
17
|
+
variant?: 'leading' | 'quote' | 'paragraph' | 'subparagraph' | 'caption' | 'label' | 'sublabel' | 'overline' | 'emphasized' | 'code' | 'preformatted';
|
|
11
18
|
/** Innhold */
|
|
12
|
-
children
|
|
13
|
-
/**
|
|
14
|
-
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
/** Fjerner luften over versalhøyden og under grunnlinjen, så teksten flukter med elementer ved siden av. Har ingen effekt i nettlesere uten støtte for `text-box`. */
|
|
21
|
+
trim?: boolean;
|
|
22
|
+
/** Kutter teksten etter så mange linjer og avslutter med «…». Hele teksten må kunne leses et annet sted, for eksempel på en egen side. */
|
|
23
|
+
maxLines?: number;
|
|
15
24
|
/** Ekstra klassenavn */
|
|
16
25
|
className?: string;
|
|
17
26
|
};
|
|
18
|
-
export type
|
|
19
|
-
export
|
|
20
|
-
export
|
|
27
|
+
export type TypographyTextVariant = NonNullable<TextOwnProps['variant']>;
|
|
28
|
+
export type TypographyTextSize = NonNullable<TextOwnProps['size']>;
|
|
29
|
+
export type TypographyWeight = NonNullable<TextOwnProps['weight']>;
|
|
30
|
+
export type TypographyTone = NonNullable<TextOwnProps['tone']>;
|
|
31
|
+
export type TextProps<C extends React.ElementType = 'p'> = PolymorphicComponentProps<C, TextOwnProps>;
|
|
32
|
+
export type TextComponent = (<C extends React.ElementType = 'p'>(props: TextProps<C> & {
|
|
33
|
+
ref?: React.Ref<Element>;
|
|
34
|
+
}) => React.ReactElement | null) & {
|
|
35
|
+
displayName?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* @beta Experimental component - may have breaking changes in future releases
|
|
39
|
+
*/
|
|
40
|
+
export declare const Text: TextComponent;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PolymorphicComponentProps } from '@entur/utils';
|
|
3
|
+
import { TypographySpacingProps } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* @beta Experimental component - may have breaking changes in future releases
|
|
6
|
+
*/
|
|
7
|
+
export type TextContainerOwnProps = TypographySpacingProps & {
|
|
8
|
+
/** Ekstra klassenavn */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Overskrifter, avsnitt, lister og annen løpende tekst */
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export type TextContainerProps<C extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<C, TextContainerOwnProps>;
|
|
14
|
+
export type TextContainerComponent = (<C extends React.ElementType = typeof defaultElement>(props: TextContainerProps<C> & {
|
|
15
|
+
ref?: React.Ref<Element>;
|
|
16
|
+
}) => React.ReactElement | null) & {
|
|
17
|
+
displayName?: string;
|
|
18
|
+
};
|
|
19
|
+
declare const defaultElement = "div";
|
|
20
|
+
/**
|
|
21
|
+
* Gir løpende tekst riktig avstand mellom overskrifter, avsnitt og lister
|
|
22
|
+
* @beta Experimental component - may have breaking changes in future releases
|
|
23
|
+
*/
|
|
24
|
+
export declare const TextContainer: TextContainerComponent;
|
|
25
|
+
export {};
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { PolymorphicComponentProps } from '@entur/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { TypographySpacingProps } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* @beta Experimental component - may have breaking changes in future releases
|
|
6
6
|
*/
|
|
7
|
-
type
|
|
7
|
+
export type UnorderedListOwnProps = TypographySpacingProps & {
|
|
8
8
|
/** Ekstra klassenavn */
|
|
9
9
|
className?: string;
|
|
10
10
|
/** Innholdet */
|
|
11
|
-
children
|
|
12
|
-
/** Spacing around the component (same as Text and Heading components) */
|
|
13
|
-
spacing?: TypographySpacing;
|
|
11
|
+
children?: React.ReactNode;
|
|
14
12
|
};
|
|
15
|
-
export type UnorderedListProps<C extends React.ElementType> = PolymorphicComponentProps<C,
|
|
13
|
+
export type UnorderedListProps<C extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<C, UnorderedListOwnProps>;
|
|
14
|
+
export type UnorderedListComponent = (<C extends React.ElementType = typeof defaultElement>(props: UnorderedListProps<C> & {
|
|
15
|
+
ref?: React.Ref<Element>;
|
|
16
|
+
}) => React.ReactElement | null) & {
|
|
17
|
+
displayName?: string;
|
|
18
|
+
};
|
|
19
|
+
declare const defaultElement = "ul";
|
|
16
20
|
/**
|
|
17
21
|
* @beta Experimental component - may have breaking changes in future releases
|
|
18
22
|
*/
|
|
19
|
-
export declare const UnorderedList:
|
|
23
|
+
export declare const UnorderedList: UnorderedListComponent;
|
|
20
24
|
export {};
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
export { Heading } from './components/Heading';
|
|
2
2
|
export { Text } from './components/Text';
|
|
3
3
|
export { Link } from './components/Link';
|
|
4
|
-
export {
|
|
4
|
+
export { Label } from './components/Label';
|
|
5
5
|
export { UnorderedList } from './components/UnorderedList';
|
|
6
6
|
export { NumberedList } from './components/NumberedList';
|
|
7
7
|
export { ListItem } from './components/ListItem';
|
|
8
|
-
export
|
|
8
|
+
export { TextContainer } from './components/TextContainer';
|
|
9
|
+
export type { HeadingComponent, HeadingOwnProps, HeadingProps, TypographyHeadingSize, TypographyHeadingVariant, } from './components/Heading';
|
|
10
|
+
export type { TextComponent, TextOwnProps, TextProps, TypographyTextSize, TypographyTextVariant, TypographyTone, TypographyWeight, } from './components/Text';
|
|
11
|
+
export type { LinkComponent, LinkOwnProps, LinkProps } from './components/Link';
|
|
12
|
+
export type { LabelOwnProps, LabelProps } from './components/Label';
|
|
13
|
+
export type { UnorderedListComponent, UnorderedListOwnProps, UnorderedListProps, } from './components/UnorderedList';
|
|
14
|
+
export type { NumberedListComponent, NumberedListOwnProps, NumberedListProps, } from './components/NumberedList';
|
|
15
|
+
export type { ListItemComponent, ListItemOwnProps, ListItemProps, } from './components/ListItem';
|
|
16
|
+
export type { TextContainerComponent, TextContainerOwnProps, TextContainerProps, } from './components/TextContainer';
|
|
17
|
+
export type { TypographySize, TypographySpacing, TypographySpacingProps, } from './types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
1
|
+
import { TypographyHeadingSize } from './components/Heading';
|
|
2
|
+
import { TypographyTextSize } from './components/Text';
|
|
3
|
+
/** Every font size in the typography, on headings and text */
|
|
4
|
+
export type TypographySize = TypographyHeadingSize | TypographyTextSize;
|
|
5
|
+
export type TypographySpacingProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Avstand over og under, fra samme skala som `gap` på Flex og Grid.
|
|
8
|
+
* Én verdi gir lik avstand over og under, `{ top, bottom }` setter dem hver for seg.
|
|
9
|
+
* Uten `spacing` har teksten ingen avstand, med mindre den ligger i en `TextContainer`.
|
|
10
|
+
*/
|
|
11
|
+
spacing?: 'none' | '2xs' | 'xs' | 's' | 'm' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl' | '9xl' | '10xl' | '11xl' | '12xl' | '13xl' | {
|
|
12
|
+
top?: 'none' | '2xs' | 'xs' | 's' | 'm' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl' | '9xl' | '10xl' | '11xl' | '12xl' | '13xl';
|
|
13
|
+
bottom?: 'none' | '2xs' | 'xs' | 's' | 'm' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl' | '9xl' | '10xl' | '11xl' | '12xl' | '13xl';
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export type TypographySpacing = NonNullable<TypographySpacingProps['spacing']>;
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import { TypographyHeadingVariant
|
|
1
|
+
import { TypographyHeadingVariant } from '../components/Heading';
|
|
2
|
+
import { TypographyTextVariant } from '../components/Text';
|
|
3
|
+
import { TypographySpacing } from '../types';
|
|
4
|
+
export declare const SPACING_STEPS: Set<string>;
|
|
2
5
|
/**
|
|
3
|
-
*
|
|
6
|
+
* Turn the spacing prop into the custom properties that set the margins
|
|
4
7
|
*/
|
|
5
|
-
export declare function
|
|
8
|
+
export declare function getSpacingStyle(spacing: TypographySpacing | undefined, style?: React.CSSProperties): React.CSSProperties | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Pass maxLines on to the CSS, which cuts the text after that many lines
|
|
11
|
+
*/
|
|
12
|
+
export declare function getMaxLinesStyle(maxLines: number | undefined, style?: React.CSSProperties): React.CSSProperties | undefined;
|
|
6
13
|
/**
|
|
7
14
|
* Get heading variant based on semantic HTML element
|
|
8
15
|
*/
|
|
9
16
|
export declare function getHeadingVariantFromSemanticType(element: string | React.ElementType): TypographyHeadingVariant;
|
|
17
|
+
/**
|
|
18
|
+
* The variant Text uses when none is given: paragraph on its own line, inherit inside other text
|
|
19
|
+
*/
|
|
20
|
+
export declare function getDefaultTextVariant(element: React.ElementType): 'paragraph' | 'inherit';
|
|
10
21
|
/**
|
|
11
22
|
* Get semantic HTML element from text variant
|
|
12
23
|
*/
|
|
13
|
-
export declare function getSemanticTypeFromTextVariant(variant: TypographyTextVariant | undefined):
|
|
24
|
+
export declare function getSemanticTypeFromTextVariant(variant: TypographyTextVariant | undefined): keyof JSX.IntrinsicElements;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Finds global CSS in the app that overrides the beta typography. Empty when the beta styles aren't loaded. */
|
|
2
|
+
export declare function findGlobalStyleConflicts(): string[];
|
|
3
|
+
/** Warns the developer once if global CSS in the app overrides the beta typography */
|
|
4
|
+
export declare function warnAboutGlobalStyles(): void;
|
package/dist/styles.css
CHANGED
|
@@ -141,7 +141,9 @@
|
|
|
141
141
|
[data-color-mode=light],
|
|
142
142
|
:root{
|
|
143
143
|
--components-typography-basetext-contrast-text-accent:#ffffff;
|
|
144
|
+
--components-typography-basetext-contrast-text-subdued:#d9dae8;
|
|
144
145
|
--components-typography-basetext-standard-text-accent:#181c56;
|
|
146
|
+
--components-typography-basetext-standard-text-subdued:#626493;
|
|
145
147
|
--components-typography-blockquote-contrast-stroke:#8284ab;
|
|
146
148
|
--components-typography-blockquote-contrast-text-accent:#ffffff;
|
|
147
149
|
--components-typography-blockquote-contrast-text-subdued:#d9dae8;
|
|
@@ -150,23 +152,27 @@
|
|
|
150
152
|
--components-typography-blockquote-standard-text-subdued:#626493;
|
|
151
153
|
--components-typography-codetext-contrast-border:rgba(255, 255, 255, 0);
|
|
152
154
|
--components-typography-codetext-contrast-border-interactive:#aeb7e2;
|
|
153
|
-
--components-typography-codetext-contrast-fill:#
|
|
155
|
+
--components-typography-codetext-contrast-fill:#292b6a;
|
|
154
156
|
--components-typography-codetext-contrast-text:#181c56;
|
|
155
157
|
--components-typography-codetext-standard-border:rgba(84, 86, 140, 0.4);
|
|
156
158
|
--components-typography-codetext-standard-border-interactive:#181c56;
|
|
157
|
-
--components-typography-codetext-standard-fill:#
|
|
159
|
+
--components-typography-codetext-standard-fill:#eaeaf1;
|
|
158
160
|
--components-typography-codetext-standard-text:#181c56;
|
|
159
161
|
--components-typography-label-contrast-text-accent:#d9dae8;
|
|
160
162
|
--components-typography-label-standard-text-accent:#626493;
|
|
161
163
|
--components-typography-list-contrast-border:#aeb7e2;
|
|
164
|
+
--components-typography-list-contrast-fill:#292b6a;
|
|
162
165
|
--components-typography-list-contrast-text-accent:#ffffff;
|
|
163
166
|
--components-typography-list-standard-border:#aeb7e2;
|
|
167
|
+
--components-typography-list-standard-fill:#eaeaf1;
|
|
164
168
|
--components-typography-list-standard-text-accent:#181c56;
|
|
165
169
|
}
|
|
166
170
|
|
|
167
171
|
[data-color-mode=dark]{
|
|
168
172
|
--components-typography-basetext-contrast-text-accent:#e5e5e9;
|
|
173
|
+
--components-typography-basetext-contrast-text-subdued:#b3b4bd;
|
|
169
174
|
--components-typography-basetext-standard-text-accent:#e5e5e9;
|
|
175
|
+
--components-typography-basetext-standard-text-subdued:#b3b4bd;
|
|
170
176
|
--components-typography-blockquote-contrast-stroke:#81828f;
|
|
171
177
|
--components-typography-blockquote-contrast-text-accent:#e5e5e9;
|
|
172
178
|
--components-typography-blockquote-contrast-text-subdued:#b3b4bd;
|
|
@@ -175,17 +181,19 @@
|
|
|
175
181
|
--components-typography-blockquote-standard-text-subdued:#b3b4bd;
|
|
176
182
|
--components-typography-codetext-contrast-border:rgba(255, 255, 255, 0);
|
|
177
183
|
--components-typography-codetext-contrast-border-interactive:#e5e5e9;
|
|
178
|
-
--components-typography-codetext-contrast-fill:#
|
|
184
|
+
--components-typography-codetext-contrast-fill:#212233;
|
|
179
185
|
--components-typography-codetext-contrast-text:#e5e5e9;
|
|
180
186
|
--components-typography-codetext-standard-border:rgba(255, 255, 255, 0);
|
|
181
187
|
--components-typography-codetext-standard-border-interactive:#e5e5e9;
|
|
182
|
-
--components-typography-codetext-standard-fill:#
|
|
188
|
+
--components-typography-codetext-standard-fill:#212233;
|
|
183
189
|
--components-typography-codetext-standard-text:#e5e5e9;
|
|
184
190
|
--components-typography-label-contrast-text-accent:#e5e5e9;
|
|
185
191
|
--components-typography-label-standard-text-accent:#e5e5e9;
|
|
186
192
|
--components-typography-list-contrast-border:#aeb7e2;
|
|
193
|
+
--components-typography-list-contrast-fill:#212233;
|
|
187
194
|
--components-typography-list-contrast-text-accent:#e5e5e9;
|
|
188
195
|
--components-typography-list-standard-border:#aeb7e2;
|
|
196
|
+
--components-typography-list-standard-fill:#212233;
|
|
189
197
|
--components-typography-list-standard-text-accent:#e5e5e9;
|
|
190
198
|
}
|
|
191
199
|
|
|
@@ -734,7 +742,7 @@ p .eds-link--ext-icon{
|
|
|
734
742
|
|
|
735
743
|
.eds-preformatted-text,
|
|
736
744
|
.eds-code-text{
|
|
737
|
-
background-color:#
|
|
745
|
+
background-color:#eaeaf1;
|
|
738
746
|
background-color:var(--components-typography-codetext-standard-fill);
|
|
739
747
|
border:0.0625rem solid rgba(84, 86, 140, 0.4);
|
|
740
748
|
border:0.0625rem solid var(--components-typography-codetext-standard-border);
|