@postenbring/hedwig-react 0.0.55 → 0.0.57
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/_tsup-dts-rollup.d.mts +162 -190
- package/dist/_tsup-dts-rollup.d.ts +162 -190
- package/dist/button/button.js +1 -1
- package/dist/button/button.js.map +1 -1
- package/dist/button/button.mjs +1 -1
- package/dist/button/index.js +1 -1
- package/dist/button/index.js.map +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/{chunk-2XSEQBJ5.mjs → chunk-5IIBIO3Y.mjs} +1 -1
- package/dist/chunk-5IIBIO3Y.mjs.map +1 -0
- package/dist/{chunk-MJ4LA23N.mjs → chunk-BDA6STW2.mjs} +2 -2
- package/dist/{chunk-5T3VUFL4.mjs → chunk-GVSLN5KE.mjs} +1 -1
- package/dist/chunk-GVSLN5KE.mjs.map +1 -0
- package/dist/{chunk-UVUIY2WB.mjs → chunk-J6ES2LO5.mjs} +2 -2
- package/dist/{chunk-UVUIY2WB.mjs.map → chunk-J6ES2LO5.mjs.map} +1 -1
- package/dist/{chunk-5GRZROYQ.mjs → chunk-LYRXA4WS.mjs} +8 -8
- package/dist/chunk-LYRXA4WS.mjs.map +1 -0
- package/dist/{chunk-KOO4VQ2N.mjs → chunk-OJ42PRYY.mjs} +2 -2
- package/dist/chunk-OJ42PRYY.mjs.map +1 -0
- package/dist/{chunk-T3EC54VN.mjs → chunk-PUFFEK6I.mjs} +2 -2
- package/dist/chunk-V4NGQVBQ.mjs +61 -0
- package/dist/chunk-V4NGQVBQ.mjs.map +1 -0
- package/dist/{chunk-LK62DXGG.mjs → chunk-ZSLWZUBI.mjs} +10 -3
- package/dist/chunk-ZSLWZUBI.mjs.map +1 -0
- package/dist/index-no-css.d.mts +1 -28
- package/dist/index-no-css.d.ts +1 -28
- package/dist/index-no-css.js +51 -117
- package/dist/index-no-css.js.map +1 -1
- package/dist/index-no-css.mjs +12 -66
- package/dist/index.d.mts +1 -28
- package/dist/index.d.ts +1 -28
- package/dist/index.js +51 -117
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -66
- package/dist/index.mjs.map +1 -1
- package/dist/modal/index.js.map +1 -1
- package/dist/modal/index.mjs +2 -2
- package/dist/modal/modal.js.map +1 -1
- package/dist/modal/modal.mjs +1 -1
- package/dist/navbar/index.js +9 -2
- package/dist/navbar/index.js.map +1 -1
- package/dist/navbar/index.mjs +2 -2
- package/dist/navbar/navbar-expandable-menu.js +9 -2
- package/dist/navbar/navbar-expandable-menu.js.map +1 -1
- package/dist/navbar/navbar-expandable-menu.mjs +1 -1
- package/dist/show-more/index.js.map +1 -1
- package/dist/show-more/index.mjs +1 -1
- package/dist/show-more/show-more.js.map +1 -1
- package/dist/show-more/show-more.mjs +1 -1
- package/dist/styled-html/index.js +1 -1
- package/dist/styled-html/index.js.map +1 -1
- package/dist/styled-html/index.mjs +1 -1
- package/dist/styled-html/styled-html.js +1 -1
- package/dist/styled-html/styled-html.js.map +1 -1
- package/dist/styled-html/styled-html.mjs +1 -1
- package/dist/text/index.d.mts +15 -0
- package/dist/text/index.d.ts +15 -0
- package/dist/text/index.js +179 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/index.mjs +36 -0
- package/dist/text/text.d.mts +2 -0
- package/dist/text/text.d.ts +2 -0
- package/dist/{typography/typography.js → text/text.js} +12 -12
- package/dist/text/text.js.map +1 -0
- package/dist/text/text.mjs +8 -0
- package/package.json +7 -7
- package/dist/chunk-2XSEQBJ5.mjs.map +0 -1
- package/dist/chunk-5GRZROYQ.mjs.map +0 -1
- package/dist/chunk-5T3VUFL4.mjs.map +0 -1
- package/dist/chunk-KOO4VQ2N.mjs.map +0 -1
- package/dist/chunk-LK62DXGG.mjs.map +0 -1
- package/dist/chunk-NCYRNCGJ.mjs +0 -107
- package/dist/chunk-NCYRNCGJ.mjs.map +0 -1
- package/dist/typography/index.d.mts +0 -42
- package/dist/typography/index.d.ts +0 -42
- package/dist/typography/index.js +0 -252
- package/dist/typography/index.js.map +0 -1
- package/dist/typography/index.mjs +0 -90
- package/dist/typography/typography.d.mts +0 -2
- package/dist/typography/typography.d.ts +0 -2
- package/dist/typography/typography.js.map +0 -1
- package/dist/typography/typography.mjs +0 -8
- /package/dist/{chunk-MJ4LA23N.mjs.map → chunk-BDA6STW2.mjs.map} +0 -0
- /package/dist/{chunk-T3EC54VN.mjs.map → chunk-PUFFEK6I.mjs.map} +0 -0
- /package/dist/{typography → text}/index.mjs.map +0 -0
- /package/dist/{typography/typography.mjs.map → text/text.mjs.map} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
__spreadValues
|
|
5
5
|
} from "./chunk-R4SQKVDQ.mjs";
|
|
6
6
|
|
|
7
|
-
// src/
|
|
7
|
+
// src/text/text.tsx
|
|
8
8
|
import { forwardRef } from "react";
|
|
9
9
|
import { clsx } from "@postenbring/hedwig-css/typed-classname/index.mjs";
|
|
10
10
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -23,7 +23,7 @@ var defaultHTMLTag = {
|
|
|
23
23
|
caption: "p",
|
|
24
24
|
"caption-title": "p"
|
|
25
25
|
};
|
|
26
|
-
var
|
|
26
|
+
var Text = forwardRef(
|
|
27
27
|
(_a, ref) => {
|
|
28
28
|
var _b = _a, {
|
|
29
29
|
as,
|
|
@@ -46,9 +46,9 @@ var Typography = forwardRef(
|
|
|
46
46
|
Component,
|
|
47
47
|
__spreadProps(__spreadValues({
|
|
48
48
|
className: clsx(
|
|
49
|
-
`hds-
|
|
50
|
-
sizeModifier && `hds-
|
|
51
|
-
spacing && "hds-
|
|
49
|
+
`hds-text-${variant}`,
|
|
50
|
+
sizeModifier && `hds-text--${sizeModifier}`,
|
|
51
|
+
spacing && "hds-text--spacing",
|
|
52
52
|
className
|
|
53
53
|
),
|
|
54
54
|
ref
|
|
@@ -58,9 +58,9 @@ var Typography = forwardRef(
|
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
|
-
|
|
61
|
+
Text.displayName = "Text";
|
|
62
62
|
|
|
63
63
|
export {
|
|
64
|
-
|
|
64
|
+
Text
|
|
65
65
|
};
|
|
66
|
-
//# sourceMappingURL=chunk-
|
|
66
|
+
//# sourceMappingURL=chunk-LYRXA4WS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/text/text.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname/index.mjs\";\nimport type { OverridableComponent } from \"../utils\";\n\ninterface HeadingProps {\n variant: \"h1-display\" | \"h1\" | \"h2\" | \"h3\" | \"h3-title\";\n as: React.ElementType;\n}\ninterface ParagraphProps {\n variant?:\n | \"body\"\n | \"body-title\"\n | \"body-small\"\n | \"body-small-title\"\n | \"technical\"\n | \"technical-title\"\n | \"caption\"\n | \"caption-title\";\n}\n\nexport type TextProps = (HeadingProps | ParagraphProps) & {\n children: React.ReactNode;\n\n /**\n * The font-size of the component. By default it's `fluid` which means it's smaller on mobile and larger on desktop.\n *\n * But you can lock it to either the min or the max size.\n */\n size?: \"min\" | \"max\" | \"fluid\";\n\n /**\n * 🚧 Experimental spacing\n */\n _unstableSpacing?: boolean;\n};\n\nconst defaultHTMLTag: Record<NonNullable<TextProps[\"variant\"]>, `h${1 | 2 | 3}` | \"p\"> = {\n \"h1-display\": \"h1\",\n h1: \"h1\",\n h2: \"h2\",\n h3: \"h3\",\n \"h3-title\": \"h3\",\n body: \"p\",\n \"body-title\": \"p\",\n \"body-small\": \"p\",\n \"body-small-title\": \"p\",\n technical: \"p\",\n \"technical-title\": \"p\",\n caption: \"p\",\n \"caption-title\": \"p\",\n};\n\n/**\n * Text component\n *\n * If the variant is `h1-display`, `h1`, `h2`, `h3`, or `h3-title` the `as` prop is required.\n *\n * This to force the consumer to consider which semantic html element to use. E.g. `<h1>` or `<h2>`\n *\n * @example\n * ```tsx\n * <Text variant=\"h1-display\" as=\"h1\">Hello world</Text>\n * <Text variant=\"body\">\n * This is a body text\n * </Text>\n * ```\n */\nexport const Text: OverridableComponent<TextProps, HTMLDivElement> = forwardRef(\n (\n {\n as,\n variant = \"body\",\n size = \"fluid\",\n _unstableSpacing: spacing,\n children,\n className,\n ...rest\n },\n ref,\n ) => {\n const Component = as ?? defaultHTMLTag[variant];\n const sizeModifier =\n size !== \"fluid\" && variant !== \"caption\" && variant !== \"caption-title\" && size;\n return (\n <Component\n className={clsx(\n `hds-text-${variant}`,\n sizeModifier && `hds-text--${sizeModifier}`,\n spacing && \"hds-text--spacing\",\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nText.displayName = \"Text\";\n"],"mappings":";;;;;;;AAAA,SAAgB,kBAAkB;AAClC,SAAS,YAAY;AAmFf;AAhDN,IAAM,iBAAmF;AAAA,EACvF,cAAc;AAAA,EACd,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,cAAc;AAAA,EACd,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,SAAS;AAAA,EACT,iBAAiB;AACnB;AAiBO,IAAM,OAAwD;AAAA,EACnE,CACE,IASA,QACG;AAVH,iBACE;AAAA;AAAA,MACA,UAAU;AAAA,MACV,OAAO;AAAA,MACP,kBAAkB;AAAA,MAClB;AAAA,MACA;AAAA,IA3EN,IAqEI,IAOK,iBAPL,IAOK;AAAA,MANH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,YAAY,kBAAM,eAAe,OAAO;AAC9C,UAAM,eACJ,SAAS,WAAW,YAAY,aAAa,YAAY,mBAAmB;AAC9E,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT,YAAY,OAAO;AAAA,UACnB,gBAAgB,aAAa,YAAY;AAAA,UACzC,WAAW;AAAA,UACX;AAAA,QACF;AAAA,QACA;AAAA,SACI,OARL;AAAA,QAUE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,KAAK,cAAc;","names":[]}
|
|
@@ -41,7 +41,7 @@ var BaseButton = forwardRef(
|
|
|
41
41
|
{
|
|
42
42
|
[`hds-button--${variant}`]: fill === "contained",
|
|
43
43
|
[`hds-button--outline-${variant}`]: fill === "outline" || fill === "outlined",
|
|
44
|
-
"hds-button--full": fullWidth,
|
|
44
|
+
"hds-button--full": fullWidth === true,
|
|
45
45
|
"hds-button--mobile-full": fullWidth === "mobile",
|
|
46
46
|
"hds-button--icon-only": icon && !children
|
|
47
47
|
},
|
|
@@ -76,4 +76,4 @@ export {
|
|
|
76
76
|
PrimaryButton,
|
|
77
77
|
SecondaryButton
|
|
78
78
|
};
|
|
79
|
-
//# sourceMappingURL=chunk-
|
|
79
|
+
//# sourceMappingURL=chunk-OJ42PRYY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/button/button.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname/index.mjs\";\nimport type { OverridableComponent } from \"../utils\";\n\ninterface ButtonPropsInternal extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The height, font size and padding of the button\n */\n size?: \"small\" | \"medium\" | \"large\";\n\n /**\n * Make the button use 100% width available.\n * Using the \"mobile\" it only stretch to full width on smaller screens\n */\n fullWidth?: boolean | \"mobile\";\n\n /**\n * Use an icon inside the button\n */\n icon?: React.ReactNode;\n\n children?: React.ReactNode;\n}\n\nexport type ButtonProps = ButtonPropsInternal &\n (\n | {\n /**\n * The background fill of the button\n */\n fill?: \"contained\" | \"outline\";\n }\n | {\n /**\n * @deprecated use `fill='outline'` instead\n */\n fill?: \"outlined\";\n }\n );\n\nexport const BaseButton: OverridableComponent<\n ButtonProps & { variant: \"primary\" | \"secondary\" },\n HTMLButtonElement\n> = forwardRef(\n (\n {\n as: Component = \"button\",\n children,\n variant,\n size = \"medium\",\n fullWidth = false,\n fill = \"contained\",\n icon,\n className,\n ...rest\n },\n ref,\n ) => {\n // TODO: Remove deprecated fill value name at some point\n // Deprecated at 10. march 2024\n if (fill === \"outlined\") {\n // eslint-disable-next-line no-console -- Deprecation warning\n console.warn(\"The `fill` value `outlined` is deprecated, use `fill='outline'` instead\");\n }\n return (\n <Component\n className={clsx(\n \"hds-button\",\n `hds-button--${size}`,\n {\n [`hds-button--${variant}`]: fill === \"contained\",\n [`hds-button--outline-${variant}`]: fill === \"outline\" || fill === \"outlined\",\n \"hds-button--full\": fullWidth === true,\n \"hds-button--mobile-full\": fullWidth === \"mobile\",\n \"hds-button--icon-only\": icon && !children,\n },\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {icon && !children ? icon : null}\n {children}\n </Component>\n );\n },\n);\nBaseButton.displayName = \"BaseButton\";\n\n/**\n * ## TODO\n *\n * - [x] Handle links that looks like buttons\n * - [ ] Revisit how to handle outline\n * - [ ] Figure out outline-white\n */\n\nexport const PrimaryButton: OverridableComponent<ButtonProps, HTMLButtonElement> = forwardRef(\n (props, ref) => {\n return <BaseButton {...props} ref={ref} variant=\"primary\" />;\n },\n);\n\nPrimaryButton.displayName = \"PrimaryButton\";\n\nexport const SecondaryButton: OverridableComponent<ButtonProps, HTMLButtonElement> = forwardRef(\n (props, ref) => {\n return <BaseButton {...props} ref={ref} variant=\"secondary\" />;\n },\n);\n\nSecondaryButton.displayName = \"SecondaryButton\";\n"],"mappings":";;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAgEf,SAkCK,KAlCL;AAzBC,IAAM,aAGT;AAAA,EACF,CACE,IAWA,QACG;AAZH,iBACE;AAAA,UAAI,YAAY;AAAA,MAChB;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,OAAO;AAAA,MACP;AAAA,MACA;AAAA,IArDN,IA6CI,IASK,iBATL,IASK;AAAA,MARH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAOF,QAAI,SAAS,YAAY;AAEvB,cAAQ,KAAK,yEAAyE;AAAA,IACxF;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,eAAe,IAAI;AAAA,UACnB;AAAA,YACE,CAAC,eAAe,OAAO,EAAE,GAAG,SAAS;AAAA,YACrC,CAAC,uBAAuB,OAAO,EAAE,GAAG,SAAS,aAAa,SAAS;AAAA,YACnE,oBAAoB,cAAc;AAAA,YAClC,2BAA2B,cAAc;AAAA,YACzC,yBAAyB,QAAQ,CAAC;AAAA,UACpC;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,SACI,OAdL;AAAA,QAgBE;AAAA,kBAAQ,CAAC,WAAW,OAAO;AAAA,UAC3B;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,WAAW,cAAc;AAUlB,IAAM,gBAAsE;AAAA,EACjF,CAAC,OAAO,QAAQ;AACd,WAAO,oBAAC,6CAAe,QAAf,EAAsB,KAAU,SAAQ,YAAU;AAAA,EAC5D;AACF;AAEA,cAAc,cAAc;AAErB,IAAM,kBAAwE;AAAA,EACnF,CAAC,OAAO,QAAQ;AACd,WAAO,oBAAC,6CAAe,QAAf,EAAsB,KAAU,SAAQ,cAAY;AAAA,EAC9D;AACF;AAEA,gBAAgB,cAAc;","names":[]}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
NavbarExpandableMenu,
|
|
3
3
|
NavbarExpandableMenuContent,
|
|
4
4
|
NavbarExpandableMenuTrigger
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZSLWZUBI.mjs";
|
|
6
6
|
import {
|
|
7
7
|
Navbar,
|
|
8
8
|
NavbarButton,
|
|
@@ -23,4 +23,4 @@ NavbarComponent.Navigation = NavbarNavigation;
|
|
|
23
23
|
export {
|
|
24
24
|
NavbarComponent
|
|
25
25
|
};
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
26
|
+
//# sourceMappingURL=chunk-PUFFEK6I.mjs.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Text
|
|
3
|
+
} from "./chunk-LYRXA4WS.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__spreadValues
|
|
6
|
+
} from "./chunk-R4SQKVDQ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/text/index.tsx
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var TextH1Display = textVariant("h1-display", "TextH1Display");
|
|
11
|
+
var TextH1 = textVariant("h1", "TextH1");
|
|
12
|
+
var TextH2 = textVariant("h2", "TextH2");
|
|
13
|
+
var TextH3 = textVariant("h3", "TextH3");
|
|
14
|
+
var TextH3Title = textVariant("h3-title", "TextH3Title");
|
|
15
|
+
var TextBody = textVariant("body", "TextBody");
|
|
16
|
+
var TextBodyTitle = textVariant("body-title", "TextBodyTitle");
|
|
17
|
+
var TextBodySmall = textVariant("body-small", "TextBodySmall");
|
|
18
|
+
var TextBodySmallTitle = textVariant("body-small-title", "TextBodySmallTitle");
|
|
19
|
+
var TextTechnical = textVariant("technical", "TextTechnical");
|
|
20
|
+
var TextTechnicalTitle = textVariant("technical-title", "TextTechnicalTitle");
|
|
21
|
+
var TextCaption = textVariant("caption", "TextCaption");
|
|
22
|
+
var TextCaptionTitle = textVariant("caption-title", "TextCaptionTitle");
|
|
23
|
+
var variantToHtmlTag = {
|
|
24
|
+
"h1-display": "h1",
|
|
25
|
+
h1: "h1",
|
|
26
|
+
h2: "h2",
|
|
27
|
+
h3: "h3",
|
|
28
|
+
"h3-title": "h3",
|
|
29
|
+
body: "p",
|
|
30
|
+
"body-title": "p",
|
|
31
|
+
"body-small": "p",
|
|
32
|
+
"body-small-title": "p",
|
|
33
|
+
technical: "p",
|
|
34
|
+
"technical-title": "p",
|
|
35
|
+
caption: "p",
|
|
36
|
+
"caption-title": "p"
|
|
37
|
+
};
|
|
38
|
+
function textVariant(variant, displayName) {
|
|
39
|
+
function WrappedText(props) {
|
|
40
|
+
return /* @__PURE__ */ jsx(Text, __spreadValues({ variant, as: variantToHtmlTag[variant != null ? variant : "body"] }, props));
|
|
41
|
+
}
|
|
42
|
+
WrappedText.displayName = displayName;
|
|
43
|
+
return WrappedText;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
TextH1Display,
|
|
48
|
+
TextH1,
|
|
49
|
+
TextH2,
|
|
50
|
+
TextH3,
|
|
51
|
+
TextH3Title,
|
|
52
|
+
TextBody,
|
|
53
|
+
TextBodyTitle,
|
|
54
|
+
TextBodySmall,
|
|
55
|
+
TextBodySmallTitle,
|
|
56
|
+
TextTechnical,
|
|
57
|
+
TextTechnicalTitle,
|
|
58
|
+
TextCaption,
|
|
59
|
+
TextCaptionTitle
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=chunk-V4NGQVBQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/text/index.tsx"],"sourcesContent":["import type { TextProps } from \"./text\";\nimport { Text } from \"./text\";\n\nexport { Text };\nexport type * from \"./text\";\n\n/**\n * # 🚨 Unstable alternative\n *\n * named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextH1Display = textVariant(\"h1-display\", \"TextH1Display\");\n/**\n * # 🚨 Unstable alternative\n *\n * named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextH1 = textVariant(\"h1\", \"TextH1\");\n/**\n * # 🚨 Unstable alternative\n *\n * named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextH2 = textVariant(\"h2\", \"TextH2\");\n/**\n * # 🚨 Unstable alternative\n *\n * named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextH3 = textVariant(\"h3\", \"TextH3\");\n/**\n * # 🚨 Unstable alternative\n *\n * named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextH3Title = textVariant(\"h3-title\", \"TextH3Title\");\n/**\n * # 🚨 Unstable alternative\n *\n * named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextBody = textVariant(\"body\", \"TextBody\"); // Less weird\n/**\n * # 🚨 Unstable alternative\n *\n * named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextBodyTitle = textVariant(\"body-title\", \"TextBodyTitle\");\n/**\n * # 🚨 Unstable alternative\n *\n * named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextBodySmall = textVariant(\"body-small\", \"TextBodySmall\");\n/**\n * # 🚨 Unstable alternative\n *\n * named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextBodySmallTitle = textVariant(\"body-small-title\", \"TextBodySmallTitle\");\n/**\n * 🚨 Unstable alterentative: Named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextTechnical = textVariant(\"technical\", \"TextTechnical\");\n/**\n * 🚨 Unstable alterentative: Named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextTechnicalTitle = textVariant(\"technical-title\", \"TextTechnicalTitle\");\n/**\n * 🚨 Unstable alterentative: Named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextCaption = textVariant(\"caption\", \"TextCaption\");\n/**\n * 🚨 Unstable alterentative: Named as the different typography levels with Text prefix\n *\n * ## Alias to @see Text\n */\nexport const TextCaptionTitle = textVariant(\"caption-title\", \"TextCaptionTitle\");\n\nconst variantToHtmlTag = {\n \"h1-display\": \"h1\",\n h1: \"h1\",\n h2: \"h2\",\n h3: \"h3\",\n \"h3-title\": \"h3\",\n body: \"p\",\n \"body-title\": \"p\",\n \"body-small\": \"p\",\n \"body-small-title\": \"p\",\n technical: \"p\",\n \"technical-title\": \"p\",\n caption: \"p\",\n \"caption-title\": \"p\",\n} as const;\n\nfunction textVariant(\n variant: TextProps[\"variant\"],\n displayName: string,\n): React.FunctionComponent<Omit<TextProps, \"variant\">> {\n function WrappedText(props: Omit<TextProps, \"variant\">) {\n return <Text variant={variant} as={variantToHtmlTag[variant ?? \"body\"]} {...props} />;\n }\n WrappedText.displayName = displayName;\n\n return WrappedText;\n}\n"],"mappings":";;;;;;;;AA4HW;AA/GJ,IAAM,gBAAgB,YAAY,cAAc,eAAe;AAQ/D,IAAM,SAAS,YAAY,MAAM,QAAQ;AAQzC,IAAM,SAAS,YAAY,MAAM,QAAQ;AAQzC,IAAM,SAAS,YAAY,MAAM,QAAQ;AAQzC,IAAM,cAAc,YAAY,YAAY,aAAa;AAQzD,IAAM,WAAW,YAAY,QAAQ,UAAU;AAQ/C,IAAM,gBAAgB,YAAY,cAAc,eAAe;AAQ/D,IAAM,gBAAgB,YAAY,cAAc,eAAe;AAQ/D,IAAM,qBAAqB,YAAY,oBAAoB,oBAAoB;AAM/E,IAAM,gBAAgB,YAAY,aAAa,eAAe;AAM9D,IAAM,qBAAqB,YAAY,mBAAmB,oBAAoB;AAM9E,IAAM,cAAc,YAAY,WAAW,aAAa;AAMxD,IAAM,mBAAmB,YAAY,iBAAiB,kBAAkB;AAE/E,IAAM,mBAAmB;AAAA,EACvB,cAAc;AAAA,EACd,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,cAAc;AAAA,EACd,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,SAAS;AAAA,EACT,iBAAiB;AACnB;AAEA,SAAS,YACP,SACA,aACqD;AACrD,WAAS,YAAY,OAAmC;AACtD,WAAO,oBAAC,uBAAK,SAAkB,IAAI,iBAAiB,4BAAW,MAAM,KAAO,MAAO;AAAA,EACrF;AACA,cAAY,cAAc;AAE1B,SAAO;AACT;","names":[]}
|
|
@@ -21,7 +21,14 @@ var navbarContext = createContext([
|
|
|
21
21
|
function NavbarExpandableMenu({ children }) {
|
|
22
22
|
const [open, setOpen] = useState(false);
|
|
23
23
|
const toggleOpen = () => {
|
|
24
|
-
|
|
24
|
+
const nextOpenState = !open;
|
|
25
|
+
setOpen(nextOpenState);
|
|
26
|
+
if (nextOpenState) {
|
|
27
|
+
window.scrollTo(0, 0);
|
|
28
|
+
document.body.classList.add(clsx("hds-navbar-scroll-lock"));
|
|
29
|
+
} else {
|
|
30
|
+
document.body.classList.remove(clsx("hds-navbar-scroll-lock"));
|
|
31
|
+
}
|
|
25
32
|
};
|
|
26
33
|
return /* @__PURE__ */ jsx(navbarContext.Provider, { value: [open, toggleOpen], children });
|
|
27
34
|
}
|
|
@@ -155,7 +162,7 @@ var NavbarExpandableMenuContent = forwardRef((_a, ref) => {
|
|
|
155
162
|
className: clsx("hds-navbar__expandable-menu-content", className),
|
|
156
163
|
"data-state": open ? "open" : "closed",
|
|
157
164
|
ref,
|
|
158
|
-
children
|
|
165
|
+
children: /* @__PURE__ */ jsx("div", { className: clsx("hds-navbar__expandable-menu-content-inner"), children })
|
|
159
166
|
})
|
|
160
167
|
);
|
|
161
168
|
});
|
|
@@ -166,4 +173,4 @@ export {
|
|
|
166
173
|
NavbarExpandableMenuTrigger,
|
|
167
174
|
NavbarExpandableMenuContent
|
|
168
175
|
};
|
|
169
|
-
//# sourceMappingURL=chunk-
|
|
176
|
+
//# sourceMappingURL=chunk-ZSLWZUBI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/navbar/navbar-expandable-menu.tsx"],"sourcesContent":["import React, { createContext, useContext, forwardRef, useState, useRef, useEffect } from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport type { ClassValue } from \"@postenbring/hedwig-css/typed-classname/index.mjs\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname/index.mjs\";\nimport type { OverridableComponent } from \"../utils\";\nimport { CloseIcon, MenuIcon } from \"./icons\";\n\nconst navbarContext = createContext([\n false as boolean,\n () => {\n // Empty\n },\n] as const);\n\n/**\n * Root\n */\nexport interface NavbarExpandableMenuProps {\n children: React.ReactNode;\n}\nexport function NavbarExpandableMenu({ children }: NavbarExpandableMenuProps) {\n const [open, setOpen] = useState(false);\n const toggleOpen = () => {\n const nextOpenState = !open;\n setOpen(nextOpenState);\n if (nextOpenState) {\n window.scrollTo(0, 0);\n //hideAllOtherElements();\n document.body.classList.add(clsx(\"hds-navbar-scroll-lock\"));\n } else {\n document.body.classList.remove(clsx(\"hds-navbar-scroll-lock\"));\n }\n };\n return <navbarContext.Provider value={[open, toggleOpen]}>{children}</navbarContext.Provider>;\n}\nNavbarExpandableMenu.displayName = \"NavbarExpandableMenu\";\n/*\nfunction hideAllOtherElements() {\n //const elements = document.querySelectorAll(\"body > *\");\n const navbarElement = document.getElementsByClassName(clsx(\"hds-navbar\"))[0];\n const siblings = getAllSiblings(navbarElement);\n console.log(siblings);\n}\n\nfunction getAllSiblings(elem: Element) {\n const sibs = [];\n let element = elem.parentNode?.firstChild;\n do {\n console.log(element);\n if (element === elem) continue;\n sibs.push(element);\n } while ((element = element?.nextSibling));\n return sibs;\n}\n*/\ninterface ButtonInterface {\n className?: ClassValue;\n open?: boolean;\n innerRef?: React.RefObject<HTMLButtonElement>;\n ref?: React.ForwardedRef<HTMLButtonElement>;\n text: React.ReactNode;\n title?: string;\n toggleOpen?: () => void;\n width?: number;\n}\n\nfunction RenderButton({\n className,\n innerRef,\n open = false,\n ref,\n text,\n title,\n toggleOpen,\n width,\n ...rest\n}: ButtonInterface) {\n const icon = open ? <CloseIcon /> : <MenuIcon />;\n const style = width ? { width } : {};\n return (\n <button\n className={clsx(\"hds-navbar__button\", className)}\n onClick={toggleOpen}\n ref={ref ?? innerRef}\n style={style}\n title={title}\n type=\"button\"\n {...rest}\n >\n {text} {icon}\n </button>\n );\n}\n\n/**\n * Trigger\n *\n * ## TODO\n * - [ ] Hide text when on mobile\n * - [X] Open / Close icon\n * - [X] Make button have consistant width\n */\n\nexport interface NavbarExpandableMenuTriggerProps\n extends Omit<React.HTMLAttributes<HTMLButtonElement>, \"children\"> {\n whenClosedText: React.ReactNode;\n whenClosedHelperTitle?: string;\n\n whenOpenText: React.ReactNode;\n whenOpenHelperTitle?: string;\n}\nexport const NavbarExpandableMenuTrigger = forwardRef<\n HTMLButtonElement,\n NavbarExpandableMenuTriggerProps\n>(\n (\n {\n whenClosedText,\n whenClosedHelperTitle,\n\n whenOpenText,\n whenOpenHelperTitle,\n\n className,\n ...rest\n },\n ref,\n ) => {\n const [open, toggleOpen] = useContext(navbarContext);\n const [width, setWidth] = useState(0);\n const measureButtonRef = useRef<HTMLButtonElement>(null);\n\n const text: React.ReactNode = open ? whenOpenText : whenClosedText;\n const title = open ? whenOpenHelperTitle : whenClosedHelperTitle;\n\n /**\n *\n * @param element - Button to measure\n * @param callback - report the width back\n */\n const measureButton = (element: React.ReactNode, callback: (width: number) => void) => {\n // Create an empty div to render the Button in\n const container = document.createElement(\"div\");\n container.style.cssText = \"display: inline-block; position: absolute; visibility: hidden\";\n\n // Attach the empty div inside the navigation section\n const c = document.getElementsByClassName(\"hds-navbar__navigation\")[0];\n c.appendChild(container);\n\n // Render the Button here\n const root = createRoot(container as HTMLElement);\n root.render(element);\n\n /**\n * Get the offsetWidth now that it is rendered\n * Also clean up after us\n */\n const getWidth = () => {\n callback(measureButtonRef.current?.offsetWidth ?? 0);\n root.unmount();\n c.removeChild(container);\n };\n // This is instead of the callback that used to be on ReactDOM.render()\n setTimeout(getWidth, 0);\n };\n\n useEffect(() => {\n measureButton(\n <RenderButton\n className={(className ? className : \"\") as ClassValue}\n innerRef={measureButtonRef}\n text={whenClosedText}\n title={title}\n {...rest}\n />,\n (closedWidth: number) => {\n measureButton(\n <RenderButton\n className={(className ? className : \"\") as ClassValue}\n innerRef={measureButtonRef}\n open\n text={whenOpenText}\n title={title}\n {...rest}\n />,\n (openWidth: number) => {\n setWidth(Math.max(openWidth, closedWidth));\n },\n );\n },\n );\n }, [className, rest, title, whenClosedText, whenOpenText]);\n\n return (\n <RenderButton\n className={(className ? className : \"\") as ClassValue}\n open={open}\n ref={ref}\n text={text as string}\n title={title}\n toggleOpen={toggleOpen}\n width={width}\n {...rest}\n />\n );\n },\n);\nNavbarExpandableMenuTrigger.displayName = \"Navbar.ExpandableMenu.Trigger\";\n\n/**\n * Content\n */\nexport interface NavbarExpandableMenuContentProps {\n children: React.ReactNode;\n className?: string;\n}\nexport const NavbarExpandableMenuContent: OverridableComponent<\n NavbarExpandableMenuContentProps,\n HTMLDivElement\n> = forwardRef(({ as: Component = \"section\", children, className, ...rest }, ref) => {\n const [open] = useContext(navbarContext);\n return (\n <Component\n {...rest}\n className={clsx(\"hds-navbar__expandable-menu-content\", className as undefined)}\n data-state={open ? \"open\" : \"closed\"}\n ref={ref}\n >\n <div className={clsx(\"hds-navbar__expandable-menu-content-inner\")}>{children}</div>\n </Component>\n );\n});\nNavbarExpandableMenuContent.displayName = \"Navbar.ExpandableMenu.Content\";\n"],"mappings":"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","names":["_a","_b"]}
|
package/dist/index-no-css.d.mts
CHANGED
|
@@ -90,21 +90,7 @@ export { TabsContents } from './_tsup-dts-rollup';
|
|
|
90
90
|
export { TabContentsProps } from './_tsup-dts-rollup';
|
|
91
91
|
export { TabsContentProps } from './_tsup-dts-rollup';
|
|
92
92
|
export { TabsContent } from './_tsup-dts-rollup';
|
|
93
|
-
export { Typography } from './_tsup-dts-rollup';
|
|
94
93
|
export { Text } from './_tsup-dts-rollup';
|
|
95
|
-
export { H1Display } from './_tsup-dts-rollup';
|
|
96
|
-
export { H1 } from './_tsup-dts-rollup';
|
|
97
|
-
export { H2 } from './_tsup-dts-rollup';
|
|
98
|
-
export { H3 } from './_tsup-dts-rollup';
|
|
99
|
-
export { H3Title } from './_tsup-dts-rollup';
|
|
100
|
-
export { Body } from './_tsup-dts-rollup';
|
|
101
|
-
export { BodyTitle } from './_tsup-dts-rollup';
|
|
102
|
-
export { BodySmall } from './_tsup-dts-rollup';
|
|
103
|
-
export { BodySmallTitle } from './_tsup-dts-rollup';
|
|
104
|
-
export { Technical } from './_tsup-dts-rollup';
|
|
105
|
-
export { TechnicalTitle } from './_tsup-dts-rollup';
|
|
106
|
-
export { Caption } from './_tsup-dts-rollup';
|
|
107
|
-
export { CaptionTitle } from './_tsup-dts-rollup';
|
|
108
94
|
export { TextH1Display } from './_tsup-dts-rollup';
|
|
109
95
|
export { TextH1 } from './_tsup-dts-rollup';
|
|
110
96
|
export { TextH2 } from './_tsup-dts-rollup';
|
|
@@ -118,19 +104,6 @@ export { TextTechnical } from './_tsup-dts-rollup';
|
|
|
118
104
|
export { TextTechnicalTitle } from './_tsup-dts-rollup';
|
|
119
105
|
export { TextCaption } from './_tsup-dts-rollup';
|
|
120
106
|
export { TextCaptionTitle } from './_tsup-dts-rollup';
|
|
121
|
-
export {
|
|
122
|
-
export { TypographyH1 } from './_tsup-dts-rollup';
|
|
123
|
-
export { TypographyH2 } from './_tsup-dts-rollup';
|
|
124
|
-
export { TypographyH3 } from './_tsup-dts-rollup';
|
|
125
|
-
export { TypographyH3Title } from './_tsup-dts-rollup';
|
|
126
|
-
export { TypographyBody } from './_tsup-dts-rollup';
|
|
127
|
-
export { TypographyBodyTitle } from './_tsup-dts-rollup';
|
|
128
|
-
export { TypographyBodySmall } from './_tsup-dts-rollup';
|
|
129
|
-
export { TypographyBodySmallTitle } from './_tsup-dts-rollup';
|
|
130
|
-
export { TypographyTechnical } from './_tsup-dts-rollup';
|
|
131
|
-
export { TypographyTechnicalTitle } from './_tsup-dts-rollup';
|
|
132
|
-
export { TypographyCaption } from './_tsup-dts-rollup';
|
|
133
|
-
export { TypographyCaptionTitle } from './_tsup-dts-rollup';
|
|
134
|
-
export { TypographyProps } from './_tsup-dts-rollup';
|
|
107
|
+
export { TextProps } from './_tsup-dts-rollup';
|
|
135
108
|
export { WarningBanner } from './_tsup-dts-rollup';
|
|
136
109
|
export { WarningBannerProps } from './_tsup-dts-rollup';
|
package/dist/index-no-css.d.ts
CHANGED
|
@@ -90,21 +90,7 @@ export { TabsContents } from './_tsup-dts-rollup';
|
|
|
90
90
|
export { TabContentsProps } from './_tsup-dts-rollup';
|
|
91
91
|
export { TabsContentProps } from './_tsup-dts-rollup';
|
|
92
92
|
export { TabsContent } from './_tsup-dts-rollup';
|
|
93
|
-
export { Typography } from './_tsup-dts-rollup';
|
|
94
93
|
export { Text } from './_tsup-dts-rollup';
|
|
95
|
-
export { H1Display } from './_tsup-dts-rollup';
|
|
96
|
-
export { H1 } from './_tsup-dts-rollup';
|
|
97
|
-
export { H2 } from './_tsup-dts-rollup';
|
|
98
|
-
export { H3 } from './_tsup-dts-rollup';
|
|
99
|
-
export { H3Title } from './_tsup-dts-rollup';
|
|
100
|
-
export { Body } from './_tsup-dts-rollup';
|
|
101
|
-
export { BodyTitle } from './_tsup-dts-rollup';
|
|
102
|
-
export { BodySmall } from './_tsup-dts-rollup';
|
|
103
|
-
export { BodySmallTitle } from './_tsup-dts-rollup';
|
|
104
|
-
export { Technical } from './_tsup-dts-rollup';
|
|
105
|
-
export { TechnicalTitle } from './_tsup-dts-rollup';
|
|
106
|
-
export { Caption } from './_tsup-dts-rollup';
|
|
107
|
-
export { CaptionTitle } from './_tsup-dts-rollup';
|
|
108
94
|
export { TextH1Display } from './_tsup-dts-rollup';
|
|
109
95
|
export { TextH1 } from './_tsup-dts-rollup';
|
|
110
96
|
export { TextH2 } from './_tsup-dts-rollup';
|
|
@@ -118,19 +104,6 @@ export { TextTechnical } from './_tsup-dts-rollup';
|
|
|
118
104
|
export { TextTechnicalTitle } from './_tsup-dts-rollup';
|
|
119
105
|
export { TextCaption } from './_tsup-dts-rollup';
|
|
120
106
|
export { TextCaptionTitle } from './_tsup-dts-rollup';
|
|
121
|
-
export {
|
|
122
|
-
export { TypographyH1 } from './_tsup-dts-rollup';
|
|
123
|
-
export { TypographyH2 } from './_tsup-dts-rollup';
|
|
124
|
-
export { TypographyH3 } from './_tsup-dts-rollup';
|
|
125
|
-
export { TypographyH3Title } from './_tsup-dts-rollup';
|
|
126
|
-
export { TypographyBody } from './_tsup-dts-rollup';
|
|
127
|
-
export { TypographyBodyTitle } from './_tsup-dts-rollup';
|
|
128
|
-
export { TypographyBodySmall } from './_tsup-dts-rollup';
|
|
129
|
-
export { TypographyBodySmallTitle } from './_tsup-dts-rollup';
|
|
130
|
-
export { TypographyTechnical } from './_tsup-dts-rollup';
|
|
131
|
-
export { TypographyTechnicalTitle } from './_tsup-dts-rollup';
|
|
132
|
-
export { TypographyCaption } from './_tsup-dts-rollup';
|
|
133
|
-
export { TypographyCaptionTitle } from './_tsup-dts-rollup';
|
|
134
|
-
export { TypographyProps } from './_tsup-dts-rollup';
|
|
107
|
+
export { TextProps } from './_tsup-dts-rollup';
|
|
135
108
|
export { WarningBanner } from './_tsup-dts-rollup';
|
|
136
109
|
export { WarningBannerProps } from './_tsup-dts-rollup';
|
package/dist/index-no-css.js
CHANGED
|
@@ -62,14 +62,8 @@ __export(index_no_css_exports, {
|
|
|
62
62
|
Accordion: () => AccordionComponent,
|
|
63
63
|
AutoAnimateHeight: () => AutoAnimateHeight,
|
|
64
64
|
Badge: () => Badge,
|
|
65
|
-
Body: () => Body,
|
|
66
|
-
BodySmall: () => BodySmall,
|
|
67
|
-
BodySmallTitle: () => BodySmallTitle,
|
|
68
|
-
BodyTitle: () => BodyTitle,
|
|
69
65
|
Box: () => BoxComponent,
|
|
70
66
|
Breadcrumbs: () => Breadcrumbs,
|
|
71
|
-
Caption: () => Caption,
|
|
72
|
-
CaptionTitle: () => CaptionTitle,
|
|
73
67
|
Card: () => CardComponent,
|
|
74
68
|
Checkbox: () => Checkbox,
|
|
75
69
|
Container: () => Container,
|
|
@@ -77,11 +71,6 @@ __export(index_no_css_exports, {
|
|
|
77
71
|
DescriptionList: () => DescriptionList,
|
|
78
72
|
ErrorMessage: () => ErrorMessage,
|
|
79
73
|
Fieldset: () => Fieldset,
|
|
80
|
-
H1: () => H1,
|
|
81
|
-
H1Display: () => H1Display,
|
|
82
|
-
H2: () => H2,
|
|
83
|
-
H3: () => H3,
|
|
84
|
-
H3Title: () => H3Title,
|
|
85
74
|
Input: () => Input,
|
|
86
75
|
Link: () => Link,
|
|
87
76
|
LinkList: () => LinkList,
|
|
@@ -98,8 +87,6 @@ __export(index_no_css_exports, {
|
|
|
98
87
|
StepIndicator: () => StepIndicator,
|
|
99
88
|
StyledHtml: () => StyledHtml,
|
|
100
89
|
Tabs: () => TabsComponent,
|
|
101
|
-
Technical: () => Technical,
|
|
102
|
-
TechnicalTitle: () => TechnicalTitle,
|
|
103
90
|
Text: () => Text,
|
|
104
91
|
TextBody: () => TextBody,
|
|
105
92
|
TextBodySmall: () => TextBodySmall,
|
|
@@ -115,20 +102,6 @@ __export(index_no_css_exports, {
|
|
|
115
102
|
TextTechnical: () => TextTechnical,
|
|
116
103
|
TextTechnicalTitle: () => TextTechnicalTitle,
|
|
117
104
|
Textarea: () => Textarea,
|
|
118
|
-
Typography: () => Typography,
|
|
119
|
-
TypographyBody: () => TypographyBody,
|
|
120
|
-
TypographyBodySmall: () => TypographyBodySmall,
|
|
121
|
-
TypographyBodySmallTitle: () => TypographyBodySmallTitle,
|
|
122
|
-
TypographyBodyTitle: () => TypographyBodyTitle,
|
|
123
|
-
TypographyCaption: () => TypographyCaption,
|
|
124
|
-
TypographyCaptionTitle: () => TypographyCaptionTitle,
|
|
125
|
-
TypographyH1: () => TypographyH1,
|
|
126
|
-
TypographyH1Display: () => TypographyH1Display,
|
|
127
|
-
TypographyH2: () => TypographyH2,
|
|
128
|
-
TypographyH3: () => TypographyH3,
|
|
129
|
-
TypographyH3Title: () => TypographyH3Title,
|
|
130
|
-
TypographyTechnical: () => TypographyTechnical,
|
|
131
|
-
TypographyTechnicalTitle: () => TypographyTechnicalTitle,
|
|
132
105
|
UnorderedList: () => UnorderedList,
|
|
133
106
|
WarningBadge: () => WarningBadge,
|
|
134
107
|
WarningBanner: () => WarningBanner,
|
|
@@ -449,7 +422,7 @@ var BaseButton = (0, import_react7.forwardRef)(
|
|
|
449
422
|
{
|
|
450
423
|
[`hds-button--${variant}`]: fill === "contained",
|
|
451
424
|
[`hds-button--outline-${variant}`]: fill === "outline" || fill === "outlined",
|
|
452
|
-
"hds-button--full": fullWidth,
|
|
425
|
+
"hds-button--full": fullWidth === true,
|
|
453
426
|
"hds-button--mobile-full": fullWidth === "mobile",
|
|
454
427
|
"hds-button--icon-only": icon && !children
|
|
455
428
|
},
|
|
@@ -1297,7 +1270,14 @@ var navbarContext = (0, import_react22.createContext)([
|
|
|
1297
1270
|
function NavbarExpandableMenu({ children }) {
|
|
1298
1271
|
const [open, setOpen] = (0, import_react22.useState)(false);
|
|
1299
1272
|
const toggleOpen = () => {
|
|
1300
|
-
|
|
1273
|
+
const nextOpenState = !open;
|
|
1274
|
+
setOpen(nextOpenState);
|
|
1275
|
+
if (nextOpenState) {
|
|
1276
|
+
window.scrollTo(0, 0);
|
|
1277
|
+
document.body.classList.add((0, import_typed_classname26.clsx)("hds-navbar-scroll-lock"));
|
|
1278
|
+
} else {
|
|
1279
|
+
document.body.classList.remove((0, import_typed_classname26.clsx)("hds-navbar-scroll-lock"));
|
|
1280
|
+
}
|
|
1301
1281
|
};
|
|
1302
1282
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(navbarContext.Provider, { value: [open, toggleOpen], children });
|
|
1303
1283
|
}
|
|
@@ -1431,7 +1411,7 @@ var NavbarExpandableMenuContent = (0, import_react22.forwardRef)((_a, ref) => {
|
|
|
1431
1411
|
className: (0, import_typed_classname26.clsx)("hds-navbar__expandable-menu-content", className),
|
|
1432
1412
|
"data-state": open ? "open" : "closed",
|
|
1433
1413
|
ref,
|
|
1434
|
-
children
|
|
1414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: (0, import_typed_classname26.clsx)("hds-navbar__expandable-menu-content-inner"), children })
|
|
1435
1415
|
})
|
|
1436
1416
|
);
|
|
1437
1417
|
});
|
|
@@ -1647,7 +1627,7 @@ var StyledHtml = (0, import_react25.forwardRef)(
|
|
|
1647
1627
|
);
|
|
1648
1628
|
}
|
|
1649
1629
|
);
|
|
1650
|
-
StyledHtml.displayName = "
|
|
1630
|
+
StyledHtml.displayName = "StyledHtml";
|
|
1651
1631
|
|
|
1652
1632
|
// src/tabs/tabs.tsx
|
|
1653
1633
|
var import_react27 = require("react");
|
|
@@ -1774,7 +1754,7 @@ TabsComponent.Tab = Tab;
|
|
|
1774
1754
|
TabsComponent.Contents = TabsContents;
|
|
1775
1755
|
TabsComponent.Content = TabsContent;
|
|
1776
1756
|
|
|
1777
|
-
// src/
|
|
1757
|
+
// src/text/text.tsx
|
|
1778
1758
|
var import_react30 = require("react");
|
|
1779
1759
|
var import_typed_classname34 = require("@postenbring/hedwig-css/typed-classname/index.mjs");
|
|
1780
1760
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
@@ -1793,7 +1773,7 @@ var defaultHTMLTag = {
|
|
|
1793
1773
|
caption: "p",
|
|
1794
1774
|
"caption-title": "p"
|
|
1795
1775
|
};
|
|
1796
|
-
var
|
|
1776
|
+
var Text = (0, import_react30.forwardRef)(
|
|
1797
1777
|
(_a, ref) => {
|
|
1798
1778
|
var _b = _a, {
|
|
1799
1779
|
as,
|
|
@@ -1816,9 +1796,9 @@ var Typography = (0, import_react30.forwardRef)(
|
|
|
1816
1796
|
Component,
|
|
1817
1797
|
__spreadProps(__spreadValues({
|
|
1818
1798
|
className: (0, import_typed_classname34.clsx)(
|
|
1819
|
-
`hds-
|
|
1820
|
-
sizeModifier && `hds-
|
|
1821
|
-
spacing && "hds-
|
|
1799
|
+
`hds-text-${variant}`,
|
|
1800
|
+
sizeModifier && `hds-text--${sizeModifier}`,
|
|
1801
|
+
spacing && "hds-text--spacing",
|
|
1822
1802
|
className
|
|
1823
1803
|
),
|
|
1824
1804
|
ref
|
|
@@ -1828,63 +1808,44 @@ var Typography = (0, import_react30.forwardRef)(
|
|
|
1828
1808
|
);
|
|
1829
1809
|
}
|
|
1830
1810
|
);
|
|
1831
|
-
|
|
1811
|
+
Text.displayName = "Text";
|
|
1832
1812
|
|
|
1833
|
-
// src/
|
|
1813
|
+
// src/text/index.tsx
|
|
1834
1814
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1835
|
-
var
|
|
1836
|
-
|
|
1837
|
-
var
|
|
1838
|
-
var
|
|
1839
|
-
var
|
|
1840
|
-
var
|
|
1841
|
-
var
|
|
1842
|
-
var
|
|
1843
|
-
var
|
|
1844
|
-
var
|
|
1845
|
-
var
|
|
1846
|
-
var
|
|
1847
|
-
var
|
|
1848
|
-
var
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
var TypographyH3 = typographyVariant("h3", "TypographyH3");
|
|
1867
|
-
var TypographyH3Title = typographyVariant("h3-title", "TypographyH3Title");
|
|
1868
|
-
var TypographyBody = typographyVariant("body", "TypographyBody");
|
|
1869
|
-
var TypographyBodyTitle = typographyVariant("body-title", "TypographyBodyTitle");
|
|
1870
|
-
var TypographyBodySmall = typographyVariant("body-small", "TypographyBodySmall");
|
|
1871
|
-
var TypographyBodySmallTitle = typographyVariant(
|
|
1872
|
-
"body-small-title",
|
|
1873
|
-
"TypographyBodySmallTitle"
|
|
1874
|
-
);
|
|
1875
|
-
var TypographyTechnical = typographyVariant("technical", "TypographyTechnical");
|
|
1876
|
-
var TypographyTechnicalTitle = typographyVariant(
|
|
1877
|
-
"technical-title",
|
|
1878
|
-
"TypographyTechnicalTitle"
|
|
1879
|
-
);
|
|
1880
|
-
var TypographyCaption = typographyVariant("caption", "TypographyCaption");
|
|
1881
|
-
var TypographyCaptionTitle = typographyVariant("caption-title", "TypographyCaptionTitle");
|
|
1882
|
-
function typographyVariant(variant, displayName) {
|
|
1883
|
-
function WrappedTypography(props) {
|
|
1884
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Typography, __spreadValues({ variant }, props));
|
|
1815
|
+
var TextH1Display = textVariant("h1-display", "TextH1Display");
|
|
1816
|
+
var TextH1 = textVariant("h1", "TextH1");
|
|
1817
|
+
var TextH2 = textVariant("h2", "TextH2");
|
|
1818
|
+
var TextH3 = textVariant("h3", "TextH3");
|
|
1819
|
+
var TextH3Title = textVariant("h3-title", "TextH3Title");
|
|
1820
|
+
var TextBody = textVariant("body", "TextBody");
|
|
1821
|
+
var TextBodyTitle = textVariant("body-title", "TextBodyTitle");
|
|
1822
|
+
var TextBodySmall = textVariant("body-small", "TextBodySmall");
|
|
1823
|
+
var TextBodySmallTitle = textVariant("body-small-title", "TextBodySmallTitle");
|
|
1824
|
+
var TextTechnical = textVariant("technical", "TextTechnical");
|
|
1825
|
+
var TextTechnicalTitle = textVariant("technical-title", "TextTechnicalTitle");
|
|
1826
|
+
var TextCaption = textVariant("caption", "TextCaption");
|
|
1827
|
+
var TextCaptionTitle = textVariant("caption-title", "TextCaptionTitle");
|
|
1828
|
+
var variantToHtmlTag = {
|
|
1829
|
+
"h1-display": "h1",
|
|
1830
|
+
h1: "h1",
|
|
1831
|
+
h2: "h2",
|
|
1832
|
+
h3: "h3",
|
|
1833
|
+
"h3-title": "h3",
|
|
1834
|
+
body: "p",
|
|
1835
|
+
"body-title": "p",
|
|
1836
|
+
"body-small": "p",
|
|
1837
|
+
"body-small-title": "p",
|
|
1838
|
+
technical: "p",
|
|
1839
|
+
"technical-title": "p",
|
|
1840
|
+
caption: "p",
|
|
1841
|
+
"caption-title": "p"
|
|
1842
|
+
};
|
|
1843
|
+
function textVariant(variant, displayName) {
|
|
1844
|
+
function WrappedText(props) {
|
|
1845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, __spreadValues({ variant, as: variantToHtmlTag[variant != null ? variant : "body"] }, props));
|
|
1885
1846
|
}
|
|
1886
|
-
|
|
1887
|
-
return
|
|
1847
|
+
WrappedText.displayName = displayName;
|
|
1848
|
+
return WrappedText;
|
|
1888
1849
|
}
|
|
1889
1850
|
|
|
1890
1851
|
// src/warning-banner/warning-banner.tsx
|
|
@@ -1966,14 +1927,8 @@ WarningBannerDescription.displayName = "WarningBannerDescription";
|
|
|
1966
1927
|
Accordion,
|
|
1967
1928
|
AutoAnimateHeight,
|
|
1968
1929
|
Badge,
|
|
1969
|
-
Body,
|
|
1970
|
-
BodySmall,
|
|
1971
|
-
BodySmallTitle,
|
|
1972
|
-
BodyTitle,
|
|
1973
1930
|
Box,
|
|
1974
1931
|
Breadcrumbs,
|
|
1975
|
-
Caption,
|
|
1976
|
-
CaptionTitle,
|
|
1977
1932
|
Card,
|
|
1978
1933
|
Checkbox,
|
|
1979
1934
|
Container,
|
|
@@ -1981,11 +1936,6 @@ WarningBannerDescription.displayName = "WarningBannerDescription";
|
|
|
1981
1936
|
DescriptionList,
|
|
1982
1937
|
ErrorMessage,
|
|
1983
1938
|
Fieldset,
|
|
1984
|
-
H1,
|
|
1985
|
-
H1Display,
|
|
1986
|
-
H2,
|
|
1987
|
-
H3,
|
|
1988
|
-
H3Title,
|
|
1989
1939
|
Input,
|
|
1990
1940
|
Link,
|
|
1991
1941
|
LinkList,
|
|
@@ -2002,8 +1952,6 @@ WarningBannerDescription.displayName = "WarningBannerDescription";
|
|
|
2002
1952
|
StepIndicator,
|
|
2003
1953
|
StyledHtml,
|
|
2004
1954
|
Tabs,
|
|
2005
|
-
Technical,
|
|
2006
|
-
TechnicalTitle,
|
|
2007
1955
|
Text,
|
|
2008
1956
|
TextBody,
|
|
2009
1957
|
TextBodySmall,
|
|
@@ -2019,20 +1967,6 @@ WarningBannerDescription.displayName = "WarningBannerDescription";
|
|
|
2019
1967
|
TextTechnical,
|
|
2020
1968
|
TextTechnicalTitle,
|
|
2021
1969
|
Textarea,
|
|
2022
|
-
Typography,
|
|
2023
|
-
TypographyBody,
|
|
2024
|
-
TypographyBodySmall,
|
|
2025
|
-
TypographyBodySmallTitle,
|
|
2026
|
-
TypographyBodyTitle,
|
|
2027
|
-
TypographyCaption,
|
|
2028
|
-
TypographyCaptionTitle,
|
|
2029
|
-
TypographyH1,
|
|
2030
|
-
TypographyH1Display,
|
|
2031
|
-
TypographyH2,
|
|
2032
|
-
TypographyH3,
|
|
2033
|
-
TypographyH3Title,
|
|
2034
|
-
TypographyTechnical,
|
|
2035
|
-
TypographyTechnicalTitle,
|
|
2036
1970
|
UnorderedList,
|
|
2037
1971
|
WarningBadge,
|
|
2038
1972
|
WarningBanner,
|