@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
package/README.md
CHANGED
|
@@ -39,8 +39,9 @@ function MyComponent() {
|
|
|
39
39
|
### Using Beta Typography (Experimental Features)
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
|
-
import { Heading, Text,
|
|
42
|
+
import { Heading, Text, Link } from '@entur/typography/beta';
|
|
43
43
|
import '@entur/typography/styles';
|
|
44
|
+
import '@entur/typography/beta/styles';
|
|
44
45
|
|
|
45
46
|
function MyComponent() {
|
|
46
47
|
return (
|
|
@@ -49,7 +50,7 @@ function MyComponent() {
|
|
|
49
50
|
My Title
|
|
50
51
|
</Heading>
|
|
51
52
|
<Text variant="paragraph">My content</Text>
|
|
52
|
-
<
|
|
53
|
+
<Link href="/more">Learn more</Link>
|
|
53
54
|
</div>
|
|
54
55
|
);
|
|
55
56
|
}
|
|
@@ -76,41 +77,9 @@ import { Heading1, Paragraph } from '@entur/typography';
|
|
|
76
77
|
import '@entur/typography/styles';
|
|
77
78
|
```
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
- 🔧 **Migration Helpers** - Drop-in replacements for legacy components
|
|
82
|
-
- 🤖 **Migration Script** - Automated migration tool
|
|
83
|
-
|
|
84
|
-
### Quick Migration
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
# Option 1: Using npx (recommended)
|
|
88
|
-
npx @entur/typography@latest migrate
|
|
89
|
-
|
|
90
|
-
# Option 2: With specific options
|
|
91
|
-
npx @entur/typography@latest migrate --dry-run
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
# Option 3: From installed package
|
|
95
|
-
npm install @entur/typography@latest
|
|
96
|
-
npx @entur/typography@latest migrate
|
|
97
|
-
|
|
98
|
-
# Option 4: Add to your package.json scripts
|
|
99
|
-
# "scripts": { "migrate-typography": "npx @entur/typography@latest migrate" }
|
|
100
|
-
# Then run: npm run migrate-typography -- --dry-run
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
**Note**: The migration script requires `glob` to be available. If you encounter an error, install it:
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
npm install glob
|
|
107
|
-
# or
|
|
108
|
-
yarn add glob
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Migration Mode
|
|
80
|
+
### Migrating to the new typography
|
|
112
81
|
|
|
113
|
-
-
|
|
82
|
+
Use the [`migrate-typography`](https://github.com/entur/design-system/tree/main/skills/migrate-typography) skill with your AI coding agent. It covers the old components (`Heading1`–`6`, `Paragraph` …), the beta changes and the layout beta spacing scale.
|
|
114
83
|
|
|
115
84
|
### Update Styles
|
|
116
85
|
|
|
@@ -128,8 +97,10 @@ yarn add glob
|
|
|
128
97
|
|
|
129
98
|
- **Semantic variants** - Title, subtitle, section, paragraph, etc.
|
|
130
99
|
- **Size variants** - Extra large, large, medium, small, extra small
|
|
131
|
-
- **Weight variants** -
|
|
132
|
-
- **
|
|
100
|
+
- **Weight variants** - Medium and bold
|
|
101
|
+
- **No margins by default** - Text sits flush wherever you place it
|
|
102
|
+
- **Spacing** - `spacing="m"` or `spacing={{ top: 's', bottom: 'xl' }}`, on the same scale as `gap` in `@entur/layout/beta`
|
|
103
|
+
- **TextContainer** - Wrap running text to get the rhythm between headings, paragraphs and lists
|
|
133
104
|
- **Accessibility** - Built-in ARIA support and semantic HTML
|
|
134
105
|
|
|
135
106
|
### Legacy Typography
|
|
@@ -1,37 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
4
5
|
const classNames = require("classnames");
|
|
5
6
|
const utils = require("../utils/utils.cjs");
|
|
6
7
|
;/* empty css */
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
8
|
+
const defaultElement = "h2";
|
|
9
|
+
const Heading = React.forwardRef(
|
|
10
|
+
({
|
|
11
|
+
children,
|
|
12
|
+
as,
|
|
13
|
+
size,
|
|
14
|
+
variant,
|
|
15
|
+
tone,
|
|
16
|
+
spacing,
|
|
17
|
+
style,
|
|
18
|
+
trim,
|
|
19
|
+
maxLines,
|
|
20
|
+
className,
|
|
21
|
+
...rest
|
|
22
|
+
}, ref) => {
|
|
23
|
+
const HeadingElement = as || defaultElement;
|
|
24
|
+
const usedVariant = variant ?? utils.getHeadingVariantFromSemanticType(HeadingElement);
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
+
HeadingElement,
|
|
27
|
+
{
|
|
28
|
+
ref,
|
|
29
|
+
className: classNames(
|
|
30
|
+
"eds-heading",
|
|
31
|
+
`eds-heading--${usedVariant}`,
|
|
32
|
+
size && `eds-heading--${size}`,
|
|
33
|
+
tone && `eds-heading--tone-${tone}`,
|
|
34
|
+
trim && "eds-heading--trim",
|
|
35
|
+
maxLines && "eds-heading--max-lines",
|
|
36
|
+
className
|
|
37
|
+
),
|
|
38
|
+
style: utils.getSpacingStyle(spacing, utils.getMaxLinesStyle(maxLines, style)),
|
|
39
|
+
...rest,
|
|
40
|
+
children
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
Heading.displayName = "Heading";
|
|
36
46
|
exports.Heading = Heading;
|
|
37
47
|
//# sourceMappingURL=Heading.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.cjs","sources":["../../../../src/beta/components/Heading.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\nimport {
|
|
1
|
+
{"version":3,"file":"Heading.cjs","sources":["../../../../src/beta/components/Heading.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\nimport { TypographySpacingProps } from '../types';\nimport {\n getHeadingVariantFromSemanticType,\n getMaxLinesStyle,\n getSpacingStyle,\n} from '../utils/utils';\nimport { PolymorphicComponentProps } from '@entur/utils';\n\nimport './heading.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport type HeadingOwnProps = TypographySpacingProps & {\n /** Visuell variant som bestemmer styling (anbefalt over size) */\n variant?:\n | 'title-1'\n | 'title-2'\n | 'subtitle-1'\n | 'subtitle-2'\n | 'section-1'\n | 'section-2';\n /** Visuell tekststørrelse som overstyrer variant-styling */\n size?: 'xs' | 's' | 'm' | 'lg' | 'xl' | '2xl';\n /** Dempet tekst for sekundære overskrifter. Velger riktig farge i kontrast- og mørk modus. */\n tone?: 'subdued';\n /** Innholdet som skal vises */\n children?: React.ReactNode;\n /** 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`. */\n trim?: boolean;\n /** Kutter teksten etter så mange linjer og avslutter med «…». Hele teksten må kunne leses et annet sted, for eksempel på en egen side. */\n maxLines?: number;\n /** Ekstra klassenavn for tilpasset styling */\n className?: string;\n};\n\nexport type TypographyHeadingVariant = NonNullable<HeadingOwnProps['variant']>;\nexport type TypographyHeadingSize = NonNullable<HeadingOwnProps['size']>;\n\nexport type HeadingProps<C extends React.ElementType = typeof defaultElement> =\n PolymorphicComponentProps<C, HeadingOwnProps>;\n\nexport type HeadingComponent = (<\n C extends React.ElementType = typeof defaultElement,\n>(\n props: HeadingProps<C> & { ref?: React.Ref<Element> },\n) => React.ReactElement | null) & { displayName?: string };\n\nconst defaultElement = 'h2';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const Heading = React.forwardRef(\n <C extends React.ElementType = typeof defaultElement>(\n {\n children,\n as,\n size,\n variant,\n tone,\n spacing,\n style,\n trim,\n maxLines,\n className,\n ...rest\n }: HeadingProps<C>,\n ref?: React.Ref<Element>,\n ): JSX.Element => {\n const HeadingElement: React.ElementType = as || defaultElement;\n\n const usedVariant =\n variant ?? getHeadingVariantFromSemanticType(HeadingElement);\n\n return (\n <HeadingElement\n ref={ref}\n className={classNames(\n 'eds-heading',\n `eds-heading--${usedVariant}`,\n size && `eds-heading--${size}`,\n tone && `eds-heading--tone-${tone}`,\n trim && 'eds-heading--trim',\n maxLines && 'eds-heading--max-lines',\n className,\n )}\n style={getSpacingStyle(spacing, getMaxLinesStyle(maxLines, style))}\n {...rest}\n >\n {children}\n </HeadingElement>\n );\n },\n) as HeadingComponent;\nHeading.displayName = 'Heading';\n"],"names":["getHeadingVariantFromSemanticType","jsx","getSpacingStyle","getMaxLinesStyle"],"mappings":";;;;;;;AAmDA,MAAM,iBAAiB;AAKhB,MAAM,UAAU,MAAM;AAAA,EAC3B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACgB;AAChB,UAAM,iBAAoC,MAAM;AAEhD,UAAM,cACJ,WAAWA,MAAAA,kCAAkC,cAAc;AAE7D,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA,gBAAgB,WAAW;AAAA,UAC3B,QAAQ,gBAAgB,IAAI;AAAA,UAC5B,QAAQ,qBAAqB,IAAI;AAAA,UACjC,QAAQ;AAAA,UACR,YAAY;AAAA,UACZ;AAAA,QAAA;AAAA,QAEF,OAAOC,MAAAA,gBAAgB,SAASC,MAAAA,iBAAiB,UAAU,KAAK,CAAC;AAAA,QAChE,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,QAAQ,cAAc;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const classNames = require("classnames");
|
|
6
|
+
const utils = require("../utils/utils.cjs");
|
|
7
|
+
;/* empty css */
|
|
8
|
+
const Label = React.forwardRef(
|
|
9
|
+
({ className, spacing, style, children, ...rest }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
10
|
+
"label",
|
|
11
|
+
{
|
|
12
|
+
ref,
|
|
13
|
+
className: classNames("eds-text", "eds-text--label", className),
|
|
14
|
+
style: utils.getSpacingStyle(spacing, style),
|
|
15
|
+
...rest,
|
|
16
|
+
children
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
Label.displayName = "Label";
|
|
21
|
+
exports.Label = Label;
|
|
22
|
+
//# sourceMappingURL=Label.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.cjs","sources":["../../../../src/beta/components/Label.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { TypographySpacingProps } from '../types';\nimport { getSpacingStyle } from '../utils/utils';\n\nimport './text.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport type LabelOwnProps = TypographySpacingProps & {\n /** Ekstra klassenavn */\n className?: string;\n /** Innholdet */\n children?: React.ReactNode;\n};\n\nexport type LabelProps = LabelOwnProps &\n Omit<React.LabelHTMLAttributes<HTMLLabelElement>, keyof LabelOwnProps>;\n\n/**\n * Ledetekst for et skjemafelt, koblet til feltet med `htmlFor` eller ved å ligge rundt det\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const Label = React.forwardRef<HTMLLabelElement, LabelProps>(\n ({ className, spacing, style, children, ...rest }, ref) => (\n <label\n ref={ref}\n className={classNames('eds-text', 'eds-text--label', className)}\n style={getSpacingStyle(spacing, style)}\n {...rest}\n >\n {children}\n </label>\n ),\n);\nLabel.displayName = 'Label';\n"],"names":["jsx","getSpacingStyle"],"mappings":";;;;;;;AAwBO,MAAM,QAAQ,MAAM;AAAA,EACzB,CAAC,EAAE,WAAW,SAAS,OAAO,UAAU,GAAG,KAAA,GAAQ,QACjDA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,WAAW,YAAY,mBAAmB,SAAS;AAAA,MAC9D,OAAOC,MAAAA,gBAAgB,SAAS,KAAK;AAAA,MACpC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;AACA,MAAM,cAAc;;"}
|
|
@@ -1,41 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
4
5
|
const classNames = require("classnames");
|
|
5
|
-
const icons = require("@entur/icons");
|
|
6
6
|
const utils = require("../utils/utils.cjs");
|
|
7
7
|
;/* empty css */
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
};
|
|
8
|
+
const defaultElement = "a";
|
|
9
|
+
const Link = React.forwardRef(
|
|
10
|
+
({ className, spacing, style, children, as, ...rest }, ref) => {
|
|
11
|
+
const LinkElement = as || defaultElement;
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13
|
+
LinkElement,
|
|
14
|
+
{
|
|
15
|
+
ref,
|
|
16
|
+
className: classNames("eds-text--link", className),
|
|
17
|
+
style: utils.getSpacingStyle(spacing, style),
|
|
18
|
+
...rest,
|
|
19
|
+
children
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
Link.displayName = "Link";
|
|
40
25
|
exports.Link = Link;
|
|
41
26
|
//# sourceMappingURL=Link.cjs.map
|
|
@@ -1 +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 {
|
|
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 { TypographySpacingProps } from '../types';\nimport { getSpacingStyle } from '../utils/utils';\n\nimport './text.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport type LinkOwnProps = TypographySpacingProps & {\n /** Ekstra klassenavn */\n className?: string;\n /** Innholdet */\n children?: React.ReactNode;\n};\n\nexport type LinkProps<C extends React.ElementType = typeof defaultElement> =\n PolymorphicComponentProps<C, LinkOwnProps>;\n\nexport type LinkComponent = (<\n C extends React.ElementType = typeof defaultElement,\n>(\n props: LinkProps<C> & { ref?: React.Ref<Element> },\n) => React.ReactElement | null) & { displayName?: string };\n\nconst defaultElement = 'a';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const Link = React.forwardRef(\n <C extends React.ElementType = typeof defaultElement>(\n { className, spacing, style, children, as, ...rest }: LinkProps<C>,\n ref?: React.Ref<Element>,\n ): JSX.Element => {\n const LinkElement: React.ElementType = as || defaultElement;\n\n return (\n <LinkElement\n ref={ref}\n className={classNames('eds-text--link', className)}\n style={getSpacingStyle(spacing, style)}\n {...rest}\n >\n {children}\n </LinkElement>\n );\n },\n) as LinkComponent;\nLink.displayName = 'Link';\n"],"names":["jsx","getSpacingStyle"],"mappings":";;;;;;;AA2BA,MAAM,iBAAiB;AAKhB,MAAM,OAAO,MAAM;AAAA,EACxB,CACE,EAAE,WAAW,SAAS,OAAO,UAAU,IAAI,GAAG,KAAA,GAC9C,QACgB;AAChB,UAAM,cAAiC,MAAM;AAE7C,WACEA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,WAAW,kBAAkB,SAAS;AAAA,QACjD,OAAOC,MAAAA,gBAAgB,SAAS,KAAK;AAAA,QACpC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,KAAK,cAAc;;"}
|
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
4
5
|
const classNames = require("classnames");
|
|
5
6
|
const utils = require("../utils/utils.cjs");
|
|
6
7
|
;/* empty css */
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
8
|
+
const defaultElement = "li";
|
|
9
|
+
const ListItem = React.forwardRef(
|
|
10
|
+
({
|
|
11
|
+
title,
|
|
12
|
+
className,
|
|
13
|
+
spacing,
|
|
14
|
+
style,
|
|
15
|
+
children,
|
|
16
|
+
as,
|
|
17
|
+
...rest
|
|
18
|
+
}, ref) => {
|
|
19
|
+
const ItemElement = as || defaultElement;
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21
|
+
ItemElement,
|
|
22
|
+
{
|
|
23
|
+
ref,
|
|
24
|
+
className: classNames("eds-text--list-item", className),
|
|
25
|
+
style: utils.getSpacingStyle(spacing, style),
|
|
26
|
+
...rest,
|
|
27
|
+
children: [
|
|
28
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "eds-text--list-item__title", children: title }),
|
|
29
|
+
children
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
ListItem.displayName = "ListItem";
|
|
32
36
|
exports.ListItem = ListItem;
|
|
33
37
|
//# sourceMappingURL=ListItem.cjs.map
|
|
@@ -1 +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 {
|
|
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 { TypographySpacingProps } from '../types';\nimport { getSpacingStyle } from '../utils/utils';\n\nimport './text.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport type ListItemOwnProps = TypographySpacingProps & {\n /** Ekstra klassenavn */\n className?: string;\n /** Innholdet */\n children?: React.ReactNode;\n /** Tittel */\n title?: React.ReactNode;\n};\n\nexport type ListItemProps<C extends React.ElementType = typeof defaultElement> =\n PolymorphicComponentProps<C, ListItemOwnProps>;\n\nexport type ListItemComponent = (<\n C extends React.ElementType = typeof defaultElement,\n>(\n props: ListItemProps<C> & { ref?: React.Ref<Element> },\n) => React.ReactElement | null) & { displayName?: string };\n\nconst defaultElement = 'li';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const ListItem = React.forwardRef(\n <C extends React.ElementType = typeof defaultElement>(\n {\n title,\n className,\n spacing,\n style,\n children,\n as,\n ...rest\n }: ListItemProps<C>,\n ref?: React.Ref<Element>,\n ): JSX.Element => {\n const ItemElement: React.ElementType = as || defaultElement;\n\n return (\n <ItemElement\n ref={ref}\n className={classNames('eds-text--list-item', className)}\n style={getSpacingStyle(spacing, style)}\n {...rest}\n >\n {title && <span className=\"eds-text--list-item__title\">{title}</span>}\n {children}\n </ItemElement>\n );\n },\n) as ListItemComponent;\nListItem.displayName = 'ListItem';\n"],"names":["jsxs","getSpacingStyle","jsx"],"mappings":";;;;;;;AA6BA,MAAM,iBAAiB;AAKhB,MAAM,WAAW,MAAM;AAAA,EAC5B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACgB;AAChB,UAAM,cAAiC,MAAM;AAE7C,WACEA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,WAAW,uBAAuB,SAAS;AAAA,QACtD,OAAOC,MAAAA,gBAAgB,SAAS,KAAK;AAAA,QACpC,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,SAASC,2BAAAA,IAAC,QAAA,EAAK,WAAU,8BAA8B,UAAA,OAAM;AAAA,UAC7D;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,SAAS,cAAc;;"}
|
|
@@ -1,32 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
4
5
|
const classNames = require("classnames");
|
|
5
6
|
const utils = require("../utils/utils.cjs");
|
|
6
7
|
;/* empty css */
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
8
|
+
const defaultElement = "ol";
|
|
9
|
+
const NumberedList = React.forwardRef(
|
|
10
|
+
({
|
|
11
|
+
type = "1",
|
|
12
|
+
variant = "default",
|
|
13
|
+
className,
|
|
14
|
+
spacing,
|
|
15
|
+
style,
|
|
16
|
+
children,
|
|
17
|
+
as,
|
|
18
|
+
...rest
|
|
19
|
+
}, ref) => {
|
|
20
|
+
const ListElement = as || defaultElement;
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
|
+
ListElement,
|
|
23
|
+
{
|
|
24
|
+
ref,
|
|
25
|
+
className: classNames(
|
|
26
|
+
"eds-text--numbered-list",
|
|
27
|
+
`eds-text--numbered-list--type-${type}`,
|
|
28
|
+
{ "eds-text--steps": variant === "steps" },
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
type,
|
|
32
|
+
role: variant === "steps" ? "list" : void 0,
|
|
33
|
+
style: utils.getSpacingStyle(spacing, style),
|
|
34
|
+
...rest,
|
|
35
|
+
children
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
NumberedList.displayName = "NumberedList";
|
|
31
41
|
exports.NumberedList = NumberedList;
|
|
32
42
|
//# sourceMappingURL=NumberedList.cjs.map
|
|
@@ -1 +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 {
|
|
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 { TypographySpacingProps } from '../types';\nimport { getSpacingStyle } from '../utils/utils';\n\nimport './text.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport type NumberedListOwnProps = TypographySpacingProps & {\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 /** `steps` viser numrene i merker, for steg-for-steg-instruksjoner\n * @default 'default'\n */\n variant?: 'default' | 'steps';\n};\n\nexport type NumberedListProps<\n C extends React.ElementType = typeof defaultElement,\n> = PolymorphicComponentProps<C, NumberedListOwnProps>;\n\nexport type NumberedListComponent = (<\n C extends React.ElementType = typeof defaultElement,\n>(\n props: NumberedListProps<C> & { ref?: React.Ref<Element> },\n) => React.ReactElement | null) & { displayName?: string };\n\nconst defaultElement = 'ol';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const NumberedList = React.forwardRef(\n <C extends React.ElementType = typeof defaultElement>(\n {\n type = '1',\n variant = 'default',\n className,\n spacing,\n style,\n children,\n as,\n ...rest\n }: NumberedListProps<C>,\n ref?: React.Ref<Element>,\n ): JSX.Element => {\n const ListElement: React.ElementType = as || defaultElement;\n\n return (\n <ListElement\n ref={ref}\n className={classNames(\n 'eds-text--numbered-list',\n `eds-text--numbered-list--type-${type}`,\n { 'eds-text--steps': variant === 'steps' },\n className,\n )}\n type={type}\n // Safari drops list semantics when the list has no markers\n role={variant === 'steps' ? 'list' : undefined}\n style={getSpacingStyle(spacing, style)}\n {...rest}\n >\n {children}\n </ListElement>\n );\n },\n) as NumberedListComponent;\nNumberedList.displayName = 'NumberedList';\n"],"names":["jsx","getSpacingStyle"],"mappings":";;;;;;;AAkCA,MAAM,iBAAiB;AAKhB,MAAM,eAAe,MAAM;AAAA,EAChC,CACE;AAAA,IACE,OAAO;AAAA,IACP,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACgB;AAChB,UAAM,cAAiC,MAAM;AAE7C,WACEA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA,iCAAiC,IAAI;AAAA,UACrC,EAAE,mBAAmB,YAAY,QAAA;AAAA,UACjC;AAAA,QAAA;AAAA,QAEF;AAAA,QAEA,MAAM,YAAY,UAAU,SAAS;AAAA,QACrC,OAAOC,MAAAA,gBAAgB,SAAS,KAAK;AAAA,QACpC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,aAAa,cAAc;;"}
|
|
@@ -1,36 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
4
5
|
const classNames = require("classnames");
|
|
5
6
|
const utils = require("../utils/utils.cjs");
|
|
6
7
|
;/* empty css */
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
8
|
+
const Text = React.forwardRef(
|
|
9
|
+
({
|
|
10
|
+
children,
|
|
11
|
+
as,
|
|
12
|
+
size,
|
|
13
|
+
variant,
|
|
14
|
+
weight,
|
|
15
|
+
tone,
|
|
16
|
+
spacing,
|
|
17
|
+
style,
|
|
18
|
+
trim,
|
|
19
|
+
maxLines,
|
|
20
|
+
className,
|
|
21
|
+
...rest
|
|
22
|
+
}, ref) => {
|
|
23
|
+
const BodyElement = as || utils.getSemanticTypeFromTextVariant(variant);
|
|
24
|
+
const usedVariant = variant ?? utils.getDefaultTextVariant(BodyElement);
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
|
+
BodyElement,
|
|
27
|
+
{
|
|
28
|
+
ref,
|
|
29
|
+
className: classNames(
|
|
30
|
+
"eds-text",
|
|
31
|
+
`eds-text--${usedVariant}`,
|
|
32
|
+
size && `eds-text--${size}`,
|
|
33
|
+
weight && `eds-text--weight-${weight}`,
|
|
34
|
+
tone && `eds-text--tone-${tone}`,
|
|
35
|
+
trim && "eds-text--trim",
|
|
36
|
+
maxLines && "eds-text--max-lines",
|
|
37
|
+
className
|
|
38
|
+
),
|
|
39
|
+
style: utils.getSpacingStyle(spacing, utils.getMaxLinesStyle(maxLines, style)),
|
|
40
|
+
...rest,
|
|
41
|
+
children
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
Text.displayName = "Text";
|
|
35
47
|
exports.Text = Text;
|
|
36
48
|
//# sourceMappingURL=Text.cjs.map
|
|
@@ -1 +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 getSemanticTypeFromTextVariant,\n
|
|
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 getDefaultTextVariant,\n getSemanticTypeFromTextVariant,\n getMaxLinesStyle,\n getSpacingStyle,\n} from '../utils/utils';\n\nimport { TypographySpacingProps } from '../types';\n\nimport './text.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport type TextOwnProps = TypographySpacingProps & {\n /** Visuell tekststørrelse (typografi-token) */\n size?: 'xs' | 's' | 'm' | 'lg' | 'xl';\n /** Fontvekt: `medium` (500) eller `bold` (600) */\n weight?: 'medium' | 'bold';\n /** Dempet tekst for sekundær informasjon, som metadata og hjelpetekst. Velger riktig farge i kontrast- og mørk modus. */\n tone?: 'subdued';\n /** Variant (kan brukes til spesielle typer tekst som for eksempel caption).\n * Uten variant blir teksten `paragraph` når den står for seg selv (`p`, `div`, `li` …), og arver\n * størrelse, farge og vekt når den står inne i annen tekst (`span`, `strong`, en komponent …). */\n variant?:\n | 'leading'\n | 'quote'\n | 'paragraph'\n | 'subparagraph'\n | 'caption'\n | 'label'\n | 'sublabel'\n | 'overline'\n | 'emphasized'\n | 'code'\n | 'preformatted';\n /** Innhold */\n children?: React.ReactNode;\n /** 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`. */\n trim?: boolean;\n /** Kutter teksten etter så mange linjer og avslutter med «…». Hele teksten må kunne leses et annet sted, for eksempel på en egen side. */\n maxLines?: number;\n /** Ekstra klassenavn */\n className?: string;\n};\n\nexport type TypographyTextVariant = NonNullable<TextOwnProps['variant']>;\nexport type TypographyTextSize = NonNullable<TextOwnProps['size']>;\nexport type TypographyWeight = NonNullable<TextOwnProps['weight']>;\nexport type TypographyTone = NonNullable<TextOwnProps['tone']>;\n\nexport type TextProps<C extends React.ElementType = 'p'> =\n PolymorphicComponentProps<C, TextOwnProps>;\n\nexport type TextComponent = (<C extends React.ElementType = 'p'>(\n props: TextProps<C> & { ref?: React.Ref<Element> },\n) => React.ReactElement | null) & { displayName?: string };\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const Text = React.forwardRef(\n <C extends React.ElementType = 'p'>(\n {\n children,\n as,\n size,\n variant,\n weight,\n tone,\n spacing,\n style,\n trim,\n maxLines,\n className,\n ...rest\n }: TextProps<C>,\n ref?: React.Ref<Element>,\n ): JSX.Element => {\n const BodyElement: React.ElementType =\n as || getSemanticTypeFromTextVariant(variant);\n const usedVariant = variant ?? getDefaultTextVariant(BodyElement);\n\n return (\n <BodyElement\n ref={ref}\n className={classNames(\n 'eds-text',\n `eds-text--${usedVariant}`,\n size && `eds-text--${size}`,\n weight && `eds-text--weight-${weight}`,\n tone && `eds-text--tone-${tone}`,\n trim && 'eds-text--trim',\n maxLines && 'eds-text--max-lines',\n className,\n )}\n style={getSpacingStyle(spacing, getMaxLinesStyle(maxLines, style))}\n {...rest}\n >\n {children}\n </BodyElement>\n );\n },\n) as TextComponent;\nText.displayName = 'Text';\n"],"names":["getSemanticTypeFromTextVariant","getDefaultTextVariant","jsx","getSpacingStyle","getMaxLinesStyle"],"mappings":";;;;;;;AAmEO,MAAM,OAAO,MAAM;AAAA,EACxB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACgB;AAChB,UAAM,cACJ,MAAMA,MAAAA,+BAA+B,OAAO;AAC9C,UAAM,cAAc,WAAWC,MAAAA,sBAAsB,WAAW;AAEhE,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA,aAAa,WAAW;AAAA,UACxB,QAAQ,aAAa,IAAI;AAAA,UACzB,UAAU,oBAAoB,MAAM;AAAA,UACpC,QAAQ,kBAAkB,IAAI;AAAA,UAC9B,QAAQ;AAAA,UACR,YAAY;AAAA,UACZ;AAAA,QAAA;AAAA,QAEF,OAAOC,MAAAA,gBAAgB,SAASC,MAAAA,iBAAiB,UAAU,KAAK,CAAC;AAAA,QAChE,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,KAAK,cAAc;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const classNames = require("classnames");
|
|
6
|
+
const utils = require("../utils/utils.cjs");
|
|
7
|
+
;/* empty css */
|
|
8
|
+
const defaultElement = "div";
|
|
9
|
+
const TextContainer = React.forwardRef(
|
|
10
|
+
({ className, spacing, style, children, as, ...rest }, ref) => {
|
|
11
|
+
const ContainerElement = as || defaultElement;
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13
|
+
ContainerElement,
|
|
14
|
+
{
|
|
15
|
+
ref,
|
|
16
|
+
className: classNames("eds-text-container", className),
|
|
17
|
+
style: utils.getSpacingStyle(spacing, style),
|
|
18
|
+
...rest,
|
|
19
|
+
children
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
TextContainer.displayName = "TextContainer";
|
|
25
|
+
exports.TextContainer = TextContainer;
|
|
26
|
+
//# sourceMappingURL=TextContainer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextContainer.cjs","sources":["../../../../src/beta/components/TextContainer.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps } from '@entur/utils';\nimport { TypographySpacingProps } from '../types';\nimport { getSpacingStyle } from '../utils/utils';\n\nimport './text-container.scss';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport type TextContainerOwnProps = TypographySpacingProps & {\n /** Ekstra klassenavn */\n className?: string;\n /** Overskrifter, avsnitt, lister og annen løpende tekst */\n children?: React.ReactNode;\n};\n\nexport type TextContainerProps<\n C extends React.ElementType = typeof defaultElement,\n> = PolymorphicComponentProps<C, TextContainerOwnProps>;\n\nexport type TextContainerComponent = (<\n C extends React.ElementType = typeof defaultElement,\n>(\n props: TextContainerProps<C> & { ref?: React.Ref<Element> },\n) => React.ReactElement | null) & { displayName?: string };\n\nconst defaultElement = 'div';\n\n/**\n * Gir løpende tekst riktig avstand mellom overskrifter, avsnitt og lister\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const TextContainer = React.forwardRef(\n <C extends React.ElementType = typeof defaultElement>(\n { className, spacing, style, children, as, ...rest }: TextContainerProps<C>,\n ref?: React.Ref<Element>,\n ): JSX.Element => {\n const ContainerElement: React.ElementType = as || defaultElement;\n\n return (\n <ContainerElement\n ref={ref}\n className={classNames('eds-text-container', className)}\n style={getSpacingStyle(spacing, style)}\n {...rest}\n >\n {children}\n </ContainerElement>\n );\n },\n) as TextContainerComponent;\nTextContainer.displayName = 'TextContainer';\n"],"names":["jsx","getSpacingStyle"],"mappings":";;;;;;;AA4BA,MAAM,iBAAiB;AAMhB,MAAM,gBAAgB,MAAM;AAAA,EACjC,CACE,EAAE,WAAW,SAAS,OAAO,UAAU,IAAI,GAAG,KAAA,GAC9C,QACgB;AAChB,UAAM,mBAAsC,MAAM;AAElD,WACEA,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,WAAW,sBAAsB,SAAS;AAAA,QACrD,OAAOC,MAAAA,gBAAgB,SAAS,KAAK;AAAA,QACpC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,cAAc,cAAc;;"}
|