@norges-domstoler/dds-components 10.7.0 → 11.1.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/cjs/components/DescriptionList/DescriptionList.d.ts +8 -0
- package/dist/cjs/components/DescriptionList/DescriptionList.stories.d.ts +2 -1
- package/dist/cjs/components/DescriptionList/DescriptionList.tokens.d.ts +3 -0
- package/dist/cjs/components/DescriptionList/DescriptionListGroup.d.ts +8 -0
- package/dist/cjs/components/InputMessage/InputMessage.d.ts +1 -1
- package/dist/cjs/index.js +67 -38
- package/dist/components/Button/Button.js +8 -2
- package/dist/components/Button/Button.styles.js +32 -29
- package/dist/components/DescriptionList/DescriptionList.d.ts +8 -0
- package/dist/components/DescriptionList/DescriptionList.js +10 -3
- package/dist/components/DescriptionList/DescriptionList.stories.d.ts +2 -1
- package/dist/components/DescriptionList/DescriptionList.tokens.d.ts +3 -0
- package/dist/components/DescriptionList/DescriptionList.tokens.js +3 -0
- package/dist/components/DescriptionList/DescriptionListGroup.d.ts +8 -0
- package/dist/components/DescriptionList/DescriptionListGroup.js +13 -3
- package/dist/components/InputMessage/InputMessage.d.ts +1 -1
- package/dist/components/InputMessage/InputMessage.js +1 -1
- package/package.json +6 -6
|
@@ -3,10 +3,18 @@ export type DescriptionListAppearance = 'small' | 'bold';
|
|
|
3
3
|
export type DescriptionListProps = BaseComponentPropsWithChildren<HTMLDListElement, {
|
|
4
4
|
/**Påvirker tekst styling. */
|
|
5
5
|
appearance?: DescriptionListAppearance;
|
|
6
|
+
/**Setter flex-direction. NB! Fungerer kun ved bruk av `DescriptionListGroup` som barn av `DescriptionList`.
|
|
7
|
+
* @default "column"
|
|
8
|
+
*/
|
|
9
|
+
direction?: 'row' | 'column';
|
|
6
10
|
}>;
|
|
7
11
|
export declare const DescriptionList: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDListElement>, "id" | "className"> & {
|
|
8
12
|
/**Påvirker tekst styling. */
|
|
9
13
|
appearance?: DescriptionListAppearance | undefined;
|
|
14
|
+
/**Setter flex-direction. NB! Fungerer kun ved bruk av `DescriptionListGroup` som barn av `DescriptionList`.
|
|
15
|
+
* @default "column"
|
|
16
|
+
*/
|
|
17
|
+
direction?: "row" | "column" | undefined;
|
|
10
18
|
} & {
|
|
11
19
|
children?: import("react").ReactNode;
|
|
12
20
|
} & {
|
|
@@ -3,6 +3,7 @@ declare const _default: {
|
|
|
3
3
|
title: string;
|
|
4
4
|
component: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDListElement>, "id" | "className"> & {
|
|
5
5
|
appearance?: import("./DescriptionList").DescriptionListAppearance | undefined;
|
|
6
|
+
direction?: "row" | "column" | undefined;
|
|
6
7
|
} & {
|
|
7
8
|
children?: import("react").ReactNode;
|
|
8
9
|
} & {
|
|
@@ -14,4 +15,4 @@ export declare const Overview: () => JSX.Element;
|
|
|
14
15
|
export declare const Default: (args: DescriptionListProps) => JSX.Element;
|
|
15
16
|
export declare const Group: (args: DescriptionListProps) => JSX.Element;
|
|
16
17
|
export declare const WithIcon: (args: DescriptionListProps) => JSX.Element;
|
|
17
|
-
export declare const
|
|
18
|
+
export declare const RowDirectionExample: (args: DescriptionListProps) => JSX.Element;
|
|
@@ -3,10 +3,18 @@ import { BaseComponentPropsWithChildren } from '../../types';
|
|
|
3
3
|
export type DescriptionListGroupProps = BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
4
4
|
/**Custom margin. */
|
|
5
5
|
margin?: Property.Margin<string>;
|
|
6
|
+
/**Custom min-width. */
|
|
7
|
+
minWidth?: Property.MinWidth<string>;
|
|
8
|
+
/**Custom max-width. */
|
|
9
|
+
maxWidth?: Property.MaxWidth<string>;
|
|
6
10
|
}>;
|
|
7
11
|
export declare const DescriptionListGroup: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDivElement>, "id" | "className"> & {
|
|
8
12
|
/**Custom margin. */
|
|
9
13
|
margin?: Property.Margin<string> | undefined;
|
|
14
|
+
/**Custom min-width. */
|
|
15
|
+
minWidth?: Property.MinWidth<string> | undefined;
|
|
16
|
+
/**Custom max-width. */
|
|
17
|
+
maxWidth?: Property.MaxWidth<string> | undefined;
|
|
10
18
|
} & {
|
|
11
19
|
children?: import("react").ReactNode;
|
|
12
20
|
} & {
|
|
@@ -12,5 +12,5 @@ export declare const InputMessage: import("react").ForwardRefExoticComponent<Pic
|
|
|
12
12
|
/** Formålet med meldingen. Påvirker styling. */
|
|
13
13
|
messageType: InputMessageType;
|
|
14
14
|
} & {
|
|
15
|
-
htmlProps?: import("react").HTMLAttributes<HTMLDivElement> | undefined;
|
|
15
|
+
htmlProps?: import("react").HTMLAttributes<HTMLDivElement> | undefined;
|
|
16
16
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/cjs/index.js
CHANGED
|
@@ -2069,7 +2069,7 @@ var InputMessageWrapper = styled__default.default.div.withConfig({
|
|
|
2069
2069
|
componentId: "sc-c954fy-0"
|
|
2070
2070
|
})(["display:flex;width:fit-content;word-break:break-word;max-width:100%;", " svg{margin-top:", ";}"], function (_ref) {
|
|
2071
2071
|
var messageType = _ref.messageType;
|
|
2072
|
-
return messageType === '
|
|
2072
|
+
return messageType === 'error' ? styled.css(["color:", ";background-color:", ";padding:", ";gap:", ";"], inputMessageTokens.message.error.color, inputMessageTokens.message.error.backgroundColor, inputMessageTokens.message.error.padding, inputMessageTokens.message.error.gap) : '';
|
|
2073
2073
|
}, inputMessageTokens.icon.marginTop);
|
|
2074
2074
|
var InputMessage = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
2075
2075
|
var message = props.message,
|
|
@@ -3613,55 +3613,58 @@ var getAppearanceAndPurposeStyling = function getAppearanceAndPurposeStyling(app
|
|
|
3613
3613
|
var ButtonWrapper = styled__default.default.button.withConfig({
|
|
3614
3614
|
displayName: "Buttonstyles__ButtonWrapper",
|
|
3615
3615
|
componentId: "sc-14dutqk-0"
|
|
3616
|
-
})(["", " border:", ";user-select:text;display:inline-flex;align-items:center;justify-content:center;height:fit-content;width:", ";cursor:
|
|
3616
|
+
})(["", " border:", ";user-select:text;display:inline-flex;align-items:center;justify-content:center;height:fit-content;width:", ";cursor:", ";box-shadow:none;text-decoration:none;@media (prefers-reduced-motion:no-preference){transition:background-color 0.2s,text-decoration-color 0.2s,box-shadow 0.2s,border-color 0.2s,color 0.2s,", ";}", " ", " ", " ", " ", " &:focus-visible,&.focus-visible{", "}*::selection{", "}"], normalizeButton, base$1.border, function (_ref) {
|
|
3617
3617
|
var fullWidth = _ref.fullWidth;
|
|
3618
3618
|
return fullWidth ? '100%' : 'fit-content';
|
|
3619
|
-
},
|
|
3620
|
-
var
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
var hasIcon = _ref3.hasIcon,
|
|
3625
|
-
hasLabel = _ref3.hasLabel,
|
|
3626
|
-
appearance = _ref3.appearance,
|
|
3619
|
+
}, function (_ref2) {
|
|
3620
|
+
var isLoading = _ref2.isLoading;
|
|
3621
|
+
return isLoading ? 'not-allowed' : 'pointer';
|
|
3622
|
+
}, focusVisibleTransitionValue, function (_ref3) {
|
|
3623
|
+
var appearance = _ref3.appearance,
|
|
3627
3624
|
purpose = _ref3.purpose;
|
|
3628
|
-
return
|
|
3625
|
+
return styled.css(["border-radius:", ";box-shadow:", ";color:", ";", ""], appearances$1[appearance].base.borderRadius, appearances$1[appearance].base.boxShadow, appearances$1[appearance].purpose[purpose].base.color, getAppearanceAndPurposeStyling(appearance, purpose));
|
|
3629
3626
|
}, function (_ref4) {
|
|
3630
3627
|
var hasIcon = _ref4.hasIcon,
|
|
3631
3628
|
hasLabel = _ref4.hasLabel,
|
|
3632
|
-
|
|
3633
|
-
|
|
3629
|
+
appearance = _ref4.appearance,
|
|
3630
|
+
purpose = _ref4.purpose;
|
|
3631
|
+
return hasIcon && !hasLabel && appearance === 'borderless' && styled.css(["&:hover{border-color:", ";box-shadow:", ";}&:active{border-color::", ";box-shadow:", ";}"], appearances$1[appearance].purpose[purpose].icon.hover.borderColor, appearances$1[appearance].purpose[purpose].icon.hover.boxShadow, appearances$1[appearance].purpose[purpose].icon.active.borderColor, appearances$1[appearance].purpose[purpose].icon.active.boxShadow);
|
|
3634
3632
|
}, function (_ref5) {
|
|
3635
|
-
var
|
|
3636
|
-
hasLabel = _ref5.hasLabel
|
|
3637
|
-
|
|
3633
|
+
var hasIcon = _ref5.hasIcon,
|
|
3634
|
+
hasLabel = _ref5.hasLabel,
|
|
3635
|
+
size = _ref5.size;
|
|
3636
|
+
return hasIcon && hasLabel && styled.css(["gap:", ";"], sizes$1[size].textAndIcon.gap);
|
|
3638
3637
|
}, function (_ref6) {
|
|
3639
|
-
var
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3638
|
+
var size = _ref6.size,
|
|
3639
|
+
hasLabel = _ref6.hasLabel;
|
|
3640
|
+
return hasLabel ? styled.css(["", " padding:", ";"], getFontStyling(typographyTypes$6[size]), sizes$1[size].text.padding) : styled.css(["font-size:", ";padding:", ";"], sizes$1[size].justIcon.icon.fontSize, sizes$1[size].justIcon.icon.padding);
|
|
3641
|
+
}, function (_ref7) {
|
|
3642
|
+
var fullWidth = _ref7.fullWidth,
|
|
3643
|
+
hasIcon = _ref7.hasIcon,
|
|
3644
|
+
hasLabel = _ref7.hasLabel,
|
|
3645
|
+
isLoading = _ref7.isLoading,
|
|
3646
|
+
iconPosition = _ref7.iconPosition;
|
|
3644
3647
|
return fullWidth && (!hasIcon || !hasLabel || isLoading ? styled.css(["justify-content:center;"]) : hasIcon && hasLabel && iconPosition === 'left' ? styled.css(["justify-content:left;"]) : styled.css(["justify-content:space-between;"]));
|
|
3645
3648
|
}, focusVisible, selection);
|
|
3646
3649
|
var StyledIconWrapperSpan = styled__default.default.span.withConfig({
|
|
3647
3650
|
displayName: "Buttonstyles__StyledIconWrapperSpan",
|
|
3648
3651
|
componentId: "sc-14dutqk-1"
|
|
3649
|
-
})(["display:flex;align-items:center;justify-content:center;", " ", " ", ""], function (
|
|
3650
|
-
var absolutePosition =
|
|
3652
|
+
})(["display:flex;align-items:center;justify-content:center;", " ", " ", ""], function (_ref8) {
|
|
3653
|
+
var absolutePosition = _ref8.absolutePosition;
|
|
3651
3654
|
return absolutePosition && styled.css(["position:absolute;"]);
|
|
3652
|
-
}, function (_ref8) {
|
|
3653
|
-
var isHidden = _ref8.isHidden;
|
|
3654
|
-
return isHidden && styled.css(["visibility:hidden;"]);
|
|
3655
3655
|
}, function (_ref9) {
|
|
3656
|
-
var
|
|
3657
|
-
|
|
3656
|
+
var isHidden = _ref9.isHidden;
|
|
3657
|
+
return isHidden && styled.css(["visibility:hidden;"]);
|
|
3658
|
+
}, function (_ref10) {
|
|
3659
|
+
var justIcon = _ref10.justIcon,
|
|
3660
|
+
size = _ref10.size;
|
|
3658
3661
|
return justIcon && styled.css(["height:", ";width:", ";"], sizes$1[size].justIcon.wrapper.height, sizes$1[size].justIcon.wrapper.width);
|
|
3659
3662
|
});
|
|
3660
3663
|
var Label$1 = styled__default.default.span.withConfig({
|
|
3661
3664
|
displayName: "Buttonstyles__Label",
|
|
3662
3665
|
componentId: "sc-14dutqk-2"
|
|
3663
|
-
})(["", ""], function (
|
|
3664
|
-
var isHidden =
|
|
3666
|
+
})(["", ""], function (_ref11) {
|
|
3667
|
+
var isHidden = _ref11.isHidden;
|
|
3665
3668
|
return isHidden && styled.css(["visibility:hidden;"]);
|
|
3666
3669
|
});
|
|
3667
3670
|
|
|
@@ -3685,7 +3688,7 @@ var Button$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
3685
3688
|
_props$fullWidth = props.fullWidth,
|
|
3686
3689
|
fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
|
|
3687
3690
|
icon = props.icon,
|
|
3688
|
-
|
|
3691
|
+
_onClick = props.onClick,
|
|
3689
3692
|
onFocus = props.onFocus,
|
|
3690
3693
|
onBlur = props.onBlur,
|
|
3691
3694
|
id = props.id,
|
|
@@ -3710,7 +3713,11 @@ var Button$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
3710
3713
|
hasIcon: hasIcon,
|
|
3711
3714
|
isLoading: loading,
|
|
3712
3715
|
size: size,
|
|
3713
|
-
onClick: onClick
|
|
3716
|
+
onClick: function onClick(event) {
|
|
3717
|
+
if (!loading && _onClick) {
|
|
3718
|
+
_onClick(event);
|
|
3719
|
+
}
|
|
3720
|
+
},
|
|
3714
3721
|
onFocus: onFocus,
|
|
3715
3722
|
onBlur: onBlur
|
|
3716
3723
|
});
|
|
@@ -3726,6 +3733,8 @@ var Button$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
3726
3733
|
})
|
|
3727
3734
|
}));
|
|
3728
3735
|
return jsxRuntime.jsxs(ButtonWrapper, Object.assign({}, wrapperProps, {
|
|
3736
|
+
"aria-disabled": loading
|
|
3737
|
+
}, {
|
|
3729
3738
|
children: [!isIconButton && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3730
3739
|
children: [iconPosition === 'left' && iconElement, jsxRuntime.jsx(Label$1, Object.assign({
|
|
3731
3740
|
isHidden: loading,
|
|
@@ -6390,6 +6399,9 @@ var desc$1 = {
|
|
|
6390
6399
|
var list$7 = {
|
|
6391
6400
|
beforeNextTerm: {
|
|
6392
6401
|
marginTop: spacing$n.SizesDdsSpacingLocalX2
|
|
6402
|
+
},
|
|
6403
|
+
rowDirection: {
|
|
6404
|
+
columnGap: spacing$n.SizesDdsSpacingLocalX2
|
|
6393
6405
|
}
|
|
6394
6406
|
};
|
|
6395
6407
|
var group$2 = {
|
|
@@ -6410,20 +6422,27 @@ var term = descriptionListTokens.term,
|
|
|
6410
6422
|
var DList = styled__default.default.dl.withConfig({
|
|
6411
6423
|
displayName: "DescriptionList__DList",
|
|
6412
6424
|
componentId: "sc-1ob73hm-0"
|
|
6413
|
-
})(["margin:0;*::selection{", "}", "
|
|
6425
|
+
})(["margin:0;*::selection{", "}", " display:flex;flex-direction:column;&:not(:has(> dt):has(> dd)){flex-direction:", ";}flex-wrap:wrap;column-gap:", ";row-gap:0;& > dt:first-of-type{margin-top:", ";}& > dd:last-child{margin-bottom:", ";}dd + dt{margin-top:", ";}"], selection, function (_ref) {
|
|
6414
6426
|
var appearance = _ref.appearance;
|
|
6415
6427
|
return appearance && styled.css(["dt{color:", ";", " ", "}"], term.appearance[appearance].color, getFontStyling(termTypographyTypes[appearance]), appearance === 'bold' && styled.css(["font-weight:600;"]));
|
|
6416
|
-
},
|
|
6428
|
+
}, function (_ref2) {
|
|
6429
|
+
var _ref2$direction = _ref2.direction,
|
|
6430
|
+
direction = _ref2$direction === void 0 ? 'column' : _ref2$direction;
|
|
6431
|
+
return direction;
|
|
6432
|
+
}, list$6.rowDirection.columnGap, term.firstOfType.marginTop, desc.lastChild.marginBottom, list$6.beforeNextTerm.marginTop);
|
|
6417
6433
|
var DescriptionList = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
6418
6434
|
var _props$appearance = props.appearance,
|
|
6419
6435
|
appearance = _props$appearance === void 0 ? 'bold' : _props$appearance,
|
|
6436
|
+
_props$direction = props.direction,
|
|
6437
|
+
direction = _props$direction === void 0 ? 'column' : _props$direction,
|
|
6420
6438
|
children = props.children,
|
|
6421
6439
|
id = props.id,
|
|
6422
6440
|
className = props.className,
|
|
6423
6441
|
htmlProps = props.htmlProps,
|
|
6424
|
-
rest = tslib.__rest(props, ["appearance", "children", "id", "className", "htmlProps"]);
|
|
6442
|
+
rest = tslib.__rest(props, ["appearance", "direction", "children", "id", "className", "htmlProps"]);
|
|
6425
6443
|
var dListProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
|
|
6426
6444
|
appearance: appearance,
|
|
6445
|
+
direction: direction,
|
|
6427
6446
|
ref: ref
|
|
6428
6447
|
});
|
|
6429
6448
|
return jsxRuntime.jsx(DList, Object.assign({}, dListProps, {
|
|
@@ -6471,21 +6490,31 @@ var DescriptionListDesc = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
6471
6490
|
var DListGroup = styled__default.default.div.withConfig({
|
|
6472
6491
|
displayName: "DescriptionListGroup__DListGroup",
|
|
6473
6492
|
componentId: "sc-jkdc0o-0"
|
|
6474
|
-
})(["margin:", ";"], function (_ref) {
|
|
6493
|
+
})(["margin:", ";", " ", ""], function (_ref) {
|
|
6475
6494
|
var margin = _ref.margin;
|
|
6476
6495
|
return margin ? margin : descriptionListTokens.group.base.margin;
|
|
6496
|
+
}, function (_ref2) {
|
|
6497
|
+
var minWidth = _ref2.minWidth;
|
|
6498
|
+
return minWidth && "min-width: ".concat(minWidth);
|
|
6499
|
+
}, function (_ref3) {
|
|
6500
|
+
var maxWidth = _ref3.maxWidth;
|
|
6501
|
+
return maxWidth && "max-width: ".concat(maxWidth);
|
|
6477
6502
|
});
|
|
6478
6503
|
var DescriptionListGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
6479
6504
|
var children = props.children,
|
|
6480
6505
|
margin = props.margin,
|
|
6506
|
+
minWidth = props.minWidth,
|
|
6507
|
+
maxWidth = props.maxWidth,
|
|
6481
6508
|
id = props.id,
|
|
6482
6509
|
className = props.className,
|
|
6483
6510
|
htmlProps = props.htmlProps,
|
|
6484
|
-
rest = tslib.__rest(props, ["children", "margin", "id", "className", "htmlProps"]);
|
|
6511
|
+
rest = tslib.__rest(props, ["children", "margin", "minWidth", "maxWidth", "id", "className", "htmlProps"]);
|
|
6485
6512
|
var dListGroupProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
|
|
6486
6513
|
children: children,
|
|
6487
6514
|
ref: ref,
|
|
6488
|
-
margin: margin
|
|
6515
|
+
margin: margin,
|
|
6516
|
+
minWidth: minWidth,
|
|
6517
|
+
maxWidth: maxWidth
|
|
6489
6518
|
});
|
|
6490
6519
|
return jsxRuntime.jsx(DListGroup, Object.assign({}, dListGroupProps, {
|
|
6491
6520
|
children: children
|
|
@@ -27,7 +27,7 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
27
27
|
_props$fullWidth = props.fullWidth,
|
|
28
28
|
fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
|
|
29
29
|
icon = props.icon,
|
|
30
|
-
|
|
30
|
+
_onClick = props.onClick,
|
|
31
31
|
onFocus = props.onFocus,
|
|
32
32
|
onBlur = props.onBlur,
|
|
33
33
|
id = props.id,
|
|
@@ -52,7 +52,11 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
52
52
|
hasIcon: hasIcon,
|
|
53
53
|
isLoading: loading,
|
|
54
54
|
size: size,
|
|
55
|
-
onClick: onClick
|
|
55
|
+
onClick: function onClick(event) {
|
|
56
|
+
if (!loading && _onClick) {
|
|
57
|
+
_onClick(event);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
56
60
|
onFocus: onFocus,
|
|
57
61
|
onBlur: onBlur
|
|
58
62
|
});
|
|
@@ -68,6 +72,8 @@ var Button = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
68
72
|
})
|
|
69
73
|
}));
|
|
70
74
|
return jsxs(ButtonWrapper, Object.assign({}, wrapperProps, {
|
|
75
|
+
"aria-disabled": loading
|
|
76
|
+
}, {
|
|
71
77
|
children: [!isIconButton && jsxs(Fragment, {
|
|
72
78
|
children: [iconPosition === 'left' && iconElement, jsx(Label, Object.assign({
|
|
73
79
|
isHidden: loading,
|
|
@@ -26,55 +26,58 @@ var getAppearanceAndPurposeStyling = function getAppearanceAndPurposeStyling(app
|
|
|
26
26
|
var ButtonWrapper = styled.button.withConfig({
|
|
27
27
|
displayName: "Buttonstyles__ButtonWrapper",
|
|
28
28
|
componentId: "sc-14dutqk-0"
|
|
29
|
-
})(["", " border:", ";user-select:text;display:inline-flex;align-items:center;justify-content:center;height:fit-content;width:", ";cursor:
|
|
29
|
+
})(["", " border:", ";user-select:text;display:inline-flex;align-items:center;justify-content:center;height:fit-content;width:", ";cursor:", ";box-shadow:none;text-decoration:none;@media (prefers-reduced-motion:no-preference){transition:background-color 0.2s,text-decoration-color 0.2s,box-shadow 0.2s,border-color 0.2s,color 0.2s,", ";}", " ", " ", " ", " ", " &:focus-visible,&.focus-visible{", "}*::selection{", "}"], normalizeButton, base.border, function (_ref) {
|
|
30
30
|
var fullWidth = _ref.fullWidth;
|
|
31
31
|
return fullWidth ? '100%' : 'fit-content';
|
|
32
|
-
},
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var hasIcon = _ref3.hasIcon,
|
|
38
|
-
hasLabel = _ref3.hasLabel,
|
|
39
|
-
appearance = _ref3.appearance,
|
|
32
|
+
}, function (_ref2) {
|
|
33
|
+
var isLoading = _ref2.isLoading;
|
|
34
|
+
return isLoading ? 'not-allowed' : 'pointer';
|
|
35
|
+
}, focusVisibleTransitionValue, function (_ref3) {
|
|
36
|
+
var appearance = _ref3.appearance,
|
|
40
37
|
purpose = _ref3.purpose;
|
|
41
|
-
return
|
|
38
|
+
return css(["border-radius:", ";box-shadow:", ";color:", ";", ""], appearances[appearance].base.borderRadius, appearances[appearance].base.boxShadow, appearances[appearance].purpose[purpose].base.color, getAppearanceAndPurposeStyling(appearance, purpose));
|
|
42
39
|
}, function (_ref4) {
|
|
43
40
|
var hasIcon = _ref4.hasIcon,
|
|
44
41
|
hasLabel = _ref4.hasLabel,
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
appearance = _ref4.appearance,
|
|
43
|
+
purpose = _ref4.purpose;
|
|
44
|
+
return hasIcon && !hasLabel && appearance === 'borderless' && css(["&:hover{border-color:", ";box-shadow:", ";}&:active{border-color::", ";box-shadow:", ";}"], appearances[appearance].purpose[purpose].icon.hover.borderColor, appearances[appearance].purpose[purpose].icon.hover.boxShadow, appearances[appearance].purpose[purpose].icon.active.borderColor, appearances[appearance].purpose[purpose].icon.active.boxShadow);
|
|
47
45
|
}, function (_ref5) {
|
|
48
|
-
var
|
|
49
|
-
hasLabel = _ref5.hasLabel
|
|
50
|
-
|
|
46
|
+
var hasIcon = _ref5.hasIcon,
|
|
47
|
+
hasLabel = _ref5.hasLabel,
|
|
48
|
+
size = _ref5.size;
|
|
49
|
+
return hasIcon && hasLabel && css(["gap:", ";"], sizes[size].textAndIcon.gap);
|
|
51
50
|
}, function (_ref6) {
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
var size = _ref6.size,
|
|
52
|
+
hasLabel = _ref6.hasLabel;
|
|
53
|
+
return hasLabel ? css(["", " padding:", ";"], getFontStyling(typographyTypes[size]), sizes[size].text.padding) : css(["font-size:", ";padding:", ";"], sizes[size].justIcon.icon.fontSize, sizes[size].justIcon.icon.padding);
|
|
54
|
+
}, function (_ref7) {
|
|
55
|
+
var fullWidth = _ref7.fullWidth,
|
|
56
|
+
hasIcon = _ref7.hasIcon,
|
|
57
|
+
hasLabel = _ref7.hasLabel,
|
|
58
|
+
isLoading = _ref7.isLoading,
|
|
59
|
+
iconPosition = _ref7.iconPosition;
|
|
57
60
|
return fullWidth && (!hasIcon || !hasLabel || isLoading ? css(["justify-content:center;"]) : hasIcon && hasLabel && iconPosition === 'left' ? css(["justify-content:left;"]) : css(["justify-content:space-between;"]));
|
|
58
61
|
}, focusVisible, selection);
|
|
59
62
|
var StyledIconWrapperSpan = styled.span.withConfig({
|
|
60
63
|
displayName: "Buttonstyles__StyledIconWrapperSpan",
|
|
61
64
|
componentId: "sc-14dutqk-1"
|
|
62
|
-
})(["display:flex;align-items:center;justify-content:center;", " ", " ", ""], function (
|
|
63
|
-
var absolutePosition =
|
|
65
|
+
})(["display:flex;align-items:center;justify-content:center;", " ", " ", ""], function (_ref8) {
|
|
66
|
+
var absolutePosition = _ref8.absolutePosition;
|
|
64
67
|
return absolutePosition && css(["position:absolute;"]);
|
|
65
|
-
}, function (_ref8) {
|
|
66
|
-
var isHidden = _ref8.isHidden;
|
|
67
|
-
return isHidden && css(["visibility:hidden;"]);
|
|
68
68
|
}, function (_ref9) {
|
|
69
|
-
var
|
|
70
|
-
|
|
69
|
+
var isHidden = _ref9.isHidden;
|
|
70
|
+
return isHidden && css(["visibility:hidden;"]);
|
|
71
|
+
}, function (_ref10) {
|
|
72
|
+
var justIcon = _ref10.justIcon,
|
|
73
|
+
size = _ref10.size;
|
|
71
74
|
return justIcon && css(["height:", ";width:", ";"], sizes[size].justIcon.wrapper.height, sizes[size].justIcon.wrapper.width);
|
|
72
75
|
});
|
|
73
76
|
var Label = styled.span.withConfig({
|
|
74
77
|
displayName: "Buttonstyles__Label",
|
|
75
78
|
componentId: "sc-14dutqk-2"
|
|
76
|
-
})(["", ""], function (
|
|
77
|
-
var isHidden =
|
|
79
|
+
})(["", ""], function (_ref11) {
|
|
80
|
+
var isHidden = _ref11.isHidden;
|
|
78
81
|
return isHidden && css(["visibility:hidden;"]);
|
|
79
82
|
});
|
|
80
83
|
|
|
@@ -3,10 +3,18 @@ export type DescriptionListAppearance = 'small' | 'bold';
|
|
|
3
3
|
export type DescriptionListProps = BaseComponentPropsWithChildren<HTMLDListElement, {
|
|
4
4
|
/**Påvirker tekst styling. */
|
|
5
5
|
appearance?: DescriptionListAppearance;
|
|
6
|
+
/**Setter flex-direction. NB! Fungerer kun ved bruk av `DescriptionListGroup` som barn av `DescriptionList`.
|
|
7
|
+
* @default "column"
|
|
8
|
+
*/
|
|
9
|
+
direction?: 'row' | 'column';
|
|
6
10
|
}>;
|
|
7
11
|
export declare const DescriptionList: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDListElement>, "id" | "className"> & {
|
|
8
12
|
/**Påvirker tekst styling. */
|
|
9
13
|
appearance?: DescriptionListAppearance | undefined;
|
|
14
|
+
/**Setter flex-direction. NB! Fungerer kun ved bruk av `DescriptionListGroup` som barn av `DescriptionList`.
|
|
15
|
+
* @default "column"
|
|
16
|
+
*/
|
|
17
|
+
direction?: "row" | "column" | undefined;
|
|
10
18
|
} & {
|
|
11
19
|
children?: import("react").ReactNode;
|
|
12
20
|
} & {
|
|
@@ -17,20 +17,27 @@ var term = descriptionListTokens.term,
|
|
|
17
17
|
var DList = styled.dl.withConfig({
|
|
18
18
|
displayName: "DescriptionList__DList",
|
|
19
19
|
componentId: "sc-1ob73hm-0"
|
|
20
|
-
})(["margin:0;*::selection{", "}", "
|
|
20
|
+
})(["margin:0;*::selection{", "}", " display:flex;flex-direction:column;&:not(:has(> dt):has(> dd)){flex-direction:", ";}flex-wrap:wrap;column-gap:", ";row-gap:0;& > dt:first-of-type{margin-top:", ";}& > dd:last-child{margin-bottom:", ";}dd + dt{margin-top:", ";}"], selection, function (_ref) {
|
|
21
21
|
var appearance = _ref.appearance;
|
|
22
22
|
return appearance && css(["dt{color:", ";", " ", "}"], term.appearance[appearance].color, getFontStyling(termTypographyTypes[appearance]), appearance === 'bold' && css(["font-weight:600;"]));
|
|
23
|
-
},
|
|
23
|
+
}, function (_ref2) {
|
|
24
|
+
var _ref2$direction = _ref2.direction,
|
|
25
|
+
direction = _ref2$direction === void 0 ? 'column' : _ref2$direction;
|
|
26
|
+
return direction;
|
|
27
|
+
}, list.rowDirection.columnGap, term.firstOfType.marginTop, desc.lastChild.marginBottom, list.beforeNextTerm.marginTop);
|
|
24
28
|
var DescriptionList = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
25
29
|
var _props$appearance = props.appearance,
|
|
26
30
|
appearance = _props$appearance === void 0 ? 'bold' : _props$appearance,
|
|
31
|
+
_props$direction = props.direction,
|
|
32
|
+
direction = _props$direction === void 0 ? 'column' : _props$direction,
|
|
27
33
|
children = props.children,
|
|
28
34
|
id = props.id,
|
|
29
35
|
className = props.className,
|
|
30
36
|
htmlProps = props.htmlProps,
|
|
31
|
-
rest = __rest(props, ["appearance", "children", "id", "className", "htmlProps"]);
|
|
37
|
+
rest = __rest(props, ["appearance", "direction", "children", "id", "className", "htmlProps"]);
|
|
32
38
|
var dListProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
|
|
33
39
|
appearance: appearance,
|
|
40
|
+
direction: direction,
|
|
34
41
|
ref: ref
|
|
35
42
|
});
|
|
36
43
|
return jsx(DList, Object.assign({}, dListProps, {
|
|
@@ -3,6 +3,7 @@ declare const _default: {
|
|
|
3
3
|
title: string;
|
|
4
4
|
component: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDListElement>, "id" | "className"> & {
|
|
5
5
|
appearance?: import("./DescriptionList").DescriptionListAppearance | undefined;
|
|
6
|
+
direction?: "row" | "column" | undefined;
|
|
6
7
|
} & {
|
|
7
8
|
children?: import("react").ReactNode;
|
|
8
9
|
} & {
|
|
@@ -14,4 +15,4 @@ export declare const Overview: () => JSX.Element;
|
|
|
14
15
|
export declare const Default: (args: DescriptionListProps) => JSX.Element;
|
|
15
16
|
export declare const Group: (args: DescriptionListProps) => JSX.Element;
|
|
16
17
|
export declare const WithIcon: (args: DescriptionListProps) => JSX.Element;
|
|
17
|
-
export declare const
|
|
18
|
+
export declare const RowDirectionExample: (args: DescriptionListProps) => JSX.Element;
|
|
@@ -3,10 +3,18 @@ import { BaseComponentPropsWithChildren } from '../../types';
|
|
|
3
3
|
export type DescriptionListGroupProps = BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
4
4
|
/**Custom margin. */
|
|
5
5
|
margin?: Property.Margin<string>;
|
|
6
|
+
/**Custom min-width. */
|
|
7
|
+
minWidth?: Property.MinWidth<string>;
|
|
8
|
+
/**Custom max-width. */
|
|
9
|
+
maxWidth?: Property.MaxWidth<string>;
|
|
6
10
|
}>;
|
|
7
11
|
export declare const DescriptionListGroup: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLDivElement>, "id" | "className"> & {
|
|
8
12
|
/**Custom margin. */
|
|
9
13
|
margin?: Property.Margin<string> | undefined;
|
|
14
|
+
/**Custom min-width. */
|
|
15
|
+
minWidth?: Property.MinWidth<string> | undefined;
|
|
16
|
+
/**Custom max-width. */
|
|
17
|
+
maxWidth?: Property.MaxWidth<string> | undefined;
|
|
10
18
|
} & {
|
|
11
19
|
children?: import("react").ReactNode;
|
|
12
20
|
} & {
|
|
@@ -8,21 +8,31 @@ import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
|
8
8
|
var DListGroup = styled.div.withConfig({
|
|
9
9
|
displayName: "DescriptionListGroup__DListGroup",
|
|
10
10
|
componentId: "sc-jkdc0o-0"
|
|
11
|
-
})(["margin:", ";"], function (_ref) {
|
|
11
|
+
})(["margin:", ";", " ", ""], function (_ref) {
|
|
12
12
|
var margin = _ref.margin;
|
|
13
13
|
return margin ? margin : descriptionListTokens.group.base.margin;
|
|
14
|
+
}, function (_ref2) {
|
|
15
|
+
var minWidth = _ref2.minWidth;
|
|
16
|
+
return minWidth && "min-width: ".concat(minWidth);
|
|
17
|
+
}, function (_ref3) {
|
|
18
|
+
var maxWidth = _ref3.maxWidth;
|
|
19
|
+
return maxWidth && "max-width: ".concat(maxWidth);
|
|
14
20
|
});
|
|
15
21
|
var DescriptionListGroup = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
16
22
|
var children = props.children,
|
|
17
23
|
margin = props.margin,
|
|
24
|
+
minWidth = props.minWidth,
|
|
25
|
+
maxWidth = props.maxWidth,
|
|
18
26
|
id = props.id,
|
|
19
27
|
className = props.className,
|
|
20
28
|
htmlProps = props.htmlProps,
|
|
21
|
-
rest = __rest(props, ["children", "margin", "id", "className", "htmlProps"]);
|
|
29
|
+
rest = __rest(props, ["children", "margin", "minWidth", "maxWidth", "id", "className", "htmlProps"]);
|
|
22
30
|
var dListGroupProps = Object.assign(Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest)), {
|
|
23
31
|
children: children,
|
|
24
32
|
ref: ref,
|
|
25
|
-
margin: margin
|
|
33
|
+
margin: margin,
|
|
34
|
+
minWidth: minWidth,
|
|
35
|
+
maxWidth: maxWidth
|
|
26
36
|
});
|
|
27
37
|
return jsx(DListGroup, Object.assign({}, dListGroupProps, {
|
|
28
38
|
children: children
|
|
@@ -12,5 +12,5 @@ export declare const InputMessage: import("react").ForwardRefExoticComponent<Pic
|
|
|
12
12
|
/** Formålet med meldingen. Påvirker styling. */
|
|
13
13
|
messageType: InputMessageType;
|
|
14
14
|
} & {
|
|
15
|
-
htmlProps?: import("react").HTMLAttributes<HTMLDivElement> | undefined;
|
|
15
|
+
htmlProps?: import("react").HTMLAttributes<HTMLDivElement> | undefined;
|
|
16
16
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -22,7 +22,7 @@ var InputMessageWrapper = styled.div.withConfig({
|
|
|
22
22
|
componentId: "sc-c954fy-0"
|
|
23
23
|
})(["display:flex;width:fit-content;word-break:break-word;max-width:100%;", " svg{margin-top:", ";}"], function (_ref) {
|
|
24
24
|
var messageType = _ref.messageType;
|
|
25
|
-
return messageType === '
|
|
25
|
+
return messageType === 'error' ? css(["color:", ";background-color:", ";padding:", ";gap:", ";"], inputMessageTokens.message.error.color, inputMessageTokens.message.error.backgroundColor, inputMessageTokens.message.error.padding, inputMessageTokens.message.error.gap) : '';
|
|
26
26
|
}, inputMessageTokens.icon.marginTop);
|
|
27
27
|
var InputMessage = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
28
28
|
var message = props.message,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@norges-domstoler/dds-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "React components used in Elsa - domstolenes designsystem",
|
|
5
5
|
"author": "Elsa team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"@storybook/addons": "^6.5.15",
|
|
62
62
|
"@storybook/builder-webpack5": "^6.5.15",
|
|
63
63
|
"@storybook/manager-webpack5": "^6.5.15",
|
|
64
|
-
"@storybook/mdx2-csf": "^0.0.
|
|
65
|
-
"@storybook/react": "^6.5.
|
|
64
|
+
"@storybook/mdx2-csf": "^0.0.4",
|
|
65
|
+
"@storybook/react": "^6.5.16",
|
|
66
66
|
"@storybook/theming": "^6.5.15",
|
|
67
67
|
"@testing-library/jest-dom": "^5.16.5",
|
|
68
68
|
"@testing-library/react": "^13.4.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@types/react": "^18.0.21",
|
|
72
72
|
"@types/react-dom": "^18.0.6",
|
|
73
73
|
"@types/styled-components": "^5.1.26",
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^5.52.0",
|
|
75
75
|
"@typescript-eslint/parser": "^5.38.1",
|
|
76
76
|
"babel-loader": "^9.1.2",
|
|
77
77
|
"babel-plugin-styled-components": "^2.0.7",
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
"eslint": "^8.24.0",
|
|
80
80
|
"eslint-config-prettier": "^8.5.0",
|
|
81
81
|
"eslint-plugin-prettier": "^4.2.1",
|
|
82
|
-
"eslint-plugin-react": "^7.
|
|
82
|
+
"eslint-plugin-react": "^7.32.2",
|
|
83
83
|
"eslint-plugin-storybook": "^0.6.4",
|
|
84
84
|
"jest": "^29.4.2",
|
|
85
|
-
"jest-environment-jsdom": "^29.
|
|
85
|
+
"jest-environment-jsdom": "^29.4.2",
|
|
86
86
|
"react": "^18.2.0",
|
|
87
87
|
"react-dom": "^18.2.0",
|
|
88
88
|
"rollup": "^3.10.0",
|