@postenbring/hedwig-react 0.0.61 → 0.0.63
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 +2 -2
- package/dist/_tsup-dts-rollup.d.ts +2 -2
- package/dist/chunk-5UJ3LEKK.mjs +76 -0
- package/dist/chunk-5UJ3LEKK.mjs.map +1 -0
- package/dist/{chunk-2LKUHKL4.mjs → chunk-Q6REETZD.mjs} +12 -6
- package/dist/chunk-Q6REETZD.mjs.map +1 -0
- package/dist/chunk-ZDPU3N54.mjs +39 -0
- package/dist/chunk-ZDPU3N54.mjs.map +1 -0
- package/dist/index-no-css.js +105 -81
- package/dist/index-no-css.js.map +1 -1
- package/dist/index-no-css.mjs +3 -3
- package/dist/index.js +105 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/show-more/index.js +36 -25
- package/dist/show-more/index.js.map +1 -1
- package/dist/show-more/index.mjs +2 -2
- package/dist/show-more/show-more.d.mts +1 -1
- package/dist/show-more/show-more.d.ts +1 -1
- package/dist/show-more/show-more.js +25 -20
- package/dist/show-more/show-more.js.map +1 -1
- package/dist/show-more/show-more.mjs +1 -1
- package/dist/step-indicator/index.js +46 -33
- package/dist/step-indicator/index.js.map +1 -1
- package/dist/step-indicator/index.mjs +1 -1
- package/dist/step-indicator/step-indicator.js +46 -33
- package/dist/step-indicator/step-indicator.js.map +1 -1
- package/dist/step-indicator/step-indicator.mjs +1 -1
- package/dist/utilities/auto-animate-height.js +11 -5
- package/dist/utilities/auto-animate-height.js.map +1 -1
- package/dist/utilities/auto-animate-height.mjs +1 -1
- package/dist/utilities/index.js +11 -5
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-2LKUHKL4.mjs.map +0 -1
- package/dist/chunk-NIRIPLQ5.mjs +0 -63
- package/dist/chunk-NIRIPLQ5.mjs.map +0 -1
- package/dist/chunk-W47NV442.mjs +0 -34
- package/dist/chunk-W47NV442.mjs.map +0 -1
|
@@ -1325,7 +1325,7 @@ export declare const ShowMore: Story_23;
|
|
|
1325
1325
|
* }
|
|
1326
1326
|
* ```
|
|
1327
1327
|
*/
|
|
1328
|
-
declare
|
|
1328
|
+
declare const ShowMoreButton: ForwardRefExoticComponent<ShowMoreProps & RefAttributes<HTMLButtonElement>>;
|
|
1329
1329
|
export { ShowMoreButton }
|
|
1330
1330
|
export { ShowMoreButton as ShowMoreButton_alias_1 }
|
|
1331
1331
|
export { ShowMoreButton as ShowMoreButton_alias_2 }
|
|
@@ -1410,7 +1410,7 @@ export declare const Solid: Story_17;
|
|
|
1410
1410
|
*
|
|
1411
1411
|
* It does not handle step content or navigation, only the visual indication of the active step.
|
|
1412
1412
|
*/
|
|
1413
|
-
declare
|
|
1413
|
+
declare const StepIndicator: ForwardRefExoticComponent<(StepIndicatorProps & TitleProps) & RefAttributes<HTMLDivElement>>;
|
|
1414
1414
|
export { StepIndicator }
|
|
1415
1415
|
export { StepIndicator as StepIndicator_alias_1 }
|
|
1416
1416
|
export { StepIndicator as StepIndicator_alias_2 }
|
|
@@ -1325,7 +1325,7 @@ export declare const ShowMore: Story_23;
|
|
|
1325
1325
|
* }
|
|
1326
1326
|
* ```
|
|
1327
1327
|
*/
|
|
1328
|
-
declare
|
|
1328
|
+
declare const ShowMoreButton: ForwardRefExoticComponent<ShowMoreProps & RefAttributes<HTMLButtonElement>>;
|
|
1329
1329
|
export { ShowMoreButton }
|
|
1330
1330
|
export { ShowMoreButton as ShowMoreButton_alias_1 }
|
|
1331
1331
|
export { ShowMoreButton as ShowMoreButton_alias_2 }
|
|
@@ -1410,7 +1410,7 @@ export declare const Solid: Story_17;
|
|
|
1410
1410
|
*
|
|
1411
1411
|
* It does not handle step content or navigation, only the visual indication of the active step.
|
|
1412
1412
|
*/
|
|
1413
|
-
declare
|
|
1413
|
+
declare const StepIndicator: ForwardRefExoticComponent<(StepIndicatorProps & TitleProps) & RefAttributes<HTMLDivElement>>;
|
|
1414
1414
|
export { StepIndicator }
|
|
1415
1415
|
export { StepIndicator as StepIndicator_alias_1 }
|
|
1416
1416
|
export { StepIndicator as StepIndicator_alias_2 }
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "./chunk-R4SQKVDQ.mjs";
|
|
6
|
+
|
|
7
|
+
// src/step-indicator/step-indicator.tsx
|
|
8
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var StepIndicator = forwardRef(
|
|
12
|
+
(_a, ref) => {
|
|
13
|
+
var _b = _a, {
|
|
14
|
+
activeStep,
|
|
15
|
+
totalSteps,
|
|
16
|
+
className,
|
|
17
|
+
label,
|
|
18
|
+
lang = "en",
|
|
19
|
+
title,
|
|
20
|
+
titleAs: TitleComponent
|
|
21
|
+
} = _b, rest = __objRest(_b, [
|
|
22
|
+
"activeStep",
|
|
23
|
+
"totalSteps",
|
|
24
|
+
"className",
|
|
25
|
+
"label",
|
|
26
|
+
"lang",
|
|
27
|
+
"title",
|
|
28
|
+
"titleAs"
|
|
29
|
+
]);
|
|
30
|
+
return /* @__PURE__ */ jsxs(
|
|
31
|
+
"div",
|
|
32
|
+
__spreadProps(__spreadValues({
|
|
33
|
+
ref,
|
|
34
|
+
className: clsx("hds-step-indicator", className),
|
|
35
|
+
lang
|
|
36
|
+
}, rest), {
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsxs("div", { className: clsx("hds-step-indicator__header"), children: [
|
|
39
|
+
/* @__PURE__ */ jsx("span", { className: clsx("hds-step-indicator__left-label"), children: label }),
|
|
40
|
+
/* @__PURE__ */ jsx("span", { children: stepLabelTranslations[lang](activeStep, totalSteps) })
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ jsx("div", { className: clsx("hds-step-indicator__steps"), children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ jsx(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: clsx("hds-step-indicator__step"),
|
|
46
|
+
"data-state": getStepState(i + 1, activeStep)
|
|
47
|
+
},
|
|
48
|
+
i
|
|
49
|
+
)) }),
|
|
50
|
+
title ? /* @__PURE__ */ jsx(TitleComponent, { className: clsx("hds-step-indicator__title"), children: title }) : null
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
StepIndicator.displayName = "StepIndicator";
|
|
57
|
+
var stepLabelTranslations = {
|
|
58
|
+
no: (activeStep, totalSteps) => `steg ${activeStep} av ${totalSteps}`,
|
|
59
|
+
en: (activeStep, totalSteps) => `step ${activeStep} of ${totalSteps}`,
|
|
60
|
+
da: (activeStep, totalSteps) => `trin ${activeStep} af ${totalSteps}`,
|
|
61
|
+
sv: (activeStep, totalSteps) => `steg ${activeStep} av ${totalSteps}`
|
|
62
|
+
};
|
|
63
|
+
function getStepState(renderedStep, activeStep) {
|
|
64
|
+
if (renderedStep < activeStep) {
|
|
65
|
+
return "previous";
|
|
66
|
+
}
|
|
67
|
+
if (renderedStep === activeStep) {
|
|
68
|
+
return "active";
|
|
69
|
+
}
|
|
70
|
+
return "next";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
StepIndicator
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=chunk-5UJ3LEKK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/step-indicator/step-indicator.tsx"],"sourcesContent":["import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef } from \"react\";\n\ntype TitleProps =\n | {\n /**\n * Optional title of the active step to be shown underneath the step indicator\n *\n * Use `titleAs` to set the correct heading level\n */\n title: React.ReactNode;\n titleAs: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n }\n | {\n title?: undefined;\n titleAs?: undefined;\n };\n\ninterface StepIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {\n /*\n * 1-indexed number of the active step\n */\n activeStep: number;\n\n /**\n * 1-indexed number of steps\n */\n totalSteps: number;\n\n /**\n * Label on the left side above the steps\n */\n label: React.ReactNode;\n\n /**\n * Language for the \"step x of y\" label, default is \"en\"\n */\n lang?: \"no\" | \"en\" | \"da\" | \"sv\";\n}\n\n/**\n * Indicate a step in a process.\n *\n * It does not handle step content or navigation, only the visual indication of the active step.\n */\nexport const StepIndicator = forwardRef<HTMLDivElement, StepIndicatorProps & TitleProps>(\n (\n {\n activeStep,\n totalSteps,\n className,\n label,\n lang = \"en\",\n title,\n titleAs: TitleComponent,\n ...rest\n },\n ref,\n ) => {\n return (\n <div\n ref={ref}\n className={clsx(\"hds-step-indicator\", className as undefined)}\n lang={lang}\n {...rest}\n >\n <div className={clsx(\"hds-step-indicator__header\")}>\n <span className={clsx(\"hds-step-indicator__left-label\")}>{label}</span>\n <span>{stepLabelTranslations[lang](activeStep, totalSteps)}</span>\n </div>\n\n <div className={clsx(\"hds-step-indicator__steps\")}>\n {Array.from({ length: totalSteps }, (_, i) => (\n <div\n className={clsx(\"hds-step-indicator__step\")}\n data-state={getStepState(i + 1, activeStep)}\n key={i}\n />\n ))}\n </div>\n\n {title ? (\n <TitleComponent className={clsx(\"hds-step-indicator__title\")}>{title}</TitleComponent>\n ) : null}\n </div>\n );\n },\n);\nStepIndicator.displayName = \"StepIndicator\";\n\n/**\n * Translated texts for the `step x of y` label.\n */\nconst stepLabelTranslations: Record<\n \"no\" | \"en\" | \"da\" | \"sv\",\n (activeStep: number, totalSteps: number) => string\n> = {\n no: (activeStep: number, totalSteps: number) => `steg ${activeStep} av ${totalSteps}`,\n en: (activeStep: number, totalSteps: number) => `step ${activeStep} of ${totalSteps}`,\n da: (activeStep: number, totalSteps: number) => `trin ${activeStep} af ${totalSteps}`,\n sv: (activeStep: number, totalSteps: number) => `steg ${activeStep} av ${totalSteps}`,\n};\n\n/**\n * Determine the state of a step.\n * 1-indexed\n */\nfunction getStepState(renderedStep: number, activeStep: number) {\n if (renderedStep < activeStep) {\n return \"previous\";\n }\n if (renderedStep === activeStep) {\n return \"active\";\n }\n return \"next\";\n}\n"],"mappings":";;;;;;;AAAA,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAiEnB,SACE,KADF;AArBD,IAAM,gBAAgB;AAAA,EAC3B,CACE,IAUA,QACG;AAXH,iBACE;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA,SAAS;AAAA,IAtDf,IA+CI,IAQK,iBARL,IAQK;AAAA,MAPH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,KAAK,sBAAsB,SAAsB;AAAA,QAC5D;AAAA,SACI,OAJL;AAAA,QAMC;AAAA,+BAAC,SAAI,WAAW,KAAK,4BAA4B,GAC/C;AAAA,gCAAC,UAAK,WAAW,KAAK,gCAAgC,GAAI,iBAAM;AAAA,YAChE,oBAAC,UAAM,gCAAsB,IAAI,EAAE,YAAY,UAAU,GAAE;AAAA,aAC7D;AAAA,UAEA,oBAAC,SAAI,WAAW,KAAK,2BAA2B,GAC7C,gBAAM,KAAK,EAAE,QAAQ,WAAW,GAAG,CAAC,GAAG,MACtC;AAAA,YAAC;AAAA;AAAA,cACC,WAAW,KAAK,0BAA0B;AAAA,cAC1C,cAAY,aAAa,IAAI,GAAG,UAAU;AAAA;AAAA,YACrC;AAAA,UACP,CACD,GACH;AAAA,UAEC,QACC,oBAAC,kBAAe,WAAW,KAAK,2BAA2B,GAAI,iBAAM,IACnE;AAAA;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AACA,cAAc,cAAc;AAK5B,IAAM,wBAGF;AAAA,EACF,IAAI,CAAC,YAAoB,eAAuB,QAAQ,UAAU,OAAO,UAAU;AAAA,EACnF,IAAI,CAAC,YAAoB,eAAuB,QAAQ,UAAU,OAAO,UAAU;AAAA,EACnF,IAAI,CAAC,YAAoB,eAAuB,QAAQ,UAAU,OAAO,UAAU;AAAA,EACnF,IAAI,CAAC,YAAoB,eAAuB,QAAQ,UAAU,OAAO,UAAU;AACrF;AAMA,SAAS,aAAa,cAAsB,YAAoB;AAC9D,MAAI,eAAe,YAAY;AAC7B,WAAO;AAAA,EACT;AACA,MAAI,iBAAiB,YAAY;AAC/B,WAAO;AAAA,EACT;AACA,SAAO;AACT;","names":[]}
|
|
@@ -28,6 +28,7 @@ var AutoAnimateHeight = forwardRef(
|
|
|
28
28
|
"animationDuration",
|
|
29
29
|
"animationEasing"
|
|
30
30
|
]);
|
|
31
|
+
const timeoutRef = useRef(null);
|
|
31
32
|
const measurementRef = useRef(null);
|
|
32
33
|
const [height, setHeight] = useState(void 0);
|
|
33
34
|
const [clonedChildren, setClonedChildren] = useState(
|
|
@@ -36,13 +37,18 @@ var AutoAnimateHeight = forwardRef(
|
|
|
36
37
|
useEffect(() => {
|
|
37
38
|
if (measurementRef.current) {
|
|
38
39
|
const { height: newHeight } = measurementRef.current.getBoundingClientRect();
|
|
40
|
+
if (timeoutRef.current) {
|
|
41
|
+
clearTimeout(timeoutRef.current);
|
|
42
|
+
}
|
|
39
43
|
if (newHeight < (height != null ? height : 0)) {
|
|
40
|
-
flushSync(() => {
|
|
41
|
-
setHeight(newHeight);
|
|
42
|
-
});
|
|
43
44
|
setTimeout(() => {
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
flushSync(() => {
|
|
46
|
+
setHeight(newHeight);
|
|
47
|
+
});
|
|
48
|
+
timeoutRef.current = setTimeout(() => {
|
|
49
|
+
setClonedChildren(cloneElement(/* @__PURE__ */ jsx(Fragment, { children }), {}));
|
|
50
|
+
}, animationDurationToValue[animationDuration]);
|
|
51
|
+
});
|
|
46
52
|
} else {
|
|
47
53
|
setHeight(newHeight);
|
|
48
54
|
setClonedChildren(cloneElement(/* @__PURE__ */ jsx(Fragment, { children }), {}));
|
|
@@ -85,4 +91,4 @@ AutoAnimateHeight.displayName = "AutoAnimateHeight";
|
|
|
85
91
|
export {
|
|
86
92
|
AutoAnimateHeight
|
|
87
93
|
};
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-Q6REETZD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utilities/auto-animate-height.tsx"],"sourcesContent":["import { cloneElement, forwardRef, useEffect, useRef, useState } from \"react\";\nimport { flushSync } from \"react-dom\";\nimport type { OverridableComponent } from \"../utils\";\n\nconst animationDurationToValue = {\n quick: 100,\n normal: 300,\n slow: 700,\n};\n\nexport interface AutoAnimateHeightProps {\n /**\n * Time of the animation, using the hedwig animation tokens\n * quick: 0.1s\n * normal: 0.3s\n * slow: 0.7s\n *\n * default is \"quick\"\n */\n animationDuration?: \"quick\" | \"normal\" | \"slow\";\n\n /**\n * Which hedwig easing function to use, default is \"normal\"\n */\n animationEasing?: \"in\" | \"out\" | \"normal\";\n children: React.ReactNode;\n style?: React.CSSProperties;\n}\n\n/**\n * Helper component to animate the height of the children when they change\n * It's done by rendering two versions of the passed children,\n * one hidden to measure the height and one visible to only changes after the height is measured.\n *\n * **IMPORTANT** Do not pass any components with effects (like data fetching), as they will trigger twice.\n */\nexport const AutoAnimateHeight: OverridableComponent<AutoAnimateHeightProps, HTMLDivElement> =\n forwardRef(\n (\n {\n as: Component = \"div\",\n children,\n style,\n animationDuration = \"quick\",\n animationEasing = \"normal\",\n ...rest\n },\n ref,\n ) => {\n const timeoutRef = useRef<NodeJS.Timeout | null>(null);\n const measurementRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<number | undefined>(undefined);\n const [clonedChildren, setClonedChildren] = useState<React.ReactNode>(() =>\n cloneElement(<>{children}</>, {}),\n );\n useEffect(() => {\n if (measurementRef.current) {\n const { height: newHeight } = measurementRef.current.getBoundingClientRect();\n\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n if (newHeight < (height ?? 0)) {\n // If the children are shrinking, hold off on replacing until the animation is done\n // This way we don't get a sudden flash of empty content\n setTimeout(() => {\n flushSync(() => {\n setHeight(newHeight);\n });\n timeoutRef.current = setTimeout(() => {\n setClonedChildren(cloneElement(<>{children}</>, {}));\n }, animationDurationToValue[animationDuration]);\n });\n } else {\n setHeight(newHeight);\n setClonedChildren(cloneElement(<>{children}</>, {}));\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- I know better\n }, [children]);\n\n return (\n <Component\n ref={ref}\n style={{\n overflow: \"hidden\",\n height,\n transitionProperty: \"height\",\n transitionDuration: `var(--hds-micro-animation-duration-${animationDuration})`,\n transitionTimingFunction: `var(--hds-micro-animation-easing-${animationEasing})`,\n ...style,\n }}\n {...rest}\n >\n <div\n aria-hidden\n ref={measurementRef}\n style={{\n position: \"absolute\",\n visibility: \"hidden\",\n }}\n >\n {children}\n </div>\n {clonedChildren}\n </Component>\n );\n },\n );\nAutoAnimateHeight.displayName = \"AutoAnimateHeight\";\n"],"mappings":";;;;;;;AAAA,SAAS,cAAc,YAAY,WAAW,QAAQ,gBAAgB;AACtE,SAAS,iBAAiB;AAoDL,wBA6Bb,YA7Ba;AAjDrB,IAAM,2BAA2B;AAAA,EAC/B,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACR;AA4BO,IAAM,oBACX;AAAA,EACE,CACE,IAQA,QACG;AATH,iBACE;AAAA,UAAI,YAAY;AAAA,MAChB;AAAA,MACA;AAAA,MACA,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,IA5C1B,IAuCM,IAMK,iBANL,IAMK;AAAA,MALH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,aAAa,OAA8B,IAAI;AACrD,UAAM,iBAAiB,OAAuB,IAAI;AAClD,UAAM,CAAC,QAAQ,SAAS,IAAI,SAA6B,MAAS;AAClE,UAAM,CAAC,gBAAgB,iBAAiB,IAAI;AAAA,MAA0B,MACpE,aAAa,gCAAG,UAAS,GAAK,CAAC,CAAC;AAAA,IAClC;AACA,cAAU,MAAM;AACd,UAAI,eAAe,SAAS;AAC1B,cAAM,EAAE,QAAQ,UAAU,IAAI,eAAe,QAAQ,sBAAsB;AAE3E,YAAI,WAAW,SAAS;AACtB,uBAAa,WAAW,OAAO;AAAA,QACjC;AACA,YAAI,aAAa,0BAAU,IAAI;AAG7B,qBAAW,MAAM;AACf,sBAAU,MAAM;AACd,wBAAU,SAAS;AAAA,YACrB,CAAC;AACD,uBAAW,UAAU,WAAW,MAAM;AACpC,gCAAkB,aAAa,gCAAG,UAAS,GAAK,CAAC,CAAC,CAAC;AAAA,YACrD,GAAG,yBAAyB,iBAAiB,CAAC;AAAA,UAChD,CAAC;AAAA,QACH,OAAO;AACL,oBAAU,SAAS;AACnB,4BAAkB,aAAa,gCAAG,UAAS,GAAK,CAAC,CAAC,CAAC;AAAA,QACrD;AAAA,MACF;AAAA,IAEF,GAAG,CAAC,QAAQ,CAAC;AAEb,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO;AAAA,UACL,UAAU;AAAA,UACV;AAAA,UACA,oBAAoB;AAAA,UACpB,oBAAoB,sCAAsC,iBAAiB;AAAA,UAC3E,0BAA0B,oCAAoC,eAAe;AAAA,WAC1E;AAAA,SAED,OAVL;AAAA,QAYC;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,eAAW;AAAA,cACX,KAAK;AAAA,cACL,OAAO;AAAA,gBACL,UAAU;AAAA,gBACV,YAAY;AAAA,cACd;AAAA,cAEC;AAAA;AAAA,UACH;AAAA,UACC;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACF,kBAAkB,cAAc;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__objRest,
|
|
3
|
+
__spreadProps,
|
|
4
|
+
__spreadValues
|
|
5
|
+
} from "./chunk-R4SQKVDQ.mjs";
|
|
6
|
+
|
|
7
|
+
// src/show-more/show-more.tsx
|
|
8
|
+
import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
9
|
+
import { forwardRef } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var ShowMoreButton = forwardRef(
|
|
12
|
+
(_a, ref) => {
|
|
13
|
+
var _b = _a, { text, variant, expanded, className } = _b, rest = __objRest(_b, ["text", "variant", "expanded", "className"]);
|
|
14
|
+
return /* @__PURE__ */ jsxs(
|
|
15
|
+
"button",
|
|
16
|
+
__spreadProps(__spreadValues({
|
|
17
|
+
ref,
|
|
18
|
+
className: clsx(
|
|
19
|
+
"hds-show-more",
|
|
20
|
+
variant === "show-more-show-less" && "hds-show-more--show-less",
|
|
21
|
+
className
|
|
22
|
+
),
|
|
23
|
+
"data-state": expanded ? "expanded" : void 0,
|
|
24
|
+
type: "button"
|
|
25
|
+
}, rest), {
|
|
26
|
+
children: [
|
|
27
|
+
text,
|
|
28
|
+
/* @__PURE__ */ jsx("span", { className: clsx("hds-show-more__icon") })
|
|
29
|
+
]
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
ShowMoreButton.displayName = "ShowMoreButton";
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
ShowMoreButton
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=chunk-ZDPU3N54.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/show-more/show-more.tsx"],"sourcesContent":["import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef } from \"react\";\n\ntype Variant =\n | {\n variant?: \"show-more\";\n expanded?: never;\n }\n | {\n variant: \"show-more-show-less\";\n expanded: boolean;\n };\n\nexport type ShowMoreProps = React.HTMLAttributes<HTMLButtonElement> & {\n text: React.ReactNode;\n} & Variant;\n\n/**\n * Simple button for triggering more content.\n *\n * You have to add the logic for what happens when the button is clicked yourself.\n *\n * **Example**\n *\n * ```tsx\n * function Content() {\n * const [items, fetchMoreItems, moreItemsAvailable] = useYourData();\n * function onShowMoreItems() {\n * fetchMoreItems();\n * }\n * return (\n * <>\n * <ul>\n * {items.map((item) => (\n * <li key={item.id}>{item.text}</li>\n * ))}\n * </ul>\n * {moreItemsAvailable ?\n * <ShowMoreButton className=\"mt-8\" onClick={onShowMoreItems} lang=\"en\" /> :\n * null\n * }\n * </>\n * )\n * }\n * ```\n */\nexport const ShowMoreButton = forwardRef<HTMLButtonElement, ShowMoreProps>(\n ({ text, variant, expanded, className, ...rest }, ref) => {\n return (\n <button\n ref={ref}\n className={clsx(\n \"hds-show-more\",\n variant === \"show-more-show-less\" && \"hds-show-more--show-less\",\n className as undefined,\n )}\n data-state={expanded ? \"expanded\" : undefined}\n type=\"button\"\n {...rest}\n >\n {text}\n <span className={clsx(\"hds-show-more__icon\")} />\n </button>\n );\n },\n);\nShowMoreButton.displayName = \"ShowMoreButton\";\n"],"mappings":";;;;;;;AAAA,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAgDrB,SAYE,KAZF;AAHC,IAAM,iBAAiB;AAAA,EAC5B,CAAC,IAAiD,QAAQ;AAAzD,iBAAE,QAAM,SAAS,UAAU,UA/C9B,IA+CG,IAAyC,iBAAzC,IAAyC,CAAvC,QAAM,WAAS,YAAU;AAC1B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA,YAAY,yBAAyB;AAAA,UACrC;AAAA,QACF;AAAA,QACA,cAAY,WAAW,aAAa;AAAA,QACpC,MAAK;AAAA,SACD,OATL;AAAA,QAWE;AAAA;AAAA,UACD,oBAAC,UAAK,WAAW,KAAK,qBAAqB,GAAG;AAAA;AAAA;AAAA,IAChD;AAAA,EAEJ;AACF;AACA,eAAe,cAAc;","names":[]}
|
package/dist/index-no-css.js
CHANGED
|
@@ -1516,6 +1516,7 @@ var AutoAnimateHeight = (0, import_react24.forwardRef)(
|
|
|
1516
1516
|
"animationDuration",
|
|
1517
1517
|
"animationEasing"
|
|
1518
1518
|
]);
|
|
1519
|
+
const timeoutRef = (0, import_react24.useRef)(null);
|
|
1519
1520
|
const measurementRef = (0, import_react24.useRef)(null);
|
|
1520
1521
|
const [height, setHeight] = (0, import_react24.useState)(void 0);
|
|
1521
1522
|
const [clonedChildren, setClonedChildren] = (0, import_react24.useState)(
|
|
@@ -1524,13 +1525,18 @@ var AutoAnimateHeight = (0, import_react24.forwardRef)(
|
|
|
1524
1525
|
(0, import_react24.useEffect)(() => {
|
|
1525
1526
|
if (measurementRef.current) {
|
|
1526
1527
|
const { height: newHeight } = measurementRef.current.getBoundingClientRect();
|
|
1528
|
+
if (timeoutRef.current) {
|
|
1529
|
+
clearTimeout(timeoutRef.current);
|
|
1530
|
+
}
|
|
1527
1531
|
if (newHeight < (height != null ? height : 0)) {
|
|
1528
|
-
(0, import_react_dom.flushSync)(() => {
|
|
1529
|
-
setHeight(newHeight);
|
|
1530
|
-
});
|
|
1531
1532
|
setTimeout(() => {
|
|
1532
|
-
|
|
1533
|
-
|
|
1533
|
+
(0, import_react_dom.flushSync)(() => {
|
|
1534
|
+
setHeight(newHeight);
|
|
1535
|
+
});
|
|
1536
|
+
timeoutRef.current = setTimeout(() => {
|
|
1537
|
+
setClonedChildren((0, import_react24.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children }), {}));
|
|
1538
|
+
}, animationDurationToValue[animationDuration]);
|
|
1539
|
+
});
|
|
1534
1540
|
} else {
|
|
1535
1541
|
setHeight(newHeight);
|
|
1536
1542
|
setClonedChildren((0, import_react24.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children }), {}));
|
|
@@ -1572,34 +1578,39 @@ AutoAnimateHeight.displayName = "AutoAnimateHeight";
|
|
|
1572
1578
|
|
|
1573
1579
|
// src/show-more/show-more.tsx
|
|
1574
1580
|
var import_typed_classname27 = require("@postenbring/hedwig-css/typed-classname");
|
|
1581
|
+
var import_react25 = require("react");
|
|
1575
1582
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
}
|
|
1583
|
+
var ShowMoreButton = (0, import_react25.forwardRef)(
|
|
1584
|
+
(_a, ref) => {
|
|
1585
|
+
var _b = _a, { text, variant, expanded, className } = _b, rest = __objRest(_b, ["text", "variant", "expanded", "className"]);
|
|
1586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
1587
|
+
"button",
|
|
1588
|
+
__spreadProps(__spreadValues({
|
|
1589
|
+
ref,
|
|
1590
|
+
className: (0, import_typed_classname27.clsx)(
|
|
1591
|
+
"hds-show-more",
|
|
1592
|
+
variant === "show-more-show-less" && "hds-show-more--show-less",
|
|
1593
|
+
className
|
|
1594
|
+
),
|
|
1595
|
+
"data-state": expanded ? "expanded" : void 0,
|
|
1596
|
+
type: "button"
|
|
1597
|
+
}, rest), {
|
|
1598
|
+
children: [
|
|
1599
|
+
text,
|
|
1600
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: (0, import_typed_classname27.clsx)("hds-show-more__icon") })
|
|
1601
|
+
]
|
|
1602
|
+
})
|
|
1603
|
+
);
|
|
1604
|
+
}
|
|
1605
|
+
);
|
|
1606
|
+
ShowMoreButton.displayName = "ShowMoreButton";
|
|
1596
1607
|
|
|
1597
1608
|
// src/skeleton/skeleton.tsx
|
|
1598
1609
|
var React11 = require("react");
|
|
1599
1610
|
var import_typed_classname28 = require("@postenbring/hedwig-css/typed-classname");
|
|
1600
|
-
var
|
|
1611
|
+
var import_react26 = require("react");
|
|
1601
1612
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1602
|
-
var Skeleton = (0,
|
|
1613
|
+
var Skeleton = (0, import_react26.forwardRef)(
|
|
1603
1614
|
(_a, ref) => {
|
|
1604
1615
|
var _b = _a, { as: Component = "div", children, variant = "text", width, height, className, style } = _b, rest = __objRest(_b, ["as", "children", "variant", "width", "height", "className", "style"]);
|
|
1605
1616
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
@@ -1619,41 +1630,54 @@ Skeleton.displayName = "Skeleton";
|
|
|
1619
1630
|
|
|
1620
1631
|
// src/step-indicator/step-indicator.tsx
|
|
1621
1632
|
var import_typed_classname29 = require("@postenbring/hedwig-css/typed-classname");
|
|
1633
|
+
var import_react27 = require("react");
|
|
1622
1634
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
1643
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: (0, import_typed_classname29.clsx)("hds-step-indicator__left-label"), children: label }),
|
|
1644
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: stepLabelTranslations[lang](activeStep, totalSteps) })
|
|
1645
|
-
] }),
|
|
1646
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: (0, import_typed_classname29.clsx)("hds-step-indicator__steps"), children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1635
|
+
var StepIndicator = (0, import_react27.forwardRef)(
|
|
1636
|
+
(_a, ref) => {
|
|
1637
|
+
var _b = _a, {
|
|
1638
|
+
activeStep,
|
|
1639
|
+
totalSteps,
|
|
1640
|
+
className,
|
|
1641
|
+
label,
|
|
1642
|
+
lang = "en",
|
|
1643
|
+
title,
|
|
1644
|
+
titleAs: TitleComponent
|
|
1645
|
+
} = _b, rest = __objRest(_b, [
|
|
1646
|
+
"activeStep",
|
|
1647
|
+
"totalSteps",
|
|
1648
|
+
"className",
|
|
1649
|
+
"label",
|
|
1650
|
+
"lang",
|
|
1651
|
+
"title",
|
|
1652
|
+
"titleAs"
|
|
1653
|
+
]);
|
|
1654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
1647
1655
|
"div",
|
|
1648
|
-
{
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
}
|
|
1656
|
+
__spreadProps(__spreadValues({
|
|
1657
|
+
ref,
|
|
1658
|
+
className: (0, import_typed_classname29.clsx)("hds-step-indicator", className),
|
|
1659
|
+
lang
|
|
1660
|
+
}, rest), {
|
|
1661
|
+
children: [
|
|
1662
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: (0, import_typed_classname29.clsx)("hds-step-indicator__header"), children: [
|
|
1663
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: (0, import_typed_classname29.clsx)("hds-step-indicator__left-label"), children: label }),
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: stepLabelTranslations[lang](activeStep, totalSteps) })
|
|
1665
|
+
] }),
|
|
1666
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: (0, import_typed_classname29.clsx)("hds-step-indicator__steps"), children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1667
|
+
"div",
|
|
1668
|
+
{
|
|
1669
|
+
className: (0, import_typed_classname29.clsx)("hds-step-indicator__step"),
|
|
1670
|
+
"data-state": getStepState(i + 1, activeStep)
|
|
1671
|
+
},
|
|
1672
|
+
i
|
|
1673
|
+
)) }),
|
|
1674
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TitleComponent, { className: (0, import_typed_classname29.clsx)("hds-step-indicator__title"), children: title }) : null
|
|
1675
|
+
]
|
|
1676
|
+
})
|
|
1677
|
+
);
|
|
1678
|
+
}
|
|
1679
|
+
);
|
|
1680
|
+
StepIndicator.displayName = "StepIndicator";
|
|
1657
1681
|
var stepLabelTranslations = {
|
|
1658
1682
|
no: (activeStep, totalSteps) => `steg ${activeStep} av ${totalSteps}`,
|
|
1659
1683
|
en: (activeStep, totalSteps) => `step ${activeStep} of ${totalSteps}`,
|
|
@@ -1671,10 +1695,10 @@ function getStepState(renderedStep, activeStep) {
|
|
|
1671
1695
|
}
|
|
1672
1696
|
|
|
1673
1697
|
// src/styled-html/styled-html.tsx
|
|
1674
|
-
var
|
|
1698
|
+
var import_react28 = require("react");
|
|
1675
1699
|
var import_typed_classname30 = require("@postenbring/hedwig-css/typed-classname");
|
|
1676
1700
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1677
|
-
var StyledHtml = (0,
|
|
1701
|
+
var StyledHtml = (0, import_react28.forwardRef)(
|
|
1678
1702
|
(_a, ref) => {
|
|
1679
1703
|
var _b = _a, { as: Component = "div", children, size, darkmode = false, className } = _b, rest = __objRest(_b, ["as", "children", "size", "darkmode", "className"]);
|
|
1680
1704
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
@@ -1696,12 +1720,12 @@ var StyledHtml = (0, import_react26.forwardRef)(
|
|
|
1696
1720
|
StyledHtml.displayName = "StyledHtml";
|
|
1697
1721
|
|
|
1698
1722
|
// src/tabs/tabs.tsx
|
|
1699
|
-
var
|
|
1723
|
+
var import_react30 = require("react");
|
|
1700
1724
|
var import_typed_classname31 = require("@postenbring/hedwig-css/typed-classname");
|
|
1701
1725
|
|
|
1702
1726
|
// src/tabs/context.ts
|
|
1703
|
-
var
|
|
1704
|
-
var TabsContext = (0,
|
|
1727
|
+
var import_react29 = require("react");
|
|
1728
|
+
var TabsContext = (0, import_react29.createContext)({
|
|
1705
1729
|
mounted: false,
|
|
1706
1730
|
activeTabId: void 0,
|
|
1707
1731
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Added default section, without handling
|
|
@@ -1711,10 +1735,10 @@ var TabsContext = (0, import_react27.createContext)({
|
|
|
1711
1735
|
|
|
1712
1736
|
// src/tabs/tabs.tsx
|
|
1713
1737
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1714
|
-
var Tabs = (0,
|
|
1738
|
+
var Tabs = (0, import_react30.forwardRef)(
|
|
1715
1739
|
(_a, ref) => {
|
|
1716
1740
|
var _b = _a, { as: Component = "div", defaultTab, children } = _b, rest = __objRest(_b, ["as", "defaultTab", "children"]);
|
|
1717
|
-
const [activeTabId, setActiveTabId] = (0,
|
|
1741
|
+
const [activeTabId, setActiveTabId] = (0, import_react30.useState)(defaultTab);
|
|
1718
1742
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Component, __spreadProps(__spreadValues({ className: (0, import_typed_classname31.clsx)("hds-tabs"), ref }, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1719
1743
|
TabsContext.Provider,
|
|
1720
1744
|
{
|
|
@@ -1727,12 +1751,12 @@ var Tabs = (0, import_react28.forwardRef)(
|
|
|
1727
1751
|
Tabs.displayName = "Tabs";
|
|
1728
1752
|
|
|
1729
1753
|
// src/tabs/tabs-list.tsx
|
|
1730
|
-
var
|
|
1754
|
+
var import_react31 = require("react");
|
|
1731
1755
|
var import_typed_classname32 = require("@postenbring/hedwig-css/typed-classname");
|
|
1732
1756
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1733
1757
|
function TabsList(_a) {
|
|
1734
1758
|
var _b = _a, { children, direction = "horizontal", className } = _b, rest = __objRest(_b, ["children", "direction", "className"]);
|
|
1735
|
-
const tabsListRef = (0,
|
|
1759
|
+
const tabsListRef = (0, import_react31.useRef)(null);
|
|
1736
1760
|
const { width: tabsWidth } = useResize(tabsListRef);
|
|
1737
1761
|
const { innerWidth } = window;
|
|
1738
1762
|
const wideEnough = innerWidth >= tabsWidth;
|
|
@@ -1757,10 +1781,10 @@ function TabsList(_a) {
|
|
|
1757
1781
|
);
|
|
1758
1782
|
}
|
|
1759
1783
|
TabsList.displayName = "Tabs.List";
|
|
1760
|
-
var Tab = (0,
|
|
1784
|
+
var Tab = (0, import_react31.forwardRef)(
|
|
1761
1785
|
(_a, ref) => {
|
|
1762
1786
|
var _b = _a, { as: Component = "button", children, tabId, className, onClick } = _b, rest = __objRest(_b, ["as", "children", "tabId", "className", "onClick"]);
|
|
1763
|
-
const context = (0,
|
|
1787
|
+
const context = (0, import_react31.useContext)(TabsContext);
|
|
1764
1788
|
if (!context.mounted) {
|
|
1765
1789
|
throw new Error("Context required. Did you use <TabContent/> outside of <Tabs/>?");
|
|
1766
1790
|
}
|
|
@@ -1790,7 +1814,7 @@ var Tab = (0, import_react29.forwardRef)(
|
|
|
1790
1814
|
Tab.displayName = "Tabs.Tab";
|
|
1791
1815
|
|
|
1792
1816
|
// src/tabs/tabs-content.tsx
|
|
1793
|
-
var
|
|
1817
|
+
var import_react32 = require("react");
|
|
1794
1818
|
var import_typed_classname33 = require("@postenbring/hedwig-css/typed-classname");
|
|
1795
1819
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1796
1820
|
function TabsContents(_a) {
|
|
@@ -1798,10 +1822,10 @@ function TabsContents(_a) {
|
|
|
1798
1822
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", __spreadProps(__spreadValues({ className: (0, import_typed_classname33.clsx)("hds-tabs--contents") }, rest), { children }));
|
|
1799
1823
|
}
|
|
1800
1824
|
TabsContents.displayName = "Tabs.Contents";
|
|
1801
|
-
var TabsContent = (0,
|
|
1825
|
+
var TabsContent = (0, import_react32.forwardRef)(
|
|
1802
1826
|
(_a, ref) => {
|
|
1803
1827
|
var _b = _a, { as: Component = "div", forTabId, children } = _b, rest = __objRest(_b, ["as", "forTabId", "children"]);
|
|
1804
|
-
const context = (0,
|
|
1828
|
+
const context = (0, import_react32.useContext)(TabsContext);
|
|
1805
1829
|
if (!context.mounted) {
|
|
1806
1830
|
throw new Error("Context required. Did you use <Tabs.Content /> outside of <Tabs/>?");
|
|
1807
1831
|
}
|
|
@@ -1821,7 +1845,7 @@ TabsComponent.Contents = TabsContents;
|
|
|
1821
1845
|
TabsComponent.Content = TabsContent;
|
|
1822
1846
|
|
|
1823
1847
|
// src/text/text.tsx
|
|
1824
|
-
var
|
|
1848
|
+
var import_react33 = require("react");
|
|
1825
1849
|
var import_typed_classname34 = require("@postenbring/hedwig-css/typed-classname");
|
|
1826
1850
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1827
1851
|
var defaultHTMLTag = {
|
|
@@ -1839,7 +1863,7 @@ var defaultHTMLTag = {
|
|
|
1839
1863
|
caption: "p",
|
|
1840
1864
|
"caption-title": "p"
|
|
1841
1865
|
};
|
|
1842
|
-
var Text = (0,
|
|
1866
|
+
var Text = (0, import_react33.forwardRef)(
|
|
1843
1867
|
(_a, ref) => {
|
|
1844
1868
|
var _b = _a, {
|
|
1845
1869
|
as,
|
|
@@ -1915,10 +1939,10 @@ function textVariant(variant, displayName) {
|
|
|
1915
1939
|
}
|
|
1916
1940
|
|
|
1917
1941
|
// src/warning-banner/warning-banner.tsx
|
|
1918
|
-
var
|
|
1942
|
+
var import_react34 = require("react");
|
|
1919
1943
|
var import_typed_classname35 = require("@postenbring/hedwig-css/typed-classname");
|
|
1920
1944
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1921
|
-
var WarningBanner = (0,
|
|
1945
|
+
var WarningBanner = (0, import_react34.forwardRef)(
|
|
1922
1946
|
(_a, ref) => {
|
|
1923
1947
|
var _b = _a, { title, description, className } = _b, rest = __objRest(_b, ["title", "description", "className"]);
|
|
1924
1948
|
const expandable = !!description;
|
|
@@ -1929,7 +1953,7 @@ var WarningBanner = (0, import_react32.forwardRef)(
|
|
|
1929
1953
|
}
|
|
1930
1954
|
);
|
|
1931
1955
|
WarningBanner.displayName = "WarningBanner";
|
|
1932
|
-
var WarningBannerTitle = (0,
|
|
1956
|
+
var WarningBannerTitle = (0, import_react34.forwardRef)(
|
|
1933
1957
|
(_a, ref) => {
|
|
1934
1958
|
var _b = _a, {
|
|
1935
1959
|
variant,
|
|
@@ -1942,7 +1966,7 @@ var WarningBannerTitle = (0, import_react32.forwardRef)(
|
|
|
1942
1966
|
"children",
|
|
1943
1967
|
"className"
|
|
1944
1968
|
]);
|
|
1945
|
-
const [open, setOpen] = (0,
|
|
1969
|
+
const [open, setOpen] = (0, import_react34.useState)(false);
|
|
1946
1970
|
if (variant === "expandable") {
|
|
1947
1971
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1948
1972
|
Component,
|
|
@@ -1975,7 +1999,7 @@ var WarningBannerTitle = (0, import_react32.forwardRef)(
|
|
|
1975
1999
|
}
|
|
1976
2000
|
);
|
|
1977
2001
|
WarningBannerTitle.displayName = "WarningBannerTitle";
|
|
1978
|
-
var WarningBannerDescription = (0,
|
|
2002
|
+
var WarningBannerDescription = (0, import_react34.forwardRef)(
|
|
1979
2003
|
(_a, ref) => {
|
|
1980
2004
|
var _b = _a, { as: Component = "p", className } = _b, rest = __objRest(_b, ["as", "className"]);
|
|
1981
2005
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|