AutoSizeInput.js — react Source File
Architecture documentation for AutoSizeInput.js, a javascript file in the react codebase. 2 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 02194688_f76e_9fd1_c1a7_fcc33ebcc5ab["AutoSizeInput.js"] 535e65e6_0d33_7d7c_6325_af13391dfa50["AutoSizeInput.css"] 02194688_f76e_9fd1_c1a7_fcc33ebcc5ab --> 535e65e6_0d33_7d7c_6325_af13391dfa50 ac587885_e294_a1e9_b13f_5e7b920fdb42["react"] 02194688_f76e_9fd1_c1a7_fcc33ebcc5ab --> ac587885_e294_a1e9_b13f_5e7b920fdb42 04e82e8f_4cf5_68df_3f32_fe28fb509921["EditableName.js"] 04e82e8f_4cf5_68df_3f32_fe28fb509921 --> 02194688_f76e_9fd1_c1a7_fcc33ebcc5ab a7173e0c_ba07_009a_1ada_f864062596b5["StyleEditor.js"] a7173e0c_ba07_009a_1ada_f864062596b5 --> 02194688_f76e_9fd1_c1a7_fcc33ebcc5ab style 02194688_f76e_9fd1_c1a7_fcc33ebcc5ab 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 styles from './AutoSizeInput.css';
type Props = {
className?: string,
onFocus?: (event: FocusEvent) => void,
placeholder?: string,
testName?: ?string,
value: any,
};
export default function AutoSizeInput({
className,
onFocus,
placeholder = '',
testName,
value,
...rest
}: Props): React.Node {
// $FlowFixMe[missing-local-annot]
const onFocusWrapper = event => {
const input = event.target;
if (input !== null) {
input.selectionStart = 0;
input.selectionEnd = value.length;
}
if (typeof onFocus === 'function') {
onFocus(event);
}
};
const isEmpty = value === '' || value === '""';
return (
// $FlowFixMe[cannot-spread-inexact] unsafe rest spread
<input
className={[styles.Input, className].join(' ')}
data-testname={testName}
onFocus={onFocusWrapper}
placeholder={placeholder}
style={{
width: `calc(${isEmpty ? placeholder.length : value.length}ch + 1px)`,
}}
value={isEmpty ? '' : value}
{...rest}
/>
);
}
Domain
Subdomains
Functions
Dependencies
- AutoSizeInput.css
- react
Imported By
Source
Frequently Asked Questions
What does AutoSizeInput.js do?
AutoSizeInput.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 AutoSizeInput.js?
AutoSizeInput.js defines 2 function(s): AutoSizeInput, type.onFocus.
What does AutoSizeInput.js depend on?
AutoSizeInput.js imports 2 module(s): AutoSizeInput.css, react.
What files import AutoSizeInput.js?
AutoSizeInput.js is imported by 2 file(s): EditableName.js, StyleEditor.js.
Where is AutoSizeInput.js in the architecture?
AutoSizeInput.js is located at packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor/AutoSizeInput.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-shared/src/devtools/views/Components/NativeStyleEditor).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free