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

393 lines
10 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 { ClassComponent, DesignToken, 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 {
/**
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.
* @see {@link InputTextPassThroughOptions}
2023-05-05 14:58:54 +00:00
*/
input?: InputTextPassThroughOptions<PasswordSharedPassThroughMethodOptions>;
2023-05-05 14:58:54 +00:00
/**
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-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 '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 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;
/**
* 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[];
/**
* Custom hide 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;
2023-10-31 17:21:47 +00:00
/**
* Hide icon click event
*/
toggleCallback: () => void;
}): VNode[];
/**
* Custom show icon template.
2023-08-17 07:16:25 +00:00
* @param {Object} scope - showicon slot's params.
*/
showicon(scope: {
/**
2023-10-31 17:21:47 +00:00
* Hide icon click event
* @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
/**
* Hide icon click event
*/
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.
*/
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' {
export interface GlobalComponents {
2022-09-14 11:26:01 +00:00
Password: GlobalComponentConstructor<Password>;
2022-09-06 12:03:37 +00:00
}
}
export default Password;