@norges-domstoler/dds-components 21.15.0 → 21.16.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/dist/index.css +16 -16
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +40 -42
- package/dist/index.d.ts +40 -42
- package/dist/index.js +94 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +120 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -18
package/dist/index.js
CHANGED
|
@@ -407,6 +407,7 @@ var typographyStyles_default = {
|
|
|
407
407
|
"a--nested__child": "typographyStyles_a--nested__child",
|
|
408
408
|
"a--margins": "typographyStyles_a--margins",
|
|
409
409
|
"a--external": "typographyStyles_a--external",
|
|
410
|
+
a__icon: "typographyStyles_a__icon",
|
|
410
411
|
"a--visited": "typographyStyles_a--visited",
|
|
411
412
|
"body-xsmall": "typographyStyles_body-xsmall",
|
|
412
413
|
"body-xsmall--margins": "typographyStyles_body-xsmall--margins",
|
|
@@ -3770,32 +3771,50 @@ var Label = ({
|
|
|
3770
3771
|
className,
|
|
3771
3772
|
htmlProps,
|
|
3772
3773
|
children,
|
|
3774
|
+
afterLabelContent,
|
|
3773
3775
|
...rest
|
|
3774
3776
|
}) => {
|
|
3775
|
-
|
|
3777
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_jsx_runtime184.Fragment, { children: [
|
|
3778
|
+
readOnly && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
3779
|
+
Icon,
|
|
3780
|
+
{
|
|
3781
|
+
icon: LockIcon,
|
|
3782
|
+
iconSize: "small",
|
|
3783
|
+
className: Label_default["read-only__icon"]
|
|
3784
|
+
}
|
|
3785
|
+
),
|
|
3786
|
+
children,
|
|
3787
|
+
showRequiredStyling && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(RequiredMarker, {})
|
|
3788
|
+
] });
|
|
3789
|
+
const labelProps = {
|
|
3790
|
+
...getBaseHTMLProps(
|
|
3791
|
+
id,
|
|
3792
|
+
cn(className, readOnly && Label_default["read-only"]),
|
|
3793
|
+
htmlProps,
|
|
3794
|
+
rest
|
|
3795
|
+
)
|
|
3796
|
+
};
|
|
3797
|
+
const render = afterLabelContent ? /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(
|
|
3776
3798
|
Typography,
|
|
3777
3799
|
{
|
|
3778
|
-
...getBaseHTMLProps(
|
|
3779
|
-
id,
|
|
3780
|
-
cn(className, readOnly && Label_default["read-only"]),
|
|
3781
|
-
htmlProps,
|
|
3782
|
-
rest
|
|
3783
|
-
),
|
|
3784
3800
|
typographyType: "labelMedium",
|
|
3801
|
+
as: "div",
|
|
3802
|
+
withMargins: rest.withMargins,
|
|
3785
3803
|
children: [
|
|
3786
|
-
|
|
3787
|
-
|
|
3804
|
+
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)(
|
|
3805
|
+
Typography,
|
|
3788
3806
|
{
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3807
|
+
...labelProps,
|
|
3808
|
+
typographyType: "labelMedium",
|
|
3809
|
+
withMargins: false,
|
|
3810
|
+
children: content
|
|
3792
3811
|
}
|
|
3793
3812
|
),
|
|
3794
|
-
|
|
3795
|
-
showRequiredStyling && /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(RequiredMarker, {})
|
|
3813
|
+
afterLabelContent
|
|
3796
3814
|
]
|
|
3797
3815
|
}
|
|
3798
|
-
);
|
|
3816
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(Typography, { ...labelProps, typographyType: "labelMedium", children: content });
|
|
3817
|
+
return render;
|
|
3799
3818
|
};
|
|
3800
3819
|
Label.displayName = "Label";
|
|
3801
3820
|
|
|
@@ -3824,7 +3843,7 @@ var import_jsx_runtime186 = require("react/jsx-runtime");
|
|
|
3824
3843
|
var Link = ({
|
|
3825
3844
|
id,
|
|
3826
3845
|
className,
|
|
3827
|
-
htmlProps
|
|
3846
|
+
htmlProps,
|
|
3828
3847
|
children,
|
|
3829
3848
|
typographyType,
|
|
3830
3849
|
withMargins,
|
|
@@ -3833,12 +3852,14 @@ var Link = ({
|
|
|
3833
3852
|
target,
|
|
3834
3853
|
style,
|
|
3835
3854
|
color,
|
|
3855
|
+
as: propAs,
|
|
3836
3856
|
...rest
|
|
3837
3857
|
}) => {
|
|
3838
|
-
const
|
|
3858
|
+
const as = propAs ? propAs : "a";
|
|
3839
3859
|
return /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(
|
|
3840
|
-
|
|
3860
|
+
ElementAs,
|
|
3841
3861
|
{
|
|
3862
|
+
as,
|
|
3842
3863
|
...getBaseHTMLProps(
|
|
3843
3864
|
id,
|
|
3844
3865
|
cn(
|
|
@@ -3851,14 +3872,13 @@ var Link = ({
|
|
|
3851
3872
|
focusable,
|
|
3852
3873
|
getColorCn(color)
|
|
3853
3874
|
),
|
|
3854
|
-
|
|
3875
|
+
htmlProps,
|
|
3855
3876
|
rest
|
|
3856
3877
|
),
|
|
3857
|
-
...rest,
|
|
3858
3878
|
rel: "noopener noreferer",
|
|
3859
3879
|
target: external ? "_blank" : target,
|
|
3860
3880
|
style: {
|
|
3861
|
-
...
|
|
3881
|
+
...htmlProps == null ? void 0 : htmlProps.style,
|
|
3862
3882
|
...style,
|
|
3863
3883
|
color: color && !isTextColor(color) ? getTextColor(color) : void 0
|
|
3864
3884
|
},
|
|
@@ -3999,12 +4019,28 @@ var BackLink_default = {
|
|
|
3999
4019
|
|
|
4000
4020
|
// src/components/BackLink/BackLink.tsx
|
|
4001
4021
|
var import_jsx_runtime190 = require("react/jsx-runtime");
|
|
4002
|
-
var BackLink = ({ label, ref, ...rest }) => {
|
|
4022
|
+
var BackLink = ({ label, ref, as = "a", ...rest }) => {
|
|
4003
4023
|
const { t } = useTranslation();
|
|
4004
|
-
return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("nav", { ref, "aria-label": t(texts.goBack), children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("nav", { ref, "aria-label": t(texts.goBack), children: /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(
|
|
4025
|
+
ElementAs,
|
|
4026
|
+
{
|
|
4027
|
+
as,
|
|
4028
|
+
className: cn(typographyStyles_default.a, focusable),
|
|
4029
|
+
rel: "noopener noreferer",
|
|
4030
|
+
...rest,
|
|
4031
|
+
children: [
|
|
4032
|
+
/* @__PURE__ */ (0, import_jsx_runtime190.jsx)(
|
|
4033
|
+
Icon,
|
|
4034
|
+
{
|
|
4035
|
+
icon: ArrowLeftIcon,
|
|
4036
|
+
iconSize: "inherit",
|
|
4037
|
+
className: cn(typographyStyles_default.a__icon, BackLink_default.icon)
|
|
4038
|
+
}
|
|
4039
|
+
),
|
|
4040
|
+
label
|
|
4041
|
+
]
|
|
4042
|
+
}
|
|
4043
|
+
) });
|
|
4008
4044
|
};
|
|
4009
4045
|
BackLink.displayName = "BackLink";
|
|
4010
4046
|
var texts = createTexts({
|
|
@@ -4233,10 +4269,10 @@ var Button = ({
|
|
|
4233
4269
|
{
|
|
4234
4270
|
ref,
|
|
4235
4271
|
...getBaseHTMLProps(id, buttonCn, htmlProps, rest),
|
|
4236
|
-
onClick
|
|
4272
|
+
onClick,
|
|
4237
4273
|
onFocus,
|
|
4238
4274
|
onBlur,
|
|
4239
|
-
|
|
4275
|
+
disabled: loading != null ? loading : rest.disabled,
|
|
4240
4276
|
children: content
|
|
4241
4277
|
}
|
|
4242
4278
|
);
|
|
@@ -6762,6 +6798,7 @@ function DateInput({
|
|
|
6762
6798
|
width,
|
|
6763
6799
|
clearable,
|
|
6764
6800
|
ref,
|
|
6801
|
+
afterLabelContent,
|
|
6765
6802
|
...props
|
|
6766
6803
|
}) {
|
|
6767
6804
|
var _a;
|
|
@@ -6780,7 +6817,8 @@ function DateInput({
|
|
|
6780
6817
|
...labelProps,
|
|
6781
6818
|
label: props.label,
|
|
6782
6819
|
showRequiredStyling: required,
|
|
6783
|
-
readOnly
|
|
6820
|
+
readOnly,
|
|
6821
|
+
afterLabelContent
|
|
6784
6822
|
}),
|
|
6785
6823
|
/* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(
|
|
6786
6824
|
Box,
|
|
@@ -6923,14 +6961,14 @@ var texts7 = createTexts({
|
|
|
6923
6961
|
});
|
|
6924
6962
|
|
|
6925
6963
|
// src/components/date-inputs/utils/useFocusManagerRef.ts
|
|
6926
|
-
var
|
|
6964
|
+
var import_focus18 = require("@react-aria/focus");
|
|
6927
6965
|
var import_react46 = require("react");
|
|
6928
6966
|
function useFocusManagerRef(ref) {
|
|
6929
6967
|
const domRef = (0, import_react46.useRef)(null);
|
|
6930
6968
|
(0, import_react46.useImperativeHandle)(ref, () => ({
|
|
6931
6969
|
...createDOMRef(domRef),
|
|
6932
6970
|
focus() {
|
|
6933
|
-
(0,
|
|
6971
|
+
(0, import_focus18.createFocusManager)(domRef).focusFirst({ tabbable: true });
|
|
6934
6972
|
}
|
|
6935
6973
|
}));
|
|
6936
6974
|
return domRef;
|
|
@@ -8688,6 +8726,7 @@ var FileUploader = (props) => {
|
|
|
8688
8726
|
errorMessage,
|
|
8689
8727
|
hideFileList,
|
|
8690
8728
|
className,
|
|
8729
|
+
afterLabelContent,
|
|
8691
8730
|
...rest
|
|
8692
8731
|
} = props;
|
|
8693
8732
|
const { t } = useTranslation();
|
|
@@ -8782,7 +8821,8 @@ var FileUploader = (props) => {
|
|
|
8782
8821
|
id: labelId,
|
|
8783
8822
|
showRequiredStyling: required,
|
|
8784
8823
|
htmlFor: inputId,
|
|
8785
|
-
readOnly
|
|
8824
|
+
readOnly,
|
|
8825
|
+
afterLabelContent
|
|
8786
8826
|
}),
|
|
8787
8827
|
hasTip && /* @__PURE__ */ (0, import_jsx_runtime260.jsx)(InputMessage, { id: tipId, message: tip, messageType: "tip" }),
|
|
8788
8828
|
inactive ? input : withDragAndDrop ? /* @__PURE__ */ (0, import_jsx_runtime260.jsxs)(
|
|
@@ -9022,6 +9062,8 @@ var import_jsx_runtime270 = require("react/jsx-runtime");
|
|
|
9022
9062
|
var InlineButton = ({
|
|
9023
9063
|
className,
|
|
9024
9064
|
color,
|
|
9065
|
+
icon,
|
|
9066
|
+
children,
|
|
9025
9067
|
...rest
|
|
9026
9068
|
}) => /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
|
|
9027
9069
|
StylelessButton,
|
|
@@ -9033,7 +9075,8 @@ var InlineButton = ({
|
|
|
9033
9075
|
InlineButton_default.button,
|
|
9034
9076
|
getColorCn(color)
|
|
9035
9077
|
),
|
|
9036
|
-
...rest
|
|
9078
|
+
...rest,
|
|
9079
|
+
children: icon ? /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(Icon, { icon, iconSize: "inherit" }) : children
|
|
9037
9080
|
}
|
|
9038
9081
|
);
|
|
9039
9082
|
|
|
@@ -10362,6 +10405,7 @@ function Select({
|
|
|
10362
10405
|
openMenuOnClick,
|
|
10363
10406
|
ref,
|
|
10364
10407
|
instanceId,
|
|
10408
|
+
afterLabelContent,
|
|
10365
10409
|
...rest
|
|
10366
10410
|
}) {
|
|
10367
10411
|
const themeContext = (0, import_react71.useContext)(ThemeContext);
|
|
@@ -10497,7 +10541,8 @@ function Select({
|
|
|
10497
10541
|
label,
|
|
10498
10542
|
htmlFor: uniqueId,
|
|
10499
10543
|
showRequiredStyling,
|
|
10500
|
-
readOnly
|
|
10544
|
+
readOnly,
|
|
10545
|
+
afterLabelContent
|
|
10501
10546
|
}),
|
|
10502
10547
|
/* @__PURE__ */ (0, import_jsx_runtime286.jsx)(import_react_select2.default, { ...reactSelectProps, ref }),
|
|
10503
10548
|
renderInputMessage(tip, tipId, errorMessage, errorMessageId)
|
|
@@ -10546,6 +10591,7 @@ var NativeSelect = ({
|
|
|
10546
10591
|
onKeyDown,
|
|
10547
10592
|
onMouseDown,
|
|
10548
10593
|
clearable,
|
|
10594
|
+
afterLabelContent,
|
|
10549
10595
|
onChange,
|
|
10550
10596
|
...rest
|
|
10551
10597
|
}) => {
|
|
@@ -10597,7 +10643,8 @@ var NativeSelect = ({
|
|
|
10597
10643
|
label,
|
|
10598
10644
|
htmlFor: uniqueId,
|
|
10599
10645
|
showRequiredStyling,
|
|
10600
|
-
readOnly
|
|
10646
|
+
readOnly,
|
|
10647
|
+
afterLabelContent
|
|
10601
10648
|
}),
|
|
10602
10649
|
/* @__PURE__ */ (0, import_jsx_runtime287.jsxs)(Box, { position: "relative", width: inputWidth, children: [
|
|
10603
10650
|
/* @__PURE__ */ (0, import_jsx_runtime287.jsx)(
|
|
@@ -11454,6 +11501,7 @@ var PhoneInput = ({
|
|
|
11454
11501
|
"aria-required": ariaRequired,
|
|
11455
11502
|
"aria-describedby": ariaDescribedby,
|
|
11456
11503
|
groupLabel = "Landskode og telefonnummer",
|
|
11504
|
+
afterLabelContent,
|
|
11457
11505
|
ref,
|
|
11458
11506
|
...props
|
|
11459
11507
|
}) => {
|
|
@@ -11542,7 +11590,8 @@ var PhoneInput = ({
|
|
|
11542
11590
|
label,
|
|
11543
11591
|
htmlFor: phoneNumberId,
|
|
11544
11592
|
showRequiredStyling,
|
|
11545
|
-
readOnly
|
|
11593
|
+
readOnly,
|
|
11594
|
+
afterLabelContent
|
|
11546
11595
|
}),
|
|
11547
11596
|
/* @__PURE__ */ (0, import_jsx_runtime289.jsxs)(
|
|
11548
11597
|
Box,
|
|
@@ -13665,6 +13714,7 @@ var TextInput_default = {
|
|
|
13665
13714
|
var import_jsx_runtime320 = require("react/jsx-runtime");
|
|
13666
13715
|
var TextInput = ({
|
|
13667
13716
|
label,
|
|
13717
|
+
afterLabelContent,
|
|
13668
13718
|
disabled,
|
|
13669
13719
|
readOnly,
|
|
13670
13720
|
errorMessage,
|
|
@@ -13842,7 +13892,13 @@ var TextInput = ({
|
|
|
13842
13892
|
),
|
|
13843
13893
|
style,
|
|
13844
13894
|
children: [
|
|
13845
|
-
renderLabel({
|
|
13895
|
+
renderLabel({
|
|
13896
|
+
label,
|
|
13897
|
+
htmlFor: uniqueId,
|
|
13898
|
+
showRequiredStyling,
|
|
13899
|
+
readOnly,
|
|
13900
|
+
afterLabelContent
|
|
13901
|
+
}),
|
|
13846
13902
|
extendedInput ? extendedInput : /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(Box, { as: StatefulInput, width: inputWidth, ...generalInputProps }),
|
|
13847
13903
|
hasBottomContainer && /* @__PURE__ */ (0, import_jsx_runtime320.jsxs)(
|
|
13848
13904
|
Box,
|
|
@@ -13936,8 +13992,7 @@ var Toggle = ({
|
|
|
13936
13992
|
type: "checkbox",
|
|
13937
13993
|
checked,
|
|
13938
13994
|
onChange: (e) => setChecked(e.target.checked),
|
|
13939
|
-
disabled,
|
|
13940
|
-
"aria-disabled": isLoading,
|
|
13995
|
+
disabled: isLoading != null ? isLoading : disabled,
|
|
13941
13996
|
"aria-readonly": readOnly,
|
|
13942
13997
|
onKeyDown: readOnlyKeyDownHandler(
|
|
13943
13998
|
"selectionControl",
|