primevue-mirror/components/lib/password/Password.d.ts

326 lines
8.7 KiB
TypeScript
Raw Normal View History

2023-03-01 08:50:45 +00:00
/**
*
* Password displays strength indicator for password fields.
*
* [Live Demo](https://www.primevue.org/password/)
*
* @module password
*
*/
2023-08-02 14:07:22 +00:00
import { HTMLAttributes, InputHTMLAttributes, TransitionProps, 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';
export declare type PasswordPassThroughOptionType = PasswordPassThroughAttributes | ((options: PasswordPassThroughMethodOptions) => PasswordPassThroughAttributes | string) | string | null | undefined;
2023-05-05 14:58:54 +00:00
2023-08-02 14:07:22 +00:00
export declare type PasswordPassThroughTransitionType = TransitionProps | ((options: PasswordPassThroughMethodOptions) => TransitionProps) | undefined;
2023-05-05 14:58:54 +00:00
/**
* Custom passthrough(pt) option method.
*/
export interface PasswordPassThroughMethodOptions {
2023-07-06 12:01:33 +00:00
instance: any;
2023-05-05 14:58:54 +00:00
props: PasswordProps;
state: PasswordState;
}
/**
* Custom passthrough(pt) options.
* @see {@link PasswordProps.pt}
*/
export interface PasswordPassThroughOptions {
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the root's DOM element.
2023-05-05 14:58:54 +00:00
*/
root?: PasswordPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the InputText component.
2023-05-05 14:58:54 +00:00
* @see {@link InputTextPassThroughOptionType}
*/
input?: PasswordPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the hide icon's DOM element.
2023-05-05 14:58:54 +00:00
*/
hideIcon?: PasswordPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the show icon's DOM element.
2023-05-05 14:58:54 +00:00
*/
showIcon?: PasswordPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the panel's DOM element.
2023-05-05 14:58:54 +00:00
*/
panel?: PasswordPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the meter's DOM element.
2023-05-05 14:58:54 +00:00
*/
meter?: PasswordPassThroughOptionType;
2023-05-26 10:33:49 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the meter label's DOM element.
2023-05-26 10:33:49 +00:00
*/
meterLabel?: PasswordPassThroughOptionType;
2023-05-05 14:58:54 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the info's DOM element.
2023-05-05 14:58:54 +00:00
*/
info?: PasswordPassThroughOptionType;
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to the hidden accessible DOM element.
2023-05-05 14:58:54 +00:00
*/
hiddenAccesible?: PasswordPassThroughOptionType;
2023-07-06 11:09:01 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to manage all lifecycle hooks
2023-07-06 11:09:01 +00:00
* @see {@link BaseComponent.ComponentHooks}
*/
hooks?: ComponentHooks;
2023-08-02 12:02:16 +00:00
/**
* Used to control Vue Transition API.
*/
2023-08-02 14:07:22 +00:00
transition?: PasswordPassThroughTransitionType;
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.
* @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.
* @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.
*/
inputStyle?: object | undefined;
2022-09-06 12:03:37 +00:00
/**
* Style class of the input field.
*/
inputClass?: string | object | undefined;
2022-09-06 12:03:37 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the HTMLInputElement to the focusable input element inside the component.
2022-09-06 12:03:37 +00:00
*/
inputProps?: InputHTMLAttributes | undefined;
/**
* Identifier of the underlying overlay panel element.
*/
panelId?: string | undefined;
/**
* Style class of the overlay panel.
*/
panelClass?: string | object | undefined;
2022-09-06 12:03:37 +00:00
/**
* Inline style of the overlay panel.
*/
panelStyle?: object | undefined;
2022-09-06 12:03:37 +00:00
/**
2023-08-01 14:01:12 +00:00
* Used to pass all properties of the HTMLDivElement to the overlay panel inside the component.
2022-09-06 12:03:37 +00:00
*/
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
/**
2023-08-01 14:01:12 +00:00
* Used to pass attributes to DOM elements inside the component.
2023-05-05 14:58:54 +00:00
* @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[];
/**
* Custom hide icon template.
*/
hideicon(scope: {
/**
* Hide icon click event
*/
onClick(): void;
}): VNode[];
/**
* Custom show icon template.
*/
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;
/**
* Callback to invoke on value change.
* @param {Event} event - Browser event.
*/
change(event: Event): void;
2023-03-01 08:50:45 +00:00
}
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;