# All files / src/form formMessageStyles.ts

88.23% Statements 45/51
100% Branches 4/4
66.66% Functions 2/3
88.23% Lines 45/51

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
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    521x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    2x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    2x
    2x
    2x
    2x
    2x
    2x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x

     import { cnb } from "cnbuilder";
    import { cssUtils } from "../cssUtils.js";
    import { bem } from "../utils/bem.js";
    import { type FormMessageClassNameOptions } from "./types.js";

    const styles = bem("rmd-form-message");

    /**
     * @remarks \@since 6.0.0
     */
    export function formMessage(options: FormMessageClassNameOptions = {}): string {
      const { className, error = false, theme = "none" } = options;

      return cnb(
        styles({ [theme]: theme !== "none" }),
        cssUtils({ textColor: error ? "error" : "text-secondary" }),
        className
      );
    }

    /** @remarks \@since 6.0.0 */
    export interface FormMessageTextClassNameOptions {
      className?: string;
    }

    /**
     * @remarks \@since 6.0.0
     */
    export function formMessageText(
      options: FormMessageTextClassNameOptions = {}
    ): string {
      const { className } = options;

      return cnb(styles("message"), className);
    }

    /** @remarks \@since 6.0.0 */
    export interface FormMessageCounterClassNameOptions {
      className?: string;
    }

    /**
     * @remarks \@since 6.0.0
     */
    export function formMessageCounter(
      options: FormMessageCounterClassNameOptions = {}
    ): string {
      const { className } = options;

      return cnb(styles("counter"), className);
    }