@hanzo/ui 8.0.0 → 8.0.2
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.
- package/package.json +15 -8
- package/src/gui-env.d.ts +27 -0
- package/src/product/index.ts +6 -0
- package/src/product/social/CampaignCard.tsx +62 -0
- package/src/product/social/ChannelBadge.tsx +60 -0
- package/src/product/social/PostCard.tsx +80 -0
- package/src/product/social/index.ts +6 -0
- package/src/product/usage/UsageDashboard.tsx +54 -0
- package/src/product/usage/UsageMeter.tsx +75 -0
- package/src/product/usage/UsageProviderCard.tsx +153 -0
- package/src/product/usage/index.ts +10 -0
- package/types/data.d.ts +2 -0
- package/types/data.d.ts.map +1 -0
- package/types/index.d.ts +3 -0
- package/types/index.d.ts.map +1 -0
- package/types/primitives/bases/data/index.d.ts +2 -0
- package/types/primitives/bases/data/index.d.ts.map +1 -0
- package/types/product/Charts.d.ts +70 -0
- package/types/product/Charts.d.ts.map +1 -0
- package/types/product/ComboBox.d.ts +20 -0
- package/types/product/ComboBox.d.ts.map +1 -0
- package/types/product/DataTable.d.ts +25 -0
- package/types/product/DataTable.d.ts.map +1 -0
- package/types/product/Donut.d.ts +26 -0
- package/types/product/Donut.d.ts.map +1 -0
- package/types/product/EmptyState.d.ts +37 -0
- package/types/product/EmptyState.d.ts.map +1 -0
- package/types/product/FadeIn.d.ts +23 -0
- package/types/product/FadeIn.d.ts.map +1 -0
- package/types/product/Field.d.ts +46 -0
- package/types/product/Field.d.ts.map +1 -0
- package/types/product/HanzoMark.d.ts +12 -0
- package/types/product/HanzoMark.d.ts.map +1 -0
- package/types/product/Metric.d.ts +103 -0
- package/types/product/Metric.d.ts.map +1 -0
- package/types/product/PageHeader.d.ts +8 -0
- package/types/product/PageHeader.d.ts.map +1 -0
- package/types/product/PrimaryButton.d.ts +13 -0
- package/types/product/PrimaryButton.d.ts.map +1 -0
- package/types/product/ProductIcon.d.ts +8 -0
- package/types/product/ProductIcon.d.ts.map +1 -0
- package/types/product/ProviderLogo.d.ts +13 -0
- package/types/product/ProviderLogo.d.ts.map +1 -0
- package/types/product/Reorder.d.ts +36 -0
- package/types/product/Reorder.d.ts.map +1 -0
- package/types/product/SelectMenu.d.ts +23 -0
- package/types/product/SelectMenu.d.ts.map +1 -0
- package/types/product/SlideOver.d.ts +48 -0
- package/types/product/SlideOver.d.ts.map +1 -0
- package/types/product/StatusTag.d.ts +4 -0
- package/types/product/StatusTag.d.ts.map +1 -0
- package/types/product/ThemeToggle.d.ts +2 -0
- package/types/product/ThemeToggle.d.ts.map +1 -0
- package/types/product/Toast.d.ts +33 -0
- package/types/product/Toast.d.ts.map +1 -0
- package/types/product/color.d.ts +18 -0
- package/types/product/color.d.ts.map +1 -0
- package/types/product/combobox/filter.d.ts +28 -0
- package/types/product/combobox/filter.d.ts.map +1 -0
- package/types/product/index.d.ts +24 -0
- package/types/product/index.d.ts.map +1 -0
- package/types/product/social/CampaignCard.d.ts +14 -0
- package/types/product/social/CampaignCard.d.ts.map +1 -0
- package/types/product/social/ChannelBadge.d.ts +7 -0
- package/types/product/social/ChannelBadge.d.ts.map +1 -0
- package/types/product/social/PostCard.d.ts +16 -0
- package/types/product/social/PostCard.d.ts.map +1 -0
- package/types/product/social/index.d.ts +4 -0
- package/types/product/social/index.d.ts.map +1 -0
- package/types/product/usage/UsageDashboard.d.ts +10 -0
- package/types/product/usage/UsageDashboard.d.ts.map +1 -0
- package/types/product/usage/UsageMeter.d.ts +15 -0
- package/types/product/usage/UsageMeter.d.ts.map +1 -0
- package/types/product/usage/UsageProviderCard.d.ts +35 -0
- package/types/product/usage/UsageProviderCard.d.ts.map +1 -0
- package/types/product/usage/index.d.ts +4 -0
- package/types/product/usage/index.d.ts.map +1 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toast — the ONE feedback primitive. Every mutation reports through `useToast()`
|
|
3
|
+
* so success/failure looks and behaves the same everywhere. A single provider
|
|
4
|
+
* holds the queue and renders the viewport (portalled top-right); there is no
|
|
5
|
+
* per-call markup. Built from GUI primitives only.
|
|
6
|
+
*
|
|
7
|
+
* Mount `<ToastProvider>` once (the dashboard layout does). Call:
|
|
8
|
+
* const toast = useToast()
|
|
9
|
+
* toast.success('Created my-db')
|
|
10
|
+
* toast.error(err instanceof ApiError ? err.message : 'Failed to create')
|
|
11
|
+
*/
|
|
12
|
+
import { type ReactNode } from 'react';
|
|
13
|
+
export type ToastKind = 'success' | 'error' | 'info';
|
|
14
|
+
export type ToastInput = {
|
|
15
|
+
title: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
kind?: ToastKind;
|
|
18
|
+
/** Auto-dismiss after this many ms; 0 keeps it until dismissed. */
|
|
19
|
+
durationMs?: number;
|
|
20
|
+
};
|
|
21
|
+
type ToastApi = {
|
|
22
|
+
toast: (t: ToastInput) => void;
|
|
23
|
+
success: (title: string, description?: string) => void;
|
|
24
|
+
error: (title: string, description?: string) => void;
|
|
25
|
+
info: (title: string, description?: string) => void;
|
|
26
|
+
dismiss: (id: number) => void;
|
|
27
|
+
};
|
|
28
|
+
export declare function ToastProvider({ children }: {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
export declare function useToast(): ToastApi;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../src/product/Toast.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,OAAO,EAAuE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAK3G,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;AAEpD,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAID,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAA;IAC9B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACtD,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACpD,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACnD,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9B,CAAA;AAyED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAkDlE;AAED,wBAAgB,QAAQ,IAAI,QAAQ,CAInC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { GetThemeValueForKey } from '@hanzo/gui';
|
|
3
|
+
/**
|
|
4
|
+
* Bridge between raw CSS colors (product hex accents) and Gui's typed `color`
|
|
5
|
+
* prop. Gui types `color` as a theme-token template (`$color12`, …), but ANY CSS
|
|
6
|
+
* color is valid at runtime — so tinting an icon with a product hex needs one
|
|
7
|
+
* sanctioned cast, in ONE place, rather than `as any` scattered around.
|
|
8
|
+
*/
|
|
9
|
+
export type IconColor = GetThemeValueForKey<'color'>;
|
|
10
|
+
/** Cast a raw CSS color (e.g. `#5E6AD2`) to Gui's `color` prop type. */
|
|
11
|
+
export declare const asColor: (hex: string) => IconColor;
|
|
12
|
+
/** A lucide/Gui icon component that accepts a size + a (token-or-cast) color —
|
|
13
|
+
* the shape the shell passes around for product/nav icons. */
|
|
14
|
+
export type IconLike = ComponentType<{
|
|
15
|
+
size?: number;
|
|
16
|
+
color?: IconColor;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/product/color.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;AAEpD,wEAAwE;AACxE,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,SAAwC,CAAA;AAE9E;+DAC+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Combobox option filtering — pure, unit-tested.
|
|
3
|
+
*
|
|
4
|
+
* The ONE matcher the ComboBox uses to narrow a live option list against typed
|
|
5
|
+
* text. Matching is a LITERAL, case-insensitive substring over the option's
|
|
6
|
+
* value + label + hint — NEVER a compiled RegExp of user input (that would be a
|
|
7
|
+
* ReDoS / injection surface; the whole codebase filters with literal `includes`,
|
|
8
|
+
* e.g. marketplace/logic + filterOrgs). Kept dependency-free so it lifts into
|
|
9
|
+
* `@hanzo/ui` alongside the ComboBox.
|
|
10
|
+
*/
|
|
11
|
+
/** One option in a combobox list. `value` is what gets committed; label/hint are display. */
|
|
12
|
+
export type ComboOption = {
|
|
13
|
+
/** The value committed to the field when this option is chosen. */
|
|
14
|
+
value: string;
|
|
15
|
+
/** Display label (defaults to `value`). */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** Optional secondary text (e.g. a provider, a description) — also searched. */
|
|
18
|
+
hint?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Filter `options` by `query` — a literal, case-insensitive substring over
|
|
22
|
+
* value/label/hint. An empty/whitespace query returns every option (no filter).
|
|
23
|
+
* PURE. The input is treated as a plain string, never a pattern.
|
|
24
|
+
*/
|
|
25
|
+
export declare function filterOptions(options: ComboOption[], query: string): ComboOption[];
|
|
26
|
+
/** True iff `value` exactly matches an option's `value` (case-sensitive). */
|
|
27
|
+
export declare function isKnownOption(options: ComboOption[], value: string): boolean;
|
|
28
|
+
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/product/combobox/filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,6FAA6F;AAC7F,MAAM,MAAM,WAAW,GAAG;IACxB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAA;IACb,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gFAAgF;IAChF,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAKD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAIlF;AAED,6EAA6E;AAC7E,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAE5E"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from './Charts';
|
|
2
|
+
export { SERIES, colorForIndex, utilColor, Sparkline as MetricSparkline, MiniBars, UtilBar, LegendDot, MetricCard, HintButton, Panel, } from './Metric';
|
|
3
|
+
export { Donut as DonutRing, type DonutSegment } from './Donut';
|
|
4
|
+
export { ComboBox } from './ComboBox';
|
|
5
|
+
export * from './combobox/filter';
|
|
6
|
+
export * from './DataTable';
|
|
7
|
+
export * from './EmptyState';
|
|
8
|
+
export * from './FadeIn';
|
|
9
|
+
export * from './Field';
|
|
10
|
+
export * from './HanzoMark';
|
|
11
|
+
export * from './PageHeader';
|
|
12
|
+
export * from './PrimaryButton';
|
|
13
|
+
export * from './ProductIcon';
|
|
14
|
+
export * from './ProviderLogo';
|
|
15
|
+
export * from './Reorder';
|
|
16
|
+
export * from './SelectMenu';
|
|
17
|
+
export * from './SlideOver';
|
|
18
|
+
export * from './StatusTag';
|
|
19
|
+
export * from './ThemeToggle';
|
|
20
|
+
export * from './Toast';
|
|
21
|
+
export * from './color';
|
|
22
|
+
export * from './usage';
|
|
23
|
+
export * from './social';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/product/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAA;AAKxB,OAAO,EACL,MAAM,EACN,aAAa,EACb,SAAS,EACT,SAAS,IAAI,eAAe,EAC5B,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,KAAK,GACN,MAAM,UAAU,CAAA;AAGjB,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAK/D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,cAAc,mBAAmB,CAAA;AAGjC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AAGvB,cAAc,SAAS,CAAA;AAGvB,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Campaign = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
channel: string;
|
|
5
|
+
status: string;
|
|
6
|
+
objective?: string;
|
|
7
|
+
/** minor units (cents) */
|
|
8
|
+
budget: number;
|
|
9
|
+
spend: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function CampaignCard({ campaign }: {
|
|
12
|
+
campaign: Campaign;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=CampaignCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CampaignCard.d.ts","sourceRoot":"","sources":["../../../src/product/social/CampaignCard.tsx"],"names":[],"mappings":"AAUA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAID,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,QAAQ,CAAA;CAAE,+BAsChE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type Channel = 'x' | 'facebook' | 'instagram' | 'linkedin' | 'tiktok' | 'youtube' | 'threads';
|
|
2
|
+
export declare function ChannelBadge({ channel, showLabel, size, }: {
|
|
3
|
+
channel: Channel;
|
|
4
|
+
showLabel?: boolean;
|
|
5
|
+
size?: number;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ChannelBadge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChannelBadge.d.ts","sourceRoot":"","sources":["../../../src/product/social/ChannelBadge.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,OAAO,GACf,GAAG,GACH,UAAU,GACV,WAAW,GACX,UAAU,GACV,QAAQ,GACR,SAAS,GACT,SAAS,CAAA;AAYb,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,SAAiB,EACjB,IAAS,GACV,EAAE;IACD,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,+BAuBA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Channel } from './ChannelBadge';
|
|
2
|
+
export type Post = {
|
|
3
|
+
id: string;
|
|
4
|
+
content: string;
|
|
5
|
+
channel: Channel;
|
|
6
|
+
status: string;
|
|
7
|
+
/** unix seconds; 0/undefined = not scheduled */
|
|
8
|
+
scheduleAt?: number;
|
|
9
|
+
media?: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare function PostCard({ post, onEdit, onDelete, }: {
|
|
12
|
+
post: Post;
|
|
13
|
+
onEdit?: (p: Post) => void;
|
|
14
|
+
onDelete?: (p: Post) => void;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=PostCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostCard.d.ts","sourceRoot":"","sources":["../../../src/product/social/PostCard.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE3D,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB,CAAA;AAYD,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,MAAM,EACN,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;IAC1B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAA;CAC7B,+BAuCA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product/social/index.ts"],"names":[],"mappings":"AAGA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type UsageProviderCardProps } from './UsageProviderCard';
|
|
2
|
+
export declare function UsageDashboard({ providers, totals, }: {
|
|
3
|
+
providers: UsageProviderCardProps[];
|
|
4
|
+
totals?: {
|
|
5
|
+
spendUSD?: number;
|
|
6
|
+
tokens?: number;
|
|
7
|
+
requests?: number;
|
|
8
|
+
};
|
|
9
|
+
}): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=UsageDashboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UsageDashboard.d.ts","sourceRoot":"","sources":["../../../src/product/usage/UsageDashboard.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAqB,KAAK,sBAAsB,EAAyC,MAAM,qBAAqB,CAAA;AAE3H,wBAAgB,cAAc,CAAC,EAC7B,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,sBAAsB,EAAE,CAAA;IACnC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACnE,+BA8BA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** A single quota window: how much is spent (0–100) and when it refills. */
|
|
2
|
+
export type UsageWindow = {
|
|
3
|
+
usedPercent: number;
|
|
4
|
+
/** ISO string or Date the window resets — drives the honest countdown. */
|
|
5
|
+
resetsAt?: string | Date;
|
|
6
|
+
};
|
|
7
|
+
/** "resets in 2h 14m" from a real reset time, or null when there is none/past. */
|
|
8
|
+
export declare function resetCountdown(resetsAt?: string | Date): string | null;
|
|
9
|
+
export declare function UsageMeter({ label, usedPercent, resetsAt, compact, }: {
|
|
10
|
+
label: string;
|
|
11
|
+
usedPercent: number;
|
|
12
|
+
resetsAt?: string | Date;
|
|
13
|
+
compact?: boolean;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=UsageMeter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UsageMeter.d.ts","sourceRoot":"","sources":["../../../src/product/usage/UsageMeter.tsx"],"names":[],"mappings":"AAiBA,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA;AAED,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAYtE;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,OAAO,GACR,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,+BAyBA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type UsageWindow } from './UsageMeter';
|
|
2
|
+
/** Format a monetary amount; falls back to "12.34 USD" where Intl currency is absent. */
|
|
3
|
+
export declare function formatUsageCurrency(value: number, currencyCode: string): string;
|
|
4
|
+
/** Compact count (1.2K / 3.4M / 5.6B) for token/request totals. */
|
|
5
|
+
export declare function formatUsageCount(n: number): string;
|
|
6
|
+
export type UsageProviderCardProps = {
|
|
7
|
+
name: string;
|
|
8
|
+
/** Accent dot color (hex/rgb) — the provider's brand mark. */
|
|
9
|
+
color?: string;
|
|
10
|
+
/** Plan/tier badge (e.g. "Pro", "Team"). */
|
|
11
|
+
plan?: string;
|
|
12
|
+
session?: UsageWindow;
|
|
13
|
+
weekly?: UsageWindow;
|
|
14
|
+
/** Additional named windows (e.g. per-model or per-tool quotas). */
|
|
15
|
+
extras?: Array<{
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
usedPercent: number;
|
|
19
|
+
resetsAt?: string | Date;
|
|
20
|
+
}>;
|
|
21
|
+
spend?: {
|
|
22
|
+
used: number;
|
|
23
|
+
limit?: number;
|
|
24
|
+
currencyCode: string;
|
|
25
|
+
};
|
|
26
|
+
/** Used-% samples over time — drawn with the canonical Sparkline. */
|
|
27
|
+
history?: number[];
|
|
28
|
+
/** An honest load/refresh error for this provider. */
|
|
29
|
+
error?: string;
|
|
30
|
+
/** Where the numbers came from (e.g. "OAuth", "API key"). */
|
|
31
|
+
sourceLabel?: string;
|
|
32
|
+
updatedAt?: string | Date;
|
|
33
|
+
};
|
|
34
|
+
export declare function UsageProviderCard({ name, color, plan, session, weekly, extras, spend, history, error, sourceLabel, updatedAt, }: UsageProviderCardProps): import("react").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=UsageProviderCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UsageProviderCard.d.ts","sourceRoot":"","sources":["../../../src/product/usage/UsageProviderCard.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAE3D,yFAAyF;AACzF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAM/E;AAED,mEAAmE;AACnE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAOlD;AAeD,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,oEAAoE;IACpE,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;IAC5F,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9D,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACP,KAAK,EACL,WAAW,EACX,SAAS,GACV,EAAE,sBAAsB,+BAuExB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/product/usage/index.ts"],"names":[],"mappings":"AAOA,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA"}
|