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

452 lines
12 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';
import { InputTextPassThroughOptions } from '../inputtext';
2023-09-05 08:50:46 +00:00
import { PassThroughOptions } from '../passthrough';
import { DefineComponent, DesignToken, EmitFn, GlobalComponentConstructor, HintedString, Nullable, PassThrough } from '../ts-helpers';
2022-09-06 12:03:37 +00:00
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 {
/**
* Defines instance.
*/
2023-07-06 12:01:33 +00:00
instance: any;
/**
* Defines valid properties.
*/
2023-05-05 14:58:54 +00:00
props: PasswordProps;
/**
* Defines current inline state.
*/
2023-05-05 14:58:54 +00:00
state: PasswordState;
/**
* Defines valid attributes.
*/
attrs: any;
/**
* Defines parent options.
*/
parent: any;
2023-09-05 08:50:46 +00:00
/**
* Defines passthrough(pt) options in global config.
*/
global: object | undefined;
2023-05-05 14:58:54 +00:00
}
/**
* Custom shared passthrough(pt) option method.
*/
export interface PasswordSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: PasswordProps;
/**
* Defines current inline state.
*/
state: PasswordState;
}
2023-05-05 14:58:54 +00:00
/**
* Custom passthrough(pt) options.
* @see {@link PasswordProps.pt}
*/
export interface PasswordPassThroughOptions {
/**
* 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.
* @see {@link InputTextPassThroughOptions}
2023-05-05 14:58:54 +00:00
*/
2024-05-06 15:23:01 +00:00
ptInput?: InputTextPassThroughOptions<PasswordSharedPassThroughMethodOptions>;
2023-05-05 14:58:54 +00:00
/**
* Used to pass attributes to the mask icon's DOM element.
2023-05-05 14:58:54 +00:00
*/
maskIcon?: PasswordPassThroughOptionType;
2023-05-05 14:58:54 +00:00
/**
* Used to pass attributes to the unmask icon's DOM element.
2023-05-05 14:58:54 +00:00
*/
unmaskIcon?: PasswordPassThroughOptionType;
2023-05-05 14:58:54 +00:00
/**
* Used to pass attributes to the overlay's DOM element.
2023-05-05 14:58:54 +00:00
*/
overlay?: PasswordPassThroughOptionType;
2023-05-05 14:58:54 +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
/**
* 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
/**
* Used to pass attributes to the meter text's DOM element.
2023-05-05 14:58:54 +00:00
*/
2024-05-06 13:10:13 +00:00
meterText?: PasswordPassThroughOptionType;
2023-05-05 14:58:54 +00:00
/**
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-11-07 06:16:39 +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
*/
appendTo?: HintedString<'body' | 'self'> | 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 'maskicon' slot.
2022-09-06 12:03:37 +00:00
*/
hideIcon?: string | undefined;
/**
* Icon to hide displaying the password as plain text.
*/
maskIcon?: string | undefined;
2022-09-06 12:03:37 +00:00
/**
* Icon to show displaying the password as plain text.
* @deprecated since v3.27.0. Use 'unmaskicon' slot.
2022-09-06 12:03:37 +00:00
*/
showIcon?: string | undefined;
/**
* Icon to show displaying the password as plain text.
*/
unmaskIcon?: string | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
2022-09-06 12:03:37 +00:00
/**
* 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;
2024-01-31 08:02:53 +00:00
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
2022-09-06 12:03:37 +00:00
/**
* 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;
/**
* Identifier of the underlying overlay element.
*/
overlayId?: string | undefined;
/**
* Style class of the overlay.
*/
overlayClass?: string | object | undefined;
/**
* Inline style of the overlay.
*/
overlayStyle?: object | undefined;
/**
* Used to pass all properties of the HTMLDivElement to the overlay inside the component.
*/
overlayProps?: HTMLAttributes | undefined;
2022-09-06 12:03:37 +00:00
/**
* Establishes relationships between the component and label(s) where its value should be one or more element IDs.
*/
2023-11-24 12:21:54 +00:00
ariaLabelledby?: string | undefined;
2022-09-06 12:03:37 +00:00
/**
* Establishes a string value that labels the component.
*/
2023-11-24 12:21:54 +00:00
ariaLabel?: string | undefined;
/**
* It generates scoped CSS variables using design tokens for the component.
*/
dt?: DesignToken<any>;
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?: PassThrough<PasswordPassThroughOptions>;
2023-09-05 08:50:46 +00:00
/**
* Used to configure passthrough(pt) options of the component.
* @type {PassThroughOptions}
*/
ptOptions?: PassThroughOptions;
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[];
/**
* @deprecated since v4.0. Use 'maskicon' slot instead.
* Custom mask icon template.
2023-08-17 07:16:25 +00:00
* @param {Object} scope - hideicon slot's params.
*/
hideicon(scope: {
/**
* Hide icon click event
2023-10-31 17:21:47 +00:00
* @deprecated since v3.39.0. Use 'toggleCallback' property instead.
*/
2023-08-17 07:16:25 +00:00
onClick: () => void;
/**
* Mask icon click event
*/
toggleCallback: () => void;
}): VNode[];
/**
* Custom hide icon template.
* @param {Object} scope - maskicon slot's params.
*/
maskicon(scope: {
2023-10-31 17:21:47 +00:00
/**
* Hide icon click event
* @deprecated since v3.39.0. Use 'toggleCallback' property instead.
*/
onClick: () => void;
/**
* Mask icon click event
2023-10-31 17:21:47 +00:00
*/
toggleCallback: () => void;
}): VNode[];
/**
* @deprecated since v4.0. use 'unmaskicon' slot instead.
* Custom unmask icon template.
2023-08-17 07:16:25 +00:00
* @param {Object} scope - showicon slot's params.
*/
showicon(scope: {
/**
* Unmask icon click event
2023-10-31 17:21:47 +00:00
* @deprecated since v3.39.0. Use 'toggleCallback' property instead.
*/
2023-08-17 07:16:25 +00:00
onClick: () => void;
2023-10-31 17:21:47 +00:00
/**
* Unmask icon click event
*/
toggleCallback: () => void;
}): VNode[];
/**
* Custom unmask icon template.
* @param {Object} scope - showicon slot's params.
*/
unmaskicon(scope: {
/**
* Unmask icon click event
* @deprecated since v3.39.0. Use 'toggleCallback' property instead.
*/
onClick: () => void;
/**
* Unmask icon click event
2023-10-31 17:21:47 +00:00
*/
toggleCallback: () => void;
}): VNode[];
2022-09-06 12:03:37 +00:00
}
2023-03-01 08:50:45 +00:00
/**
* Defines valid emits in Password component.
*/
2024-05-16 14:05:43 +00:00
export interface PasswordEmitsOptions {
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
export declare type PasswordEmits = EmitFn<PasswordEmitsOptions>;
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 08:50:45 +00:00
*/
declare const Password: DefineComponent<PasswordProps, PasswordSlots, PasswordEmits>;
2022-09-06 12:03:37 +00:00
declare module 'vue' {
export interface GlobalComponents {
Password: GlobalComponentConstructor<PasswordProps, PasswordSlots, PasswordEmits>;
2022-09-06 12:03:37 +00:00
}
}
export default Password;