@awsui/components-react
Version:
On July 19th, 2022, we launched [Cloudscape Design System](https://cloudscape.design). Cloudscape is an evolution of AWS-UI. It consists of user interface guidelines, front-end components, design resources, and development tools for building intuitive, en
56 lines • 2.64 kB
JavaScript
import { __rest } from "tslib";
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import React, { useImperativeHandle, useRef } from 'react';
import clsx from 'clsx';
import { getBaseProps } from '../internal/base-component';
import useBaseComponent from '../internal/hooks/use-base-component';
import { applyDisplayName } from '../internal/utils/apply-display-name';
import InternalInput from './internal';
import styles from './styles.css.js';
const Input = React.forwardRef((_a, ref) => {
var { value, type = 'text', step, inputMode, autoComplete = true, spellcheck, disabled, readOnly, disableBrowserAutocorrect, onKeyDown, onKeyUp, onChange, onBlur, onFocus, ariaRequired, name, placeholder, autoFocus, ariaLabel, ariaLabelledby, ariaDescribedby, invalid, warning, controlId, clearAriaLabel } = _a, rest = __rest(_a, ["value", "type", "step", "inputMode", "autoComplete", "spellcheck", "disabled", "readOnly", "disableBrowserAutocorrect", "onKeyDown", "onKeyUp", "onChange", "onBlur", "onFocus", "ariaRequired", "name", "placeholder", "autoFocus", "ariaLabel", "ariaLabelledby", "ariaDescribedby", "invalid", "warning", "controlId", "clearAriaLabel"]);
const baseComponentProps = useBaseComponent('Input', {
props: { autoComplete, autoFocus, disableBrowserAutocorrect, inputMode, readOnly, spellcheck, type },
});
const baseProps = getBaseProps(rest);
const inputRef = useRef(null);
useImperativeHandle(ref, () => ({
focus(...args) {
var _a;
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(...args);
},
select() {
var _a;
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.select();
},
}), [inputRef]);
return (React.createElement(InternalInput, Object.assign({ ref: inputRef }, Object.assign(Object.assign(Object.assign({}, baseProps), baseComponentProps), { autoComplete,
ariaLabel,
ariaRequired,
autoFocus,
disabled,
disableBrowserAutocorrect,
name,
onKeyDown,
onKeyUp,
onChange,
onBlur,
onFocus,
placeholder,
readOnly,
type,
step,
inputMode,
spellcheck,
value,
ariaDescribedby,
ariaLabelledby,
invalid,
warning,
controlId,
clearAriaLabel }), { className: clsx(styles.root, baseProps.className), __inheritFormFieldProps: true })));
});
applyDisplayName(Input, 'Input');
export default Input;
//# sourceMappingURL=index.js.map