2023-03-01 08:50:45 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Password displays strength indicator for password fields.
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/password/)
|
|
|
|
*
|
|
|
|
* @module password
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
import { HTMLAttributes, InputHTMLAttributes, VNode } from 'vue';
|
2023-07-06 11:17:08 +00:00
|
|
|
import { ComponentHooks } from '../basecomponent';
|
2023-05-05 14:58:54 +00:00
|
|
|
import { InputTextPassThroughOptionType } from '../inputtext';
|
2022-09-06 12:03:37 +00:00
|
|
|
import { ClassComponent, GlobalComponentConstructor, Nullable } from '../ts-helpers';
|
|
|
|
|
2023-05-05 14:58:54 +00:00
|
|
|
export declare type PasswordPassThroughOptionType = PasswordPassThroughAttributes | ((options: PasswordPassThroughMethodOptions) => PasswordPassThroughAttributes) | null | undefined;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) option method.
|
|
|
|
*/
|
|
|
|
export interface PasswordPassThroughMethodOptions {
|
|
|
|
props: PasswordProps;
|
|
|
|
state: PasswordState;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough(pt) options.
|
|
|
|
* @see {@link PasswordProps.pt}
|
|
|
|
*/
|
|
|
|
export interface PasswordPassThroughOptions {
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the root's DOM element.
|
|
|
|
*/
|
|
|
|
root?: PasswordPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the InputText component.
|
|
|
|
* @see {@link InputTextPassThroughOptionType}
|
|
|
|
*/
|
|
|
|
input?: PasswordPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the hide icon's DOM element.
|
|
|
|
*/
|
|
|
|
hideIcon?: PasswordPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the show icon's DOM element.
|
|
|
|
*/
|
|
|
|
showIcon?: PasswordPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the panel's DOM element.
|
|
|
|
*/
|
|
|
|
panel?: PasswordPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the meter's DOM element.
|
|
|
|
*/
|
|
|
|
meter?: PasswordPassThroughOptionType;
|
2023-05-26 10:33:49 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the meter label's DOM element.
|
|
|
|
*/
|
|
|
|
meterLabel?: PasswordPassThroughOptionType;
|
2023-05-05 14:58:54 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the info's DOM element.
|
|
|
|
*/
|
|
|
|
info?: PasswordPassThroughOptionType;
|
|
|
|
/**
|
|
|
|
* Uses to pass attributes to the hidden accessible DOM element.
|
|
|
|
*/
|
|
|
|
hiddenAccesible?: PasswordPassThroughOptionType;
|
2023-07-06 11:09:01 +00:00
|
|
|
/**
|
|
|
|
* Uses to manage all lifecycle hooks
|
|
|
|
* @see {@link BaseComponent.ComponentHooks}
|
|
|
|
*/
|
|
|
|
hooks?: ComponentHooks;
|
2023-05-05 14:58:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Custom passthrough attributes for each DOM elements
|
|
|
|
*/
|
|
|
|
export interface PasswordPassThroughAttributes {
|
|
|
|
[key: string]: any;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Defines current inline state in Password component.
|
|
|
|
*/
|
|
|
|
export interface PasswordState {
|
|
|
|
/**
|
|
|
|
* Current overlay visible state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
overlayVisible: boolean;
|
|
|
|
/**
|
|
|
|
* Current overlay visible state as a boolean.
|
|
|
|
* @see {@link PasswordMeterStateOptions}
|
|
|
|
*/
|
|
|
|
meter: PasswordMeterStateOptions;
|
|
|
|
/**
|
|
|
|
* Current info test state as a string.
|
|
|
|
*/
|
|
|
|
infoText: string;
|
|
|
|
/**
|
|
|
|
* Current focused state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
focused: boolean;
|
|
|
|
/**
|
|
|
|
* Current unmasked state as a boolean.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unmasked: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PasswordMeterStateOptions {
|
|
|
|
/**
|
|
|
|
* Current strength of the meter state as a string.
|
|
|
|
*/
|
|
|
|
strength: string;
|
|
|
|
/**
|
|
|
|
* Current width of the meter state as a string.
|
|
|
|
*/
|
|
|
|
width: string;
|
|
|
|
}
|
|
|
|
|
2023-03-01 08:50:45 +00:00
|
|
|
/**
|
|
|
|
* Defines valid properties in Password component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface PasswordProps extends InputHTMLAttributes {
|
|
|
|
/**
|
|
|
|
* Value of the component.
|
|
|
|
*/
|
|
|
|
modelValue?: Nullable<string>;
|
|
|
|
/**
|
|
|
|
* Text to prompt password entry. Defaults to PrimeVue Locale configuration.
|
|
|
|
*/
|
|
|
|
promptLabel?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Regex for a medium level password.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue ^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{6,})
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
mediumRegex?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Regex for a strong level password.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue ^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.{8,})
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
strongRegex?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Text for a weak password. Defaults to PrimeVue Locale configuration.
|
|
|
|
*/
|
|
|
|
weakLabel?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Text for a medium password. Defaults to PrimeVue Locale configuration.
|
|
|
|
*/
|
|
|
|
mediumLabel?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Text for a strong password. Defaults to PrimeVue Locale configuration.
|
|
|
|
*/
|
|
|
|
strongLabel?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Whether to show the strength indicator or not.
|
2023-03-01 08:50:45 +00:00
|
|
|
* @defaultValue true
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
feedback?: boolean | undefined;
|
|
|
|
/**
|
2023-03-01 08:50:45 +00:00
|
|
|
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
|
2023-03-08 10:51:52 +00:00
|
|
|
* @defaultValue body
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
2023-03-01 08:50:45 +00:00
|
|
|
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Whether to show an icon to display the password as plain text.
|
2023-03-01 08:50:45 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
toggleMask?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to hide displaying the password as plain text.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'hideicon' slot.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
hideIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Icon to show displaying the password as plain text.
|
2023-04-18 10:51:10 +00:00
|
|
|
* @deprecated since v3.27.0. Use 'showicon' slot.
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
showIcon?: string | undefined;
|
|
|
|
/**
|
|
|
|
* When present, it specifies that the component should be disabled.
|
2023-03-01 08:50:45 +00:00
|
|
|
* @defaultValue false
|
2022-09-06 12:03:37 +00:00
|
|
|
*/
|
|
|
|
disabled?: boolean | undefined;
|
|
|
|
/**
|
|
|
|
* Placeholder text for the input.
|
|
|
|
*/
|
|
|
|
placeholder?: string | undefined;
|
2022-09-14 11:26:01 +00:00
|
|
|
/**
|
|
|
|
* When present, it specifies that an input field must be filled out before submitting the form.
|
2023-03-01 08:50:45 +00:00
|
|
|
* @defaultValue false
|
2022-09-14 11:26:01 +00:00
|
|
|
*/
|
|
|
|
required?: boolean | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Identifier of the underlying input element.
|
|
|
|
*/
|
|
|
|
inputId?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Inline style of the input field.
|
|
|
|
*/
|
2023-03-09 07:02:25 +00:00
|
|
|
inputStyle?: object | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Style class of the input field.
|
|
|
|
*/
|
2023-03-09 07:02:25 +00:00
|
|
|
inputClass?: string | object | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass all properties of the HTMLInputElement to the focusable input element inside the component.
|
|
|
|
*/
|
|
|
|
inputProps?: InputHTMLAttributes | undefined;
|
|
|
|
/**
|
|
|
|
* Identifier of the underlying overlay panel element.
|
|
|
|
*/
|
|
|
|
panelId?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Style class of the overlay panel.
|
|
|
|
*/
|
2023-03-09 07:02:25 +00:00
|
|
|
panelClass?: string | object | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Inline style of the overlay panel.
|
|
|
|
*/
|
2023-03-09 07:02:25 +00:00
|
|
|
panelStyle?: object | undefined;
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass all properties of the HTMLDivElement to the overlay panel inside the component.
|
|
|
|
*/
|
|
|
|
panelProps?: HTMLAttributes | undefined;
|
|
|
|
/**
|
|
|
|
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
|
|
|
|
*/
|
|
|
|
'aria-labelledby'?: string | undefined;
|
|
|
|
/**
|
|
|
|
* Establishes a string value that labels the component.
|
|
|
|
*/
|
|
|
|
'aria-label'?: string | undefined;
|
2023-05-05 14:58:54 +00:00
|
|
|
/**
|
|
|
|
* Uses to pass attributes to DOM elements inside the component.
|
|
|
|
* @type {PasswordPassThroughOptions}
|
|
|
|
*/
|
|
|
|
pt?: PasswordPassThroughOptions;
|
2023-05-25 08:53:29 +00:00
|
|
|
/**
|
|
|
|
* When enabled, it removes component related styles in the core.
|
|
|
|
* @defaultValue false
|
|
|
|
*/
|
|
|
|
unstyled?: boolean;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 08:50:45 +00:00
|
|
|
/**
|
|
|
|
* Defines valid slots in Password component.
|
|
|
|
*/
|
2022-09-06 12:03:37 +00:00
|
|
|
export interface PasswordSlots {
|
|
|
|
/**
|
|
|
|
* Custom header template.
|
|
|
|
*/
|
2023-03-01 08:50:45 +00:00
|
|
|
header(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom footer template.
|
|
|
|
*/
|
2023-03-01 08:50:45 +00:00
|
|
|
footer(): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Custom content template.
|
|
|
|
*/
|
2023-03-01 08:50:45 +00:00
|
|
|
content(): VNode[];
|
2023-04-04 12:41:34 +00:00
|
|
|
/**
|
|
|
|
* Custom hide icon template.
|
|
|
|
*/
|
2023-04-18 10:51:10 +00:00
|
|
|
hideicon(scope: {
|
|
|
|
/**
|
|
|
|
* Hide icon click event
|
|
|
|
*/
|
|
|
|
onClick(): void;
|
|
|
|
}): VNode[];
|
2023-04-04 12:41:34 +00:00
|
|
|
/**
|
|
|
|
* Custom show icon template.
|
|
|
|
*/
|
2023-04-18 10:51:10 +00:00
|
|
|
showicon(scope: {
|
|
|
|
/**
|
|
|
|
* Show icon click event
|
|
|
|
*/
|
|
|
|
onClick(): void;
|
|
|
|
}): VNode[];
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
|
2023-03-01 08:50:45 +00:00
|
|
|
/**
|
|
|
|
* Defines valid emits in Password component.
|
|
|
|
*/
|
|
|
|
export interface PasswordEmits {
|
2022-09-06 12:03:37 +00:00
|
|
|
/**
|
|
|
|
* Emitted when the value changes.
|
|
|
|
* @param {string} value - New value.
|
|
|
|
*/
|
2023-03-01 08:50:45 +00:00
|
|
|
'update:modelValue'(value: string): void;
|
|
|
|
}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
2023-03-01 08:50:45 +00:00
|
|
|
/**
|
|
|
|
* **PrimeVue - Password**
|
|
|
|
*
|
|
|
|
* _Password displays strength indicator for password fields._
|
|
|
|
*
|
|
|
|
* [Live Demo](https://www.primevue.org/password/)
|
|
|
|
* --- ---
|
|
|
|
* ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png)
|
|
|
|
*
|
|
|
|
* @group Component
|
|
|
|
*/
|
2023-03-01 14:48:23 +00:00
|
|
|
declare class Password extends ClassComponent<PasswordProps, PasswordSlots, PasswordEmits> {}
|
2022-09-06 12:03:37 +00:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
|
|
|
interface GlobalComponents {
|
2022-09-14 11:26:01 +00:00
|
|
|
Password: GlobalComponentConstructor<Password>;
|
2022-09-06 12:03:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Password;
|