Skip to content

Commit

Permalink
fix(autocapitalize): remove autoCapitalize
Browse files Browse the repository at this point in the history
  • Loading branch information
aliraza556 committed Oct 15, 2024
1 parent cbbe490 commit 55dc006
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/BaseTextInput/WebTextInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import styled from 'styled-components'
import { colors } from '~/utils/colors'
import { BaseTextInputProps } from '../types'

type Props = Required<Pick<BaseTextInputProps, 'colorName' | 'disabled' | 'placeholderTextColor' | 'textAlign'>>
type Props = Required<
Pick<BaseTextInputProps, 'autoCapitalize' | 'colorName' | 'disabled' | 'placeholderTextColor' | 'textAlign'>
>

export const WebTextInput = styled.input<Props>`
-webkit-appearance: none;
Expand All @@ -16,6 +18,7 @@ export const WebTextInput = styled.input<Props>`
outline: 0;
padding: 0;
text-align: ${({ textAlign }) => textAlign};
text-transform: ${({ autoCapitalize }) => autoCapitalize};
&:focus {
border: none;
Expand Down
2 changes: 2 additions & 0 deletions src/components/BaseTextInput/defaultProps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ type DefaultProps = Required<
Pick<
BaseTextInputProps,
| 'autoComplete'
| 'autoCapitalize'
| 'colorName'
| 'disabled'
| 'maxLength'
Expand All @@ -18,6 +19,7 @@ type DefaultProps = Required<
export const defaultProps: DefaultProps = {
autoComplete: 'off',
colorName: 'black',
autoCapitalize: 'none',
disabled: false,
maxLength: 524288,
placeholder: '',
Expand Down
2 changes: 2 additions & 0 deletions src/components/BaseTextInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const BaseTextInput = forwardRef(
(
{
autoComplete = defaultProps.autoComplete,
autoCapitalize = defaultProps.autoCapitalize,
autoFocus,
className,
colorName = defaultProps.colorName,
Expand Down Expand Up @@ -41,6 +42,7 @@ export const BaseTextInput = forwardRef(
return (
<WebTextInput
ref={ref}
autoCapitalize={autoCapitalize}
autoComplete={autoComplete}
autoFocus={autoFocus}
className={className}
Expand Down
3 changes: 3 additions & 0 deletions src/components/BaseTextInput/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ type TextAlign = 'left' | 'right'

type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send'

type AutoCapitalize = 'characters' | 'none' | 'sentences' | 'words'

export type InputType = 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'url'

export type BaseTextInputProps = {
autoComplete?: string
autoCapitalize?: AutoCapitalize
autoFocus?: boolean
className?: string
colorName?: ColorName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const FormInput = ({
<Fragment key={field.id}>
<Grid item xs={5}>
<TextInput
autoCapitalize="none"
autoComplete="off"
className="text-input"
dataTestId={`cy-item-name-${index}`}
Expand Down
2 changes: 2 additions & 0 deletions src/components/common/TextInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export const TextInput = ({
value={value}
>
<WebTextInput
autoCapitalize="none"
colorName="white"
data-testid={dataTestId}
disabled={disabled}
Expand All @@ -226,6 +227,7 @@ export const TextInput = ({
) : (
<BaseTextInput
{...props}
autoCapitalize="none"
colorName="white"
dataTestId={dataTestId}
id={id}
Expand Down

0 comments on commit 55dc006

Please sign in to comment.