@danxbot/ui 15.40.0 → 16.0.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.
@@ -11,15 +11,17 @@ export interface ProfileFormSaveInput {
11
11
  name: string;
12
12
  username?: string;
13
13
  email: string;
14
+ /** Present only when the avatar changed: a URL sets it, `null` removes it. */
15
+ avatarUrl?: string | null;
14
16
  }
15
17
  export interface ProfileFormProps {
16
18
  account: ProfileFormAccount;
17
19
  onSave: (input: ProfileFormSaveInput) => Promise<void>;
20
+ /** Uploads the file to storage and resolves with its URL. Must NOT change the
21
+ * account — the avatar is only persisted by `onSave`. */
18
22
  onUploadAvatar: (file: File) => Promise<string>;
19
- /** Fired the moment a new avatar finishes uploading (or is removed) — see
20
- * the module header for why the avatar has no separate Save step. */
21
- onAvatarChange?: (avatarUrl: string | null) => void;
22
23
  saveLabel?: string;
24
+ discardLabel?: string;
23
25
  className?: string;
24
26
  }
25
- export declare function ProfileForm({ account, onSave, onUploadAvatar, onAvatarChange, saveLabel, className, }: ProfileFormProps): import("react").JSX.Element;
27
+ export declare function ProfileForm({ account, onSave, onUploadAvatar, saveLabel, discardLabel, className, }: ProfileFormProps): import("react").JSX.Element;
@@ -4,8 +4,8 @@ export interface ProfilePageProps {
4
4
  * still locally-editable) `actualUser` display. */
5
5
  account?: ProfileFormAccount;
6
6
  onSave?: (input: ProfileFormSaveInput) => Promise<void>;
7
+ /** Uploads the file and resolves with its URL; the avatar is persisted only by `onSave` (DX-4131). */
7
8
  onUploadAvatar?: (file: File) => Promise<string>;
8
- onAvatarChange?: (avatarUrl: string | null) => void;
9
9
  /** DX-4029: `false` omits the page's own title text (the `<h1>` and the
10
10
  * team-name line) so a host layout can own the screen's one `<h1>`. The
11
11
  * read-only avatar (content, not title) stays, and the default `true` is
@@ -13,4 +13,4 @@ export interface ProfilePageProps {
13
13
  heading?: boolean;
14
14
  className?: string;
15
15
  }
16
- export declare function ProfilePage({ account, onSave, onUploadAvatar, onAvatarChange, heading, className, }: ProfilePageProps): import("react").JSX.Element;
16
+ export declare function ProfilePage({ account, onSave, onUploadAvatar, heading, className, }: ProfilePageProps): import("react").JSX.Element;
@@ -4,17 +4,19 @@ export interface TeamSettingsFormTeam {
4
4
  }
5
5
  export interface TeamSettingsFormSaveInput {
6
6
  name: string;
7
+ /** Present only when the logo changed: a URL sets it, `null` removes it. */
8
+ logoUrl?: string | null;
7
9
  }
8
10
  export interface TeamSettingsFormProps {
9
11
  team: TeamSettingsFormTeam;
10
12
  onSave: (input: TeamSettingsFormSaveInput) => Promise<void>;
13
+ /** Uploads the file to storage and resolves with its URL. Must NOT change the
14
+ * team record — the logo is only persisted by `onSave`. */
11
15
  onUploadLogo: (file: File) => Promise<string>;
12
- /** Fired the moment a new logo finishes uploading (or is removed) — see
13
- * the module header for why the logo has no separate Save step. */
14
- onLogoChange?: (logoUrl: string | null) => void;
15
16
  /** The viewer lacks `team.update` — every control renders disabled. */
16
17
  readOnly?: boolean;
17
18
  saveLabel?: string;
19
+ discardLabel?: string;
18
20
  className?: string;
19
21
  }
20
- export declare function TeamSettingsForm({ team, onSave, onUploadLogo, onLogoChange, readOnly, saveLabel, className, }: TeamSettingsFormProps): import("react").JSX.Element;
22
+ export declare function TeamSettingsForm({ team, onSave, onUploadLogo, readOnly, saveLabel, discardLabel, className, }: TeamSettingsFormProps): import("react").JSX.Element;
@@ -0,0 +1,25 @@
1
+ export interface SaveFlow {
2
+ saving: boolean;
3
+ /** The last Save resolved and nothing has been edited since. */
4
+ saved: boolean;
5
+ error: string | null;
6
+ /** Run a draft change (an edit, or a Discard) and retire the last outcome. */
7
+ edit: (change: () => void) => void;
8
+ /** Run the consumer's `onSave`; a rejection's message (or `failureMessage`) becomes `error`. */
9
+ save: (run: () => Promise<void>) => Promise<void>;
10
+ }
11
+ export declare function useSaveFlow(failureMessage: string): SaveFlow;
12
+ /** The line under a staged image, naming what Save will do with it. */
13
+ export declare function stagedImageNote(noun: string, saveLabel: string, removed: boolean): string;
14
+ export interface StagedFormActionsProps {
15
+ onSave: () => void;
16
+ onDiscard: () => void;
17
+ /** The draft is valid, changed, and nothing is in flight. */
18
+ canSave: boolean;
19
+ /** The draft differs from what is saved in ANY way, including whitespace Save would trim away. */
20
+ canDiscard: boolean;
21
+ saving: boolean;
22
+ saveLabel: string;
23
+ discardLabel: string;
24
+ }
25
+ export declare function StagedFormActions({ onSave, onDiscard, canSave, canDiscard, saving, saveLabel, discardLabel, }: StagedFormActionsProps): import("react").JSX.Element;
@@ -0,0 +1,15 @@
1
+ export interface StagedImage {
2
+ /** What to show: the staged URL (or `null` for a staged removal), else the saved one. */
3
+ value: string | null;
4
+ /** The staged value differs from the saved one — the form must send it on Save. */
5
+ dirty: boolean;
6
+ /** A pick is mid-upload. */
7
+ uploading: boolean;
8
+ /** Stage a URL, or `null` to stage a removal. */
9
+ stage: (url: string | null) => void;
10
+ /** Drop the staged value and go back to the saved one. */
11
+ discard: () => void;
12
+ /** Pass to `ImageUploadField.onUpload`. */
13
+ upload: (file: File) => Promise<string>;
14
+ }
15
+ export declare function useStagedImage(saved: string | null | undefined, onUpload: (file: File) => Promise<string>): StagedImage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "15.40.0",
3
+ "version": "16.0.0",
4
4
  "type": "module",
5
5
  "description": "Danxbot — a domain-agnostic React design system with motion as a first-class primitive.",
6
6
  "license": "MIT",