@databricks/appkit-ui 0.39.0 → 0.40.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.
- package/dist/cli/commands/generate-types.js +114 -5
- package/dist/cli/commands/generate-types.js.map +1 -1
- package/dist/cli/commands/spawn-lock.js +116 -0
- package/dist/cli/commands/spawn-lock.js.map +1 -0
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/react/charts/index.d.ts +1 -0
- package/dist/react/charts/index.js +1 -0
- package/dist/react/charts/loading.d.ts +24 -0
- package/dist/react/charts/loading.d.ts.map +1 -0
- package/dist/react/charts/loading.js +20 -2
- package/dist/react/charts/loading.js.map +1 -1
- package/dist/react/charts/wrapper.d.ts.map +1 -1
- package/dist/react/charts/wrapper.js +9 -2
- package/dist/react/charts/wrapper.js.map +1 -1
- package/dist/react/hooks/index.d.ts +3 -1
- package/dist/react/hooks/index.js +2 -0
- package/dist/react/hooks/types.d.ts +28 -1
- package/dist/react/hooks/types.d.ts.map +1 -1
- package/dist/react/hooks/use-analytics-query.d.ts.map +1 -1
- package/dist/react/hooks/use-analytics-query.js +77 -45
- package/dist/react/hooks/use-analytics-query.js.map +1 -1
- package/dist/react/hooks/use-analytics-warehouse-status.js +48 -0
- package/dist/react/hooks/use-analytics-warehouse-status.js.map +1 -0
- package/dist/react/hooks/use-chart-data.d.ts +8 -0
- package/dist/react/hooks/use-chart-data.d.ts.map +1 -1
- package/dist/react/hooks/use-chart-data.js +3 -2
- package/dist/react/hooks/use-chart-data.js.map +1 -1
- package/dist/react/hooks/use-resource-status.d.ts +92 -0
- package/dist/react/hooks/use-resource-status.d.ts.map +1 -0
- package/dist/react/hooks/use-resource-status.js +199 -0
- package/dist/react/hooks/use-resource-status.js.map +1 -0
- package/dist/react/index.d.ts +5 -2
- package/dist/react/index.js +5 -2
- package/dist/react/resource-status-indicator.d.ts +78 -0
- package/dist/react/resource-status-indicator.d.ts.map +1 -0
- package/dist/react/resource-status-indicator.js +155 -0
- package/dist/react/resource-status-indicator.js.map +1 -0
- package/dist/react/ui/index.js +1 -1
- package/dist/react/ui/sonner.js +1 -1
- package/docs/development/type-generation.md +13 -0
- package/docs/plugins/analytics.md +156 -0
- package/package.json +1 -1
- package/sbom.cdx.json +1 -1
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { createContext, useCallback, useContext, useMemo, useRef, useSyncExternalStore } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/react/hooks/use-resource-status.tsx
|
|
5
|
+
const NOOP_SUBSCRIBE = () => () => {};
|
|
6
|
+
const SEVERITY_RANK = {
|
|
7
|
+
error: 0,
|
|
8
|
+
warning: 1,
|
|
9
|
+
pending: 2
|
|
10
|
+
};
|
|
11
|
+
const EMPTY_SNAPSHOT = {
|
|
12
|
+
worst: null,
|
|
13
|
+
byKind: {},
|
|
14
|
+
affectedLabels: [],
|
|
15
|
+
activeCount: 0,
|
|
16
|
+
elapsedMs: 0,
|
|
17
|
+
version: 0
|
|
18
|
+
};
|
|
19
|
+
const GET_EMPTY_SNAPSHOT = () => EMPTY_SNAPSHOT;
|
|
20
|
+
/** Flat per-publisher map exposed to React via `useSyncExternalStore`. */
|
|
21
|
+
var ResourceStatusStore = class {
|
|
22
|
+
entries = /* @__PURE__ */ new Map();
|
|
23
|
+
listeners = /* @__PURE__ */ new Set();
|
|
24
|
+
snapshot = EMPTY_SNAPSHOT;
|
|
25
|
+
version = 0;
|
|
26
|
+
publish(id, label, status, kindHint) {
|
|
27
|
+
this.entries.set(id, {
|
|
28
|
+
label,
|
|
29
|
+
status,
|
|
30
|
+
kindHint
|
|
31
|
+
});
|
|
32
|
+
this.bump();
|
|
33
|
+
}
|
|
34
|
+
unpublish(id) {
|
|
35
|
+
if (this.entries.delete(id)) this.bump();
|
|
36
|
+
}
|
|
37
|
+
subscribe(listener) {
|
|
38
|
+
this.listeners.add(listener);
|
|
39
|
+
return () => {
|
|
40
|
+
this.listeners.delete(listener);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
getSnapshot() {
|
|
44
|
+
return this.snapshot;
|
|
45
|
+
}
|
|
46
|
+
/** Exposed for the kind-filter path so it can pick up status-less `kindHint` slots. */
|
|
47
|
+
getEntries() {
|
|
48
|
+
return this.entries;
|
|
49
|
+
}
|
|
50
|
+
bump() {
|
|
51
|
+
this.version += 1;
|
|
52
|
+
this.snapshot = aggregate(this.entries, this.version);
|
|
53
|
+
for (const l of this.listeners) l();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
function isWorse(a, b) {
|
|
57
|
+
const aRank = SEVERITY_RANK[a.severity];
|
|
58
|
+
const bRank = SEVERITY_RANK[b.severity];
|
|
59
|
+
if (aRank !== bRank) return aRank < bRank;
|
|
60
|
+
return a.startedAt < b.startedAt;
|
|
61
|
+
}
|
|
62
|
+
/** Pure derivation of the snapshot from `entries` at a given `version`. */
|
|
63
|
+
function aggregate(entries, version) {
|
|
64
|
+
if (entries.size === 0) return {
|
|
65
|
+
...EMPTY_SNAPSHOT,
|
|
66
|
+
version
|
|
67
|
+
};
|
|
68
|
+
let worst = null;
|
|
69
|
+
const byKind = {};
|
|
70
|
+
const affectedLabels = /* @__PURE__ */ new Set();
|
|
71
|
+
for (const entry of entries.values()) {
|
|
72
|
+
const status = entry.status;
|
|
73
|
+
if (!status) continue;
|
|
74
|
+
affectedLabels.add(entry.label);
|
|
75
|
+
const existing = byKind[status.kind];
|
|
76
|
+
if (!existing || isWorse(status, existing)) byKind[status.kind] = status;
|
|
77
|
+
if (!worst || isWorse(status, worst)) worst = status;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
worst,
|
|
81
|
+
byKind,
|
|
82
|
+
affectedLabels: [...affectedLabels].sort(),
|
|
83
|
+
activeCount: entries.size,
|
|
84
|
+
elapsedMs: worst ? Math.max(0, Date.now() - worst.startedAt) : 0,
|
|
85
|
+
version
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** Kind-scoped aggregate; walks entries directly to include status-less `kindHint` slots. */
|
|
89
|
+
function aggregateForKind(entries, kind, version) {
|
|
90
|
+
const affectedLabels = /* @__PURE__ */ new Set();
|
|
91
|
+
let activeCount = 0;
|
|
92
|
+
let worst = null;
|
|
93
|
+
for (const entry of entries.values()) {
|
|
94
|
+
if ((entry.status?.kind ?? entry.kindHint) !== kind) continue;
|
|
95
|
+
activeCount++;
|
|
96
|
+
const status = entry.status;
|
|
97
|
+
if (!status) continue;
|
|
98
|
+
affectedLabels.add(entry.label);
|
|
99
|
+
if (!worst || isWorse(status, worst)) worst = status;
|
|
100
|
+
}
|
|
101
|
+
if (activeCount === 0) return {
|
|
102
|
+
...EMPTY_SNAPSHOT,
|
|
103
|
+
version
|
|
104
|
+
};
|
|
105
|
+
const byKind = {};
|
|
106
|
+
if (worst) byKind[kind] = worst;
|
|
107
|
+
return {
|
|
108
|
+
worst,
|
|
109
|
+
byKind,
|
|
110
|
+
affectedLabels: [...affectedLabels].sort(),
|
|
111
|
+
activeCount,
|
|
112
|
+
elapsedMs: worst ? Math.max(0, Date.now() - worst.startedAt) : 0,
|
|
113
|
+
version
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const ResourceStatusContext = createContext(null);
|
|
117
|
+
function useResourceStatusContext() {
|
|
118
|
+
return useContext(ResourceStatusContext);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Mount once near the root of your app to enable a global, cross-plugin
|
|
122
|
+
* readiness aggregate. Plugins publish {@link ResourceStatus} snapshots
|
|
123
|
+
* while a resource is warming up / unavailable; {@link useResourceStatus}
|
|
124
|
+
* exposes the worst across all of them.
|
|
125
|
+
*
|
|
126
|
+
* Without a provider, `useResourceStatus` and `useResourceStatusPublisher`
|
|
127
|
+
* fall back to no-ops, so plugins are safe to call them unconditionally.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```tsx
|
|
131
|
+
* <ResourceStatusProvider>
|
|
132
|
+
* <ResourceStatusIndicator />
|
|
133
|
+
* <App />
|
|
134
|
+
* </ResourceStatusProvider>
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
function ResourceStatusProvider({ children }) {
|
|
138
|
+
const storeRef = useRef(null);
|
|
139
|
+
if (storeRef.current === null) storeRef.current = new ResourceStatusStore();
|
|
140
|
+
const value = useMemo(() => ({ store: storeRef.current }), []);
|
|
141
|
+
return /* @__PURE__ */ jsx(ResourceStatusContext.Provider, {
|
|
142
|
+
value,
|
|
143
|
+
children
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Returns the aggregated resource-readiness snapshot across every active
|
|
148
|
+
* publisher under the nearest {@link ResourceStatusProvider}. Falls back
|
|
149
|
+
* to the empty/idle aggregate when no provider is mounted.
|
|
150
|
+
*
|
|
151
|
+
* @param filter Optional `{ kind }` to scope to a single resource kind.
|
|
152
|
+
*/
|
|
153
|
+
function useResourceStatus(filter) {
|
|
154
|
+
const store = useResourceStatusContext()?.store;
|
|
155
|
+
const subscribe = useMemo(() => store ? (listener) => store.subscribe(listener) : NOOP_SUBSCRIBE, [store]);
|
|
156
|
+
const getSnapshot = useMemo(() => store ? () => store.getSnapshot() : GET_EMPTY_SNAPSHOT, [store]);
|
|
157
|
+
const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
158
|
+
return useMemo(() => {
|
|
159
|
+
if (!filter?.kind) return snapshot;
|
|
160
|
+
if (!store) return {
|
|
161
|
+
...EMPTY_SNAPSHOT,
|
|
162
|
+
version: snapshot.version
|
|
163
|
+
};
|
|
164
|
+
return aggregateForKind(store.getEntries(), filter.kind, snapshot.version);
|
|
165
|
+
}, [
|
|
166
|
+
snapshot,
|
|
167
|
+
store,
|
|
168
|
+
filter?.kind
|
|
169
|
+
]);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Register a publisher with the nearest {@link ResourceStatusProvider}.
|
|
173
|
+
* Safe to call without a provider — `publish`/`unpublish` are no-ops.
|
|
174
|
+
*
|
|
175
|
+
* @param id Stable identifier (e.g. a `useId()` value).
|
|
176
|
+
* @param label Human-readable label surfaced via `affectedLabels`.
|
|
177
|
+
*/
|
|
178
|
+
function useResourceStatusPublisher(id, label, options) {
|
|
179
|
+
const ctx = useResourceStatusContext();
|
|
180
|
+
const ctxRef = useRef(ctx);
|
|
181
|
+
ctxRef.current = ctx;
|
|
182
|
+
const kindHint = options?.kindHint;
|
|
183
|
+
return {
|
|
184
|
+
publish: useCallback((status) => {
|
|
185
|
+
ctxRef.current?.store.publish(id, label, status, kindHint);
|
|
186
|
+
}, [
|
|
187
|
+
id,
|
|
188
|
+
label,
|
|
189
|
+
kindHint
|
|
190
|
+
]),
|
|
191
|
+
unpublish: useCallback(() => {
|
|
192
|
+
ctxRef.current?.store.unpublish(id);
|
|
193
|
+
}, [id])
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
//#endregion
|
|
198
|
+
export { ResourceStatusProvider, useResourceStatus, useResourceStatusPublisher };
|
|
199
|
+
//# sourceMappingURL=use-resource-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-resource-status.js","names":[],"sources":["../../../src/react/hooks/use-resource-status.tsx"],"sourcesContent":["import {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useSyncExternalStore,\n} from \"react\";\n\nconst NOOP_SUBSCRIBE: (listener: () => void) => () => void = () => () => {};\n\n/**\n * Cross-kind severity, ordered worst-first (`error > warning > pending`).\n * Callers `unpublish` rather than publishing a status for ready resources.\n */\nexport type ResourceSeverity = \"pending\" | \"warning\" | \"error\";\n\n/**\n * Readiness snapshot for a single resource (SQL warehouse, Lakebase\n * connection, model-serving endpoint, …). Plugins publish these while a\n * user-visible cold start / warm-up / unavailability is in flight.\n */\nexport interface ResourceStatus {\n /** Resource family, conventionally lowercase-kebab (`\"warehouse\"`, `\"lakebase\"`). */\n kind: string;\n /** Resource-specific raw state, e.g. `\"STARTING\"`, `\"DELETED\"`. Opaque to the aggregator. */\n state: string;\n severity: ResourceSeverity;\n /** Human-readable summary forwarded to the indicator UI. */\n summary?: string;\n /** Epoch ms when the publisher started waiting; drives `elapsedMs`. */\n startedAt: number;\n}\n\n/** Aggregate view of every active publisher; returned by {@link useResourceStatus}. */\nexport interface AggregatedResourceStatus {\n /** Highest-severity status across all publishers, or `null` when nothing is pending. */\n worst: ResourceStatus | null;\n /** Worst status per `kind`. */\n byKind: Record<string, ResourceStatus>;\n /** De-duped, sorted labels of every publisher with a non-null status. */\n affectedLabels: string[];\n /** Total registered publishers (including those whose status is `null`). */\n activeCount: number;\n /** Milliseconds since the worst entry's `startedAt`; `0` when nothing is pending. */\n elapsedMs: number;\n /** Monotonic counter bumped on every `publish`/`unpublish`. */\n version: number;\n}\n\n/** Optional filter for {@link useResourceStatus}. */\nexport interface ResourceStatusFilter {\n /** Restrict the aggregate to a single resource kind. */\n kind?: string;\n}\n\nconst SEVERITY_RANK: Record<ResourceSeverity, number> = {\n error: 0,\n warning: 1,\n pending: 2,\n};\n\n/**\n * Internal registry record. `kindHint` keeps status-less slots associated\n * with their kind so kind-scoped views can count \"registered but not yet\n * reporting\" publishers (e.g. analytics charts before the first SSE event).\n */\ninterface RegistryEntry {\n label: string;\n status: ResourceStatus | null;\n kindHint?: string;\n}\n\nconst EMPTY_SNAPSHOT: AggregatedResourceStatus = {\n worst: null,\n byKind: {},\n affectedLabels: [],\n activeCount: 0,\n elapsedMs: 0,\n version: 0,\n};\n\nconst GET_EMPTY_SNAPSHOT = (): AggregatedResourceStatus => EMPTY_SNAPSHOT;\n\n/** Flat per-publisher map exposed to React via `useSyncExternalStore`. */\nclass ResourceStatusStore {\n private entries = new Map<string, RegistryEntry>();\n private listeners = new Set<() => void>();\n private snapshot: AggregatedResourceStatus = EMPTY_SNAPSHOT;\n private version = 0;\n\n publish(\n id: string,\n label: string,\n status: ResourceStatus | null,\n kindHint?: string,\n ): void {\n this.entries.set(id, { label, status, kindHint });\n this.bump();\n }\n\n unpublish(id: string): void {\n if (this.entries.delete(id)) this.bump();\n }\n\n subscribe(listener: () => void): () => void {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n getSnapshot(): AggregatedResourceStatus {\n return this.snapshot;\n }\n\n /** Exposed for the kind-filter path so it can pick up status-less `kindHint` slots. */\n getEntries(): Map<string, RegistryEntry> {\n return this.entries;\n }\n\n private bump(): void {\n this.version += 1;\n this.snapshot = aggregate(this.entries, this.version);\n for (const l of this.listeners) l();\n }\n}\n\nfunction isWorse(a: ResourceStatus, b: ResourceStatus): boolean {\n const aRank = SEVERITY_RANK[a.severity];\n const bRank = SEVERITY_RANK[b.severity];\n if (aRank !== bRank) return aRank < bRank;\n // Same severity → longer-pending entry wins.\n return a.startedAt < b.startedAt;\n}\n\n/** Pure derivation of the snapshot from `entries` at a given `version`. */\nfunction aggregate(\n entries: Map<string, RegistryEntry>,\n version: number,\n): AggregatedResourceStatus {\n if (entries.size === 0) return { ...EMPTY_SNAPSHOT, version };\n\n let worst: ResourceStatus | null = null;\n const byKind: Record<string, ResourceStatus> = {};\n const affectedLabels = new Set<string>();\n\n for (const entry of entries.values()) {\n const status = entry.status;\n if (!status) continue;\n affectedLabels.add(entry.label);\n const existing = byKind[status.kind];\n if (!existing || isWorse(status, existing)) {\n byKind[status.kind] = status;\n }\n if (!worst || isWorse(status, worst)) {\n worst = status;\n }\n }\n\n return {\n worst,\n byKind,\n affectedLabels: [...affectedLabels].sort(),\n activeCount: entries.size,\n elapsedMs: worst ? Math.max(0, Date.now() - worst.startedAt) : 0,\n version,\n };\n}\n\n/** Kind-scoped aggregate; walks entries directly to include status-less `kindHint` slots. */\nfunction aggregateForKind(\n entries: Map<string, RegistryEntry>,\n kind: string,\n version: number,\n): AggregatedResourceStatus {\n const affectedLabels = new Set<string>();\n let activeCount = 0;\n let worst: ResourceStatus | null = null;\n\n for (const entry of entries.values()) {\n const entryKind = entry.status?.kind ?? entry.kindHint;\n if (entryKind !== kind) continue;\n activeCount++;\n const status = entry.status;\n if (!status) continue;\n affectedLabels.add(entry.label);\n if (!worst || isWorse(status, worst)) {\n worst = status;\n }\n }\n\n if (activeCount === 0) return { ...EMPTY_SNAPSHOT, version };\n\n const byKind: Record<string, ResourceStatus> = {};\n if (worst) byKind[kind] = worst;\n\n return {\n worst,\n byKind,\n affectedLabels: [...affectedLabels].sort(),\n activeCount,\n elapsedMs: worst ? Math.max(0, Date.now() - worst.startedAt) : 0,\n version,\n };\n}\n\ninterface ResourceStatusContextValue {\n store: ResourceStatusStore;\n}\n\nconst ResourceStatusContext = createContext<ResourceStatusContextValue | null>(\n null,\n);\n\nfunction useResourceStatusContext(): ResourceStatusContextValue | null {\n return useContext(ResourceStatusContext);\n}\n\nexport interface ResourceStatusProviderProps {\n children: ReactNode;\n}\n\n/**\n * Mount once near the root of your app to enable a global, cross-plugin\n * readiness aggregate. Plugins publish {@link ResourceStatus} snapshots\n * while a resource is warming up / unavailable; {@link useResourceStatus}\n * exposes the worst across all of them.\n *\n * Without a provider, `useResourceStatus` and `useResourceStatusPublisher`\n * fall back to no-ops, so plugins are safe to call them unconditionally.\n *\n * @example\n * ```tsx\n * <ResourceStatusProvider>\n * <ResourceStatusIndicator />\n * <App />\n * </ResourceStatusProvider>\n * ```\n */\nexport function ResourceStatusProvider({\n children,\n}: ResourceStatusProviderProps) {\n const storeRef = useRef<ResourceStatusStore | null>(null);\n if (storeRef.current === null) storeRef.current = new ResourceStatusStore();\n\n const value = useMemo(\n () => ({ store: storeRef.current as ResourceStatusStore }),\n [],\n );\n\n return (\n <ResourceStatusContext.Provider value={value}>\n {children}\n </ResourceStatusContext.Provider>\n );\n}\n\n/**\n * Returns the aggregated resource-readiness snapshot across every active\n * publisher under the nearest {@link ResourceStatusProvider}. Falls back\n * to the empty/idle aggregate when no provider is mounted.\n *\n * @param filter Optional `{ kind }` to scope to a single resource kind.\n */\nexport function useResourceStatus(\n filter?: ResourceStatusFilter,\n): AggregatedResourceStatus {\n const ctx = useResourceStatusContext();\n const store = ctx?.store;\n\n const subscribe = useMemo(\n () =>\n store\n ? (listener: () => void) => store.subscribe(listener)\n : NOOP_SUBSCRIBE,\n [store],\n );\n const getSnapshot = useMemo(\n () => (store ? () => store.getSnapshot() : GET_EMPTY_SNAPSHOT),\n [store],\n );\n\n const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);\n\n return useMemo(() => {\n if (!filter?.kind) return snapshot;\n if (!store) return { ...EMPTY_SNAPSHOT, version: snapshot.version };\n return aggregateForKind(store.getEntries(), filter.kind, snapshot.version);\n }, [snapshot, store, filter?.kind]);\n}\n\n/**\n * Register a publisher with the nearest {@link ResourceStatusProvider}.\n * Safe to call without a provider — `publish`/`unpublish` are no-ops.\n *\n * @param id Stable identifier (e.g. a `useId()` value).\n * @param label Human-readable label surfaced via `affectedLabels`.\n */\nexport function useResourceStatusPublisher(\n id: string,\n label: string,\n options?: { kindHint?: string },\n): {\n publish: (status: ResourceStatus | null) => void;\n unpublish: () => void;\n} {\n const ctx = useResourceStatusContext();\n const ctxRef = useRef(ctx);\n ctxRef.current = ctx;\n const kindHint = options?.kindHint;\n\n const publish = useCallback(\n (status: ResourceStatus | null) => {\n ctxRef.current?.store.publish(id, label, status, kindHint);\n },\n [id, label, kindHint],\n );\n const unpublish = useCallback(() => {\n ctxRef.current?.store.unpublish(id);\n }, [id]);\n\n return { publish, unpublish };\n}\n"],"mappings":"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"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -8,9 +8,11 @@ import { LineChart } from "./charts/line/index.js";
|
|
|
8
8
|
import { DonutChart, PieChart } from "./charts/pie/index.js";
|
|
9
9
|
import { RadarChart } from "./charts/radar/index.js";
|
|
10
10
|
import { ScatterChart } from "./charts/scatter/index.js";
|
|
11
|
+
import { AnalyticsFormat, InferResultByFormat, InferRowType, InferServingChunk, InferServingRequest, InferServingResponse, PluginRegistry, QueryRegistry, ServingAlias, ServingEndpointRegistry, TypedArrowTable, UseAnalyticsQueryOptions, UseAnalyticsQueryResult, WarehouseState, WarehouseStatus } from "./hooks/types.js";
|
|
11
12
|
import { UseChartDataOptions, UseChartDataResult, useChartData } from "./hooks/use-chart-data.js";
|
|
12
13
|
import { BaseChart, BaseChartProps } from "./charts/base.js";
|
|
13
14
|
import { createChart } from "./charts/create-chart.js";
|
|
15
|
+
import { LoadingSkeleton, ResourceWaitingPlaceholder } from "./charts/loading.js";
|
|
14
16
|
import { ChartWrapper, ChartWrapperProps } from "./charts/wrapper.js";
|
|
15
17
|
import { NormalizedHeatmapData, normalizeChartData, normalizeHeatmapData } from "./charts/normalize.js";
|
|
16
18
|
import { CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL } from "./charts/constants.js";
|
|
@@ -36,7 +38,8 @@ import { GenieChatMessageList } from "./genie/genie-chat-message-list.js";
|
|
|
36
38
|
import { GenieQueryVisualization } from "./genie/genie-query-visualization.js";
|
|
37
39
|
import { useGenieChat } from "./genie/use-genie-chat.js";
|
|
38
40
|
import "./genie/index.js";
|
|
39
|
-
import {
|
|
41
|
+
import { AggregatedResourceStatus, ResourceSeverity, ResourceStatus, ResourceStatusFilter, ResourceStatusProvider, ResourceStatusProviderProps, useResourceStatus, useResourceStatusPublisher } from "./hooks/use-resource-status.js";
|
|
42
|
+
import { ResourceKindRenderer, ResourceStatusIndicator, ResourceStatusIndicatorProps, ResourceStatusToasterOptions, useResourceStatusToaster } from "./resource-status-indicator.js";
|
|
40
43
|
import { AgentChatEvent, UseAgentChatOptions, UseAgentChatResult, useAgentChat } from "./hooks/use-agent-chat.js";
|
|
41
44
|
import { useAnalyticsQuery } from "./hooks/use-analytics-query.js";
|
|
42
45
|
import { useIsMobile } from "./hooks/use-mobile.js";
|
|
@@ -102,4 +105,4 @@ import { Textarea } from "./ui/textarea.js";
|
|
|
102
105
|
import { Toggle, toggleVariants } from "./ui/toggle.js";
|
|
103
106
|
import { ToggleGroup, ToggleGroupItem } from "./ui/toggle-group.js";
|
|
104
107
|
import "./ui/index.js";
|
|
105
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AgentChatEvent, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnalyticsFormat, AreaChart, AreaChartProps, AreaChartSpecificProps, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BarChartProps, BarChartSpecificProps, BaseChart, BaseChartProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, CartesianContext, ChartBaseProps, ChartColorPalette, ChartConfig, ChartContainer, ChartData, ChartInference, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, ChartType, ChartWrapper, ChartWrapperProps, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ColumnCategory, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DATE_FIELD_PATTERNS, DataFormat, DataProps, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DirectoryEntry, DirectoryList, DirectoryListProps, DonutChart, DonutChartProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FileBreadcrumb, FileBreadcrumbProps, FileBrowserLabels, FileEntry, FileEntryProps, FilePreview, FilePreviewPanel, FilePreviewPanelProps, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GenieAttachmentResponse, GenieChat, GenieChatInput, GenieChatMessage, GenieChatMessageList, GenieChatProps, GenieChatStatus, GenieColumnMeta, GenieMessageItem, GenieMessageResponse, GenieQueryVisualization, GenieStatementResponse, GenieStreamEvent, HeatmapChart, HeatmapChartProps, HeatmapChartSpecificProps, HeatmapContext, HoverCard, HoverCardContent, HoverCardTrigger, InferResultByFormat, InferRowType, InferServingChunk, InferServingRequest, InferServingResponse, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, LineChart, LineChartProps, LineChartSpecificProps, METADATA_DATE_PATTERNS, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NAME_FIELD_PATTERNS, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NewFolderInput, NewFolderInputProps, NormalizedChartData, NormalizedChartDataBase, NormalizedHeatmapData, OptionBuilderContext, Orientation, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PieChart, PieChartProps, PieChartSpecificProps, PluginRegistry, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalContainerContext, PortalContainerProvider, Progress, QueryProps, QueryRegistry, RadarChart, RadarChartProps, RadarChartSpecificProps, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScatterChart, ScatterChartProps, ScatterChartSpecificProps, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, ServingAlias, ServingEndpointRegistry, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, TERMINAL_STATUSES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransformedGenieData, TypedArrowTable, UnifiedChartProps, UseAgentChatOptions, UseAgentChatResult, UseAnalyticsQueryOptions, UseAnalyticsQueryResult, UseChartDataOptions, UseChartDataResult, UseGenieChatOptions, UseGenieChatReturn, UseServingInvokeOptions, UseServingInvokeResult, UseServingStreamOptions, UseServingStreamResult, badgeVariants, buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption, buttonGroupVariants, buttonVariants, cn, createChart, createTimeSeriesData, formatFileSize, formatLabel, getCompatibleChartTypes, inferChartType, isArrowTable, isDataProps, isQueryProps, navigationMenuTriggerStyle, normalizeChartData, normalizeHeatmapData, sortTimeSeriesAscending, toChartArray, toChartValue, toggleVariants, transformGenieData, truncateLabel, useAgentChat, useAllThemeColors, useAnalyticsQuery, useChartData, useFormField, useGenieChat, useIsMobile, usePluginClientConfig, usePortalContainer, useResolvedPortalContainer, useServingInvoke, useServingStream, useSidebar, useThemeColors };
|
|
108
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AgentChatEvent, AggregatedResourceStatus, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnalyticsFormat, AreaChart, AreaChartProps, AreaChartSpecificProps, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BarChartProps, BarChartSpecificProps, BaseChart, BaseChartProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, CartesianContext, ChartBaseProps, ChartColorPalette, ChartConfig, ChartContainer, ChartData, ChartInference, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, ChartType, ChartWrapper, ChartWrapperProps, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ColumnCategory, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DATE_FIELD_PATTERNS, DataFormat, DataProps, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DirectoryEntry, DirectoryList, DirectoryListProps, DonutChart, DonutChartProps, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FileBreadcrumb, FileBreadcrumbProps, FileBrowserLabels, FileEntry, FileEntryProps, FilePreview, FilePreviewPanel, FilePreviewPanelProps, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GenieAttachmentResponse, GenieChat, GenieChatInput, GenieChatMessage, GenieChatMessageList, GenieChatProps, GenieChatStatus, GenieColumnMeta, GenieMessageItem, GenieMessageResponse, GenieQueryVisualization, GenieStatementResponse, GenieStreamEvent, HeatmapChart, HeatmapChartProps, HeatmapChartSpecificProps, HeatmapContext, HoverCard, HoverCardContent, HoverCardTrigger, InferResultByFormat, InferRowType, InferServingChunk, InferServingRequest, InferServingResponse, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, LineChart, LineChartProps, LineChartSpecificProps, LoadingSkeleton, METADATA_DATE_PATTERNS, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NAME_FIELD_PATTERNS, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NewFolderInput, NewFolderInputProps, NormalizedChartData, NormalizedChartDataBase, NormalizedHeatmapData, OptionBuilderContext, Orientation, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PieChart, PieChartProps, PieChartSpecificProps, PluginRegistry, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalContainerContext, PortalContainerProvider, Progress, QueryProps, QueryRegistry, RadarChart, RadarChartProps, RadarChartSpecificProps, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ResourceKindRenderer, ResourceSeverity, ResourceStatus, ResourceStatusFilter, ResourceStatusIndicator, ResourceStatusIndicatorProps, ResourceStatusProvider, ResourceStatusProviderProps, ResourceStatusToasterOptions, ResourceWaitingPlaceholder, ScatterChart, ScatterChartProps, ScatterChartSpecificProps, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, ServingAlias, ServingEndpointRegistry, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, TERMINAL_STATUSES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TransformedGenieData, TypedArrowTable, UnifiedChartProps, UseAgentChatOptions, UseAgentChatResult, UseAnalyticsQueryOptions, UseAnalyticsQueryResult, UseChartDataOptions, UseChartDataResult, UseGenieChatOptions, UseGenieChatReturn, UseServingInvokeOptions, UseServingInvokeResult, UseServingStreamOptions, UseServingStreamResult, WarehouseState, WarehouseStatus, badgeVariants, buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption, buttonGroupVariants, buttonVariants, cn, createChart, createTimeSeriesData, formatFileSize, formatLabel, getCompatibleChartTypes, inferChartType, isArrowTable, isDataProps, isQueryProps, navigationMenuTriggerStyle, normalizeChartData, normalizeHeatmapData, sortTimeSeriesAscending, toChartArray, toChartValue, toggleVariants, transformGenieData, truncateLabel, useAgentChat, useAllThemeColors, useAnalyticsQuery, useChartData, useFormField, useGenieChat, useIsMobile, usePluginClientConfig, usePortalContainer, useResolvedPortalContainer, useResourceStatus, useResourceStatusPublisher, useResourceStatusToaster, useServingInvoke, useServingStream, useSidebar, useThemeColors };
|
package/dist/react/index.js
CHANGED
|
@@ -6,8 +6,10 @@ import { normalizeChartData, normalizeHeatmapData } from "./charts/normalize.js"
|
|
|
6
6
|
import { buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption } from "./charts/options.js";
|
|
7
7
|
import { useAllThemeColors, useThemeColors } from "./charts/theme.js";
|
|
8
8
|
import { BaseChart } from "./charts/base.js";
|
|
9
|
+
import { ResourceStatusProvider, useResourceStatus, useResourceStatusPublisher } from "./hooks/use-resource-status.js";
|
|
9
10
|
import { useAnalyticsQuery } from "./hooks/use-analytics-query.js";
|
|
10
11
|
import { useChartData } from "./hooks/use-chart-data.js";
|
|
12
|
+
import { LoadingSkeleton, ResourceWaitingPlaceholder } from "./charts/loading.js";
|
|
11
13
|
import { ChartWrapper } from "./charts/wrapper.js";
|
|
12
14
|
import { createChart } from "./charts/create-chart.js";
|
|
13
15
|
import { AreaChart } from "./charts/area/index.js";
|
|
@@ -46,6 +48,8 @@ import { GenieChatMessageList } from "./genie/genie-chat-message-list.js";
|
|
|
46
48
|
import { useGenieChat } from "./genie/use-genie-chat.js";
|
|
47
49
|
import { GenieChat } from "./genie/genie-chat.js";
|
|
48
50
|
import "./genie/index.js";
|
|
51
|
+
import { Toaster } from "./ui/sonner.js";
|
|
52
|
+
import { ResourceStatusIndicator, useResourceStatusToaster } from "./resource-status-indicator.js";
|
|
49
53
|
import { useAgentChat } from "./hooks/use-agent-chat.js";
|
|
50
54
|
import { useIsMobile } from "./hooks/use-mobile.js";
|
|
51
55
|
import { usePluginClientConfig } from "./hooks/use-plugin-config.js";
|
|
@@ -93,10 +97,9 @@ import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHe
|
|
|
93
97
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip.js";
|
|
94
98
|
import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from "./ui/sidebar.js";
|
|
95
99
|
import { Slider } from "./ui/slider.js";
|
|
96
|
-
import { Toaster } from "./ui/sonner.js";
|
|
97
100
|
import { Switch } from "./ui/switch.js";
|
|
98
101
|
import { Toggle, toggleVariants } from "./ui/toggle.js";
|
|
99
102
|
import { ToggleGroup, ToggleGroupItem } from "./ui/toggle-group.js";
|
|
100
103
|
import "./ui/index.js";
|
|
101
104
|
|
|
102
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AreaChart, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BaseChart, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, ChartWrapper, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DATE_FIELD_PATTERNS, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DirectoryList, DonutChart, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FileBreadcrumb, FileEntry, FilePreviewPanel, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GenieChat, GenieChatInput, GenieChatMessage, GenieChatMessageList, GenieQueryVisualization, HeatmapChart, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, LineChart, METADATA_DATE_PATTERNS, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NAME_FIELD_PATTERNS, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NewFolderInput, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PieChart, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalContainerContext, PortalContainerProvider, Progress, RadarChart, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScatterChart, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption, buttonGroupVariants, buttonVariants, cn, createChart, createTimeSeriesData, formatFileSize, formatLabel, getCompatibleChartTypes, inferChartType, isArrowTable, isDataProps, isQueryProps, navigationMenuTriggerStyle, normalizeChartData, normalizeHeatmapData, sortTimeSeriesAscending, toChartArray, toChartValue, toggleVariants, transformGenieData, truncateLabel, useAgentChat, useAllThemeColors, useAnalyticsQuery, useChartData, useFormField, useGenieChat, useIsMobile, usePluginClientConfig, usePortalContainer, useResolvedPortalContainer, useServingInvoke, useServingStream, useSidebar, useThemeColors };
|
|
105
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AreaChart, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BaseChart, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, ChartWrapper, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DATE_FIELD_PATTERNS, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DirectoryList, DonutChart, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FileBreadcrumb, FileEntry, FilePreviewPanel, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GenieChat, GenieChatInput, GenieChatMessage, GenieChatMessageList, GenieQueryVisualization, HeatmapChart, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, LineChart, LoadingSkeleton, METADATA_DATE_PATTERNS, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NAME_FIELD_PATTERNS, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NewFolderInput, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PieChart, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalContainerContext, PortalContainerProvider, Progress, RadarChart, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ResourceStatusIndicator, ResourceStatusProvider, ResourceWaitingPlaceholder, ScatterChart, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption, buttonGroupVariants, buttonVariants, cn, createChart, createTimeSeriesData, formatFileSize, formatLabel, getCompatibleChartTypes, inferChartType, isArrowTable, isDataProps, isQueryProps, navigationMenuTriggerStyle, normalizeChartData, normalizeHeatmapData, sortTimeSeriesAscending, toChartArray, toChartValue, toggleVariants, transformGenieData, truncateLabel, useAgentChat, useAllThemeColors, useAnalyticsQuery, useChartData, useFormField, useGenieChat, useIsMobile, usePluginClientConfig, usePortalContainer, useResolvedPortalContainer, useResourceStatus, useResourceStatusPublisher, useResourceStatusToaster, useServingInvoke, useServingStream, useSidebar, useThemeColors };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { AggregatedResourceStatus, ResourceStatus } from "./hooks/use-resource-status.js";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { LucideIcon } from "lucide-react";
|
|
4
|
+
import { ToasterProps } from "sonner";
|
|
5
|
+
|
|
6
|
+
//#region src/react/resource-status-indicator.d.ts
|
|
7
|
+
/** Per-kind copy + icon overrides for {@link ResourceStatusIndicator}. */
|
|
8
|
+
interface ResourceKindRenderer {
|
|
9
|
+
title: (status: ResourceStatus) => string;
|
|
10
|
+
description: (status: ResourceStatus, aggregate: AggregatedResourceStatus) => string;
|
|
11
|
+
/** Defaults to sonner's built-in loading/error icon. */
|
|
12
|
+
icon?: LucideIcon;
|
|
13
|
+
}
|
|
14
|
+
/** Options shared by {@link ResourceStatusIndicator} and {@link useResourceStatusToaster}. */
|
|
15
|
+
interface ResourceStatusToasterOptions {
|
|
16
|
+
/** Restrict to a single resource kind. Otherwise shows the worst across all kinds. */
|
|
17
|
+
kind?: string;
|
|
18
|
+
/** Per-kind copy + icon overrides. */
|
|
19
|
+
renderers?: Record<string, ResourceKindRenderer>;
|
|
20
|
+
/** Class name applied to the toast (not the Toaster wrapper). */
|
|
21
|
+
toastClassName?: string;
|
|
22
|
+
/** Full custom render override, rendered inside `toast.custom`. */
|
|
23
|
+
render?: (aggregate: AggregatedResourceStatus) => React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Drives a sticky sonner toast that mirrors the worst pending resource
|
|
27
|
+
* status. Does not render anything — supply your own `<Toaster />`. Most
|
|
28
|
+
* apps should prefer {@link ResourceStatusIndicator}; use this hook only
|
|
29
|
+
* to share an existing Toaster with unrelated app toasts.
|
|
30
|
+
*/
|
|
31
|
+
declare function useResourceStatusToaster(options?: ResourceStatusToasterOptions): void;
|
|
32
|
+
interface ResourceStatusIndicatorProps extends ResourceStatusToasterOptions, Omit<ToasterProps, "className"> {
|
|
33
|
+
/** Class name applied to the Toaster wrapper. */
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Drop-in indicator that mounts a `<Toaster />` and surfaces the worst
|
|
38
|
+
* pending {@link ResourceStatus} across every plugin/component publishing
|
|
39
|
+
* into the nearest {@link ResourceStatusProvider} as a sonner toast
|
|
40
|
+
* (`toast.loading` for cold starts, `toast.error` for unrecoverable
|
|
41
|
+
* states), keyed by the worst kind so only one indicator toast is on
|
|
42
|
+
* screen at a time.
|
|
43
|
+
*
|
|
44
|
+
* Forwards `Toaster` props (`position` defaults to `top-right`, plus
|
|
45
|
+
* `theme`, `richColors`, …). Apps that already mount their own
|
|
46
|
+
* `<Toaster />` should drop this component and call
|
|
47
|
+
* {@link useResourceStatusToaster} instead.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <ResourceStatusProvider>
|
|
52
|
+
* <ResourceStatusIndicator />
|
|
53
|
+
* <App />
|
|
54
|
+
* </ResourceStatusProvider>
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example Custom render
|
|
58
|
+
* ```tsx
|
|
59
|
+
* <ResourceStatusIndicator
|
|
60
|
+
* render={(agg) => (
|
|
61
|
+
* <div className="my-card">
|
|
62
|
+
* {agg.worst?.kind} {agg.worst?.state.toLowerCase()}
|
|
63
|
+
* </div>
|
|
64
|
+
* )}
|
|
65
|
+
* />
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
declare function ResourceStatusIndicator({
|
|
69
|
+
kind,
|
|
70
|
+
renderers,
|
|
71
|
+
toastClassName,
|
|
72
|
+
render,
|
|
73
|
+
position,
|
|
74
|
+
...toasterProps
|
|
75
|
+
}?: ResourceStatusIndicatorProps): react_jsx_runtime0.JSX.Element;
|
|
76
|
+
//#endregion
|
|
77
|
+
export { ResourceKindRenderer, ResourceStatusIndicator, ResourceStatusIndicatorProps, ResourceStatusToasterOptions, useResourceStatusToaster };
|
|
78
|
+
//# sourceMappingURL=resource-status-indicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-status-indicator.d.ts","names":[],"sources":["../../src/react/resource-status-indicator.tsx"],"mappings":";;;;;;;UAciB,oBAAA;EACf,KAAA,GAAQ,MAAA,EAAQ,cAAA;EAChB,WAAA,GACE,MAAA,EAAQ,cAAA,EACR,SAAA,EAAW,wBAAA;EAJsB;EAOnC,IAAA,GAAO,UAAA;AAAA;;UAIQ,4BAAA;EAJR;EAMP,IAAA;EANiB;EAQjB,SAAA,GAAY,MAAA,SAAe,oBAAA;EAdX;EAgBhB,cAAA;EAfA;EAiBA,MAAA,IAAU,SAAA,EAAW,wBAAA,KAA6B,KAAA,CAAM,SAAA;AAAA;;;;;;;iBA+B1C,wBAAA,CACd,OAAA,GAAS,4BAAA;AAAA,UAsFM,4BAAA,SACP,4BAAA,EACN,IAAA,CAAK,YAAA;;EAEP,SAAA;AAAA;;;;;;;;;;;;;;;;;AA3FF;;;;;AAuFA;;;;;;;;;;;iBAuCgB,uBAAA,CAAA;EACd,IAAA;EACA,SAAA;EACA,cAAA;EACA,MAAA;EACA,QAAA;EAAA,GACG;AAAA,IACF,4BAAA,GAAiC,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { useResourceStatus } from "./hooks/use-resource-status.js";
|
|
2
|
+
import { Toaster as Toaster$1 } from "./ui/sonner.js";
|
|
3
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
4
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
|
+
import { toast } from "sonner";
|
|
6
|
+
|
|
7
|
+
//#region src/react/resource-status-indicator.tsx
|
|
8
|
+
/** ~1Hz tick driving the elapsed-time display between store events. */
|
|
9
|
+
const ELAPSED_TICK_MS = 1e3;
|
|
10
|
+
const DEFAULT_KIND_RENDERERS = { warehouse: {
|
|
11
|
+
title: (s) => s.severity === "error" ? "SQL warehouse unavailable" : "SQL warehouse warming up",
|
|
12
|
+
description: (s, agg) => {
|
|
13
|
+
if (s.severity === "error") return s.summary ?? "The configured SQL warehouse is unavailable. Update DATABRICKS_WAREHOUSE_ID and reload.";
|
|
14
|
+
const labels = agg.affectedLabels.length;
|
|
15
|
+
if (labels === 0) return `Waiting for the warehouse to reach RUNNING · ${formatElapsed(agg.elapsedMs)}`;
|
|
16
|
+
return `${labels} ${labels === 1 ? "query" : "queries"} waiting · ${formatElapsed(agg.elapsedMs)}`;
|
|
17
|
+
}
|
|
18
|
+
} };
|
|
19
|
+
/**
|
|
20
|
+
* Drives a sticky sonner toast that mirrors the worst pending resource
|
|
21
|
+
* status. Does not render anything — supply your own `<Toaster />`. Most
|
|
22
|
+
* apps should prefer {@link ResourceStatusIndicator}; use this hook only
|
|
23
|
+
* to share an existing Toaster with unrelated app toasts.
|
|
24
|
+
*/
|
|
25
|
+
function useResourceStatusToaster(options = {}) {
|
|
26
|
+
const { kind, renderers, toastClassName, render } = options;
|
|
27
|
+
const aggregate = useResourceStatus(kind ? { kind } : void 0);
|
|
28
|
+
const worst = aggregate.worst;
|
|
29
|
+
const instanceId = useId();
|
|
30
|
+
const [, forceTick] = useState(0);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!worst) return;
|
|
33
|
+
const id = setInterval(() => forceTick((n) => n + 1), ELAPSED_TICK_MS);
|
|
34
|
+
return () => clearInterval(id);
|
|
35
|
+
}, [worst]);
|
|
36
|
+
const liveIdRef = useRef(null);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!worst) {
|
|
39
|
+
if (liveIdRef.current) {
|
|
40
|
+
toast.dismiss(liveIdRef.current);
|
|
41
|
+
liveIdRef.current = null;
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const liveAggregate = {
|
|
46
|
+
...aggregate,
|
|
47
|
+
elapsedMs: Math.max(0, Date.now() - worst.startedAt)
|
|
48
|
+
};
|
|
49
|
+
const nextId = `appkit-resource:${instanceId}:${worst.kind}:${worst.severity}`;
|
|
50
|
+
if (liveIdRef.current && liveIdRef.current !== nextId) toast.dismiss(liveIdRef.current);
|
|
51
|
+
liveIdRef.current = nextId;
|
|
52
|
+
if (render) {
|
|
53
|
+
const node = render(liveAggregate);
|
|
54
|
+
toast.custom(() => /* @__PURE__ */ jsx(Fragment, { children: node }), {
|
|
55
|
+
id: nextId,
|
|
56
|
+
duration: Number.POSITIVE_INFINITY,
|
|
57
|
+
className: toastClassName
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const renderer = {
|
|
62
|
+
...DEFAULT_KIND_RENDERERS,
|
|
63
|
+
...renderers
|
|
64
|
+
}[worst.kind];
|
|
65
|
+
const title = renderer?.title(worst) ?? defaultTitle(worst);
|
|
66
|
+
const description = renderer?.description(worst, liveAggregate) ?? defaultDescription(worst);
|
|
67
|
+
const Icon = renderer?.icon;
|
|
68
|
+
const opts = {
|
|
69
|
+
id: nextId,
|
|
70
|
+
description,
|
|
71
|
+
duration: Number.POSITIVE_INFINITY,
|
|
72
|
+
className: toastClassName,
|
|
73
|
+
...Icon ? { icon: /* @__PURE__ */ jsx(Icon, { className: "size-4" }) } : {}
|
|
74
|
+
};
|
|
75
|
+
if (worst.severity === "error") toast.error(title, opts);
|
|
76
|
+
else toast.loading(title, opts);
|
|
77
|
+
});
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
return () => {
|
|
80
|
+
if (liveIdRef.current) {
|
|
81
|
+
toast.dismiss(liveIdRef.current);
|
|
82
|
+
liveIdRef.current = null;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}, []);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Drop-in indicator that mounts a `<Toaster />` and surfaces the worst
|
|
89
|
+
* pending {@link ResourceStatus} across every plugin/component publishing
|
|
90
|
+
* into the nearest {@link ResourceStatusProvider} as a sonner toast
|
|
91
|
+
* (`toast.loading` for cold starts, `toast.error` for unrecoverable
|
|
92
|
+
* states), keyed by the worst kind so only one indicator toast is on
|
|
93
|
+
* screen at a time.
|
|
94
|
+
*
|
|
95
|
+
* Forwards `Toaster` props (`position` defaults to `top-right`, plus
|
|
96
|
+
* `theme`, `richColors`, …). Apps that already mount their own
|
|
97
|
+
* `<Toaster />` should drop this component and call
|
|
98
|
+
* {@link useResourceStatusToaster} instead.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```tsx
|
|
102
|
+
* <ResourceStatusProvider>
|
|
103
|
+
* <ResourceStatusIndicator />
|
|
104
|
+
* <App />
|
|
105
|
+
* </ResourceStatusProvider>
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @example Custom render
|
|
109
|
+
* ```tsx
|
|
110
|
+
* <ResourceStatusIndicator
|
|
111
|
+
* render={(agg) => (
|
|
112
|
+
* <div className="my-card">
|
|
113
|
+
* {agg.worst?.kind} {agg.worst?.state.toLowerCase()}
|
|
114
|
+
* </div>
|
|
115
|
+
* )}
|
|
116
|
+
* />
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
function ResourceStatusIndicator({ kind, renderers, toastClassName, render, position = "top-right", ...toasterProps } = {}) {
|
|
120
|
+
useResourceStatusToaster({
|
|
121
|
+
kind,
|
|
122
|
+
renderers,
|
|
123
|
+
toastClassName,
|
|
124
|
+
render
|
|
125
|
+
});
|
|
126
|
+
return /* @__PURE__ */ jsx(Toaster$1, {
|
|
127
|
+
position,
|
|
128
|
+
...toasterProps
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function defaultTitle(status) {
|
|
132
|
+
switch (status.severity) {
|
|
133
|
+
case "error": return `${humanizeKind(status.kind)} unavailable`;
|
|
134
|
+
case "warning": return `${humanizeKind(status.kind)} degraded`;
|
|
135
|
+
default: return `${humanizeKind(status.kind)} not ready`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function defaultDescription(status) {
|
|
139
|
+
return status.summary ?? `Current state: ${status.state}.`;
|
|
140
|
+
}
|
|
141
|
+
function humanizeKind(kind) {
|
|
142
|
+
if (!kind) return "Resource";
|
|
143
|
+
return kind.split(/[-_]/g).filter(Boolean).map((part) => part[0].toUpperCase() + part.slice(1)).join(" ");
|
|
144
|
+
}
|
|
145
|
+
function formatElapsed(ms) {
|
|
146
|
+
const totalSeconds = Math.max(0, Math.floor(ms / 1e3));
|
|
147
|
+
if (totalSeconds < 60) return `${totalSeconds}s`;
|
|
148
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
149
|
+
const seconds = totalSeconds % 60;
|
|
150
|
+
return seconds === 0 ? `${minutes}m` : `${minutes}m ${seconds}s`;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
//#endregion
|
|
154
|
+
export { ResourceStatusIndicator, useResourceStatusToaster };
|
|
155
|
+
//# sourceMappingURL=resource-status-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-status-indicator.js","names":["Toaster"],"sources":["../../src/react/resource-status-indicator.tsx"],"sourcesContent":["import type { LucideIcon } from \"lucide-react\";\nimport { useEffect, useId, useRef, useState } from \"react\";\nimport { type ToasterProps, toast } from \"sonner\";\nimport {\n type AggregatedResourceStatus,\n type ResourceStatus,\n useResourceStatus,\n} from \"./hooks/use-resource-status\";\nimport { Toaster } from \"./ui/sonner\";\n\n/** ~1Hz tick driving the elapsed-time display between store events. */\nconst ELAPSED_TICK_MS = 1000;\n\n/** Per-kind copy + icon overrides for {@link ResourceStatusIndicator}. */\nexport interface ResourceKindRenderer {\n title: (status: ResourceStatus) => string;\n description: (\n status: ResourceStatus,\n aggregate: AggregatedResourceStatus,\n ) => string;\n /** Defaults to sonner's built-in loading/error icon. */\n icon?: LucideIcon;\n}\n\n/** Options shared by {@link ResourceStatusIndicator} and {@link useResourceStatusToaster}. */\nexport interface ResourceStatusToasterOptions {\n /** Restrict to a single resource kind. Otherwise shows the worst across all kinds. */\n kind?: string;\n /** Per-kind copy + icon overrides. */\n renderers?: Record<string, ResourceKindRenderer>;\n /** Class name applied to the toast (not the Toaster wrapper). */\n toastClassName?: string;\n /** Full custom render override, rendered inside `toast.custom`. */\n render?: (aggregate: AggregatedResourceStatus) => React.ReactNode;\n}\n\nconst DEFAULT_KIND_RENDERERS: Record<string, ResourceKindRenderer> = {\n warehouse: {\n title: (s) =>\n s.severity === \"error\"\n ? \"SQL warehouse unavailable\"\n : \"SQL warehouse warming up\",\n description: (s, agg) => {\n if (s.severity === \"error\") {\n return (\n s.summary ??\n \"The configured SQL warehouse is unavailable. Update DATABRICKS_WAREHOUSE_ID and reload.\"\n );\n }\n const labels = agg.affectedLabels.length;\n if (labels === 0) {\n return `Waiting for the warehouse to reach RUNNING · ${formatElapsed(agg.elapsedMs)}`;\n }\n return `${labels} ${labels === 1 ? \"query\" : \"queries\"} waiting · ${formatElapsed(agg.elapsedMs)}`;\n },\n },\n};\n\n/**\n * Drives a sticky sonner toast that mirrors the worst pending resource\n * status. Does not render anything — supply your own `<Toaster />`. Most\n * apps should prefer {@link ResourceStatusIndicator}; use this hook only\n * to share an existing Toaster with unrelated app toasts.\n */\nexport function useResourceStatusToaster(\n options: ResourceStatusToasterOptions = {},\n): void {\n const { kind, renderers, toastClassName, render } = options;\n const aggregate = useResourceStatus(kind ? { kind } : undefined);\n const worst = aggregate.worst;\n // Per-instance + per-kind toast id: instance scoping isolates multiple\n // indicators in the same tree; kind scoping forces dismiss-and-recreate\n // when severity flips between toast types (sonner can't morph\n // jsx/description cleanly across `custom` ↔ `loading`/`error`).\n const instanceId = useId();\n\n // The store is event-driven, so re-render at ~1Hz to keep the elapsed\n // counter advancing between status emissions.\n const [, forceTick] = useState(0);\n useEffect(() => {\n if (!worst) return;\n const id = setInterval(() => forceTick((n) => n + 1), ELAPSED_TICK_MS);\n return () => clearInterval(id);\n }, [worst]);\n\n const liveIdRef = useRef<string | null>(null);\n\n // Runs every render: cheap because sonner patches the same id in place.\n useEffect(() => {\n if (!worst) {\n if (liveIdRef.current) {\n toast.dismiss(liveIdRef.current);\n liveIdRef.current = null;\n }\n return;\n }\n\n // Live elapsed; the snapshot only refreshes on store events.\n const liveAggregate: AggregatedResourceStatus = {\n ...aggregate,\n elapsedMs: Math.max(0, Date.now() - worst.startedAt),\n };\n\n const nextId = `appkit-resource:${instanceId}:${worst.kind}:${worst.severity}`;\n if (liveIdRef.current && liveIdRef.current !== nextId) {\n toast.dismiss(liveIdRef.current);\n }\n liveIdRef.current = nextId;\n\n if (render) {\n const node = render(liveAggregate);\n toast.custom(() => <>{node}</>, {\n id: nextId,\n duration: Number.POSITIVE_INFINITY,\n className: toastClassName,\n });\n return;\n }\n\n const merged = { ...DEFAULT_KIND_RENDERERS, ...renderers };\n const renderer = merged[worst.kind];\n const title = renderer?.title(worst) ?? defaultTitle(worst);\n const description =\n renderer?.description(worst, liveAggregate) ?? defaultDescription(worst);\n const Icon = renderer?.icon;\n const opts = {\n id: nextId,\n description,\n duration: Number.POSITIVE_INFINITY,\n className: toastClassName,\n ...(Icon ? { icon: <Icon className=\"size-4\" /> } : {}),\n };\n\n if (worst.severity === \"error\") {\n toast.error(title, opts);\n } else {\n toast.loading(title, opts);\n }\n });\n\n // Dismiss on unmount so the toast doesn't outlive its mount point.\n useEffect(() => {\n return () => {\n if (liveIdRef.current) {\n toast.dismiss(liveIdRef.current);\n liveIdRef.current = null;\n }\n };\n }, []);\n}\n\nexport interface ResourceStatusIndicatorProps\n extends ResourceStatusToasterOptions,\n Omit<ToasterProps, \"className\"> {\n /** Class name applied to the Toaster wrapper. */\n className?: string;\n}\n\n/**\n * Drop-in indicator that mounts a `<Toaster />` and surfaces the worst\n * pending {@link ResourceStatus} across every plugin/component publishing\n * into the nearest {@link ResourceStatusProvider} as a sonner toast\n * (`toast.loading` for cold starts, `toast.error` for unrecoverable\n * states), keyed by the worst kind so only one indicator toast is on\n * screen at a time.\n *\n * Forwards `Toaster` props (`position` defaults to `top-right`, plus\n * `theme`, `richColors`, …). Apps that already mount their own\n * `<Toaster />` should drop this component and call\n * {@link useResourceStatusToaster} instead.\n *\n * @example\n * ```tsx\n * <ResourceStatusProvider>\n * <ResourceStatusIndicator />\n * <App />\n * </ResourceStatusProvider>\n * ```\n *\n * @example Custom render\n * ```tsx\n * <ResourceStatusIndicator\n * render={(agg) => (\n * <div className=\"my-card\">\n * {agg.worst?.kind} {agg.worst?.state.toLowerCase()}\n * </div>\n * )}\n * />\n * ```\n */\nexport function ResourceStatusIndicator({\n kind,\n renderers,\n toastClassName,\n render,\n position = \"top-right\",\n ...toasterProps\n}: ResourceStatusIndicatorProps = {}) {\n useResourceStatusToaster({ kind, renderers, toastClassName, render });\n return <Toaster position={position} {...toasterProps} />;\n}\n\nfunction defaultTitle(status: ResourceStatus): string {\n switch (status.severity) {\n case \"error\":\n return `${humanizeKind(status.kind)} unavailable`;\n case \"warning\":\n return `${humanizeKind(status.kind)} degraded`;\n default:\n return `${humanizeKind(status.kind)} not ready`;\n }\n}\n\nfunction defaultDescription(status: ResourceStatus): string {\n return status.summary ?? `Current state: ${status.state}.`;\n}\n\nfunction humanizeKind(kind: string): string {\n if (!kind) return \"Resource\";\n return kind\n .split(/[-_]/g)\n .filter(Boolean)\n .map((part) => part[0].toUpperCase() + part.slice(1))\n .join(\" \");\n}\n\nfunction formatElapsed(ms: number): string {\n const totalSeconds = Math.max(0, Math.floor(ms / 1000));\n if (totalSeconds < 60) return `${totalSeconds}s`;\n const minutes = Math.floor(totalSeconds / 60);\n const seconds = totalSeconds % 60;\n return seconds === 0 ? `${minutes}m` : `${minutes}m ${seconds}s`;\n}\n"],"mappings":";;;;;;;;AAWA,MAAM,kBAAkB;AAyBxB,MAAM,yBAA+D,EACnE,WAAW;CACT,QAAQ,MACN,EAAE,aAAa,UACX,8BACA;CACN,cAAc,GAAG,QAAQ;AACvB,MAAI,EAAE,aAAa,QACjB,QACE,EAAE,WACF;EAGJ,MAAM,SAAS,IAAI,eAAe;AAClC,MAAI,WAAW,EACb,QAAO,gDAAgD,cAAc,IAAI,UAAU;AAErF,SAAO,GAAG,OAAO,GAAG,WAAW,IAAI,UAAU,UAAU,aAAa,cAAc,IAAI,UAAU;;CAEnG,EACF;;;;;;;AAQD,SAAgB,yBACd,UAAwC,EAAE,EACpC;CACN,MAAM,EAAE,MAAM,WAAW,gBAAgB,WAAW;CACpD,MAAM,YAAY,kBAAkB,OAAO,EAAE,MAAM,GAAG,OAAU;CAChE,MAAM,QAAQ,UAAU;CAKxB,MAAM,aAAa,OAAO;CAI1B,MAAM,GAAG,aAAa,SAAS,EAAE;AACjC,iBAAgB;AACd,MAAI,CAAC,MAAO;EACZ,MAAM,KAAK,kBAAkB,WAAW,MAAM,IAAI,EAAE,EAAE,gBAAgB;AACtE,eAAa,cAAc,GAAG;IAC7B,CAAC,MAAM,CAAC;CAEX,MAAM,YAAY,OAAsB,KAAK;AAG7C,iBAAgB;AACd,MAAI,CAAC,OAAO;AACV,OAAI,UAAU,SAAS;AACrB,UAAM,QAAQ,UAAU,QAAQ;AAChC,cAAU,UAAU;;AAEtB;;EAIF,MAAM,gBAA0C;GAC9C,GAAG;GACH,WAAW,KAAK,IAAI,GAAG,KAAK,KAAK,GAAG,MAAM,UAAU;GACrD;EAED,MAAM,SAAS,mBAAmB,WAAW,GAAG,MAAM,KAAK,GAAG,MAAM;AACpE,MAAI,UAAU,WAAW,UAAU,YAAY,OAC7C,OAAM,QAAQ,UAAU,QAAQ;AAElC,YAAU,UAAU;AAEpB,MAAI,QAAQ;GACV,MAAM,OAAO,OAAO,cAAc;AAClC,SAAM,aAAa,0CAAG,OAAQ,EAAE;IAC9B,IAAI;IACJ,UAAU,OAAO;IACjB,WAAW;IACZ,CAAC;AACF;;EAIF,MAAM,WADS;GAAE,GAAG;GAAwB,GAAG;GAAW,CAClC,MAAM;EAC9B,MAAM,QAAQ,UAAU,MAAM,MAAM,IAAI,aAAa,MAAM;EAC3D,MAAM,cACJ,UAAU,YAAY,OAAO,cAAc,IAAI,mBAAmB,MAAM;EAC1E,MAAM,OAAO,UAAU;EACvB,MAAM,OAAO;GACX,IAAI;GACJ;GACA,UAAU,OAAO;GACjB,WAAW;GACX,GAAI,OAAO,EAAE,MAAM,oBAAC,QAAK,WAAU,WAAW,EAAE,GAAG,EAAE;GACtD;AAED,MAAI,MAAM,aAAa,QACrB,OAAM,MAAM,OAAO,KAAK;MAExB,OAAM,QAAQ,OAAO,KAAK;GAE5B;AAGF,iBAAgB;AACd,eAAa;AACX,OAAI,UAAU,SAAS;AACrB,UAAM,QAAQ,UAAU,QAAQ;AAChC,cAAU,UAAU;;;IAGvB,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CR,SAAgB,wBAAwB,EACtC,MACA,WACA,gBACA,QACA,WAAW,aACX,GAAG,iBAC6B,EAAE,EAAE;AACpC,0BAAyB;EAAE;EAAM;EAAW;EAAgB;EAAQ,CAAC;AACrE,QAAO,oBAACA;EAAkB;EAAU,GAAI;GAAgB;;AAG1D,SAAS,aAAa,QAAgC;AACpD,SAAQ,OAAO,UAAf;EACE,KAAK,QACH,QAAO,GAAG,aAAa,OAAO,KAAK,CAAC;EACtC,KAAK,UACH,QAAO,GAAG,aAAa,OAAO,KAAK,CAAC;EACtC,QACE,QAAO,GAAG,aAAa,OAAO,KAAK,CAAC;;;AAI1C,SAAS,mBAAmB,QAAgC;AAC1D,QAAO,OAAO,WAAW,kBAAkB,OAAO,MAAM;;AAG1D,SAAS,aAAa,MAAsB;AAC1C,KAAI,CAAC,KAAM,QAAO;AAClB,QAAO,KACJ,MAAM,QAAQ,CACd,OAAO,QAAQ,CACf,KAAK,SAAS,KAAK,GAAG,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC,CACpD,KAAK,IAAI;;AAGd,SAAS,cAAc,IAAoB;CACzC,MAAM,eAAe,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,IAAK,CAAC;AACvD,KAAI,eAAe,GAAI,QAAO,GAAG,aAAa;CAC9C,MAAM,UAAU,KAAK,MAAM,eAAe,GAAG;CAC7C,MAAM,UAAU,eAAe;AAC/B,QAAO,YAAY,IAAI,GAAG,QAAQ,KAAK,GAAG,QAAQ,IAAI,QAAQ"}
|
package/dist/react/ui/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
|
|
|
8
8
|
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
9
9
|
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./table.js";
|
|
10
10
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./tabs.js";
|
|
11
|
+
import { Toaster } from "./sonner.js";
|
|
11
12
|
import { Input } from "./input.js";
|
|
12
13
|
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "./select.js";
|
|
13
14
|
import { Checkbox } from "./checkbox.js";
|
|
@@ -47,7 +48,6 @@ import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHe
|
|
|
47
48
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
|
|
48
49
|
import { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from "./sidebar.js";
|
|
49
50
|
import { Slider } from "./slider.js";
|
|
50
|
-
import { Toaster } from "./sonner.js";
|
|
51
51
|
import { Switch } from "./switch.js";
|
|
52
52
|
import { Toggle, toggleVariants } from "./toggle.js";
|
|
53
53
|
import { ToggleGroup, ToggleGroupItem } from "./toggle-group.js";
|
package/dist/react/ui/sonner.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon } from "lucide-react";
|
|
3
|
-
import { useTheme } from "next-themes";
|
|
4
3
|
import { Toaster } from "sonner";
|
|
4
|
+
import { useTheme } from "next-themes";
|
|
5
5
|
|
|
6
6
|
//#region src/react/ui/sonner.tsx
|
|
7
7
|
/** Toast notification system for displaying temporary messages */
|