@danxbot/ui 15.39.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.
@@ -0,0 +1,61 @@
1
+ import type { ReactNode, Ref } from "react";
2
+ import { type VariantProps } from "tailwind-variants";
3
+ import { type ProgressTone } from "./Progress";
4
+ declare const ring: import("tailwind-variants").TVReturnType<{
5
+ size: {
6
+ /** 28px — sits in a tab or a row beside a 14px label; a two-digit count fits the centre. */
7
+ sm: "size-7";
8
+ md: "size-10";
9
+ lg: "size-16";
10
+ };
11
+ }, undefined, "relative inline-grid shrink-0 place-items-center", {
12
+ size: {
13
+ /** 28px — sits in a tab or a row beside a 14px label; a two-digit count fits the centre. */
14
+ sm: "size-7";
15
+ md: "size-10";
16
+ lg: "size-16";
17
+ };
18
+ }, undefined, import("tailwind-variants").TVReturnTypeLike<{
19
+ size: {
20
+ /** 28px — sits in a tab or a row beside a 14px label; a two-digit count fits the centre. */
21
+ sm: "size-7";
22
+ md: "size-10";
23
+ lg: "size-16";
24
+ };
25
+ }, undefined>>;
26
+ /** One ring: how full it is (0-100, clamped) and the tone it is drawn in. */
27
+ export interface ConcentricRingLevel {
28
+ value: number;
29
+ tone: ProgressTone;
30
+ }
31
+ export interface ConcentricRingProps extends VariantProps<typeof ring> {
32
+ /**
33
+ * REQUIRED, and the whole sentence — both fractions in words, with their
34
+ * numbers. See the banner: this is what keeps color from being the only
35
+ * carrier of "which ring is which".
36
+ */
37
+ label: string;
38
+ /** The larger, first-read ring. */
39
+ outer: ConcentricRingLevel;
40
+ /** The smaller ring inside it. */
41
+ inner: ConcentricRingLevel;
42
+ /** Centred in the disc inside the inner ring, e.g. the total. Hidden from assistive tech. */
43
+ children?: ReactNode;
44
+ className?: string;
45
+ ref?: Ref<HTMLSpanElement>;
46
+ }
47
+ /**
48
+ * Two nested rings, each filled by its own 0-100 value, around a centre number.
49
+ *
50
+ * ```tsx
51
+ * <ConcentricRing
52
+ * label="Goals: 5 of 6 signed off by a person, 1 of 6 verified by an agent"
53
+ * outer={{ value: (5 / 6) * 100, tone: "success" }}
54
+ * inner={{ value: (1 / 6) * 100, tone: "brand" }}
55
+ * >
56
+ * 6
57
+ * </ConcentricRing>
58
+ * ```
59
+ */
60
+ export declare function ConcentricRing({ label, outer, inner, size, children, className, ref }: ConcentricRingProps): import("react").JSX.Element;
61
+ export {};
@@ -473,6 +473,7 @@ export type ProgressRingSegmentsProps = ProgressRingBase & ProgressRingCentre &
473
473
  tone?: never;
474
474
  };
475
475
  export type ProgressRingProps = ProgressRingValueProps | ProgressRingSegmentsProps;
476
+ export declare const RING_TONE: Record<string, string>;
476
477
  /** One arc, resolved to the two fractions an SVG dash actually needs. */
477
478
  export interface ProgressRingArc {
478
479
  label: string;
@@ -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;
@@ -70,6 +70,7 @@ export { Separator, ScrollArea, Collapsible, CollapsibleRoot, CollapsibleTrigger
70
70
  export { PanelGroup, Panel, PanelResizer, type PanelGroupProps, type PanelProps, type PanelResizerProps, type PanelDirection, type PanelNarrowMode, } from "./components/Panel";
71
71
  export { Avatar, AvatarGroup, type AvatarProps, type AvatarGroupProps, type AvatarStatus, } from "./components/Avatar";
72
72
  export { Progress, Meter, ProgressRing, type ProgressProps, type MeterProps, type ProgressRingProps, type ProgressRingValueProps, type ProgressRingSegmentsProps, type ProgressRingSegment, type ProgressTone, } from "./components/Progress";
73
+ export { ConcentricRing, type ConcentricRingProps, type ConcentricRingLevel, } from "./components/ConcentricRing";
73
74
  export { Stat, StatRow, Sparkline, type StatProps, type StatRowProps, type SparklineProps, type StatSize, type StatTrend, type StatSentiment, } from "./components/Stat";
74
75
  export { ShareBar, type ShareBarProps, type ShareBarSegment, } from "./components/chart/ShareBar";
75
76
  export { BarList, type BarListProps, type BarListItem, } from "./components/chart/BarList";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "15.39.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",