Skip to content

Commit

Permalink
feat: add calculateStrength option to password variant
Browse files Browse the repository at this point in the history
  • Loading branch information
joshunrau committed Jul 9, 2024
1 parent 3e8c6e4 commit 9ba22e1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Simplify } from 'type-fest';
import type { IntRange, Simplify } from 'type-fest';

// INTERNAL UTILITIES

Expand Down Expand Up @@ -88,14 +88,19 @@ export type BaseFormField = {
export type FormFieldMixin<TField extends { kind: StaticFieldKind }> = Simplify<BaseFormField & TField>;

export type StringFormField<TValue extends string = string> = FormFieldMixin<
| {
calculateStrength?: (password: string) => IntRange<0, 5>;
kind: 'string';
variant: 'password';
}
| {
kind: 'string';
options: { [K in TValue]: string };
variant: 'radio' | 'select';
}
| {
kind: 'string';
variant: 'input' | 'password' | 'textarea';
variant: 'input' | 'textarea';
}
>;

Expand Down

0 comments on commit 9ba22e1

Please sign in to comment.