@norges-domstoler/dds-components 22.8.1 → 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 +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +40 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -6
- 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
|
};
|
|
@@ -10936,9 +10968,9 @@ var getCustomStyles = (size2, hasError, isReadOnly) => ({
|
|
|
10936
10968
|
backgroundColor: "var(--dds-color-surface-hover-default)"
|
|
10937
10969
|
}
|
|
10938
10970
|
},
|
|
10939
|
-
menu: () => ({
|
|
10971
|
+
menu: (provided) => ({
|
|
10972
|
+
...provided,
|
|
10940
10973
|
boxSizing: "border-box",
|
|
10941
|
-
position: "absolute",
|
|
10942
10974
|
width: "100%",
|
|
10943
10975
|
boxShadow: "var(--dds-shadow-medium)",
|
|
10944
10976
|
zIndex: 100,
|
|
@@ -11153,6 +11185,7 @@ function Select({
|
|
|
11153
11185
|
isClearable = true,
|
|
11154
11186
|
placeholder,
|
|
11155
11187
|
menuPortalTarget,
|
|
11188
|
+
menuPlacement = "auto",
|
|
11156
11189
|
customOptionElement,
|
|
11157
11190
|
customSingleValueElement,
|
|
11158
11191
|
"data-testid": dataTestId,
|
|
@@ -11248,12 +11281,13 @@ function Select({
|
|
|
11248
11281
|
isClearable,
|
|
11249
11282
|
hideSelectedOptions: hideSelectedOptions ? hideSelectedOptions : false,
|
|
11250
11283
|
placeholder: placeholder ? placeholder : "",
|
|
11251
|
-
closeMenuOnSelect: closeMenuOnSelect ? closeMenuOnSelect : isMulti
|
|
11284
|
+
closeMenuOnSelect: closeMenuOnSelect ? closeMenuOnSelect : !isMulti,
|
|
11252
11285
|
isMulti,
|
|
11253
11286
|
instanceId: instanceId != null ? instanceId : useId21(),
|
|
11254
11287
|
inputId: uniqueId,
|
|
11255
11288
|
name: uniqueId,
|
|
11256
11289
|
menuPortalTarget: portalTarget,
|
|
11290
|
+
menuPlacement,
|
|
11257
11291
|
classNamePrefix: prefix,
|
|
11258
11292
|
styles: getCustomStyles(componentSize, hasErrorMessage, readOnly),
|
|
11259
11293
|
filterOption: (option, inputValue) => {
|