/*! * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved. * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.") * * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and limitations under the License. */ import { ChangeEventHandler, FocusEventHandler } from "react"; import type { HtmlProps } from "./HtmlProps.js"; import { FieldComponentProps } from "./FieldComponentProps.js"; import { FocusHandle } from "./inputUtils.js"; export type PasswordFieldProps = { /** * Controls the browser autocomplete hint for the password field. * - If `'current-password'`, hints that the field is for signing in with an existing password. * - If `'new-password'`, hints that the field is for creating or updating a password; browsers may suggest a strong password. */ autoCompleteType?: "current-password" | "new-password"; /** * initial value for input. Use when component in uncontrolled. */ defaultValue?: string; /** * If `true`, the input receives focus automatically on mount. */ hasInitialFocus?: boolean; /** * If `true`, renders a toggle button that lets the user reveal or hide the password value. * @default true */ hasShowPassword?: boolean; /** * Ref attached to the underlying element. */ inputRef?: React.RefObject; /** * The label for the `input` element. */ label: string; /** * Called when the input loses focus. */ onBlur?: FocusEventHandler; /** * Called when the input value changes. */ onChange?: ChangeEventHandler; /** * Called when the input gains focus. */ onFocus?: FocusEventHandler; /** * The short hint displayed in the `input` before the user enters a value. */ placeholder?: string; /** * Accessible name for the password visibility toggle. This is a stable name that does not change when the password is shown or hidden — the toggle's pressed state is conveyed through `aria-pressed`, so the name must stay constant to follow the ARIA toggle-button pattern. Override per instance when a page has more than one PasswordField (or when collecting other sensitive input such as a security answer) so screen-reader users can tell the toggles apart (e.g. "Show re-entered password"). */ showPasswordToggleAriaLabel?: string; /** * The value of the `input` element. Use when component is controlled. */ value?: string; } & FieldComponentProps & Pick; declare const MemoizedPasswordField: import("react").MemoExoticComponent element. */ inputRef?: React.RefObject; /** * The label for the `input` element. */ label: string; /** * Called when the input loses focus. */ onBlur?: FocusEventHandler; /** * Called when the input value changes. */ onChange?: ChangeEventHandler; /** * Called when the input gains focus. */ onFocus?: FocusEventHandler; /** * The short hint displayed in the `input` before the user enters a value. */ placeholder?: string; /** * Accessible name for the password visibility toggle. This is a stable name that does not change when the password is shown or hidden — the toggle's pressed state is conveyed through `aria-pressed`, so the name must stay constant to follow the ARIA toggle-button pattern. Override per instance when a page has more than one PasswordField (or when collecting other sensitive input such as a security answer) so screen-reader users can tell the toggles apart (e.g. "Show re-entered password"). */ showPasswordToggleAriaLabel?: string; /** * The value of the `input` element. Use when component is controlled. */ value?: string; } & FieldComponentProps & Pick & import("react").RefAttributes>>; export { MemoizedPasswordField as PasswordField }; //# sourceMappingURL=PasswordField.d.ts.map