@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
46 lines (45 loc) • 1.87 kB
TypeScript
import React, { MutableRefObject } from 'react';
import { Props as StringFieldProps } from '../String';
import { InputProps } from '../../../../components/Input';
export type PasswordVisibilityEvent = React.MouseEvent<HTMLButtonElement> & {
value: string;
};
export type PasswordProps = Omit<StringFieldProps, 'innerRef'> & {
/**
* Fires when the input toggles to show the password.
*/
onShowPassword?: (event: PasswordVisibilityEvent) => void;
/**
* Fires when the input toggles to hide the password.
*/
onHidePassword?: (event: PasswordVisibilityEvent) => void;
/**
* The sizes you can choose is small (1.5rem), default (2rem), medium (2.5rem) and large (3rem) are supported component sizes. Defaults to default / null. Also, if you define a number like size="2" then it will be forwarded as the input element attribute.
*/
size?: InputProps['size'];
/**
* ElementRef passed on to the password input element.
*/
innerRef?: MutableRefObject<HTMLInputElement>;
/**
* @deprecated in v11, use use `locales`prop on `Provider` and override `passwordShowLabel` instead.
*/
show_password?: string;
/**
* @deprecated in v11, use use `locales`prop on `Provider` and override `passwordHideLabel` instead.
*/
hide_password?: string;
/**
* @deprecated in v11, use `onShowPassword` instead.
*/
on_show_password?: (event: PasswordVisibilityEvent) => void;
/**
* @deprecated in v11, use `onHidePassword` instead.
*/
on_hide_password?: (event: PasswordVisibilityEvent) => void;
};
declare function Password({ id, className, innerRef, value, label, disabled, size, ...externalProps }: PasswordProps): import("react/jsx-runtime").JSX.Element;
declare namespace Password {
var _supportsSpacingProps: boolean;
}
export default Password;