@moderneinc/design-system-components 7.9.0-next.869ab7 → 7.9.1-next.3107a8

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.
@@ -15,8 +15,8 @@ export interface ModAlertProps extends Omit<AlertProps, 'severity' | 'variant' |
15
15
  */
16
16
  type?: AlertType;
17
17
  /**
18
- * Vertical density. `default` is page-level (64px fixed height,
19
- * supports title + description). `compact` is inline-panel use (auto
18
+ * Vertical density. `default` is page-level (64px minimum height that
19
+ * grows with wrapped text, supports title + description). `compact` is inline-panel use (auto
20
20
  * height, unchanged for single-line content up to a 32px-tall `action`,
21
21
  * growing with comfortable padding once the message wraps onto multiple
22
22
  * lines).
@@ -35,6 +35,11 @@ export interface ModAlertProps extends Omit<AlertProps, 'severity' | 'variant' |
35
35
  * Custom icon to display (defaults to intent-based icon)
36
36
  */
37
37
  icon?: ReactNode;
38
+ /**
39
+ * Caps the height of the message area; content beyond it scrolls.
40
+ * Unset, the alert grows to fit its content.
41
+ */
42
+ maxHeight?: number | string;
38
43
  /**
39
44
  * Optional action element (typically a button) displayed on the right
40
45
  */
@@ -50,7 +55,7 @@ export interface ModAlertProps extends Omit<AlertProps, 'severity' | 'variant' |
50
55
  * ModAlert - Alert component for displaying contextual status messages
51
56
  */
52
57
  export declare const ModAlert: {
53
- ({ intent, type, size, title, description, icon, action, children, ...props }: ModAlertProps): import("react").JSX.Element;
58
+ ({ intent, type, size, title, description, icon, action, children, maxHeight, ...props }: ModAlertProps): import("react").JSX.Element;
54
59
  displayName: string;
55
60
  };
56
61
  export {};
package/dist/index.d.ts CHANGED
@@ -323,8 +323,8 @@ interface ModAlertProps extends Omit<AlertProps, 'severity' | 'variant' | 'color
323
323
  */
324
324
  type?: AlertType;
325
325
  /**
326
- * Vertical density. `default` is page-level (64px fixed height,
327
- * supports title + description). `compact` is inline-panel use (auto
326
+ * Vertical density. `default` is page-level (64px minimum height that
327
+ * grows with wrapped text, supports title + description). `compact` is inline-panel use (auto
328
328
  * height, unchanged for single-line content up to a 32px-tall `action`,
329
329
  * growing with comfortable padding once the message wraps onto multiple
330
330
  * lines).
@@ -343,6 +343,11 @@ interface ModAlertProps extends Omit<AlertProps, 'severity' | 'variant' | 'color
343
343
  * Custom icon to display (defaults to intent-based icon)
344
344
  */
345
345
  icon?: ReactNode;
346
+ /**
347
+ * Caps the height of the message area; content beyond it scrolls.
348
+ * Unset, the alert grows to fit its content.
349
+ */
350
+ maxHeight?: number | string;
346
351
  /**
347
352
  * Optional action element (typically a button) displayed on the right
348
353
  */
@@ -358,7 +363,7 @@ interface ModAlertProps extends Omit<AlertProps, 'severity' | 'variant' | 'color
358
363
  * ModAlert - Alert component for displaying contextual status messages
359
364
  */
360
365
  declare const ModAlert: {
361
- ({ intent, type, size, title, description, icon, action, children, ...props }: ModAlertProps): react.JSX.Element;
366
+ ({ intent, type, size, title, description, icon, action, children, maxHeight, ...props }: ModAlertProps): react.JSX.Element;
362
367
  displayName: string;
363
368
  };
364
369
 
package/dist/index.esm.js CHANGED
@@ -434,21 +434,26 @@ const intentColors$1 = {
434
434
  info: semanticColors.color.status.info
435
435
  };
