# All files / src/menu MenuWidgetKeyboardProvider.tsx

94.28% Statements 33/35
50% Branches 1/2
100% Functions 1/1
94.28% Lines 33/35

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
    361x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    1x
    178x
    178x
    178x
    178x

    178x
    178x
    178x
    178x
    178x
    178x
    178x
     "use client";
    import { type ReactElement, type ReactNode } from "react";
    import { type KeyboardMovementContext } from "../movement/types.js";
    import { KeyboardMovementProvider } from "../movement/useKeyboardMovementProvider.js";

    /**
     * @remarks \@since 6.0.0
     * @internal
     */
    export interface MenuWidgetKeyboardProviderProps {
      value: Readonly<KeyboardMovementContext>;
      disabled: boolean;
      children: ReactNode;
    }

    /**
     * **Client Component**
     *
     * @remarks \@since 6.0.0
     * @internal
     */
    export function MenuWidgetKeyboardProvider(
      props: MenuWidgetKeyboardProviderProps
    ): ReactElement {
      const { value, disabled, children } = props;
      if (disabled) {
        return <>{children}</>;
      }

      return (
        <KeyboardMovementProvider value={value}>
          {children}
        </KeyboardMovementProvider>
      );
    }