@exegia/corpora-ui 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist-lib/components/blocks/auth/__tests__/linked-accounts-block.test.d.ts +1 -0
  2. package/dist-lib/components/blocks/auth/__tests__/onboarding-block.test.d.ts +1 -0
  3. package/dist-lib/components/blocks/auth/__tests__/passkey-manager-block.test.d.ts +1 -0
  4. package/dist-lib/components/blocks/auth/__tests__/passkey-sign-in-block.test.d.ts +1 -0
  5. package/dist-lib/components/blocks/auth/__tests__/signup-block.test.d.ts +1 -0
  6. package/dist-lib/components/blocks/auth/__tests__/update-password-block.test.d.ts +1 -0
  7. package/dist-lib/components/blocks/auth/linked-accounts-block.d.ts +30 -0
  8. package/dist-lib/components/blocks/auth/onboarding/profile-step.d.ts +19 -0
  9. package/dist-lib/components/blocks/auth/onboarding-block.d.ts +69 -0
  10. package/dist-lib/components/blocks/auth/passkey-manager-block.d.ts +38 -0
  11. package/dist-lib/components/blocks/auth/passkey-sign-in-block.d.ts +27 -0
  12. package/dist-lib/components/blocks/auth/signup-block.d.ts +16 -1
  13. package/dist-lib/components/blocks/auth/update-password-block.d.ts +28 -0
  14. package/dist-lib/components/composed/social-providers.d.ts +7 -0
  15. package/dist-lib/index.d.ts +5 -0
  16. package/dist-lib/index.js +1122 -392
  17. package/dist-lib/index.js.map +1 -1
  18. package/package.json +5 -1
  19. package/src/components/blocks/auth/__tests__/linked-accounts-block.test.tsx +110 -0
  20. package/src/components/blocks/auth/__tests__/onboarding-block.test.tsx +156 -0
  21. package/src/components/blocks/auth/__tests__/passkey-manager-block.test.tsx +131 -0
  22. package/src/components/blocks/auth/__tests__/passkey-sign-in-block.test.tsx +59 -0
  23. package/src/components/blocks/auth/__tests__/signup-block.test.tsx +176 -0
  24. package/src/components/blocks/auth/__tests__/update-password-block.test.tsx +95 -0
  25. package/src/components/blocks/auth/linked-accounts-block.tsx +223 -0
  26. package/src/components/blocks/auth/onboarding/profile-step.tsx +227 -0
  27. package/src/components/blocks/auth/onboarding-block.tsx +240 -0
  28. package/src/components/blocks/auth/passkey-manager-block.tsx +334 -0
  29. package/src/components/blocks/auth/passkey-sign-in-block.tsx +81 -0
  30. package/src/components/blocks/auth/signup-block.tsx +43 -10
  31. package/src/components/blocks/auth/update-password-block.tsx +157 -0
  32. package/src/components/composed/social-providers.tsx +3 -2
  33. package/src/index.ts +5 -0
