Upgrading from 1.0 to 1.1
1.1 adds features without breaking the hook. A few defaults changed; each can be turned off.
Summary
npm install @virastack/password@^1.1The hook's options and return value are the same; new fields are additions. The 1.0 docs are archived.
New defaults
| Behavior | 1.0 | 1.1 (how to turn off) |
|---|---|---|
| Form submit / reset | Visibility unchanged | Hidden again (hideOnSubmit: false) |
| autoComplete | Not set | current-password; new-password with policy or matchWith (autoComplete: false) |
| spellCheck, autoCorrect, autoCapitalize | Not set | Off (override in inputProps) |
| Toggle clicked with a mouse | Focus stays on the button | Focus and caret return to the input |
| mergeProps: aria-describedby | Later value wins | Values are joined |
| mergeProps: ref | Later value wins | Refs are composed |
| inputProps.id | aria-controls kept the hook's id | aria-controls follows inputProps.id |
useViraPassword({
hideOnSubmit: false, // keep the 1.0 behavior on submit
autoComplete: false, // leave autocomplete out, as in 1.0
inputProps: { spellCheck: true }, // your inputProps still win
})New features
- Options:
visible,onVisibleChange,hideOnSubmit,hideOnBlur,autoComplete,policy,forbidden,matchWith,value - Return value:
capsLock,strength,strengthProps,matches,issues,rule - Entries: /strength, /server, /pwned
- composeRefs
Package
- Files are
.mjs/.cjswith.d.mts/.d.ctstypes. Deep imports intodistwere never public; use the package entries. getInputAriaAttributesreturns a typed object instead ofRecord<string, any>.- Peer dependencies are unchanged: React and React DOM 18.2+.
