input.tsx 628 B

123456789101112131415161718192021
  1. import isPropValid from '@emotion/is-prop-valid';
  2. import styled from '@emotion/styled';
  3. import {inputStyles} from 'sentry/styles/input';
  4. export interface InputProps
  5. extends React.InputHTMLAttributes<HTMLInputElement>,
  6. Omit<Parameters<typeof inputStyles>[0], 'theme'> {
  7. type?: React.HTMLInputTypeAttribute;
  8. }
  9. const Input = styled('input', {
  10. shouldForwardProp: prop =>
  11. // Do not forward required to `input` to avoid default browser behavior
  12. typeof prop === 'string' && isPropValid(prop) && prop !== 'required',
  13. })<InputProps>`
  14. ${inputStyles};
  15. `;
  16. // Cast type to avoid exporting theme
  17. export default Input;