@norges-domstoler/dds-components 10.7.0 → 11.0.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/index.js CHANGED
@@ -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:pointer;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) {
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
- }, focusVisibleTransitionValue, function (_ref2) {
3620
- var appearance = _ref2.appearance,
3621
- purpose = _ref2.purpose;
3622
- 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));
3623
- }, function (_ref3) {
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 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);
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
- size = _ref4.size;
3633
- return hasIcon && hasLabel && styled.css(["gap:", ";"], sizes$1[size].textAndIcon.gap);
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 size = _ref5.size,
3636
- hasLabel = _ref5.hasLabel;
3637
- 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);
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 fullWidth = _ref6.fullWidth,
3640
- hasIcon = _ref6.hasIcon,
3641
- hasLabel = _ref6.hasLabel,
3642
- isLoading = _ref6.isLoading,
3643
- iconPosition = _ref6.iconPosition;
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 (_ref7) {
3650
- var absolutePosition = _ref7.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 justIcon = _ref9.justIcon,
3657
- size = _ref9.size;
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 (_ref10) {
3664
- var isHidden = _ref10.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
- onClick = props.onClick,
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,
@@ -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
- onClick = props.onClick,
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:pointer;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) {
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
- }, focusVisibleTransitionValue, function (_ref2) {
33
- var appearance = _ref2.appearance,
34
- purpose = _ref2.purpose;
35
- return css(["border-radius:", ";box-shadow:", ";color:", ";", ""], appearances[appearance].base.borderRadius, appearances[appearance].base.boxShadow, appearances[appearance].purpose[purpose].base.color, getAppearanceAndPurposeStyling(appearance, purpose));
36
- }, function (_ref3) {
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 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);
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
- size = _ref4.size;
46
- return hasIcon && hasLabel && css(["gap:", ";"], sizes[size].textAndIcon.gap);
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 size = _ref5.size,
49
- hasLabel = _ref5.hasLabel;
50
- 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);
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 fullWidth = _ref6.fullWidth,
53
- hasIcon = _ref6.hasIcon,
54
- hasLabel = _ref6.hasLabel,
55
- isLoading = _ref6.isLoading,
56
- iconPosition = _ref6.iconPosition;
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 (_ref7) {
63
- var absolutePosition = _ref7.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 justIcon = _ref9.justIcon,
70
- size = _ref9.size;
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 (_ref10) {
77
- var isHidden = _ref10.isHidden;
79
+ })(["", ""], function (_ref11) {
80
+ var isHidden = _ref11.isHidden;
78
81
  return isHidden && css(["visibility:hidden;"]);
79
82
  });
80
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norges-domstoler/dds-components",
3
- "version": "10.7.0",
3
+ "version": "11.0.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.3",
65
- "@storybook/react": "^6.5.15",
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.38.1",
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.31.8",
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.0.3",
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",