@@ -0,0 +1,30 @@
1
+ import { SocialProvider } from '../../composed/social-providers';
2
+ import * as React from "react";
3
+ /** One sign-in identity attached to the account. */
4
+ export interface LinkedIdentity {
5
+ id: string;
6
+ provider: SocialProvider;
7
+ /** Account address shown under the provider name, when known. */
8
+ email?: string | null;
9
+ }
10
+ export interface LinkedAccountsBlockProps {
11
+ title?: string;
12
+ description?: string;
13
+ /** Identities already attached to the account. */
14
+ identities?: LinkedIdentity[];
15
+ /** Providers offered as connect candidates; connected ones are filtered out. */
16
+ providers?: SocialProvider[];
17
+ /** Shows the loading row instead of the list. */
18
+ loading?: boolean;
19
+ /** Reject (or throw) to show the inline error. */
20
+ onLink?: (provider: SocialProvider) => Promise<void> | void;
21
+ onUnlink?: (id: string) => Promise<void> | void;
22
+ className?: string;
23
+ }
24
+ /**
25
+ * Settings panel for the sign-in identities attached to an account: lists the
26
+ * connected ones, offers connect buttons for the rest, and guards the last
27
+ * remaining method from being disconnected — the guard is a disabled button
28
+ * plus an explanation rather than an error after the fact.
29
+ */
30
+ export declare function LinkedAccountsBlock({ title, description, identities, providers, loading, onLink, onUnlink, className, }: LinkedAccountsBlockProps): React.JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { OnboardingStepConfig, OnboardingValue } from '../onboarding-block';
2
+ import * as React from "react";
3
+ export interface ProfileStepProps {
4
+ step: OnboardingStepConfig;
5
+ /** Seed values, so drafts survive back/forward navigation. */
6
+ values: Record<string, OnboardingValue>;
7
+ submitting?: boolean;
8
+ submitLabel: string;
9
+ onSubmit: (values: Record<string, OnboardingValue>) => void | Promise<void>;
10
+ onBack?: () => void;
11
+ /** Reports every edit so the flow can restore drafts across navigation. */
12
+ onDraftChange?: (name: string, value: OnboardingValue) => void;
13
+ }
14
+ /**
15
+ * Renders one declared profile step: `OnboardingFieldConfig[]` → labeled
16
+ * controls, validated locally before anything is handed to `onSubmit`. Mounted
17
+ * keyed by `step.id` so drafts re-seed per step.
18
+ */
19
+ export declare function ProfileStep({ step, values, submitting, submitLabel, onSubmit, onBack, onDraftChange, }: ProfileStepProps): React.JSX.Element;
@@ -0,0 +1,69 @@
1
+ import { AuthAccent } from '../../../lib/auth-accent';
2
+ import * as React from "react";
3
+ /** Value a single onboarding field can hold. */
4
+ export type OnboardingValue = string | boolean;
5
+ export interface OnboardingSelectOption {
6
+ value: string;
7
+ label: string;
8
+ }
9
+ interface OnboardingFieldBase {
10
+ /** Key the value is collected under; unique within the flow. */
11
+ name: string;
12
+ label: string;
13
+ /** Required fields gate the step's advance. */
14
+ required?: boolean;
15
+ placeholder?: string;
16
+ /** Extra validation; return a message to reject, `null` to accept. */
17
+ validate?: (value: string) => string | null;
18
+ }
19
+ export interface OnboardingTextField extends OnboardingFieldBase {
20
+ kind: "text" | "textarea" | "url";
21
+ }
22
+ export interface OnboardingCheckboxField extends OnboardingFieldBase {
23
+ kind: "checkbox";
24
+ }
25
+ export interface OnboardingSelectField extends OnboardingFieldBase {
26
+ kind: "select";
27
+ options: OnboardingSelectOption[];
28
+ }
29
+ /** Discriminated on `kind`. */
30
+ export type OnboardingFieldConfig = OnboardingTextField | OnboardingCheckboxField | OnboardingSelectField;
31
+ export interface OnboardingStepConfig {
32
+ /** Unique within the flow and stable across releases. */
33
+ id: string;
34
+ title: string;
35
+ description?: string;
36
+ fields: OnboardingFieldConfig[];
37
+ }
38
+ /** Default configuration: a single required display-name step. */
39
+ export declare const DEFAULT_ONBOARDING_STEPS: OnboardingStepConfig[];
40
+ export interface OnboardingBlockProps {
41
+ /** Declared profile steps. */
42
+ steps?: OnboardingStepConfig[];
43
+ /** Brand mark rendered above the title. Omit for no logo row at all. */
44
+ logo?: React.ReactNode;
45
+ /** Brand accent for the primary action. Omit to keep the default primary. */
46
+ accent?: AuthAccent;
47
+ /**
48
+ * Fires per step as it is submitted. Reject (or throw) to keep the user on
49
+ * the step and show the error.
50
+ */
51
+ onStepSubmit?: (stepId: string, values: Record<string, OnboardingValue>) => Promise<void> | void;
52
+ /** Fires once, after the final step is accepted, with the merged profile. */
53
+ onComplete?: (profile: Record<string, OnboardingValue>) => Promise<void> | void;
54
+ /** Shows a brief success screen once onboarding completes. */
55
+ showCompleteScreen?: boolean;
56
+ className?: string;
57
+ }
58
+ /**
59
+ * Multi-step profile onboarding: a declared `steps` config renders as
60
+ * progress-tracked forms with back/forward navigation, per-step submission and
61
+ * a single completion signal. Drafts survive back-navigation, and the step
62
+ * heading takes focus on advance so a screen reader announces where the flow
63
+ * moved.
64
+ *
65
+ * Account creation and email confirmation are separate blocks (`SignupBlock`,
66
+ * `CodeAuthBlock`) — this one picks up once the account exists.
67
+ */
68
+ export declare function OnboardingBlock({ steps, logo, accent, onStepSubmit, onComplete, showCompleteScreen, className, }: OnboardingBlockProps): React.JSX.Element | null;
69
+ export {};
@@ -0,0 +1,38 @@
1
+ import * as React from "react";
2
+ /** One registered passkey, as rendered by {@link PasskeyManagerBlock}. */
3
+ export interface PasskeyRecord {
4
+ id: string;
5
+ /** Server-derived name; falls back to "Passkey" when absent. */
6
+ name?: string | null;
7
+ /** ISO timestamps. Unparseable values are simply not shown. */
8
+ createdAt?: string | null;
9
+ lastUsedAt?: string | null;
10
+ }
11
+ export interface PasskeyManagerBlockProps {
12
+ title?: string;
13
+ description?: string;
14
+ /** The account's passkeys, newest first. */
15
+ passkeys?: PasskeyRecord[];
16
+ /** Whether this device can register passkeys at all. */
17
+ available?: boolean;
18
+ /** Shows the loading row instead of the list. */
19
+ loading?: boolean;
20
+ /**
21
+ * Reject (or throw) to show the error. Resolving with `{ cancelled: true }`
22
+ * returns silently to idle — a dismissed OS prompt is not a failure.
23
+ */
24
+ onRegister?: () => Promise<{
25
+ cancelled?: boolean;
26
+ } | void> | void;
27
+ onRename?: (id: string, name: string) => Promise<void> | void;
28
+ onDelete?: (id: string) => Promise<void> | void;
29
+ className?: string;
30
+ }
31
+ /**
32
+ * Settings panel for the passkeys on an account: register, inline rename with
33
+ * field-level validation, and delete behind an explicit confirmation. Deleting
34
+ * the last passkey is allowed — it is the account's passkey method that goes
35
+ * away, not its only way in — so the confirmation carries a warning instead of
36
+ * a block.
37
+ */
38
+ export declare function PasskeyManagerBlock({ title, description, passkeys, available, loading, onRegister, onRename, onDelete, className, }: PasskeyManagerBlockProps): React.JSX.Element;
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ export interface PasskeySignInBlockProps {
3
+ /**
4
+ * Whether this device can use passkeys. `false` renders nothing at all —
5
+ * a passkey button that is guaranteed to fail is worse than no button.
6
+ */
7
+ available?: boolean;
8
+ /** Button label. */
9
+ label?: string;
10
+ /**
11
+ * Reject (or throw) to show the inline error. Resolving with
12
+ * `{ cancelled: true }` returns silently to idle — a dismissed OS prompt is
13
+ * not a failure and must not surface an error.
14
+ */
15
+ onSignIn?: () => Promise<{
16
+ cancelled?: boolean;
17
+ } | void> | void;
18
+ /** Hint shown under an error, pointing at the remaining sign-in methods. */
19
+ fallbackHint?: React.ReactNode;
20
+ className?: string;
21
+ }
22
+ /**
23
+ * Passkey sign-in entry point — a single button plus its error state, sized
24
+ * to drop into a login card next to the password form rather than to stand on
25
+ * its own. Renders `null` while passkeys are unavailable.
26
+ */
27
+ export declare function PasskeySignInBlock({ available, label, onSignIn, fallbackHint, className, }: PasskeySignInBlockProps): React.JSX.Element | null;
@@ -4,6 +4,11 @@ import * as React from "react";
4
4
  export interface SignupBlockProps {
5
5
  title?: string;
6
6
  description?: string;
7
+ /**
8
+ * Replaces the built-in "terms" link inside the consent label — pass your
9
+ * own dialog trigger to render it inline instead of wiring `onTerms`.
10
+ */
11
+ termsComponent?: React.ReactNode;
7
12
  /** Brand mark rendered above the title. Omit for no logo row at all. */
8
13
  logo?: React.ReactNode;
9
14
  /** Brand accent for the primary action. Omit to keep the default primary. */
@@ -12,6 +17,16 @@ export interface SignupBlockProps {
12
17
  showNameField?: boolean;
13
18
  /** Require the terms checkbox before submitting. */
14
19
  showTerms?: boolean;
20
+ /**
21
+ * Controls the terms checkbox. Pass it with `onTermsCheckedChange` when
22
+ * something outside the block has to tick the box — an "I agree" action in
23
+ * your own terms dialog, say. Omit to let the block own the state.
24
+ */
25
+ termsChecked?: boolean;
26
+ /** Starting state of the terms checkbox while it is uncontrolled. */
27
+ defaultTermsChecked?: boolean;
28
+ /** Fires on every change, controlled or not. */
29
+ onTermsCheckedChange?: (checked: boolean) => void;
15
30
  /** Block submission until every password requirement is met. */
16
31
  enforceStrongPassword?: boolean;
17
32
  onSubmit?: (data: {
@@ -23,4 +38,4 @@ export interface SignupBlockProps {
23
38
  onLogin?: () => void;
24
39
  onTerms?: () => void;
25
40
  }
26
- export declare function SignupBlock({ title, description, logo, accent, providers, showNameField, showTerms, enforceStrongPassword, onSubmit, onProviderSelect, onLogin, onTerms, }: SignupBlockProps): React.JSX.Element;
41
+ export declare function SignupBlock({ title, description, logo, accent, providers, showNameField, showTerms, termsChecked, defaultTermsChecked, onTermsCheckedChange, enforceStrongPassword, onSubmit, termsComponent, onProviderSelect, onLogin, onTerms, }: SignupBlockProps): React.JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { AuthAccent } from '../../../lib/auth-accent';
2
+ import * as React from "react";
3
+ export interface UpdatePasswordBlockProps {
4
+ title?: string;
5
+ description?: string;
6
+ /** Brand mark rendered above the title. Omit for no logo row at all. */
7
+ logo?: React.ReactNode;
8
+ /** Brand accent for the primary action. Omit to keep the default primary. */
9
+ accent?: AuthAccent;
10
+ /**
11
+ * Minimum strength (0-4, as scored by `getPasswordStrength`) the new
12
+ * password must reach before the confirm field is revealed. 0 disables the
13
+ * gate.
14
+ */
15
+ minStrength?: number;
16
+ /** Reject (or throw) to show the error state with the error's message. */
17
+ onSubmit?: (data: {
18
+ password: string;
19
+ }) => Promise<void> | void;
20
+ onDone?: () => void;
21
+ }
22
+ /**
23
+ * Password change form for an already-authenticated user: a strength-metered
24
+ * new password gates the confirm field, which in turn gates the submit
25
+ * button. Mismatch is caught client-side; everything else comes back as a
26
+ * rejection from `onSubmit`.
27
+ */
28
+ export declare function UpdatePasswordBlock({ title, description, logo, accent, minStrength, onSubmit, onDone, }: UpdatePasswordBlockProps): React.JSX.Element;
@@ -1,5 +1,12 @@
1
1
  import type * as React from "react";
2
2
  export type SocialProvider = "google" | "apple" | "github" | "x";
3
+ /** Label + brand mark per provider, shared with the auth blocks. */
4
+ export declare const SOCIAL_PROVIDERS: Record<SocialProvider, {
5
+ label: string;
6
+ Icon: React.ComponentType<{
7
+ className?: string;
8
+ }>;
9
+ }>;
3
10
  declare const ACTION_LABELS: {
4
11
  readonly login: "Login with";
5
12
  readonly signup: "Sign up with";
@@ -22,8 +22,13 @@ export * from './components/composed/social-providers';
22
22
  export * from './components/blocks/auth/auth-shell';
23
23
  export * from './components/blocks/auth/code-auth-block';
24
24
  export * from './components/blocks/auth/forgot-password-block';
25
+ export * from './components/blocks/auth/linked-accounts-block';
25
26
  export * from './components/blocks/auth/login-block';
27
+ export * from './components/blocks/auth/onboarding-block';
28
+ export * from './components/blocks/auth/passkey-manager-block';
29
+ export * from './components/blocks/auth/passkey-sign-in-block';
26
30
  export * from './components/blocks/auth/signup-block';
31
+ export * from './components/blocks/auth/update-password-block';
27
32
  export * from './lib/auth-accent';
28
33
  export * from './lib/sound';
29
34
  export * from './lib/utils';