@norges-domstoler/dds-components 0.0.0-dev-20240305141413 → 0.0.0-dev-20240306131021

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.mjs CHANGED
@@ -3509,6 +3509,22 @@ var getDefaultTypographyType = (h) => {
3509
3509
  return "headingSans06";
3510
3510
  }
3511
3511
  };
3512
+ var scaledTypographyType = (type) => {
3513
+ switch (type) {
3514
+ case "headingSans08":
3515
+ return "headingSans07";
3516
+ case "headingSans07":
3517
+ return "headingSans06";
3518
+ case "headingSans06":
3519
+ return "headingSans05";
3520
+ case "headingSans05":
3521
+ return "headingSans04";
3522
+ case "headingSans04":
3523
+ return "headingSans03";
3524
+ default:
3525
+ return type;
3526
+ }
3527
+ };
3512
3528
  var Heading = forwardRef4(
3513
3529
  (props, ref) => {
3514
3530
  const {
@@ -3521,9 +3537,12 @@ var Heading = forwardRef4(
3521
3537
  ...rest
3522
3538
  } = props;
3523
3539
  const headingElement = getHeadingElement(level);
3540
+ const standardTypographyType = typographyType7 != null ? typographyType7 : getDefaultTypographyType(headingElement);
3541
+ const screenSize = useScreenSize();
3542
+ const isSmallScreen = screenSize <= 1 /* Small */;
3524
3543
  const headingProps = {
3525
3544
  ...getBaseHTMLProps(id, className, htmlProps, rest),
3526
- typographyType: typographyType7 ? typographyType7 : getDefaultTypographyType(headingElement),
3545
+ typographyType: isSmallScreen ? scaledTypographyType(standardTypographyType) : standardTypographyType,
3527
3546
  as: headingElement,
3528
3547
  ref
3529
3548
  };