# KptAuth (kpt-auth) An authentication screen: sign in, sign up and password recovery in one component, with a promo panel and a list of external providers (OAuth/SSO). Signal Forms. The component is **presentational** - it does not call an API and does not navigate; the app does that in the handlers. Import: `import { KptAuth, KptAuthProviderDef } from '@konce-pt/angular';` ## Selector `kpt-auth` ## Inputs - `mode`: model<'signIn' | 'signUp' | 'forgot'> = 'signIn' - two-way (the app can force a mode) - `layout`: 'slider' | 'split' = 'slider' - the promo panel slides to the other side / stays put - `providers`: KptAuthProvider[] = [] - `{ id, label, icon?, iconUrl?, description? }` - `providerLayout`: 'list' | 'grid' = 'list' - a full-width list / a grid of icons with captions - `showName`, `requireTerms`, `showRemember`: boolean = true - whether the fields are present - `busy`: boolean - the submit button goes into a loading state (submitting is blocked), the providers are blocked; the fields stay editable - `error` / `notice`: string | null - a server message (a `danger` / `success` kpt-alert) - `promoTitle` / `promoText`: string | null - `null` = mode-dependent text from i18n, `''` = hide it (making room for the `[kptAuthPromo]` slot) - `animated`: boolean = true; `animationDuration`: number = 320 (ms) ## Outputs - `signIn`: { email, password, remember } - `signUp`: { name, email, password, terms } - `resetPassword`: { email } - `providerSelect`: KptAuthProvider - the chosen provider (the whole object, not just the `id`) - `modeChange` - from the `mode` model ## Content projection - `[kptAuthBrand]` - a logo/name above the heading - `[kptAuthPromo]` - the promo panel's content (below the title/text, above the CTA) - `[kptAuthSso]` - an enterprise sign-in button **above** the provider separator - `[kptAuthFields]` - extra fields inside the `
` (sign in and sign up - one slot, shown in whichever of the two forms is active) - `[kptAuthFooter]` - the footer (terms, copyright) - `ng-template[kptAuthProvider]="id"` (`KptAuthProviderDef`) - custom markup for a single provider; context: `$implicit` = the provider, `select` = the function that reports the choice **Fields from the `[kptAuthFields]` slot do not enter the component's model.** The consumer binds them to their own form and reads them in the `signIn`/`signUp` handler - they are not part of the emitted value. ## Validation Three independent forms (one per mode), with unconditional validators: e-mail required and valid, password required (sign up: at least 8 characters), the password and its confirmation matching (`validateTree`), consent required when `requireTerms`. Messages are composed from the error's `kind` at render time, so **changing the language at runtime repaints them** (the validators are created once). An error appears only once the field has been touched; `submit()` marks the whole tree as touched itself. That is why the submit button is **not** disabled while the form is invalid: pressing it shows what is missing instead of a dead button (WCAG 3.3.1), and the outputs fire only for a valid form. ## Provider icons The core carries no brand icons. Three ways around it: 1. `provideKptTablerIcons()` from `@konce-pt/angular/icons` -> `icon: 'brand-google'`, `'brand-facebook'`, `'brand-linkedin'`, `'brand-windows'`, `'brand-apple'`, `'brand-github'`, `'key'`. 2. `KptIconRegistry.register({ google: '' })` - note: the sanitizer lets `fill`/`stroke`/`opacity` through, but strips `defs`/gradients and `fill-rule`, and the `viewBox` is fixed at `0 0 24 24`. A multi-color logo needs an explicit `fill` on every path. 3. `iconUrl` (a plain ``) or the `kptAuthProvider` template - for a logo with a gradient. The icon is decorative (`kpt-icon` carries `aria-hidden`), so the button's accessible name always comes from `label`. ## Accessibility - Only the **active mode's form** lives in the DOM - there are no invisible but still focusable elements. - The panel heading carries `tabindex="-1"` and takes focus after a mode change (otherwise the change is not announced, and focus stays on a button that has slid off screen). - Labels through `kpt-form-field` + `controlId`; `autocomplete`: `email`, `current-password`, `new-password`, `name`. - The mode switches are `