@entur/typography 3.2.0 → 3.2.1
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/dist/BaseHeading.d.ts +1 -1
- 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/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/beta/cjs/components/Heading.cjs +5 -5
- package/dist/beta/cjs/components/Heading.cjs.map +1 -1
- package/dist/beta/cjs/components/Link.cjs +4 -4
- package/dist/beta/cjs/components/Link.cjs.map +1 -1
- package/dist/beta/cjs/components/ListItem.cjs +4 -4
- package/dist/beta/cjs/components/ListItem.cjs.map +1 -1
- package/dist/beta/cjs/components/NumberedList.cjs +4 -4
- package/dist/beta/cjs/components/NumberedList.cjs.map +1 -1
- package/dist/beta/cjs/components/Text.cjs +6 -6
- package/dist/beta/cjs/components/Text.cjs.map +1 -1
- package/dist/beta/cjs/components/TextContainer.cjs +4 -4
- package/dist/beta/cjs/components/TextContainer.cjs.map +1 -1
- package/dist/beta/cjs/components/UnorderedList.cjs +4 -4
- package/dist/beta/cjs/components/UnorderedList.cjs.map +1 -1
- package/dist/beta/cjs/utils/utils.cjs.map +1 -1
- package/dist/beta/esm/components/Heading.mjs +2 -2
- package/dist/beta/esm/components/Heading.mjs.map +1 -1
- package/dist/beta/esm/components/Link.mjs +2 -2
- package/dist/beta/esm/components/Link.mjs.map +1 -1
- package/dist/beta/esm/components/ListItem.mjs +2 -2
- package/dist/beta/esm/components/ListItem.mjs.map +1 -1
- package/dist/beta/esm/components/NumberedList.mjs +2 -2
- package/dist/beta/esm/components/NumberedList.mjs.map +1 -1
- package/dist/beta/esm/components/Text.mjs +2 -2
- package/dist/beta/esm/components/Text.mjs.map +1 -1
- package/dist/beta/esm/components/TextContainer.mjs +2 -2
- package/dist/beta/esm/components/TextContainer.mjs.map +1 -1
- package/dist/beta/esm/components/UnorderedList.mjs +2 -2
- package/dist/beta/esm/components/UnorderedList.mjs.map +1 -1
- package/dist/beta/esm/utils/utils.mjs.map +1 -1
- package/dist/beta/types/utils/utils.d.ts +2 -1
- package/dist/typography.cjs.map +1 -1
- package/dist/typography.mjs.map +1 -1
- package/package.json +7 -6
- package/dist/beta/types/tests/styles.test.d.ts +0 -1
- package/dist/beta/types/tests/warnAboutGlobalStyles.test.d.ts +0 -1
package/dist/BaseHeading.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ type BaseHeadingOwnProps = {
|
|
|
14
14
|
};
|
|
15
15
|
declare const defaultElement = "h1";
|
|
16
16
|
export type BaseHeadingProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, BaseHeadingOwnProps>;
|
|
17
|
-
export declare const BaseHeading: <E extends React.ElementType = "h1">({ className, level, margin, as, ...rest }: BaseHeadingProps<E>) => JSX.Element;
|
|
17
|
+
export declare const BaseHeading: <E extends React.ElementType = "h1">({ className, level, margin, as, ...rest }: BaseHeadingProps<E>) => React.JSX.Element;
|
|
18
18
|
export {};
|
package/dist/CodeText.d.ts
CHANGED
|
@@ -12,5 +12,5 @@ export type CodeTextOwnProps = {
|
|
|
12
12
|
};
|
|
13
13
|
export type CodeTextProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, CodeTextOwnProps>;
|
|
14
14
|
declare const defaultElement = "code";
|
|
15
|
-
export declare const CodeText: <E extends React.ElementType = "code">({ className, as, ...rest }: CodeTextProps<E>) => JSX.Element;
|
|
15
|
+
export declare const CodeText: <E extends React.ElementType = "code">({ className, as, ...rest }: CodeTextProps<E>) => React.JSX.Element;
|
|
16
16
|
export {};
|
package/dist/EmphasizedText.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type EmphasizedTextOwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type EmphasizedTextProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, EmphasizedTextOwnProps>;
|
|
18
18
|
declare const defaultElement = "em";
|
|
19
|
-
export declare const EmphasizedText: <E extends React.ElementType = "em">({ className, margin, as, ...rest }: EmphasizedTextProps<E>) => JSX.Element;
|
|
19
|
+
export declare const EmphasizedText: <E extends React.ElementType = "em">({ className, margin, as, ...rest }: EmphasizedTextProps<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/Heading1.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type Heading1OwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
declare const defaultElement = "h1";
|
|
18
18
|
export type Heading1Props<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, Heading1OwnProps>;
|
|
19
|
-
export declare const Heading1: <E extends React.ElementType = "h1">({ margin, children, as, ...rest }: Heading1Props<E>) => JSX.Element;
|
|
19
|
+
export declare const Heading1: <E extends React.ElementType = "h1">({ margin, children, as, ...rest }: Heading1Props<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/Heading2.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type Heading2OwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type Heading2Props<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, Heading2OwnProps>;
|
|
18
18
|
declare const defaultElement = "h2";
|
|
19
|
-
export declare const Heading2: <E extends React.ElementType = "h2">({ margin, children, as, ...rest }: Heading2Props<E>) => JSX.Element;
|
|
19
|
+
export declare const Heading2: <E extends React.ElementType = "h2">({ margin, children, as, ...rest }: Heading2Props<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/Heading3.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type Heading3OwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type Heading3Props<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, Heading3OwnProps>;
|
|
18
18
|
declare const defaultElement = "h3";
|
|
19
|
-
export declare const Heading3: <E extends React.ElementType = "h3">({ margin, children, as, ...rest }: Heading3Props<E>) => JSX.Element;
|
|
19
|
+
export declare const Heading3: <E extends React.ElementType = "h3">({ margin, children, as, ...rest }: Heading3Props<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/Heading4.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type Heading4OwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type Heading4Props<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, Heading4OwnProps>;
|
|
18
18
|
declare const defaultElement = "h4";
|
|
19
|
-
export declare const Heading4: <E extends React.ElementType = "h4">({ margin, children, as, ...rest }: Heading4Props<E>) => JSX.Element;
|
|
19
|
+
export declare const Heading4: <E extends React.ElementType = "h4">({ margin, children, as, ...rest }: Heading4Props<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/Heading5.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type Heading5OwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type Heading5Props<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, Heading5OwnProps>;
|
|
18
18
|
declare const defaultElement = "h5";
|
|
19
|
-
export declare const Heading5: <E extends React.ElementType = "h5">({ margin, children, as, ...rest }: Heading5Props<E>) => JSX.Element;
|
|
19
|
+
export declare const Heading5: <E extends React.ElementType = "h5">({ margin, children, as, ...rest }: Heading5Props<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/Heading6.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type Heading6OwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type Heading6Props<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, Heading6OwnProps>;
|
|
18
18
|
declare const defaultElement = "h6";
|
|
19
|
-
export declare const Heading6: <E extends React.ElementType = "h6">({ margin, children, as, ...rest }: Heading6Props<E>) => JSX.Element;
|
|
19
|
+
export declare const Heading6: <E extends React.ElementType = "h6">({ margin, children, as, ...rest }: Heading6Props<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/Label.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type LabelOwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type LabelProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, LabelOwnProps>;
|
|
18
18
|
declare const defaultElement = "label";
|
|
19
|
-
export declare const Label: <E extends React.ElementType = "label">({ className, margin, as, ...rest }: LabelProps<E>) => JSX.Element;
|
|
19
|
+
export declare const Label: <E extends React.ElementType = "label">({ className, margin, as, ...rest }: LabelProps<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/LeadParagraph.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type LeadParagraphOwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type LeadParagraphProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, LeadParagraphOwnProps>;
|
|
18
18
|
declare const defaultElement = "p";
|
|
19
|
-
export declare const LeadParagraph: <E extends React.ElementType = "p">({ className, margin, as, ...rest }: LeadParagraphProps<E>) => JSX.Element;
|
|
19
|
+
export declare const LeadParagraph: <E extends React.ElementType = "p">({ className, margin, as, ...rest }: LeadParagraphProps<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/Link.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ export type LinkOwnProps = {
|
|
|
18
18
|
};
|
|
19
19
|
export type LinkProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, LinkOwnProps>;
|
|
20
20
|
declare const defaultElement = "a";
|
|
21
|
-
export declare const Link: <E extends React.ElementType = "a">({ external, ariaLabelExternalIcon, className, margin, children, as, ...rest }: LinkProps<E>) => JSX.Element;
|
|
21
|
+
export declare const Link: <E extends React.ElementType = "a">({ external, ariaLabelExternalIcon, className, margin, children, as, ...rest }: LinkProps<E>) => React.JSX.Element;
|
|
22
22
|
export {};
|
package/dist/Paragraph.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type ParagraphOwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type ParagraphProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, ParagraphOwnProps>;
|
|
18
18
|
declare const defaultElement = "p";
|
|
19
|
-
export declare const Paragraph: <E extends React.ElementType = "p">({ margin, className, as, ...rest }: ParagraphProps<E>) => JSX.Element;
|
|
19
|
+
export declare const Paragraph: <E extends React.ElementType = "p">({ margin, className, as, ...rest }: ParagraphProps<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -12,5 +12,5 @@ export type PreformattedTextOwnProps = {
|
|
|
12
12
|
};
|
|
13
13
|
export type PreformattedTextProps<T extends React.ElementType> = PolymorphicComponentProps<T, PreformattedTextOwnProps>;
|
|
14
14
|
declare const defaultElement = "pre";
|
|
15
|
-
export declare const PreformattedText: <E extends React.ElementType = "pre">({ className, as, ...rest }: PreformattedTextProps<E>) => JSX.Element;
|
|
15
|
+
export declare const PreformattedText: <E extends React.ElementType = "pre">({ className, as, ...rest }: PreformattedTextProps<E>) => React.JSX.Element;
|
|
16
16
|
export {};
|
package/dist/SmallText.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type SmallTextOwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type SmallTextProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, SmallTextOwnProps>;
|
|
18
18
|
declare const defaultElement = "span";
|
|
19
|
-
export declare const SmallText: <E extends React.ElementType = "span">({ className, margin, as, ...rest }: SmallTextProps<E>) => JSX.Element;
|
|
19
|
+
export declare const SmallText: <E extends React.ElementType = "span">({ className, margin, as, ...rest }: SmallTextProps<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/StrongText.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type StrongTextOwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type StrongTextProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, StrongTextOwnProps>;
|
|
18
18
|
declare const defaultElement = "strong";
|
|
19
|
-
export declare const StrongText: <E extends React.ElementType = "strong">({ className, margin, as, ...rest }: StrongTextProps<E>) => JSX.Element;
|
|
19
|
+
export declare const StrongText: <E extends React.ElementType = "strong">({ className, margin, as, ...rest }: StrongTextProps<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/SubLabel.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type SubLabelOwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type SubLabelProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, SubLabelOwnProps>;
|
|
18
18
|
declare const defaultElement = "span";
|
|
19
|
-
export declare const SubLabel: <E extends React.ElementType = "span">({ className, margin, as, ...rest }: SubLabelProps<E>) => JSX.Element;
|
|
19
|
+
export declare const SubLabel: <E extends React.ElementType = "span">({ className, margin, as, ...rest }: SubLabelProps<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
package/dist/SubParagraph.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export type SubParagraphOwnProps = {
|
|
|
16
16
|
};
|
|
17
17
|
export type SubParagraphProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, SubParagraphOwnProps>;
|
|
18
18
|
declare const defaultElement = "p";
|
|
19
|
-
export declare const SubParagraph: <E extends React.ElementType = "p">({ className, margin, as, ...rest }: SubParagraphProps<E>) => JSX.Element;
|
|
19
|
+
export declare const SubParagraph: <E extends React.ElementType = "p">({ className, margin, as, ...rest }: SubParagraphProps<E>) => React.JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
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");
|
|
5
4
|
const classNames = require("classnames");
|
|
6
|
-
const utils = require("../utils/utils.cjs");
|
|
5
|
+
const utils$1 = require("../utils/utils.cjs");
|
|
6
|
+
const utils = require("@entur/utils");
|
|
7
7
|
;/* empty css */
|
|
8
8
|
const defaultElement = "h2";
|
|
9
|
-
const Heading =
|
|
9
|
+
const Heading = utils.forwardRefPolymorphic(
|
|
10
10
|
({
|
|
11
11
|
children,
|
|
12
12
|
as,
|
|
@@ -21,7 +21,7 @@ const Heading = React.forwardRef(
|
|
|
21
21
|
...rest
|
|
22
22
|
}, ref) => {
|
|
23
23
|
const HeadingElement = as || defaultElement;
|
|
24
|
-
const usedVariant = variant ?? utils.getHeadingVariantFromSemanticType(HeadingElement);
|
|
24
|
+
const usedVariant = variant ?? utils$1.getHeadingVariantFromSemanticType(HeadingElement);
|
|
25
25
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
26
|
HeadingElement,
|
|
27
27
|
{
|
|
@@ -35,7 +35,7 @@ const Heading = React.forwardRef(
|
|
|
35
35
|
maxLines && "eds-heading--max-lines",
|
|
36
36
|
className
|
|
37
37
|
),
|
|
38
|
-
style: utils.getSpacingStyle(spacing, utils.getMaxLinesStyle(maxLines, style)),
|
|
38
|
+
style: utils$1.getSpacingStyle(spacing, utils$1.getMaxLinesStyle(maxLines, style)),
|
|
39
39
|
...rest,
|
|
40
40
|
children
|
|
41
41
|
}
|
|
@@ -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 { 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 =
|
|
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, forwardRefPolymorphic } 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 = forwardRefPolymorphic<HeadingComponent>(\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 ): React.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);\nHeading.displayName = 'Heading';\n"],"names":["forwardRefPolymorphic","getHeadingVariantFromSemanticType","jsx","getSpacingStyle","getMaxLinesStyle"],"mappings":";;;;;;;AAmDA,MAAM,iBAAiB;AAKhB,MAAM,UAAUA,MAAAA;AAAAA,EACrB,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,QACsB;AACtB,UAAM,iBAAoC,MAAM;AAEhD,UAAM,cACJ,WAAWC,QAAAA,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,QAAAA,gBAAgB,SAASC,QAAAA,iBAAiB,UAAU,KAAK,CAAC;AAAA,QAChE,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,QAAQ,cAAc;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
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");
|
|
5
4
|
const classNames = require("classnames");
|
|
6
|
-
const utils = require("
|
|
5
|
+
const utils = require("@entur/utils");
|
|
6
|
+
const utils$1 = require("../utils/utils.cjs");
|
|
7
7
|
;/* empty css */
|
|
8
8
|
const defaultElement = "a";
|
|
9
|
-
const Link =
|
|
9
|
+
const Link = utils.forwardRefPolymorphic(
|
|
10
10
|
({ className, spacing, style, children, as, ...rest }, ref) => {
|
|
11
11
|
const LinkElement = as || defaultElement;
|
|
12
12
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14,7 +14,7 @@ const Link = React.forwardRef(
|
|
|
14
14
|
{
|
|
15
15
|
ref,
|
|
16
16
|
className: classNames("eds-text--link", className),
|
|
17
|
-
style: utils.getSpacingStyle(spacing, style),
|
|
17
|
+
style: utils$1.getSpacingStyle(spacing, style),
|
|
18
18
|
...rest,
|
|
19
19
|
children
|
|
20
20
|
}
|
|
@@ -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 { 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 =
|
|
1
|
+
{"version":3,"file":"Link.cjs","sources":["../../../../src/beta/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps, forwardRefPolymorphic } 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 = forwardRefPolymorphic<LinkComponent>(\n <C extends React.ElementType = typeof defaultElement>(\n { className, spacing, style, children, as, ...rest }: LinkProps<C>,\n ref?: React.Ref<Element>,\n ): React.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);\nLink.displayName = 'Link';\n"],"names":["forwardRefPolymorphic","jsx","getSpacingStyle"],"mappings":";;;;;;;AA2BA,MAAM,iBAAiB;AAKhB,MAAM,OAAOA,MAAAA;AAAAA,EAClB,CACE,EAAE,WAAW,SAAS,OAAO,UAAU,IAAI,GAAG,KAAA,GAC9C,QACsB;AACtB,UAAM,cAAiC,MAAM;AAE7C,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,WAAW,kBAAkB,SAAS;AAAA,QACjD,OAAOC,QAAAA,gBAAgB,SAAS,KAAK;AAAA,QACpC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,KAAK,cAAc;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
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");
|
|
5
4
|
const classNames = require("classnames");
|
|
6
|
-
const utils = require("
|
|
5
|
+
const utils = require("@entur/utils");
|
|
6
|
+
const utils$1 = require("../utils/utils.cjs");
|
|
7
7
|
;/* empty css */
|
|
8
8
|
const defaultElement = "li";
|
|
9
|
-
const ListItem =
|
|
9
|
+
const ListItem = utils.forwardRefPolymorphic(
|
|
10
10
|
({
|
|
11
11
|
title,
|
|
12
12
|
className,
|
|
@@ -27,7 +27,7 @@ const ListItem = React.forwardRef(
|
|
|
27
27
|
tone && `eds-text--tone-${tone}`,
|
|
28
28
|
className
|
|
29
29
|
),
|
|
30
|
-
style: utils.getSpacingStyle(spacing, style),
|
|
30
|
+
style: utils$1.getSpacingStyle(spacing, style),
|
|
31
31
|
...rest,
|
|
32
32
|
children: [
|
|
33
33
|
title && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "eds-text--list-item__title", children: title }),
|
|
@@ -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 { 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 /** Dempet punkt, for eksempel et steg som er fullført. Velger riktig farge i kontrast- og mørk modus. */\n tone?: 'subdued';\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 =
|
|
1
|
+
{"version":3,"file":"ListItem.cjs","sources":["../../../../src/beta/components/ListItem.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps, forwardRefPolymorphic } 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 /** Dempet punkt, for eksempel et steg som er fullført. Velger riktig farge i kontrast- og mørk modus. */\n tone?: 'subdued';\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 = forwardRefPolymorphic<ListItemComponent>(\n <C extends React.ElementType = typeof defaultElement>(\n {\n title,\n className,\n tone,\n spacing,\n style,\n children,\n as,\n ...rest\n }: ListItemProps<C>,\n ref?: React.Ref<Element>,\n ): React.JSX.Element => {\n const ItemElement: React.ElementType = as || defaultElement;\n\n return (\n <ItemElement\n ref={ref}\n className={classNames(\n 'eds-text--list-item',\n tone && `eds-text--tone-${tone}`,\n className,\n )}\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);\nListItem.displayName = 'ListItem';\n"],"names":["forwardRefPolymorphic","jsxs","getSpacingStyle","jsx"],"mappings":";;;;;;;AA+BA,MAAM,iBAAiB;AAKhB,MAAM,WAAWA,MAAAA;AAAAA,EACtB,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACsB;AACtB,UAAM,cAAiC,MAAM;AAE7C,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA,QAAQ,kBAAkB,IAAI;AAAA,UAC9B;AAAA,QAAA;AAAA,QAEF,OAAOC,QAAAA,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,12 +1,12 @@
|
|
|
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");
|
|
5
4
|
const classNames = require("classnames");
|
|
6
|
-
const utils = require("
|
|
5
|
+
const utils = require("@entur/utils");
|
|
6
|
+
const utils$1 = require("../utils/utils.cjs");
|
|
7
7
|
;/* empty css */
|
|
8
8
|
const defaultElement = "ol";
|
|
9
|
-
const NumberedList =
|
|
9
|
+
const NumberedList = utils.forwardRefPolymorphic(
|
|
10
10
|
({
|
|
11
11
|
type = "1",
|
|
12
12
|
variant = "default",
|
|
@@ -32,7 +32,7 @@ const NumberedList = React.forwardRef(
|
|
|
32
32
|
),
|
|
33
33
|
type,
|
|
34
34
|
role: variant === "steps" ? "list" : void 0,
|
|
35
|
-
style: utils.getSpacingStyle(spacing, style),
|
|
35
|
+
style: utils$1.getSpacingStyle(spacing, style),
|
|
36
36
|
...rest,
|
|
37
37
|
children
|
|
38
38
|
}
|
|
@@ -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 { 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 /** Dempet liste for sekundær informasjon, som hjelpetekst. Velger riktig farge i kontrast- og mørk modus. */\n tone?: 'subdued';\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 =
|
|
1
|
+
{"version":3,"file":"NumberedList.cjs","sources":["../../../../src/beta/components/NumberedList.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps, forwardRefPolymorphic } 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 /** Dempet liste for sekundær informasjon, som hjelpetekst. Velger riktig farge i kontrast- og mørk modus. */\n tone?: 'subdued';\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 = forwardRefPolymorphic<NumberedListComponent>(\n <C extends React.ElementType = typeof defaultElement>(\n {\n type = '1',\n variant = 'default',\n className,\n tone,\n spacing,\n style,\n children,\n as,\n ...rest\n }: NumberedListProps<C>,\n ref?: React.Ref<Element>,\n ): React.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 tone && `eds-text--tone-${tone}`,\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);\nNumberedList.displayName = 'NumberedList';\n"],"names":["forwardRefPolymorphic","jsx","getSpacingStyle"],"mappings":";;;;;;;AAoCA,MAAM,iBAAiB;AAKhB,MAAM,eAAeA,MAAAA;AAAAA,EAC1B,CACE;AAAA,IACE,OAAO;AAAA,IACP,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACsB;AACtB,UAAM,cAAiC,MAAM;AAE7C,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA,iCAAiC,IAAI;AAAA,UACrC,EAAE,mBAAmB,YAAY,QAAA;AAAA,UACjC,QAAQ,kBAAkB,IAAI;AAAA,UAC9B;AAAA,QAAA;AAAA,QAEF;AAAA,QAEA,MAAM,YAAY,UAAU,SAAS;AAAA,QACrC,OAAOC,QAAAA,gBAAgB,SAAS,KAAK;AAAA,QACpC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,aAAa,cAAc;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
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");
|
|
5
4
|
const classNames = require("classnames");
|
|
6
|
-
const utils = require("
|
|
5
|
+
const utils = require("@entur/utils");
|
|
6
|
+
const utils$1 = require("../utils/utils.cjs");
|
|
7
7
|
;/* empty css */
|
|
8
|
-
const Text =
|
|
8
|
+
const Text = utils.forwardRefPolymorphic(
|
|
9
9
|
({
|
|
10
10
|
children,
|
|
11
11
|
as,
|
|
@@ -20,8 +20,8 @@ const Text = React.forwardRef(
|
|
|
20
20
|
className,
|
|
21
21
|
...rest
|
|
22
22
|
}, ref) => {
|
|
23
|
-
const BodyElement = as || utils.getSemanticTypeFromTextVariant(variant);
|
|
24
|
-
const usedVariant = variant ?? utils.getDefaultTextVariant(BodyElement);
|
|
23
|
+
const BodyElement = as || utils$1.getSemanticTypeFromTextVariant(variant);
|
|
24
|
+
const usedVariant = variant ?? utils$1.getDefaultTextVariant(BodyElement);
|
|
25
25
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26
26
|
BodyElement,
|
|
27
27
|
{
|
|
@@ -36,7 +36,7 @@ const Text = React.forwardRef(
|
|
|
36
36
|
maxLines && "eds-text--max-lines",
|
|
37
37
|
className
|
|
38
38
|
),
|
|
39
|
-
style: utils.getSpacingStyle(spacing, utils.getMaxLinesStyle(maxLines, style)),
|
|
39
|
+
style: utils$1.getSpacingStyle(spacing, utils$1.getMaxLinesStyle(maxLines, style)),
|
|
40
40
|
...rest,
|
|
41
41
|
children
|
|
42
42
|
}
|
|
@@ -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 getDefaultTextVariant,\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, forwardRefPolymorphic } from '@entur/utils';\n\nimport {\n getDefaultTextVariant,\n getMaxLinesStyle,\n getSemanticTypeFromTextVariant,\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 = forwardRefPolymorphic<TextComponent>(\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 ): React.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);\nText.displayName = 'Text';\n"],"names":["forwardRefPolymorphic","getSemanticTypeFromTextVariant","getDefaultTextVariant","jsx","getSpacingStyle","getMaxLinesStyle"],"mappings":";;;;;;;AAmEO,MAAM,OAAOA,MAAAA;AAAAA,EAClB,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,QACsB;AACtB,UAAM,cACJ,MAAMC,QAAAA,+BAA+B,OAAO;AAC9C,UAAM,cAAc,WAAWC,QAAAA,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,QAAAA,gBAAgB,SAASC,QAAAA,iBAAiB,UAAU,KAAK,CAAC;AAAA,QAChE,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,KAAK,cAAc;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
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");
|
|
5
4
|
const classNames = require("classnames");
|
|
6
|
-
const utils = require("
|
|
5
|
+
const utils = require("@entur/utils");
|
|
6
|
+
const utils$1 = require("../utils/utils.cjs");
|
|
7
7
|
;/* empty css */
|
|
8
8
|
const defaultElement = "div";
|
|
9
|
-
const TextContainer =
|
|
9
|
+
const TextContainer = utils.forwardRefPolymorphic(
|
|
10
10
|
({ className, spacing, style, children, as, ...rest }, ref) => {
|
|
11
11
|
const ContainerElement = as || defaultElement;
|
|
12
12
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14,7 +14,7 @@ const TextContainer = React.forwardRef(
|
|
|
14
14
|
{
|
|
15
15
|
ref,
|
|
16
16
|
className: classNames("eds-text-container", className),
|
|
17
|
-
style: utils.getSpacingStyle(spacing, style),
|
|
17
|
+
style: utils$1.getSpacingStyle(spacing, style),
|
|
18
18
|
...rest,
|
|
19
19
|
children
|
|
20
20
|
}
|
|
@@ -1 +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 =
|
|
1
|
+
{"version":3,"file":"TextContainer.cjs","sources":["../../../../src/beta/components/TextContainer.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps, forwardRefPolymorphic } 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 = forwardRefPolymorphic<TextContainerComponent>(\n <C extends React.ElementType = typeof defaultElement>(\n { className, spacing, style, children, as, ...rest }: TextContainerProps<C>,\n ref?: React.Ref<Element>,\n ): React.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);\nTextContainer.displayName = 'TextContainer';\n"],"names":["forwardRefPolymorphic","jsx","getSpacingStyle"],"mappings":";;;;;;;AA4BA,MAAM,iBAAiB;AAMhB,MAAM,gBAAgBA,MAAAA;AAAAA,EAC3B,CACE,EAAE,WAAW,SAAS,OAAO,UAAU,IAAI,GAAG,KAAA,GAC9C,QACsB;AACtB,UAAM,mBAAsC,MAAM;AAElD,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,WAAW,sBAAsB,SAAS;AAAA,QACrD,OAAOC,QAAAA,gBAAgB,SAAS,KAAK;AAAA,QACpC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,cAAc,cAAc;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
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");
|
|
5
4
|
const classNames = require("classnames");
|
|
6
|
-
const utils = require("
|
|
5
|
+
const utils = require("@entur/utils");
|
|
6
|
+
const utils$1 = require("../utils/utils.cjs");
|
|
7
7
|
;/* empty css */
|
|
8
8
|
const defaultElement = "ul";
|
|
9
|
-
const UnorderedList =
|
|
9
|
+
const UnorderedList = utils.forwardRefPolymorphic(
|
|
10
10
|
({
|
|
11
11
|
className,
|
|
12
12
|
tone,
|
|
@@ -26,7 +26,7 @@ const UnorderedList = React.forwardRef(
|
|
|
26
26
|
tone && `eds-text--tone-${tone}`,
|
|
27
27
|
className
|
|
28
28
|
),
|
|
29
|
-
style: utils.getSpacingStyle(spacing, style),
|
|
29
|
+
style: utils$1.getSpacingStyle(spacing, style),
|
|
30
30
|
role: "list",
|
|
31
31
|
...rest,
|
|
32
32
|
children
|
|
@@ -1 +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 { 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 UnorderedListOwnProps = TypographySpacingProps & {\n /** Ekstra klassenavn */\n className?: string;\n /** Dempet liste for sekundær informasjon, som hjelpetekst. Velger riktig farge i kontrast- og mørk modus. */\n tone?: 'subdued';\n /** Innholdet */\n children?: React.ReactNode;\n};\n\nexport type UnorderedListProps<\n C extends React.ElementType = typeof defaultElement,\n> = PolymorphicComponentProps<C, UnorderedListOwnProps>;\n\nexport type UnorderedListComponent = (<\n C extends React.ElementType = typeof defaultElement,\n>(\n props: UnorderedListProps<C> & { ref?: React.Ref<Element> },\n) => React.ReactElement | null) & { displayName?: string };\n\nconst defaultElement = 'ul';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const UnorderedList =
|
|
1
|
+
{"version":3,"file":"UnorderedList.cjs","sources":["../../../../src/beta/components/UnorderedList.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps, forwardRefPolymorphic } 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 UnorderedListOwnProps = TypographySpacingProps & {\n /** Ekstra klassenavn */\n className?: string;\n /** Dempet liste for sekundær informasjon, som hjelpetekst. Velger riktig farge i kontrast- og mørk modus. */\n tone?: 'subdued';\n /** Innholdet */\n children?: React.ReactNode;\n};\n\nexport type UnorderedListProps<\n C extends React.ElementType = typeof defaultElement,\n> = PolymorphicComponentProps<C, UnorderedListOwnProps>;\n\nexport type UnorderedListComponent = (<\n C extends React.ElementType = typeof defaultElement,\n>(\n props: UnorderedListProps<C> & { ref?: React.Ref<Element> },\n) => React.ReactElement | null) & { displayName?: string };\n\nconst defaultElement = 'ul';\n\n/**\n * @beta Experimental component - may have breaking changes in future releases\n */\nexport const UnorderedList = forwardRefPolymorphic<UnorderedListComponent>(\n <C extends React.ElementType = typeof defaultElement>(\n {\n className,\n tone,\n spacing,\n style,\n children,\n as,\n ...rest\n }: UnorderedListProps<C>,\n ref?: React.Ref<Element>,\n ): React.JSX.Element => {\n const ListElement: React.ElementType = as || defaultElement;\n\n return (\n <ListElement\n ref={ref}\n className={classNames(\n 'eds-text--unordered-list',\n tone && `eds-text--tone-${tone}`,\n className,\n )}\n style={getSpacingStyle(spacing, style)}\n // Safari drops list semantics when the list has no markers\n role=\"list\"\n {...rest}\n >\n {children}\n </ListElement>\n );\n },\n);\nUnorderedList.displayName = 'UnorderedList';\n"],"names":["forwardRefPolymorphic","jsx","getSpacingStyle"],"mappings":";;;;;;;AA8BA,MAAM,iBAAiB;AAKhB,MAAM,gBAAgBA,MAAAA;AAAAA,EAC3B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACsB;AACtB,UAAM,cAAiC,MAAM;AAE7C,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA,QAAQ,kBAAkB,IAAI;AAAA,UAC9B;AAAA,QAAA;AAAA,QAEF,OAAOC,QAAAA,gBAAgB,SAAS,KAAK;AAAA,QAErC,MAAK;AAAA,QACJ,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,cAAc,cAAc;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../../../../src/beta/utils/utils.ts"],"sourcesContent":["import type { TypographyHeadingVariant } from '../components/Heading';\nimport type { TypographyTextVariant } from '../components/Text';\nimport type { TypographySpacing } from '../types';\n\ntype SpacingStep = Exclude<TypographySpacing, object>;\n\n// Same scale as the layout beta, read from @entur/tokens/styles/spacing\nexport const SPACING_STEPS = new Set<string>([\n 'none',\n '2xs',\n 'xs',\n 's',\n 'm',\n 'lg',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl',\n '7xl',\n '8xl',\n '9xl',\n '10xl',\n '11xl',\n '12xl',\n '13xl',\n]);\nconst warnedSpacing = new Set<string>();\n\nfunction toSpacingValue(step: SpacingStep | undefined): string | undefined {\n if (step === undefined) return undefined;\n if (SPACING_STEPS.has(step))\n // A unit keeps it valid inside calc()\n return step === 'none' ? '0px' : `var(--spacing-${step})`;\n\n if (process.env.NODE_ENV !== 'production' && !warnedSpacing.has(step)) {\n warnedSpacing.add(step);\n console.warn(\n `[@entur/typography] spacing=\"${step}\" er ikke en gyldig verdi og blir ignorert. Bruk none, 2xs, xs, s, m, lg, xl, 2xl … 13xl, eller { top, bottom }.`,\n );\n }\n return undefined;\n}\n\n/**\n * Turn the spacing prop into the custom properties that set the margins\n */\nexport function getSpacingStyle(\n spacing: TypographySpacing | undefined,\n style?: React.CSSProperties,\n): React.CSSProperties | undefined {\n if (spacing === undefined) return style;\n\n const { top, bottom } =\n typeof spacing === 'object' ? spacing : { top: spacing, bottom: spacing };\n const spacingStyle: Record<string, string> = {};\n const topValue = toSpacingValue(top);\n const bottomValue = toSpacingValue(bottom);\n if (topValue) spacingStyle['--eds-text-spacing-top'] = topValue;\n if (bottomValue) spacingStyle['--eds-text-spacing-bottom'] = bottomValue;\n\n return { ...spacingStyle, ...style };\n}\n\n/**\n * Pass maxLines on to the CSS, which cuts the text after that many lines\n */\nexport function getMaxLinesStyle(\n maxLines: number | undefined,\n style?: React.CSSProperties,\n): React.CSSProperties | undefined {\n if (!maxLines) return style;\n return { '--eds-text-max-lines': maxLines, ...style } as React.CSSProperties;\n}\n\n/**\n * Get heading variant based on semantic HTML element\n */\nexport function getHeadingVariantFromSemanticType(\n element: string | React.ElementType,\n): TypographyHeadingVariant {\n // Same as the default element, h2\n if (typeof element !== 'string') return 'title-2';\n\n switch (element.toLowerCase()) {\n case 'h1':\n return 'title-1';\n case 'h2':\n return 'title-2';\n case 'h3':\n return 'subtitle-1';\n case 'h4':\n return 'subtitle-2';\n case 'h5':\n return 'section-1';\n case 'h6':\n return 'section-2';\n default:\n return 'title-2';\n }\n}\n\n// Elements that hold a paragraph of their own; anything else sits in other text and inherits it\nconst BLOCK_TEXT_ELEMENTS = new Set([\n 'p',\n 'div',\n 'li',\n 'dd',\n 'dt',\n 'figcaption',\n]);\n\n/**\n * The variant Text uses when none is given: paragraph on its own line, inherit inside other text\n */\nexport function getDefaultTextVariant(\n element: React.ElementType,\n): 'paragraph' | 'inherit' {\n return typeof element === 'string' && BLOCK_TEXT_ELEMENTS.has(element)\n ? 'paragraph'\n : 'inherit';\n}\n\n/**\n * Get semantic HTML element from text variant\n */\nexport function getSemanticTypeFromTextVariant(\n variant: TypographyTextVariant | undefined,\n): keyof JSX.IntrinsicElements {\n if (!variant) return 'p';\n\n switch (variant) {\n case 'emphasized':\n return 'em';\n case 'code':\n return 'code';\n case 'preformatted':\n return 'pre';\n case 'quote':\n return 'blockquote';\n case 'leading':\n case 'paragraph':\n case 'subparagraph':\n case 'caption':\n case 'label':\n case 'overline':\n case 'sublabel':\n default:\n return 'p';\n }\n}\n"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../../../src/beta/utils/utils.ts"],"sourcesContent":["import type React from 'react';\nimport type { TypographyHeadingVariant } from '../components/Heading';\nimport type { TypographyTextVariant } from '../components/Text';\nimport type { TypographySpacing } from '../types';\n\ntype SpacingStep = Exclude<TypographySpacing, object>;\n\n// Same scale as the layout beta, read from @entur/tokens/styles/spacing\nexport const SPACING_STEPS = new Set<string>([\n 'none',\n '2xs',\n 'xs',\n 's',\n 'm',\n 'lg',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl',\n '7xl',\n '8xl',\n '9xl',\n '10xl',\n '11xl',\n '12xl',\n '13xl',\n]);\nconst warnedSpacing = new Set<string>();\n\nfunction toSpacingValue(step: SpacingStep | undefined): string | undefined {\n if (step === undefined) return undefined;\n if (SPACING_STEPS.has(step))\n // A unit keeps it valid inside calc()\n return step === 'none' ? '0px' : `var(--spacing-${step})`;\n\n if (process.env.NODE_ENV !== 'production' && !warnedSpacing.has(step)) {\n warnedSpacing.add(step);\n console.warn(\n `[@entur/typography] spacing=\"${step}\" er ikke en gyldig verdi og blir ignorert. Bruk none, 2xs, xs, s, m, lg, xl, 2xl … 13xl, eller { top, bottom }.`,\n );\n }\n return undefined;\n}\n\n/**\n * Turn the spacing prop into the custom properties that set the margins\n */\nexport function getSpacingStyle(\n spacing: TypographySpacing | undefined,\n style?: React.CSSProperties,\n): React.CSSProperties | undefined {\n if (spacing === undefined) return style;\n\n const { top, bottom } =\n typeof spacing === 'object' ? spacing : { top: spacing, bottom: spacing };\n const spacingStyle: Record<string, string> = {};\n const topValue = toSpacingValue(top);\n const bottomValue = toSpacingValue(bottom);\n if (topValue) spacingStyle['--eds-text-spacing-top'] = topValue;\n if (bottomValue) spacingStyle['--eds-text-spacing-bottom'] = bottomValue;\n\n return { ...spacingStyle, ...style };\n}\n\n/**\n * Pass maxLines on to the CSS, which cuts the text after that many lines\n */\nexport function getMaxLinesStyle(\n maxLines: number | undefined,\n style?: React.CSSProperties,\n): React.CSSProperties | undefined {\n if (!maxLines) return style;\n return { '--eds-text-max-lines': maxLines, ...style } as React.CSSProperties;\n}\n\n/**\n * Get heading variant based on semantic HTML element\n */\nexport function getHeadingVariantFromSemanticType(\n element: string | React.ElementType,\n): TypographyHeadingVariant {\n // Same as the default element, h2\n if (typeof element !== 'string') return 'title-2';\n\n switch (element.toLowerCase()) {\n case 'h1':\n return 'title-1';\n case 'h2':\n return 'title-2';\n case 'h3':\n return 'subtitle-1';\n case 'h4':\n return 'subtitle-2';\n case 'h5':\n return 'section-1';\n case 'h6':\n return 'section-2';\n default:\n return 'title-2';\n }\n}\n\n// Elements that hold a paragraph of their own; anything else sits in other text and inherits it\nconst BLOCK_TEXT_ELEMENTS = new Set([\n 'p',\n 'div',\n 'li',\n 'dd',\n 'dt',\n 'figcaption',\n]);\n\n/**\n * The variant Text uses when none is given: paragraph on its own line, inherit inside other text\n */\nexport function getDefaultTextVariant(\n element: React.ElementType,\n): 'paragraph' | 'inherit' {\n return typeof element === 'string' && BLOCK_TEXT_ELEMENTS.has(element)\n ? 'paragraph'\n : 'inherit';\n}\n\n/**\n * Get semantic HTML element from text variant\n */\nexport function getSemanticTypeFromTextVariant(\n variant: TypographyTextVariant | undefined,\n): keyof React.JSX.IntrinsicElements {\n if (!variant) return 'p';\n\n switch (variant) {\n case 'emphasized':\n return 'em';\n case 'code':\n return 'code';\n case 'preformatted':\n return 'pre';\n case 'quote':\n return 'blockquote';\n case 'leading':\n case 'paragraph':\n case 'subparagraph':\n case 'caption':\n case 'label':\n case 'overline':\n case 'sublabel':\n default:\n return 'p';\n }\n}\n"],"names":[],"mappings":";;AAQO,MAAM,oCAAoB,IAAY;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AACD,MAAM,oCAAoB,IAAA;AAE1B,SAAS,eAAe,MAAmD;AACzE,MAAI,SAAS,OAAW,QAAO;AAC/B,MAAI,cAAc,IAAI,IAAI;AAExB,WAAO,SAAS,SAAS,QAAQ,iBAAiB,IAAI;AAExD,MAAI,QAAQ,IAAI,aAAa,gBAAgB,CAAC,cAAc,IAAI,IAAI,GAAG;AACrE,kBAAc,IAAI,IAAI;AACtB,YAAQ;AAAA,MACN,gCAAgC,IAAI;AAAA,IAAA;AAAA,EAExC;AACA,SAAO;AACT;AAKO,SAAS,gBACd,SACA,OACiC;AACjC,MAAI,YAAY,OAAW,QAAO;AAElC,QAAM,EAAE,KAAK,OAAA,IACX,OAAO,YAAY,WAAW,UAAU,EAAE,KAAK,SAAS,QAAQ,QAAA;AAClE,QAAM,eAAuC,CAAA;AAC7C,QAAM,WAAW,eAAe,GAAG;AACnC,QAAM,cAAc,eAAe,MAAM;AACzC,MAAI,SAAU,cAAa,wBAAwB,IAAI;AACvD,MAAI,YAAa,cAAa,2BAA2B,IAAI;AAE7D,SAAO,EAAE,GAAG,cAAc,GAAG,MAAA;AAC/B;AAKO,SAAS,iBACd,UACA,OACiC;AACjC,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO,EAAE,wBAAwB,UAAU,GAAG,MAAA;AAChD;AAKO,SAAS,kCACd,SAC0B;AAE1B,MAAI,OAAO,YAAY,SAAU,QAAO;AAExC,UAAQ,QAAQ,eAAY;AAAA,IAC1B,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EAAA;AAEb;AAGA,MAAM,0CAA0B,IAAI;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAKM,SAAS,sBACd,SACyB;AACzB,SAAO,OAAO,YAAY,YAAY,oBAAoB,IAAI,OAAO,IACjE,cACA;AACN;AAKO,SAAS,+BACd,SACmC;AACnC,MAAI,CAAC,QAAS,QAAO;AAErB,UAAQ,SAAA;AAAA,IACN,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL;AACE,aAAO;AAAA,EAAA;AAEb;;;;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import classNames from "classnames";
|
|
4
3
|
import { getHeadingVariantFromSemanticType, getSpacingStyle, getMaxLinesStyle } from "../utils/utils.mjs";
|
|
4
|
+
import { forwardRefPolymorphic } from "@entur/utils";
|
|
5
5
|
/* empty css */
|
|
6
6
|
const defaultElement = "h2";
|
|
7
|
-
const Heading =
|
|
7
|
+
const Heading = forwardRefPolymorphic(
|
|
8
8
|
({
|
|
9
9
|
children,
|
|
10
10
|
as,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading.mjs","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 =
|
|
1
|
+
{"version":3,"file":"Heading.mjs","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, forwardRefPolymorphic } 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 = forwardRefPolymorphic<HeadingComponent>(\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 ): React.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);\nHeading.displayName = 'Heading';\n"],"names":[],"mappings":";;;;;AAmDA,MAAM,iBAAiB;AAKhB,MAAM,UAAU;AAAA,EACrB,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,QACsB;AACtB,UAAM,iBAAoC,MAAM;AAEhD,UAAM,cACJ,WAAW,kCAAkC,cAAc;AAE7D,WACE;AAAA,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,OAAO,gBAAgB,SAAS,iBAAiB,UAAU,KAAK,CAAC;AAAA,QAChE,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,QAAQ,cAAc;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import classNames from "classnames";
|
|
3
|
+
import { forwardRefPolymorphic } from "@entur/utils";
|
|
4
4
|
import { getSpacingStyle } from "../utils/utils.mjs";
|
|
5
5
|
/* empty css */
|
|
6
6
|
const defaultElement = "a";
|
|
7
|
-
const Link =
|
|
7
|
+
const Link = forwardRefPolymorphic(
|
|
8
8
|
({ className, spacing, style, children, as, ...rest }, ref) => {
|
|
9
9
|
const LinkElement = as || defaultElement;
|
|
10
10
|
return /* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.mjs","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 =
|
|
1
|
+
{"version":3,"file":"Link.mjs","sources":["../../../../src/beta/components/Link.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { PolymorphicComponentProps, forwardRefPolymorphic } 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 = forwardRefPolymorphic<LinkComponent>(\n <C extends React.ElementType = typeof defaultElement>(\n { className, spacing, style, children, as, ...rest }: LinkProps<C>,\n ref?: React.Ref<Element>,\n ): React.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);\nLink.displayName = 'Link';\n"],"names":[],"mappings":";;;;;AA2BA,MAAM,iBAAiB;AAKhB,MAAM,OAAO;AAAA,EAClB,CACE,EAAE,WAAW,SAAS,OAAO,UAAU,IAAI,GAAG,KAAA,GAC9C,QACsB;AACtB,UAAM,cAAiC,MAAM;AAE7C,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,WAAW,kBAAkB,SAAS;AAAA,QACjD,OAAO,gBAAgB,SAAS,KAAK;AAAA,QACpC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AACA,KAAK,cAAc;"}
|