Home / File/ SearchInput.js — react Source File

SearchInput.js — react Source File

Architecture documentation for SearchInput.js, a javascript file in the react codebase. 8 imports, 0 dependents.

File javascript BabelCompiler Validation 8 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  9ae0d283_dcfa_919c_9bba_95892e72fbcd["SearchInput.js"]
  f9049b08_60f8_abce_a6a6_153f88447124["Button.js"]
  9ae0d283_dcfa_919c_9bba_95892e72fbcd --> f9049b08_60f8_abce_a6a6_153f88447124
  f71ee326_17f0_7db4_4178_2763fb1c2ad1["Button"]
  9ae0d283_dcfa_919c_9bba_95892e72fbcd --> f71ee326_17f0_7db4_4178_2763fb1c2ad1
  9f39024f_b905_9b0f_2fc7_e24785732638["ButtonIcon.js"]
  9ae0d283_dcfa_919c_9bba_95892e72fbcd --> 9f39024f_b905_9b0f_2fc7_e24785732638
  4690d9c0_cb81_9593_7817_f9e61a49f9e7["ButtonIcon"]
  9ae0d283_dcfa_919c_9bba_95892e72fbcd --> 4690d9c0_cb81_9593_7817_f9e61a49f9e7
  21af3248_c15c_a61c_1f5b_7409a91b945c["Icon.js"]
  9ae0d283_dcfa_919c_9bba_95892e72fbcd --> 21af3248_c15c_a61c_1f5b_7409a91b945c
  f23861b1_8332_6fa9_2862_ddd6110f3776["Icon"]
  9ae0d283_dcfa_919c_9bba_95892e72fbcd --> f23861b1_8332_6fa9_2862_ddd6110f3776
  4849a20b_f05b_e4d8_1e24_3bd7e0e4f9ca["SearchInput.css"]
  9ae0d283_dcfa_919c_9bba_95892e72fbcd --> 4849a20b_f05b_e4d8_1e24_3bd7e0e4f9ca
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  9ae0d283_dcfa_919c_9bba_95892e72fbcd --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  style 9ae0d283_dcfa_919c_9bba_95892e72fbcd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

import * as React from 'react';
import {useEffect, useRef} from 'react';
import Button from './Button';
import ButtonIcon from './ButtonIcon';
import Icon from './Icon';

import styles from './SearchInput.css';

type Props = {
  goToNextResult: () => void,
  goToPreviousResult: () => void,
  placeholder: string,
  search: (text: string) => void,
  searchIndex: number,
  searchResultsCount: number,
  searchText: string,
  testName?: ?string,
};

export default function SearchInput({
  goToNextResult,
  goToPreviousResult,
  placeholder,
  search,
  searchIndex,
  searchResultsCount,
  searchText,
  testName,
}: Props): React.Node {
  const inputRef = useRef<HTMLInputElement | null>(null);

  const resetSearch = () => search('');

  // $FlowFixMe[missing-local-annot]
  const handleChange = ({currentTarget}) => {
    search(currentTarget.value);
  };
  // $FlowFixMe[missing-local-annot]
  const handleKeyPress = ({key, shiftKey}) => {
    if (key === 'Enter') {
      if (shiftKey) {
        goToPreviousResult();
      } else {
        goToNextResult();
      }
    }
  };

  // Auto-focus search input
  useEffect(() => {
    if (inputRef.current === null) {
// ... (85 more lines)

Domain

Subdomains

Frequently Asked Questions

What does SearchInput.js do?
SearchInput.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in SearchInput.js?
SearchInput.js defines 4 function(s): SearchInput, type.goToNextResult, type.goToPreviousResult, type.search.
What does SearchInput.js depend on?
SearchInput.js imports 8 module(s): Button, Button.js, ButtonIcon, ButtonIcon.js, Icon, Icon.js, SearchInput.css, react.
Where is SearchInput.js in the architecture?
SearchInput.js is located at packages/react-devtools-shared/src/devtools/views/SearchInput.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free