Skip to content

Commit

Permalink
merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessioGr committed Jul 31, 2024
1 parent aeeb470 commit 0244109
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
5 changes: 4 additions & 1 deletion packages/ui/src/fields/Password/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export type PasswordFieldProps = {
style?: React.CSSProperties
validate?: Validate
width?: string
} & Pick<FormFieldBase, 'AfterInput' | 'BeforeInput' | 'CustomDescription' | 'CustomError' | 'CustomLabel' | >
} & Pick<
FormFieldBase,
'AfterInput' | 'BeforeInput' | 'CustomDescription' | 'CustomError' | 'CustomLabel'
>

const PasswordFieldComponent: React.FC<PasswordFieldProps> = (props) => {
const {
Expand Down
7 changes: 4 additions & 3 deletions packages/ui/src/fields/Password/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React from 'react'

import type { PasswordInputProps } from './types.js'

import { RenderComponent } from '../../providers/ComponentMap/RenderComponent.js'
import { FieldError } from '../FieldError/index.js'
import { FieldLabel } from '../FieldLabel/index.js'
import { fieldBaseClass } from '../shared/index.js'
Expand Down Expand Up @@ -62,7 +63,7 @@ export const PasswordInput: React.FC<PasswordInputProps> = (props) => {
<div className={`${fieldBaseClass}__wrap`}>
<FieldError CustomError={CustomError} path={path} {...(errorProps || {})} />
<div>
{BeforeInput !== undefined && BeforeInput}
<RenderComponent mappedComponent={BeforeInput} />
<input
aria-label={label}
autoComplete={autoComplete}
Expand All @@ -77,9 +78,9 @@ export const PasswordInput: React.FC<PasswordInputProps> = (props) => {
type="password"
value={value || ''}
/>
{AfterInput !== undefined && AfterInput}
<RenderComponent mappedComponent={AfterInput} />
</div>
{CustomDescription !== undefined && CustomDescription}
<RenderComponent mappedComponent={CustomDescription} />
</div>
</div>
)
Expand Down
12 changes: 5 additions & 7 deletions packages/ui/src/fields/Password/types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import type { ErrorProps, LabelProps } from 'payload'
import type { ErrorProps, FormFieldBase, LabelProps } from 'payload'
import type { ChangeEvent } from 'react'
export type PasswordInputProps = {
AfterInput?: React.ReactElement
BeforeInput?: React.ReactElement
CustomDescription?: React.ReactElement
CustomError?: React.ReactElement
CustomLabel?: React.ReactElement
autoComplete?: string
className?: string
errorProps: ErrorProps
Expand All @@ -23,4 +18,7 @@ export type PasswordInputProps = {
style?: React.CSSProperties
value?: string
width?: string
}
} & Pick<
FormFieldBase,
'AfterInput' | 'BeforeInput' | 'CustomDescription' | 'CustomError' | 'CustomLabel'
>

0 comments on commit 0244109

Please sign in to comment.