mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
fixed the autocapitalization ability
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { forwardRef, InputHTMLAttributes, ReactNode } from "react";
|
import { ChangeEvent, forwardRef, InputHTMLAttributes, ReactNode } from "react";
|
||||||
import { cva, VariantProps } from "cva";
|
import { cva, VariantProps } from "cva";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
@@ -10,6 +10,7 @@ type Props = {
|
|||||||
rightIcon?: ReactNode;
|
rightIcon?: ReactNode;
|
||||||
isDisabled?: boolean;
|
isDisabled?: boolean;
|
||||||
isReadOnly?: boolean;
|
isReadOnly?: boolean;
|
||||||
|
autoCapitalization?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const inputVariants = cva(
|
const inputVariants = cva(
|
||||||
@@ -80,10 +81,19 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|||||||
variant = "filled",
|
variant = "filled",
|
||||||
size = "md",
|
size = "md",
|
||||||
isReadOnly,
|
isReadOnly,
|
||||||
|
autoCapitalization,
|
||||||
...props
|
...props
|
||||||
},
|
},
|
||||||
ref
|
ref
|
||||||
): JSX.Element => {
|
): JSX.Element => {
|
||||||
|
const handleInput = (event: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
console.log(123, props, autoCapitalization)
|
||||||
|
if (autoCapitalization) {
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
event.target.value = event.target.value.toUpperCase();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={inputParentContainerVariants({ isRounded, isError, isFullWidth, variant })}>
|
<div className={inputParentContainerVariants({ isRounded, isError, isFullWidth, variant })}>
|
||||||
{leftIcon && <span className="absolute left-0 ml-3 text-sm">{leftIcon}</span>}
|
{leftIcon && <span className="absolute left-0 ml-3 text-sm">{leftIcon}</span>}
|
||||||
@@ -93,6 +103,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|||||||
ref={ref}
|
ref={ref}
|
||||||
readOnly={isReadOnly}
|
readOnly={isReadOnly}
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
|
onInput={handleInput}
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
leftIcon ? "pl-10" : "pl-2.5",
|
leftIcon ? "pl-10" : "pl-2.5",
|
||||||
rightIcon ? "pr-10" : "pr-2.5",
|
rightIcon ? "pr-10" : "pr-2.5",
|
||||||
|
|||||||
@@ -971,6 +971,7 @@ export const DashboardPage = () => {
|
|||||||
register={register}
|
register={register}
|
||||||
control={control}
|
control={control}
|
||||||
setValue={setValue}
|
setValue={setValue}
|
||||||
|
autoCapitalization={currentWorkspace?.autoCapitalization}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{!isReadOnly && !isRollbackMode && (
|
{!isReadOnly && !isRollbackMode && (
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ type Props = {
|
|||||||
setValue: UseFormSetValue<FormData>;
|
setValue: UseFormSetValue<FormData>;
|
||||||
isKeyError?: boolean;
|
isKeyError?: boolean;
|
||||||
keyError?: string;
|
keyError?: string;
|
||||||
|
autoCapitalization?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SecretInputRow = memo(
|
export const SecretInputRow = memo(
|
||||||
@@ -98,7 +99,8 @@ export const SecretInputRow = memo(
|
|||||||
setValue,
|
setValue,
|
||||||
isKeyError,
|
isKeyError,
|
||||||
keyError,
|
keyError,
|
||||||
secUniqId
|
secUniqId,
|
||||||
|
autoCapitalization
|
||||||
}: Props): JSX.Element => {
|
}: Props): JSX.Element => {
|
||||||
const isKeySubDisabled = useRef<boolean>(false);
|
const isKeySubDisabled = useRef<boolean>(false);
|
||||||
// comment management in a row
|
// comment management in a row
|
||||||
@@ -243,6 +245,7 @@ export const SecretInputRow = memo(
|
|||||||
isKeySubDisabled.current = false;
|
isKeySubDisabled.current = false;
|
||||||
field.onBlur();
|
field.onBlur();
|
||||||
}}
|
}}
|
||||||
|
autoCapitalization={autoCapitalization}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user