@moderneinc/design-system-components 7.9.0-next.227c6c → 7.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/dist/index.js CHANGED
@@ -773,6 +773,7 @@ function ModBreadcrumbs({ children, className }) {
773
773
  );
774
774
  }
775
775
 
776
+ const LABEL_LINE_HEIGHT = 20;
776
777
  const StyledButton = styles.styled(Button, {
777
778
  shouldForwardProp: (prop) => prop !== "buttonVariant" && prop !== "buttonSize"
778
779
  })(({ theme, buttonVariant: variant, buttonSize: size }) => {
@@ -789,24 +790,30 @@ const StyledButton = styles.styled(Button, {
789
790
  }
790
791
  };
791
792
  const sizeStyles = sizeConfig[size];
793
+ const paddingY = (sizeStyles.height - LABEL_LINE_HEIGHT) / 2 - 1;
792
794
  const paddingX = variant === "tertiary" ? 0 : sizeStyles.paddingX;
793
795
  const spinnerSize = size === "small" ? designSystemTokens.iconSize.md : designSystemTokens.iconSize.xl;
794
796
  const disabled = `&.${Button.buttonClasses.disabled}:not(.${Button.buttonClasses.loading})`;
795
797
  const baseStyles = {
796
- height: sizeStyles.height,
797
- padding: `0 ${paddingX}px`,
798
+ // A label that wraps grows the button instead of spilling out of it; fit-content, not auto, so a
799
+ // flex row doesn't stretch it to the row's tallest item
800
+ minHeight: sizeStyles.height,
801
+ height: "fit-content",
802
+ padding: `${paddingY}px ${paddingX}px`,
798
803
  fontFamily: "inherit",
799
804
  fontSize: sizeStyles.fontSize,
800
805
  fontWeight: designSystemTokens.typography.fontWeight.semiBold,
801
806
  letterSpacing: "inherit",
802
807
  lineHeight: "1.25rem",
808
+ textAlign: "center",
803
809
  borderRadius: designSystemTokens.borderRadius.button,
804
810
  textTransform: "none",
805
811
  transition: theme.transitions.create(["background-color", "border-color", "color"], {
806
812
  duration: theme.transitions.duration.short
807
813
  }),
808
814
  position: "relative",
809
- minWidth: "fit-content",
815
+ // Shrinks in a tight row down to its longest word, then wraps
816
+ minWidth: "min-content",
810
817
  gap: designSystemTokens.spacing.spacing_1,
811
818
  ...touchTarget(theme),
812
819
  // `gap` spaces the icons; MUI's slot margins would add to it
@@ -6496,6 +6503,10 @@ const Group = styles.styled("div", {
6496
6503
  shouldForwardProp: (prop) => prop !== "splitVariant"
6497
6504
  })(({ theme, splitVariant }) => ({
6498
6505
  display: "inline-flex",
6506
+ // Both halves match the taller one when the label wraps
6507
+ [`& > .${Button.buttonClasses.root}`]: {
6508
+ height: "auto"
6509
+ },
6499
6510
  [`& > .${Button.buttonClasses.root}:first-of-type`]: {
6500
6511
  borderStartEndRadius: 0,
6501
6512
  borderEndEndRadius: 0