# All files / src/transition maxWidthTransition.ts

100% Statements 24/24
100% Branches 4/4
100% Functions 1/1
100% Lines 24/24

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    251x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    26x
    26x
    26x
    26x
    26x
    26x
    26x
    26x
    26x
    26x
     import { cnb } from "cnbuilder";
    import { bem } from "../utils/bem.js";
    import { DISPLAY_NONE_CLASS } from "../utils/isElementVisible.js";

    const styles = bem("rmd-max-width-transition");

    export interface MaxWidthTransitionClassNameOptions {
      className?: string;

      disabled?: boolean;
      transitionIn: boolean;
    }

    export function maxWidthTransition(
      options: MaxWidthTransitionClassNameOptions
    ): string {
      const { disabled, className, transitionIn } = options;

      return cnb(
        !disabled && styles({ visible: transitionIn }),
        disabled && !transitionIn && DISPLAY_NONE_CLASS,
        className
      );
    }