@entur/typography 1.10.0-beta.8 → 2.0.0-beta.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 +37 -17
- package/dist/BaseHeading.d.ts +1 -1
- package/dist/Blockquote.d.ts +3 -4
- package/dist/CodeText.d.ts +1 -1
- package/dist/EmphasizedText.d.ts +1 -1
- package/dist/Heading1.d.ts +1 -1
- package/dist/Heading2.d.ts +1 -1
- package/dist/Heading3.d.ts +1 -1
- package/dist/Heading4.d.ts +1 -1
- package/dist/Heading5.d.ts +1 -1
- package/dist/Heading6.d.ts +1 -1
- package/dist/Label.d.ts +1 -1
- package/dist/LeadParagraph.d.ts +1 -1
- package/dist/Link.d.ts +1 -1
- package/dist/ListItem.d.ts +1 -1
- package/dist/NumberedList.d.ts +1 -1
- package/dist/Paragraph.d.ts +1 -1
- package/dist/PreformattedText.d.ts +1 -1
- package/dist/SmallText.d.ts +1 -1
- package/dist/StrongText.d.ts +1 -1
- package/dist/SubLabel.d.ts +1 -1
- package/dist/SubParagraph.d.ts +1 -1
- package/dist/UnorderedList.d.ts +1 -1
- package/dist/beta/cjs/components/Blockquote.cjs +29 -0
- package/dist/beta/cjs/components/Blockquote.cjs.map +1 -0
- package/dist/beta/cjs/components/Heading.cjs +37 -0
- package/dist/beta/cjs/components/Heading.cjs.map +1 -0
- package/dist/beta/cjs/components/Link.cjs +41 -0
- package/dist/beta/cjs/components/Link.cjs.map +1 -0
- package/dist/beta/cjs/components/ListItem.cjs +33 -0
- package/dist/beta/cjs/components/ListItem.cjs.map +1 -0
- package/dist/beta/cjs/components/NumberedList.cjs +32 -0
- package/dist/beta/cjs/components/NumberedList.cjs.map +1 -0
- package/dist/beta/cjs/components/Text.cjs +36 -0
- package/dist/beta/cjs/components/Text.cjs.map +1 -0
- package/dist/beta/cjs/components/UnorderedList.cjs +29 -0
- package/dist/beta/cjs/components/UnorderedList.cjs.map +1 -0
- package/dist/beta/cjs/index.cjs +18 -0
- package/dist/beta/cjs/index.cjs.map +1 -0
- package/dist/beta/cjs/utils/utils.cjs +77 -0
- package/dist/beta/cjs/utils/utils.cjs.map +1 -0
- package/dist/beta/esm/components/Blockquote.mjs +29 -0
- package/dist/beta/esm/components/Blockquote.mjs.map +1 -0
- package/dist/beta/esm/components/Heading.mjs +37 -0
- package/dist/beta/esm/components/Heading.mjs.map +1 -0
- package/dist/beta/esm/components/Link.mjs +41 -0
- package/dist/beta/esm/components/Link.mjs.map +1 -0
- package/dist/beta/esm/components/ListItem.mjs +33 -0
- package/dist/beta/esm/components/ListItem.mjs.map +1 -0
- package/dist/beta/esm/components/NumberedList.mjs +32 -0
- package/dist/beta/esm/components/NumberedList.mjs.map +1 -0
- package/dist/beta/esm/components/Text.mjs +36 -0
- package/dist/beta/esm/components/Text.mjs.map +1 -0
- package/dist/beta/esm/components/UnorderedList.mjs +29 -0
- package/dist/beta/esm/components/UnorderedList.mjs.map +1 -0
- package/dist/beta/esm/index.mjs +18 -0
- package/dist/beta/esm/index.mjs.map +1 -0
- package/dist/beta/esm/utils/utils.mjs +77 -0
- package/dist/beta/esm/utils/utils.mjs.map +1 -0
- package/dist/beta/styles/components/heading.css +458 -0
- package/dist/beta/styles/components/text.css +959 -0
- package/dist/beta/types/components/Blockquote.d.ts +12 -0
- package/dist/beta/{Heading.d.ts → types/components/Heading.d.ts} +2 -3
- package/dist/beta/types/components/Link.d.ts +22 -0
- package/dist/beta/types/components/ListItem.d.ts +22 -0
- package/dist/beta/types/components/NumberedList.d.ts +22 -0
- package/dist/beta/{Text.d.ts → types/components/Text.d.ts} +2 -3
- package/dist/beta/types/components/UnorderedList.d.ts +20 -0
- package/dist/beta/types/index.d.ts +8 -0
- package/dist/beta/types/utils/utils.d.ts +13 -0
- package/dist/index.d.ts +0 -5
- package/dist/styles.css +162 -820
- package/dist/typography.cjs.js +416 -0
- package/dist/typography.cjs.js.map +1 -0
- package/dist/typography.esm.js +392 -454
- package/dist/typography.esm.js.map +1 -1
- package/fonts/Entur-Nationale-Demibold.eot +0 -0
- package/fonts/Entur-Nationale-Demibold.woff +0 -0
- package/fonts/Entur-Nationale-Demibold.woff2 +0 -0
- package/fonts/Entur-Nationale-DemiboldItalic.eot +0 -0
- package/fonts/Entur-Nationale-DemiboldItalic.woff +0 -0
- package/fonts/Entur-Nationale-DemiboldItalic.woff2 +0 -0
- package/fonts/Entur-Nationale-Italic.eot +0 -0
- package/fonts/Entur-Nationale-Italic.woff +0 -0
- package/fonts/Entur-Nationale-Italic.woff2 +0 -0
- package/fonts/Entur-Nationale-Light.eot +0 -0
- package/fonts/Entur-Nationale-Light.woff +0 -0
- package/fonts/Entur-Nationale-Light.woff2 +0 -0
- package/fonts/Entur-Nationale-LightItalic.eot +0 -0
- package/fonts/Entur-Nationale-LightItalic.woff +0 -0
- package/fonts/Entur-Nationale-LightItalic.woff2 +0 -0
- package/fonts/Entur-Nationale-Medium.eot +0 -0
- package/fonts/Entur-Nationale-Medium.woff +0 -0
- package/fonts/Entur-Nationale-Medium.woff2 +0 -0
- package/fonts/Entur-Nationale-MediumItalic.eot +0 -0
- package/fonts/Entur-Nationale-MediumItalic.woff +0 -0
- package/fonts/Entur-Nationale-MediumItalic.woff2 +0 -0
- package/fonts/Entur-Nationale-Regular.eot +0 -0
- package/fonts/Entur-Nationale-Regular.woff +0 -0
- package/fonts/Entur-Nationale-Regular.woff2 +0 -0
- package/package.json +59 -19
- package/scripts/migrate-typography.js +415 -178
- package/dist/beta/BlockquoteBeta.d.ts +0 -12
- package/dist/beta/LinkBeta.d.ts +0 -16
- package/dist/beta/index.d.ts +0 -6
- package/dist/beta/utils.d.ts +0 -9
- package/dist/index.js +0 -8
- package/dist/typography.cjs.development.js +0 -508
- package/dist/typography.cjs.development.js.map +0 -1
- package/dist/typography.cjs.production.min.js +0 -2
- package/dist/typography.cjs.production.min.js.map +0 -1
- /package/dist/beta/{types.d.ts → types/types.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -19,35 +19,37 @@ yarn add @entur/typography
|
|
|
19
19
|
|
|
20
20
|
## 🚀 Quick Start
|
|
21
21
|
|
|
22
|
-
### Using
|
|
22
|
+
### Using Stable Typography (Recommended for Production)
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
|
-
import {
|
|
25
|
+
import { Heading1, Paragraph, Link } from '@entur/typography';
|
|
26
|
+
import '@entur/typography/styles';
|
|
26
27
|
|
|
27
28
|
function MyComponent() {
|
|
28
29
|
return (
|
|
29
30
|
<div>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
</
|
|
33
|
-
<Text variant="paragraph">My content</Text>
|
|
34
|
-
<LinkBeta href="/more">Learn more</LinkBeta>
|
|
31
|
+
<Heading1>My Title</Heading1>
|
|
32
|
+
<Paragraph>My content</Paragraph>
|
|
33
|
+
<Link href="/more">Learn more</Link>
|
|
35
34
|
</div>
|
|
36
35
|
);
|
|
37
36
|
}
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
### Using
|
|
39
|
+
### Using Beta Typography (Experimental Features)
|
|
41
40
|
|
|
42
41
|
```typescript
|
|
43
|
-
import {
|
|
42
|
+
import { Heading, Text, LinkBeta } from '@entur/typography/beta';
|
|
43
|
+
import '@entur/typography/styles';
|
|
44
44
|
|
|
45
45
|
function MyComponent() {
|
|
46
46
|
return (
|
|
47
47
|
<div>
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
<Heading as="h1" variant="title-1">
|
|
49
|
+
My Title
|
|
50
|
+
</Heading>
|
|
51
|
+
<Text variant="paragraph">My content</Text>
|
|
52
|
+
<LinkBeta href="/more">Learn more</LinkBeta>
|
|
51
53
|
</div>
|
|
52
54
|
);
|
|
53
55
|
}
|
|
@@ -55,6 +57,25 @@ function MyComponent() {
|
|
|
55
57
|
|
|
56
58
|
## 🔄 Migration
|
|
57
59
|
|
|
60
|
+
**Good news!** This package maintains full backward compatibility. All existing import patterns continue to work exactly as before.
|
|
61
|
+
|
|
62
|
+
### Backward Compatibility
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// ✅ All these still work exactly as before
|
|
66
|
+
import { Heading1 } from '@entur/typography/dist/Heading1';
|
|
67
|
+
import { Paragraph } from '@entur/typography/dist/Paragraph';
|
|
68
|
+
import '@entur/typography/dist/styles.css';
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Modern Imports (Recommended)
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
// 🚀 But these are now preferred
|
|
75
|
+
import { Heading1, Paragraph } from '@entur/typography';
|
|
76
|
+
import '@entur/typography/styles';
|
|
77
|
+
```
|
|
78
|
+
|
|
58
79
|
**Migrating from legacy typography?** We've created a comprehensive migration package to help you transition smoothly. Follow our migration guide in our website.
|
|
59
80
|
|
|
60
81
|
- 🔧 **Migration Helpers** - Drop-in replacements for legacy components
|
|
@@ -68,7 +89,7 @@ npx @entur/typography@latest migrate
|
|
|
68
89
|
|
|
69
90
|
# Option 2: With specific options
|
|
70
91
|
npx @entur/typography@latest migrate --dry-run
|
|
71
|
-
|
|
92
|
+
|
|
72
93
|
|
|
73
94
|
# Option 3: From installed package
|
|
74
95
|
npm install @entur/typography@latest
|
|
@@ -87,10 +108,9 @@ npm install glob
|
|
|
87
108
|
yarn add glob
|
|
88
109
|
```
|
|
89
110
|
|
|
90
|
-
### Migration
|
|
111
|
+
### Migration Mode
|
|
91
112
|
|
|
92
|
-
- **🚀 Complete Migration
|
|
93
|
-
- **📝 Import-Only Migration**: Updates only import paths (safer for gradual migration)
|
|
113
|
+
- **🚀 Complete Migration**: Updates imports + component usage
|
|
94
114
|
|
|
95
115
|
### Update Styles
|
|
96
116
|
|
|
@@ -99,7 +119,7 @@ yarn add glob
|
|
|
99
119
|
@import '@entur/typography/dist/styles.css';
|
|
100
120
|
|
|
101
121
|
// With this
|
|
102
|
-
@import '@entur/typography/
|
|
122
|
+
@import '@entur/typography/styles';
|
|
103
123
|
```
|
|
104
124
|
|
|
105
125
|
## 🎨 Features
|
package/dist/BaseHeading.d.ts
CHANGED
package/dist/Blockquote.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type BlockquoteProps = {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type BlockquoteProps = {
|
|
3
3
|
/** Ekstra klassenavn */
|
|
4
4
|
className?: string;
|
|
5
5
|
} & React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLElement>, HTMLQuoteElement>;
|
|
6
6
|
export declare const Blockquote: ({ className, ref, ...rest }: BlockquoteProps) => React.JSX.Element;
|
|
7
|
-
type BlockquoteFooterProps = {
|
|
7
|
+
export type BlockquoteFooterProps = {
|
|
8
8
|
/** Ekstra klassenavn */
|
|
9
9
|
className?: string;
|
|
10
10
|
} & React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
11
11
|
export declare const BlockquoteFooter: React.FunctionComponent<BlockquoteFooterProps>;
|
|
12
|
-
export {};
|
package/dist/CodeText.d.ts
CHANGED
package/dist/EmphasizedText.d.ts
CHANGED
package/dist/Heading1.d.ts
CHANGED
package/dist/Heading2.d.ts
CHANGED
package/dist/Heading3.d.ts
CHANGED
package/dist/Heading4.d.ts
CHANGED
package/dist/Heading5.d.ts
CHANGED
package/dist/Heading6.d.ts
CHANGED
package/dist/Label.d.ts
CHANGED
package/dist/LeadParagraph.d.ts
CHANGED
package/dist/Link.d.ts
CHANGED
package/dist/ListItem.d.ts
CHANGED
package/dist/NumberedList.d.ts
CHANGED
package/dist/Paragraph.d.ts
CHANGED
package/dist/SmallText.d.ts
CHANGED
package/dist/StrongText.d.ts
CHANGED
package/dist/SubLabel.d.ts
CHANGED
package/dist/SubParagraph.d.ts
CHANGED
package/dist/UnorderedList.d.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require('../../styles/components/text.css');const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const classNames = require("classnames");
|
|
5
|
+
;/* empty css */
|
|
6
|
+
const Blockquote = ({ className, ...rest }) => {
|
|
7
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8
|
+
"blockquote",
|
|
9
|
+
{
|
|
10
|
+
className: classNames("eds-text--blockquote", className),
|
|
11
|
+
...rest
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
const BlockquoteFooter = ({
|
|
16
|
+
className,
|
|
17
|
+
...rest
|
|
18
|
+
}) => {
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20
|
+
"footer",
|
|
21
|
+
{
|
|
22
|
+
className: classNames("eds-text--blockquote__footer", className),
|
|
23
|
+
...rest
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
exports.Blockquote = Blockquote;
|
|
28
|
+
exports.BlockquoteFooter = BlockquoteFooter;
|
|
29
|
+
//# sourceMappingURL=Blockquote.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Blockquote.cjs","sources":["../../../../src/beta/components/Blockquote.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\n\nimport './text.scss';\n\nexport type BlockquoteProps = {\n /** Ekstra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<\n React.BlockquoteHTMLAttributes<HTMLQuoteElement>,\n HTMLQuoteElement\n>;\n\nexport const Blockquote = ({ className, ...rest }: BlockquoteProps) => {\n return (\n <blockquote\n className={classNames('eds-text--blockquote', className)}\n {...rest}\n />\n );\n};\n\ntype BlockquoteFooterProps = {\n /** Ekstra klassenavn */\n className?: string;\n} & React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;\n\nexport const BlockquoteFooter = ({\n className,\n ...rest\n}: BlockquoteFooterProps) => {\n return (\n <footer\n className={classNames('eds-text--blockquote__footer', className)}\n {...rest}\n />\n );\n};\n"],"names":["jsx"],"mappings":";;;;;AAaO,MAAM,aAAa,CAAC,EAAE,WAAW,GAAG,WAA4B;AACrE,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,WAAW,wBAAwB,SAAS;AAAA,MACtD,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AAOO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA,GAAG;AACL,MAA6B;AAC3B,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,WAAW,gCAAgC,SAAS;AAAA,MAC9D,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require('../../styles/components/heading.css');const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const classNames = require("classnames");
|
|
5
|
+
const utils = require("../utils/utils.cjs");
|
|
6
|
+
;/* empty css */
|
|
7
|
+
const Heading = ({
|
|
8
|
+
children,
|
|
9
|
+
as,
|
|
10
|
+
size,
|
|
11
|
+
variant,
|
|
12
|
+
spacing,
|
|
13
|
+
className,
|
|
14
|
+
...rest
|
|
15
|
+
}) => {
|
|
16
|
+
const HeadingElement = as || "h1";
|
|
17
|
+
const usedVariant = variant ?? utils.getHeadingVariantFromSemanticType(HeadingElement);
|
|
18
|
+
const shouldUseSize = size !== void 0;
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20
|
+
HeadingElement,
|
|
21
|
+
{
|
|
22
|
+
className: classNames(
|
|
23
|
+
"eds-heading",
|
|
24
|
+
// Only apply variant if size is not specified
|
|
25
|
+
{ [`eds-heading--${usedVariant}`]: !shouldUseSize },
|
|
26
|
+
// Size takes precedence when specified
|
|
27
|
+
{ [`eds-heading--${size}`]: shouldUseSize && size },
|
|
28
|
+
utils.getSpacingClasses(spacing, "eds-heading"),
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...rest,
|
|
32
|
+
children
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
exports.Heading = Heading;
|
|
37
|
+
//# sourceMappingURL=Heading.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.cjs","sources":["../../../../src/beta/components/Heading.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\nimport {\n TypographyHeadingVariant,\n TypographySize,\n TypographySpacing,\n} from '../types';\nimport {\n getHeadingVariantFromSemanticType,\n getSpacingClasses,\n} from '../utils/utils';\nimport { PolymorphicComponentProps } from '@entur/utils';\n\nimport './heading.scss';\n\ntype HeadingBaseProps = {\n /** Visuell variant som bestemmer styling (anbefalt over size) */\n variant?: TypographyHeadingVariant;\n /** Visuell tekststørrelse som overstyrer variant-styling */\n size?: TypographySize;\n /** Innholdet som skal vises */\n children: React.ReactNode;\n /** Ekstra klassenavn for tilpasset styling */\n className?: string;\n /** Inline CSS-stiler */\n style?: React.CSSProperties;\n /** Spacing around the component */\n spacing?: TypographySpacing;\n};\n\nexport type HeadingProps<C extends React.ElementType> =\n PolymorphicComponentProps<C, HeadingBaseProps>;\n\nexport const Heading = <C extends React.ElementType = 'h1'>({\n children,\n as,\n size,\n variant,\n spacing,\n className,\n ...rest\n}: HeadingProps<C>) => {\n const HeadingElement = as || 'h1';\n\n // Function to determine the variant based on the semantic type\n const usedVariant =\n variant ?? getHeadingVariantFromSemanticType(HeadingElement);\n\n // When size is explicitly provided, it should override variant styling\n const shouldUseSize = size !== undefined;\n\n return (\n <HeadingElement\n className={classNames(\n 'eds-heading',\n // Only apply variant if size is not specified\n { [`eds-heading--${usedVariant}`]: !shouldUseSize },\n // Size takes precedence when specified\n { [`eds-heading--${size}`]: shouldUseSize && size },\n getSpacingClasses(spacing, 'eds-heading'),\n className,\n )}\n {...rest}\n >\n {children}\n </HeadingElement>\n );\n};\n"],"names":["getHeadingVariantFromSemanticType","jsx","getSpacingClasses"],"mappings":";;;;;;AAkCO,MAAM,UAAU,CAAqC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAuB;AACrB,QAAM,iBAAiB,MAAM;AAG7B,QAAM,cACJ,WAAWA,MAAAA,kCAAkC,cAAc;AAG7D,QAAM,gBAAgB,SAAS;AAE/B,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA;AAAA,QAEA,EAAE,CAAC,gBAAgB,WAAW,EAAE,GAAG,CAAC,cAAA;AAAA;AAAA,QAEpC,EAAE,CAAC,gBAAgB,IAAI,EAAE,GAAG,iBAAiB,KAAA;AAAA,QAC7CC,MAAAA,kBAAkB,SAAS,aAAa;AAAA,QACxC;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require('../../styles/components/text.css');const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const classNames = require("classnames");
|
|
5
|
+
const icons = require("@entur/icons");
|
|
6
|
+
const utils = require("../utils/utils.cjs");
|
|
7
|
+
;/* empty css */
|
|
8
|
+
const Link = ({
|
|
9
|
+
external = false,
|
|
10
|
+
ariaLabelExternalIcon = "(ekstern lenke)",
|
|
11
|
+
className,
|
|
12
|
+
spacing,
|
|
13
|
+
children,
|
|
14
|
+
as,
|
|
15
|
+
...rest
|
|
16
|
+
}) => {
|
|
17
|
+
const LinkElement = as || "a";
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19
|
+
LinkElement,
|
|
20
|
+
{
|
|
21
|
+
className: classNames(
|
|
22
|
+
"eds-text--link",
|
|
23
|
+
utils.getSpacingClasses(spacing, "eds-text--link"),
|
|
24
|
+
className
|
|
25
|
+
),
|
|
26
|
+
...rest,
|
|
27
|
+
children: [
|
|
28
|
+
children,
|
|
29
|
+
external ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
30
|
+
icons.ExternalIcon,
|
|
31
|
+
{
|
|
32
|
+
className: "eds-text--link--ext-icon",
|
|
33
|
+
"aria-label": ariaLabelExternalIcon
|
|
34
|
+
}
|
|
35
|
+
) : null
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
exports.Link = Link;
|
|
41
|
+
//# sourceMappingURL=Link.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.cjs","sources":["../../../../src/beta/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps } from '@entur/utils';\nimport { ExternalIcon } from '@entur/icons';\nimport { TypographySpacing } from '../types';\nimport { getSpacingClasses } from '../utils/utils';\n\nimport './text.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\ntype LinkBaseProps = {\n external?: boolean;\n\n /** Ekstra klassenavn */\n className?: string;\n /** Innholdet */\n children: React.ReactNode;\n /** Spacing around the component (same as Text and Heading components) */\n spacing?: TypographySpacing;\n ariaLabelExternalIcon?: string;\n};\n\nexport type LinkProps<C extends React.ElementType> = PolymorphicComponentProps<\n C,\n LinkBaseProps\n>;\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const Link = <C extends React.ElementType = 'a'>({\n external = false,\n ariaLabelExternalIcon = '(ekstern lenke)',\n className,\n spacing,\n children,\n as,\n ...rest\n}: LinkProps<C>): JSX.Element => {\n const LinkElement: React.ElementType = as || 'a';\n return (\n <LinkElement\n className={classNames(\n 'eds-text--link',\n getSpacingClasses(spacing, 'eds-text--link'),\n className,\n )}\n {...rest}\n >\n {children}\n {external ? (\n <ExternalIcon\n className=\"eds-text--link--ext-icon\"\n aria-label={ariaLabelExternalIcon}\n />\n ) : null}\n </LinkElement>\n );\n};\n"],"names":["jsxs","getSpacingClasses","jsx","ExternalIcon"],"mappings":";;;;;;;AAgCO,MAAM,OAAO,CAAoC;AAAA,EACtD,WAAW;AAAA,EACX,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAiC;AAC/B,QAAM,cAAiC,MAAM;AAC7C,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACAC,MAAAA,kBAAkB,SAAS,gBAAgB;AAAA,QAC3C;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEH,UAAA;AAAA,QAAA;AAAA,QACA,WACCC,2BAAAA;AAAAA,UAACC,MAAAA;AAAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,cAAY;AAAA,UAAA;AAAA,QAAA,IAEZ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGV;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require('../../styles/components/text.css');const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const classNames = require("classnames");
|
|
5
|
+
const utils = require("../utils/utils.cjs");
|
|
6
|
+
;/* empty css */
|
|
7
|
+
const ListItem = ({
|
|
8
|
+
children,
|
|
9
|
+
className,
|
|
10
|
+
title,
|
|
11
|
+
spacing,
|
|
12
|
+
as,
|
|
13
|
+
...rest
|
|
14
|
+
}) => {
|
|
15
|
+
const ItemElement = as || "li";
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17
|
+
ItemElement,
|
|
18
|
+
{
|
|
19
|
+
className: classNames(
|
|
20
|
+
"eds-text--list-item",
|
|
21
|
+
utils.getSpacingClasses(spacing, "eds-text--list-item"),
|
|
22
|
+
className
|
|
23
|
+
),
|
|
24
|
+
...rest,
|
|
25
|
+
children: [
|
|
26
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "eds-text--list-item__title eds-text--weight-bold", children: title }),
|
|
27
|
+
children
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
exports.ListItem = ListItem;
|
|
33
|
+
//# sourceMappingURL=ListItem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.cjs","sources":["../../../../src/beta/components/ListItem.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps } from '@entur/utils';\nimport { TypographySpacing } from '../types';\nimport { getSpacingClasses } from '../utils/utils';\n\nimport './text.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\ntype ListItemBaseProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Innholdet */\n children: React.ReactNode;\n /** Tittel */\n title?: React.ReactNode;\n /** Spacing around the component (same as Text and Heading components) */\n spacing?: TypographySpacing;\n};\n\nexport type ListItemProps<C extends React.ElementType> =\n PolymorphicComponentProps<C, ListItemBaseProps>;\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const ListItem = <C extends React.ElementType = 'li'>({\n children,\n className,\n title,\n spacing,\n as,\n ...rest\n}: ListItemProps<C>): JSX.Element => {\n const ItemElement: React.ElementType = as || 'li';\n\n return (\n <ItemElement\n className={classNames(\n 'eds-text--list-item',\n getSpacingClasses(spacing, 'eds-text--list-item'),\n className,\n )}\n {...rest}\n >\n {title && (\n <span className=\"eds-text--list-item__title eds-text--weight-bold\">\n {title}\n </span>\n )}\n {children}\n </ItemElement>\n );\n};\n"],"names":["jsxs","getSpacingClasses","jsx"],"mappings":";;;;;;AA4BO,MAAM,WAAW,CAAqC;AAAA,EAC3D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAqC;AACnC,QAAM,cAAiC,MAAM;AAE7C,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACAC,MAAAA,kBAAkB,SAAS,qBAAqB;AAAA,QAChD;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEH,UAAA;AAAA,QAAA,SACCC,2BAAAA,IAAC,QAAA,EAAK,WAAU,oDACb,UAAA,OACH;AAAA,QAED;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require('../../styles/components/text.css');const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const classNames = require("classnames");
|
|
5
|
+
const utils = require("../utils/utils.cjs");
|
|
6
|
+
;/* empty css */
|
|
7
|
+
const NumberedList = ({
|
|
8
|
+
className,
|
|
9
|
+
type = "1",
|
|
10
|
+
spacing,
|
|
11
|
+
as,
|
|
12
|
+
children,
|
|
13
|
+
...rest
|
|
14
|
+
}) => {
|
|
15
|
+
const ListElement = as || "ol";
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17
|
+
ListElement,
|
|
18
|
+
{
|
|
19
|
+
className: classNames(
|
|
20
|
+
"eds-text--numbered-list",
|
|
21
|
+
{ [`eds-text--numbered-list--type-${type}`]: type },
|
|
22
|
+
utils.getSpacingClasses(spacing, "eds-text--numbered-list"),
|
|
23
|
+
className
|
|
24
|
+
),
|
|
25
|
+
type,
|
|
26
|
+
...rest,
|
|
27
|
+
children
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
exports.NumberedList = NumberedList;
|
|
32
|
+
//# sourceMappingURL=NumberedList.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberedList.cjs","sources":["../../../../src/beta/components/NumberedList.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps } from '@entur/utils';\nimport { TypographySpacing } from '../types';\nimport { getSpacingClasses } from '../utils/utils';\n\nimport './text.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\ntype NumberedListBaseProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Innholdet */\n children: React.ReactNode;\n /** List type (1, A, a, I, i) */\n type?: '1' | 'A' | 'a' | 'I' | 'i';\n /** Spacing around the component (same as Text and Heading components) */\n spacing?: TypographySpacing;\n};\n\nexport type NumberedListProps<C extends React.ElementType> =\n PolymorphicComponentProps<C, NumberedListBaseProps>;\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const NumberedList = <C extends React.ElementType = 'ol'>({\n className,\n type = '1',\n spacing,\n as,\n children,\n ...rest\n}: NumberedListProps<C>): JSX.Element => {\n const ListElement: React.ElementType = as || 'ol';\n\n return (\n <ListElement\n className={classNames(\n 'eds-text--numbered-list',\n { [`eds-text--numbered-list--type-${type}`]: type },\n getSpacingClasses(spacing, 'eds-text--numbered-list'),\n className,\n )}\n type={type}\n {...rest}\n >\n {children}\n </ListElement>\n );\n};\n"],"names":["jsx","getSpacingClasses"],"mappings":";;;;;;AA4BO,MAAM,eAAe,CAAqC;AAAA,EAC/D;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyC;AACvC,QAAM,cAAiC,MAAM;AAE7C,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,EAAE,CAAC,iCAAiC,IAAI,EAAE,GAAG,KAAA;AAAA,QAC7CC,MAAAA,kBAAkB,SAAS,yBAAyB;AAAA,QACpD;AAAA,MAAA;AAAA,MAEF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require('../../styles/components/text.css');const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const classNames = require("classnames");
|
|
5
|
+
const utils = require("../utils/utils.cjs");
|
|
6
|
+
;/* empty css */
|
|
7
|
+
const TypographyText = ({
|
|
8
|
+
children,
|
|
9
|
+
as,
|
|
10
|
+
size,
|
|
11
|
+
variant,
|
|
12
|
+
weight = "medium",
|
|
13
|
+
spacing,
|
|
14
|
+
className,
|
|
15
|
+
...rest
|
|
16
|
+
}) => {
|
|
17
|
+
const BodyElement = as || utils.getSemanticTypeFromTextVariant(variant);
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19
|
+
BodyElement,
|
|
20
|
+
{
|
|
21
|
+
className: classNames(
|
|
22
|
+
"eds-text",
|
|
23
|
+
variant && `eds-text--${variant}`,
|
|
24
|
+
size && `eds-text--${size}`,
|
|
25
|
+
weight && `eds-text--weight-${weight}`,
|
|
26
|
+
utils.getSpacingClasses(spacing, "eds-text"),
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
...rest,
|
|
30
|
+
children
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
const Text = TypographyText;
|
|
35
|
+
exports.Text = Text;
|
|
36
|
+
//# sourceMappingURL=Text.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.cjs","sources":["../../../../src/beta/components/Text.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { PolymorphicComponentProps } from '@entur/utils';\n\nimport {\n getSpacingClasses,\n getSemanticTypeFromTextVariant,\n} from '../utils/utils';\n\nimport {\n TypographySize,\n TypographyTextVariant,\n TypographyWeight,\n TypographySpacing,\n} from '../types';\n\nimport './text.scss';\n\ntype TextBaseProps = {\n /** Visuell tekststørrelse (typografi-token) */\n size?: TypographySize;\n /** Fontvekt */\n weight?: TypographyWeight;\n /** Variant (kan brukes til spesielle typer tekst som for eksempel caption) */\n variant?: TypographyTextVariant;\n /** Innhold */\n children: React.ReactNode;\n /** Spacing around the component */\n spacing?: TypographySpacing;\n /** Ekstra klassenavn */\n className?: string;\n};\n\nexport type TextProps<C extends React.ElementType> = PolymorphicComponentProps<\n C,\n TextBaseProps\n>;\n\nconst TypographyText = <C extends React.ElementType = 'p'>({\n children,\n as,\n size,\n variant,\n weight = 'medium',\n spacing,\n className,\n ...rest\n}: TextProps<C>) => {\n const BodyElement = as || getSemanticTypeFromTextVariant(variant);\n\n return (\n <BodyElement\n className={classNames(\n 'eds-text',\n variant && `eds-text--${variant}`,\n size && `eds-text--${size}`,\n weight && `eds-text--weight-${weight}`,\n getSpacingClasses(spacing, 'eds-text'),\n className,\n )}\n {...rest}\n >\n {children}\n </BodyElement>\n );\n};\n\n// Export as Text to avoid DOM conflicts\nexport const Text = TypographyText;\n"],"names":["getSemanticTypeFromTextVariant","jsx","getSpacingClasses"],"mappings":";;;;;;AAwCA,MAAM,iBAAiB,CAAoC;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAoB;AAClB,QAAM,cAAc,MAAMA,MAAAA,+BAA+B,OAAO;AAEhE,SACEC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,WAAW,aAAa,OAAO;AAAA,QAC/B,QAAQ,aAAa,IAAI;AAAA,QACzB,UAAU,oBAAoB,MAAM;AAAA,QACpCC,MAAAA,kBAAkB,SAAS,UAAU;AAAA,QACrC;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;AAGO,MAAM,OAAO;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require('../../styles/components/text.css');const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const classNames = require("classnames");
|
|
5
|
+
const utils = require("../utils/utils.cjs");
|
|
6
|
+
;/* empty css */
|
|
7
|
+
const UnorderedList = ({
|
|
8
|
+
className,
|
|
9
|
+
spacing,
|
|
10
|
+
as,
|
|
11
|
+
children,
|
|
12
|
+
...rest
|
|
13
|
+
}) => {
|
|
14
|
+
const ListElement = as || "ul";
|
|
15
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
16
|
+
ListElement,
|
|
17
|
+
{
|
|
18
|
+
className: classNames(
|
|
19
|
+
"eds-text--unordered-list",
|
|
20
|
+
utils.getSpacingClasses(spacing, "eds-text--unordered-list"),
|
|
21
|
+
className
|
|
22
|
+
),
|
|
23
|
+
...rest,
|
|
24
|
+
children
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
exports.UnorderedList = UnorderedList;
|
|
29
|
+
//# sourceMappingURL=UnorderedList.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnorderedList.cjs","sources":["../../../../src/beta/components/UnorderedList.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps } from '@entur/utils';\nimport { TypographySpacing } from '../types';\nimport { getSpacingClasses } from '../utils/utils';\n\nimport './text.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\ntype UnorderedListBaseProps = {\n /** Ekstra klassenavn */\n className?: string;\n /** Innholdet */\n children: React.ReactNode;\n /** Spacing around the component (same as Text and Heading components) */\n spacing?: TypographySpacing;\n};\n\nexport type UnorderedListProps<C extends React.ElementType> =\n PolymorphicComponentProps<C, UnorderedListBaseProps>;\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const UnorderedList = <C extends React.ElementType = 'ul'>({\n className,\n spacing,\n as,\n children,\n ...rest\n}: UnorderedListProps<C>): JSX.Element => {\n const ListElement: React.ElementType = as || 'ul';\n\n return (\n <ListElement\n className={classNames(\n 'eds-text--unordered-list',\n getSpacingClasses(spacing, 'eds-text--unordered-list'),\n className,\n )}\n {...rest}\n >\n {children}\n </ListElement>\n );\n};\n"],"names":["jsx","getSpacingClasses"],"mappings":";;;;;;AA0BO,MAAM,gBAAgB,CAAqC;AAAA,EAChE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAA0C;AACxC,QAAM,cAAiC,MAAM;AAE7C,SACEA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACAC,MAAAA,kBAAkB,SAAS,0BAA0B;AAAA,QACrD;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Heading = require("./components/Heading.cjs");
|
|
4
|
+
const Text = require("./components/Text.cjs");
|
|
5
|
+
const Link = require("./components/Link.cjs");
|
|
6
|
+
const Blockquote = require("./components/Blockquote.cjs");
|
|
7
|
+
const UnorderedList = require("./components/UnorderedList.cjs");
|
|
8
|
+
const NumberedList = require("./components/NumberedList.cjs");
|
|
9
|
+
const ListItem = require("./components/ListItem.cjs");
|
|
10
|
+
exports.Heading = Heading.Heading;
|
|
11
|
+
exports.Text = Text.Text;
|
|
12
|
+
exports.Link = Link.Link;
|
|
13
|
+
exports.Blockquote = Blockquote.Blockquote;
|
|
14
|
+
exports.BlockquoteFooter = Blockquote.BlockquoteFooter;
|
|
15
|
+
exports.UnorderedList = UnorderedList.UnorderedList;
|
|
16
|
+
exports.NumberedList = NumberedList.NumberedList;
|
|
17
|
+
exports.ListItem = ListItem.ListItem;
|
|
18
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|