436
436
  const StyledAlert$2 = styled(Alert, {
437
- shouldForwardProp: (prop) => prop !== "intent" && prop !== "alertType" && prop !== "alertSize" && prop !== "hasChildren"
437
+ shouldForwardProp: (prop) => prop !== "intent" && prop !== "alertType" && prop !== "alertSize" && prop !== "hasChildren" && prop !== "messageMaxHeight"
438
438
  })(
439
439
  ({
440
440
  theme,
441
441
  intent = "success",
442
442
  alertType = "outlined",
443
443
  alertSize = "default",
444
- hasChildren = false
444
+ hasChildren = false,
445
+ messageMaxHeight
445
446
  }) => {
446
447
  const palette = intentColors$1[intent];
447
448
  const isFilled = alertType === "filled";
448
449
  const isCompact = alertSize === "compact";
449
450
  const iconColor = isFilled ? semanticColors.color.text.tooltip : palette.solid;
450
451
  const messageColor = isFilled ? semanticColors.color.text.tooltip : semanticColors.color.text.primary;
451
- const { verticalPadding, ...sizeStyles } = isCompact ? { minHeight: spacing.spacing_4, verticalPadding: spacing.spacing_1_2 } : hasChildren ? { minHeight: spacing.spacing_8, height: "auto", verticalPadding: spacing.spacing_1_1_2 } : { height: spacing.spacing_8, verticalPadding: 0 };
452
+ const { verticalPadding, ...sizeStyles } = isCompact ? { minHeight: spacing.spacing_4, verticalPadding: spacing.spacing_1_2 } : hasChildren ? { minHeight: spacing.spacing_8, height: "auto", verticalPadding: spacing.spacing_1_1_2 } : {
453
+ minHeight: spacing.spacing_8,
454
+ boxSizing: "border-box",
455
+ verticalPadding: spacing.spacing_1
456
+ };
452
457
  return {
453
458
  ...sizeStyles,
454
459
  width: "100%",
@@ -475,13 +480,9 @@ const StyledAlert$2 = styled(Alert, {
475
480
  flex: 1,
476
481
  display: "flex",
477
482
  flexDirection: "column",
478
- justifyContent: hasChildren ? "flex-start" : "center",
479
- // Stretch + scroll instead of spilling past the fixed-height border.
480
- ...!hasChildren && {
481
- alignSelf: "stretch",
482
- overflowY: "auto",
483
- minHeight: 0
484
- },
483
+ justifyContent: hasChildren ? "flex-start" : "safe center",
484
+ overflowWrap: "anywhere",
485
+ ...messageMaxHeight !== void 0 && { maxHeight: messageMaxHeight, overflowY: "auto" },
485
486
  "& span:last-child": {
486
487
  fontSize: theme.typography.pxToRem(typography.fontSize.sm),
487
488
  fontWeight: typography.fontWeight.medium,
@@ -498,15 +499,7 @@ const StyledAlert$2 = styled(Alert, {
498
499
  }
499
500
  },
500
501
  [theme.breakpoints.down("md")]: {
501
- width: FILL_AVAILABLE,
502
- // A wrapped default alert grows instead of scrolling inside its fixed 64px.
503
- ...!isCompact && !hasChildren && {
504
- height: "auto",
505
- minHeight: spacing.spacing_8 - spacing.spacing_1_1_2 * 2,
506
- paddingTop: spacing.spacing_1_1_2,
507
- paddingBottom: spacing.spacing_1_1_2
508
- },
509
- [`& .${alertClasses.message}`]: { overflowWrap: "anywhere" }
502
+ width: FILL_AVAILABLE
510
503
  }
511
504
  };
512
505
  }
@@ -527,6 +520,7 @@ const ModAlert = ({
527
520
  icon,
528
521
  action,
529
522
  children,
523
+ maxHeight,
530
524
  ...props
531
525
  }) => {
532
526
  const defaultIcon = iconMap[intent];
@@ -538,6 +532,7 @@ const ModAlert = ({
538
532
  alertType: type,
539
533
  alertSize: size,
540
534
  hasChildren: Boolean(children),
535
+ messageMaxHeight: maxHeight,
541
536
  icon: icon ?? defaultIcon,
542
537
  action,
543
538
  children: [