@norges-domstoler/dds-components 22.8.2 → 22.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -18
- package/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +35 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -49,9 +49,11 @@ var typographyStyles_default = {
|
|
|
49
49
|
"heading-xlarge--margins": "typographyStyles_heading-xlarge--margins",
|
|
50
50
|
"heading-xxlarge": "typographyStyles_heading-xxlarge",
|
|
51
51
|
"heading-xxlarge--margins": "typographyStyles_heading-xxlarge--margins",
|
|
52
|
+
"heading--margins-over-input": "typographyStyles_heading--margins-over-input",
|
|
52
53
|
"label-medium": "typographyStyles_label-medium",
|
|
53
54
|
"label-medium--margins": "typographyStyles_label-medium--margins",
|
|
54
55
|
legend: "typographyStyles_legend",
|
|
56
|
+
"legend--margins-over-input": "typographyStyles_legend--margins-over-input",
|
|
55
57
|
caption: "typographyStyles_caption",
|
|
56
58
|
"caption--withMargins": "typographyStyles_caption--withMargins",
|
|
57
59
|
bold: "typographyStyles_bold",
|
|
@@ -378,6 +380,12 @@ function cn(...classNames) {
|
|
|
378
380
|
function convertCamelToHyphen(value) {
|
|
379
381
|
return value.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([a-z])([0-9])/g, "$1-$2").toLowerCase();
|
|
380
382
|
}
|
|
383
|
+
function optAttr(value, keepZero) {
|
|
384
|
+
if (keepZero && value === 0) {
|
|
385
|
+
return value;
|
|
386
|
+
}
|
|
387
|
+
return value ? value : void 0;
|
|
388
|
+
}
|
|
381
389
|
|
|
382
390
|
// src/utils/getFocusableElements.ts
|
|
383
391
|
function getFocusableElements(elementRef) {
|
|
@@ -3934,6 +3942,8 @@ var Heading = ({
|
|
|
3934
3942
|
children,
|
|
3935
3943
|
typographyType,
|
|
3936
3944
|
level,
|
|
3945
|
+
withMargins,
|
|
3946
|
+
withMarginsOverInput,
|
|
3937
3947
|
...rest
|
|
3938
3948
|
}) => {
|
|
3939
3949
|
const headingElement = getHeadingElement(level);
|
|
@@ -3941,9 +3951,19 @@ var Heading = ({
|
|
|
3941
3951
|
return /* @__PURE__ */ jsx199(
|
|
3942
3952
|
Typography,
|
|
3943
3953
|
{
|
|
3944
|
-
...getBaseHTMLProps(
|
|
3954
|
+
...getBaseHTMLProps(
|
|
3955
|
+
id,
|
|
3956
|
+
cn(
|
|
3957
|
+
className,
|
|
3958
|
+
withMarginsOverInput && typographyStyles_default["heading--margins-over-input"]
|
|
3959
|
+
),
|
|
3960
|
+
style,
|
|
3961
|
+
htmlProps,
|
|
3962
|
+
rest
|
|
3963
|
+
),
|
|
3945
3964
|
typographyType: standardTypographyType,
|
|
3946
3965
|
as: headingElement,
|
|
3966
|
+
withMargins: optAttr(withMargins || withMarginsOverInput),
|
|
3947
3967
|
children
|
|
3948
3968
|
}
|
|
3949
3969
|
);
|
|
@@ -4022,14 +4042,26 @@ var Legend = ({
|
|
|
4022
4042
|
style,
|
|
4023
4043
|
htmlProps,
|
|
4024
4044
|
typographyType = "headingLarge",
|
|
4045
|
+
withMarginsOverInput,
|
|
4046
|
+
withMargins,
|
|
4025
4047
|
...rest
|
|
4026
4048
|
}) => {
|
|
4027
4049
|
return /* @__PURE__ */ jsx201(
|
|
4028
4050
|
Typography,
|
|
4029
4051
|
{
|
|
4030
|
-
...getBaseHTMLProps(
|
|
4052
|
+
...getBaseHTMLProps(
|
|
4053
|
+
id,
|
|
4054
|
+
cn(
|
|
4055
|
+
className,
|
|
4056
|
+
withMarginsOverInput && typographyStyles_default["legend--margins-over-input"]
|
|
4057
|
+
),
|
|
4058
|
+
style,
|
|
4059
|
+
htmlProps,
|
|
4060
|
+
rest
|
|
4061
|
+
),
|
|
4031
4062
|
as: "legend",
|
|
4032
|
-
typographyType
|
|
4063
|
+
typographyType,
|
|
4064
|
+
withMargins: optAttr(withMargins || withMarginsOverInput)
|
|
4033
4065
|
}
|
|
4034
4066
|
);
|
|
4035
4067
|
};
|