@sero-ai/ui 0.3.2 → 0.4.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/.turbo/turbo-build.log +628 -0
- package/.turbo/turbo-typecheck.log +1 -1
- package/CHANGELOG.md +38 -0
- package/dist/components/context-editor/CapabilitySection.cjs +57 -0
- package/dist/components/context-editor/CapabilitySection.d.cts +20 -0
- package/dist/components/context-editor/CapabilitySection.d.ts +20 -0
- package/dist/components/context-editor/CapabilitySection.js +57 -0
- package/dist/components/context-editor/ContextEditor.cjs +108 -0
- package/dist/components/context-editor/ContextEditor.d.cts +26 -0
- package/dist/components/context-editor/ContextEditor.d.ts +26 -0
- package/dist/components/context-editor/ContextEditor.js +108 -0
- package/dist/components/context-editor/PresetBar.cjs +71 -0
- package/dist/components/context-editor/PresetBar.d.cts +19 -0
- package/dist/components/context-editor/PresetBar.d.ts +19 -0
- package/dist/components/context-editor/PresetBar.js +71 -0
- package/dist/components/context-editor/SkillsSection.cjs +31 -0
- package/dist/components/context-editor/SkillsSection.d.cts +14 -0
- package/dist/components/context-editor/SkillsSection.d.ts +14 -0
- package/dist/components/context-editor/SkillsSection.js +31 -0
- package/dist/components/context-editor/SystemPromptSection.cjs +58 -0
- package/dist/components/context-editor/SystemPromptSection.d.cts +25 -0
- package/dist/components/context-editor/SystemPromptSection.d.ts +25 -0
- package/dist/components/context-editor/SystemPromptSection.js +58 -0
- package/dist/components/context-editor/ToolsSection.cjs +31 -0
- package/dist/components/context-editor/ToolsSection.d.cts +14 -0
- package/dist/components/context-editor/ToolsSection.d.ts +14 -0
- package/dist/components/context-editor/ToolsSection.js +31 -0
- package/dist/components/context-editor/index.cjs +8 -0
- package/dist/components/context-editor/index.d.cts +5 -0
- package/dist/components/context-editor/index.d.ts +5 -0
- package/dist/components/context-editor/index.js +8 -0
- package/dist/components/context-editor/parts.cjs +184 -0
- package/dist/components/context-editor/parts.d.cts +32 -0
- package/dist/components/context-editor/parts.d.ts +32 -0
- package/dist/components/context-editor/parts.js +184 -0
- package/dist/components/context-editor/use-context-editor-model.cjs +194 -0
- package/dist/components/context-editor/use-context-editor-model.d.cts +57 -0
- package/dist/components/context-editor/use-context-editor-model.d.ts +57 -0
- package/dist/components/context-editor/use-context-editor-model.js +194 -0
- package/dist/components/dashboard/activity-list.cjs +59 -0
- package/dist/components/dashboard/activity-list.d.cts +27 -0
- package/dist/components/dashboard/activity-list.d.ts +27 -0
- package/dist/components/dashboard/activity-list.js +59 -0
- package/dist/components/dashboard/catalog.cjs +322 -0
- package/dist/components/dashboard/catalog.d.cts +14 -0
- package/dist/components/dashboard/catalog.d.ts +14 -0
- package/dist/components/dashboard/catalog.js +322 -0
- package/dist/components/dashboard/data-boundary.cjs +29 -0
- package/dist/components/dashboard/data-boundary.d.cts +21 -0
- package/dist/components/dashboard/data-boundary.d.ts +21 -0
- package/dist/components/dashboard/data-boundary.js +29 -0
- package/dist/components/dashboard/empty-state.cjs +49 -0
- package/dist/components/dashboard/empty-state.d.cts +20 -0
- package/dist/components/dashboard/empty-state.d.ts +20 -0
- package/dist/components/dashboard/empty-state.js +49 -0
- package/dist/components/dashboard/icon-button.cjs +40 -0
- package/dist/components/dashboard/icon-button.d.cts +24 -0
- package/dist/components/dashboard/icon-button.d.ts +24 -0
- package/dist/components/dashboard/icon-button.js +40 -0
- package/dist/components/dashboard/index.cjs +15 -0
- package/dist/components/dashboard/index.d.cts +24 -0
- package/dist/components/dashboard/index.d.ts +24 -0
- package/dist/components/dashboard/index.js +15 -0
- package/dist/components/dashboard/item-list.cjs +71 -0
- package/dist/components/dashboard/item-list.d.cts +28 -0
- package/dist/components/dashboard/item-list.d.ts +28 -0
- package/dist/components/dashboard/item-list.js +71 -0
- package/dist/components/dashboard/key-value.cjs +39 -0
- package/dist/components/dashboard/key-value.d.cts +17 -0
- package/dist/components/dashboard/key-value.d.ts +17 -0
- package/dist/components/dashboard/key-value.js +39 -0
- package/dist/components/dashboard/layout.cjs +193 -0
- package/dist/components/dashboard/layout.d.cts +91 -0
- package/dist/components/dashboard/layout.d.ts +91 -0
- package/dist/components/dashboard/layout.js +193 -0
- package/dist/components/dashboard/metric.cjs +98 -0
- package/dist/components/dashboard/metric.d.cts +44 -0
- package/dist/components/dashboard/metric.d.ts +44 -0
- package/dist/components/dashboard/metric.js +98 -0
- package/dist/components/dashboard/progress-ring.cjs +77 -0
- package/dist/components/dashboard/progress-ring.d.cts +25 -0
- package/dist/components/dashboard/progress-ring.d.ts +25 -0
- package/dist/components/dashboard/progress-ring.js +77 -0
- package/dist/components/dashboard/skeletons.cjs +54 -0
- package/dist/components/dashboard/skeletons.d.cts +15 -0
- package/dist/components/dashboard/skeletons.d.ts +15 -0
- package/dist/components/dashboard/skeletons.js +54 -0
- package/dist/components/dashboard/spacing.cjs +10 -0
- package/dist/components/dashboard/spacing.d.cts +4 -0
- package/dist/components/dashboard/spacing.d.ts +4 -0
- package/dist/components/dashboard/spacing.js +10 -0
- package/dist/components/dashboard/stale-indicator.cjs +42 -0
- package/dist/components/dashboard/stale-indicator.d.cts +15 -0
- package/dist/components/dashboard/stale-indicator.d.ts +15 -0
- package/dist/components/dashboard/stale-indicator.js +42 -0
- package/dist/components/dashboard/status.cjs +62 -0
- package/dist/components/dashboard/status.d.cts +15 -0
- package/dist/components/dashboard/status.d.ts +15 -0
- package/dist/components/dashboard/status.js +62 -0
- package/dist/components/dashboard/tone.cjs +26 -0
- package/dist/components/dashboard/tone.d.cts +9 -0
- package/dist/components/dashboard/tone.d.ts +9 -0
- package/dist/components/dashboard/tone.js +26 -0
- package/dist/components/dashboard/typography.cjs +99 -0
- package/dist/components/dashboard/typography.d.cts +57 -0
- package/dist/components/dashboard/typography.d.ts +57 -0
- package/dist/components/dashboard/typography.js +99 -0
- package/dist/components/reference/ActivityExample.cjs +47 -0
- package/dist/components/reference/ActivityExample.d.cts +5 -0
- package/dist/components/reference/ActivityExample.d.ts +5 -0
- package/dist/components/reference/ActivityExample.js +47 -0
- package/dist/components/reference/ResourceExample.cjs +54 -0
- package/dist/components/reference/ResourceExample.d.cts +5 -0
- package/dist/components/reference/ResourceExample.d.ts +5 -0
- package/dist/components/reference/ResourceExample.js +54 -0
- package/dist/components/reference/SchedulerExample.cjs +68 -0
- package/dist/components/reference/SchedulerExample.d.cts +5 -0
- package/dist/components/reference/SchedulerExample.d.ts +5 -0
- package/dist/components/reference/SchedulerExample.js +68 -0
- package/dist/components/reference/StarterExample.cjs +34 -0
- package/dist/components/reference/StarterExample.d.cts +5 -0
- package/dist/components/reference/StarterExample.d.ts +5 -0
- package/dist/components/reference/StarterExample.js +34 -0
- package/dist/components/reference/index.cjs +10 -0
- package/dist/components/reference/index.d.cts +5 -0
- package/dist/components/reference/index.d.ts +5 -0
- package/dist/components/reference/index.js +10 -0
- package/dist/components/ui/badge.cjs +5 -1
- package/dist/components/ui/badge.d.cts +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/badge.js +5 -1
- package/dist/dashboard-catalog.cjs +8 -0
- package/dist/dashboard-catalog.d.cts +1 -0
- package/dist/dashboard-catalog.d.ts +1 -0
- package/dist/dashboard-catalog.js +8 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +1 -0
- package/dist/reference.cjs +12 -0
- package/dist/reference.d.cts +5 -0
- package/dist/reference.d.ts +5 -0
- package/dist/reference.js +12 -0
- package/dist/styles/glass-board.css +43 -0
- package/dist/styles/globals.css +59 -0
- package/package.json +70 -41
- package/src/components/context-editor/CapabilitySection.tsx +85 -0
- package/src/components/context-editor/ContextEditor.tsx +138 -0
- package/src/components/context-editor/PresetBar.tsx +94 -0
- package/src/components/context-editor/SkillsSection.tsx +37 -0
- package/src/components/context-editor/SystemPromptSection.tsx +88 -0
- package/src/components/context-editor/ToolsSection.tsx +37 -0
- package/src/components/context-editor/index.ts +7 -0
- package/src/components/context-editor/parts.tsx +217 -0
- package/src/components/context-editor/use-context-editor-model.ts +296 -0
- package/src/components/dashboard/__tests__/catalog.test.ts +57 -0
- package/src/components/dashboard/__tests__/glass.test.tsx +42 -0
- package/src/components/dashboard/__tests__/state.test.tsx +110 -0
- package/src/components/dashboard/__tests__/variants.test.tsx +95 -0
- package/src/components/dashboard/activity-list.tsx +99 -0
- package/src/components/dashboard/catalog.ts +351 -0
- package/src/components/dashboard/data-boundary.tsx +54 -0
- package/src/components/dashboard/empty-state.tsx +70 -0
- package/src/components/dashboard/icon-button.tsx +58 -0
- package/src/components/dashboard/index.ts +21 -0
- package/src/components/dashboard/item-list.tsx +106 -0
- package/src/components/dashboard/key-value.tsx +54 -0
- package/src/components/dashboard/layout.tsx +286 -0
- package/src/components/dashboard/metric.tsx +139 -0
- package/src/components/dashboard/progress-ring.tsx +100 -0
- package/src/components/dashboard/skeletons.tsx +73 -0
- package/src/components/dashboard/spacing.ts +14 -0
- package/src/components/dashboard/stale-indicator.tsx +55 -0
- package/src/components/dashboard/status.tsx +75 -0
- package/src/components/dashboard/tone.ts +35 -0
- package/src/components/dashboard/typography.tsx +151 -0
- package/src/components/reference/ActivityExample.tsx +68 -0
- package/src/components/reference/ResourceExample.tsx +78 -0
- package/src/components/reference/SchedulerExample.tsx +88 -0
- package/src/components/reference/StarterExample.tsx +48 -0
- package/src/components/reference/index.ts +10 -0
- package/src/components/ui/badge.tsx +6 -0
- package/src/dashboard-catalog.ts +13 -0
- package/src/index.ts +5 -0
- package/src/reference.ts +15 -0
- package/src/styles/glass-board.css +43 -0
- package/src/styles/globals.css +59 -0
- package/tsup.config.ts +6 -2
- package/vitest.config.ts +8 -0
- package/LICENSE +0 -201
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
+
var _utils = require('../../lib/utils');
|
|
3
|
+
var _tone = require('./tone');
|
|
4
|
+
function ProgressRing({
|
|
5
|
+
className,
|
|
6
|
+
value,
|
|
7
|
+
max = 100,
|
|
8
|
+
size = 44,
|
|
9
|
+
thickness = 4,
|
|
10
|
+
tone = "info",
|
|
11
|
+
label,
|
|
12
|
+
showValue = true,
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
const clamped = Math.min(Math.max(value, 0), max);
|
|
17
|
+
const pct = max > 0 ? clamped / max : 0;
|
|
18
|
+
const radius = (size - thickness) / 2;
|
|
19
|
+
const circumference = 2 * Math.PI * radius;
|
|
20
|
+
const dashOffset = circumference * (1 - pct);
|
|
21
|
+
const center = size / 2;
|
|
22
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "progress-ring",
|
|
26
|
+
role: "progressbar",
|
|
27
|
+
"aria-label": label,
|
|
28
|
+
"aria-valuenow": Math.round(clamped),
|
|
29
|
+
"aria-valuemin": 0,
|
|
30
|
+
"aria-valuemax": max,
|
|
31
|
+
className: _utils.cn.call(void 0,
|
|
32
|
+
"relative inline-flex shrink-0 items-center justify-center",
|
|
33
|
+
_tone.toneColor[tone],
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
style: { width: size, height: size },
|
|
37
|
+
...props,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { width: size, height: size, className: "-rotate-90", children: [
|
|
40
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
41
|
+
"circle",
|
|
42
|
+
{
|
|
43
|
+
cx: center,
|
|
44
|
+
cy: center,
|
|
45
|
+
r: radius,
|
|
46
|
+
fill: "none",
|
|
47
|
+
stroke: "var(--surface-line)",
|
|
48
|
+
strokeWidth: thickness
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
52
|
+
"circle",
|
|
53
|
+
{
|
|
54
|
+
cx: center,
|
|
55
|
+
cy: center,
|
|
56
|
+
r: radius,
|
|
57
|
+
fill: "none",
|
|
58
|
+
stroke: "currentColor",
|
|
59
|
+
strokeWidth: thickness,
|
|
60
|
+
strokeLinecap: "round",
|
|
61
|
+
strokeDasharray: circumference,
|
|
62
|
+
strokeDashoffset: dashOffset,
|
|
63
|
+
className: "transition-[stroke-dashoffset] duration-500"
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "absolute inset-0 flex items-center justify-center text-[var(--text-primary)]", children: _nullishCoalesce(children, () => ( (showValue && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-xs font-semibold tabular-nums", children: [
|
|
68
|
+
Math.round(pct * 100),
|
|
69
|
+
"%"
|
|
70
|
+
] })))) })
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
exports.ProgressRing = ProgressRing;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Tone } from './tone.cjs';
|
|
4
|
+
|
|
5
|
+
interface ProgressRingProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
6
|
+
/** Current value. */
|
|
7
|
+
value: number;
|
|
8
|
+
/** Maximum value the ring represents. */
|
|
9
|
+
max?: number;
|
|
10
|
+
/** Outer diameter in pixels. */
|
|
11
|
+
size?: number;
|
|
12
|
+
/** Stroke width in pixels. */
|
|
13
|
+
thickness?: number;
|
|
14
|
+
tone?: Tone;
|
|
15
|
+
/** Accessible name for the gauge. */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** Show the percentage in the centre when no children are provided. */
|
|
18
|
+
showValue?: boolean;
|
|
19
|
+
/** Custom centre content (overrides `showValue`). */
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/** Circular progress / donut gauge for a bounded value. */
|
|
23
|
+
declare function ProgressRing({ className, value, max, size, thickness, tone, label, showValue, children, ...props }: ProgressRingProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
|
|
25
|
+
export { ProgressRing, type ProgressRingProps };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Tone } from './tone.js';
|
|
4
|
+
|
|
5
|
+
interface ProgressRingProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
6
|
+
/** Current value. */
|
|
7
|
+
value: number;
|
|
8
|
+
/** Maximum value the ring represents. */
|
|
9
|
+
max?: number;
|
|
10
|
+
/** Outer diameter in pixels. */
|
|
11
|
+
size?: number;
|
|
12
|
+
/** Stroke width in pixels. */
|
|
13
|
+
thickness?: number;
|
|
14
|
+
tone?: Tone;
|
|
15
|
+
/** Accessible name for the gauge. */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** Show the percentage in the centre when no children are provided. */
|
|
18
|
+
showValue?: boolean;
|
|
19
|
+
/** Custom centre content (overrides `showValue`). */
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/** Circular progress / donut gauge for a bounded value. */
|
|
23
|
+
declare function ProgressRing({ className, value, max, size, thickness, tone, label, showValue, children, ...props }: ProgressRingProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
|
|
25
|
+
export { ProgressRing, type ProgressRingProps };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
import { toneColor } from "./tone";
|
|
4
|
+
function ProgressRing({
|
|
5
|
+
className,
|
|
6
|
+
value,
|
|
7
|
+
max = 100,
|
|
8
|
+
size = 44,
|
|
9
|
+
thickness = 4,
|
|
10
|
+
tone = "info",
|
|
11
|
+
label,
|
|
12
|
+
showValue = true,
|
|
13
|
+
children,
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
const clamped = Math.min(Math.max(value, 0), max);
|
|
17
|
+
const pct = max > 0 ? clamped / max : 0;
|
|
18
|
+
const radius = (size - thickness) / 2;
|
|
19
|
+
const circumference = 2 * Math.PI * radius;
|
|
20
|
+
const dashOffset = circumference * (1 - pct);
|
|
21
|
+
const center = size / 2;
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "progress-ring",
|
|
26
|
+
role: "progressbar",
|
|
27
|
+
"aria-label": label,
|
|
28
|
+
"aria-valuenow": Math.round(clamped),
|
|
29
|
+
"aria-valuemin": 0,
|
|
30
|
+
"aria-valuemax": max,
|
|
31
|
+
className: cn(
|
|
32
|
+
"relative inline-flex shrink-0 items-center justify-center",
|
|
33
|
+
toneColor[tone],
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
style: { width: size, height: size },
|
|
37
|
+
...props,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsxs("svg", { width: size, height: size, className: "-rotate-90", children: [
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
"circle",
|
|
42
|
+
{
|
|
43
|
+
cx: center,
|
|
44
|
+
cy: center,
|
|
45
|
+
r: radius,
|
|
46
|
+
fill: "none",
|
|
47
|
+
stroke: "var(--surface-line)",
|
|
48
|
+
strokeWidth: thickness
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
"circle",
|
|
53
|
+
{
|
|
54
|
+
cx: center,
|
|
55
|
+
cy: center,
|
|
56
|
+
r: radius,
|
|
57
|
+
fill: "none",
|
|
58
|
+
stroke: "currentColor",
|
|
59
|
+
strokeWidth: thickness,
|
|
60
|
+
strokeLinecap: "round",
|
|
61
|
+
strokeDasharray: circumference,
|
|
62
|
+
strokeDashoffset: dashOffset,
|
|
63
|
+
className: "transition-[stroke-dashoffset] duration-500"
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center text-[var(--text-primary)]", children: children ?? (showValue && /* @__PURE__ */ jsxs("span", { className: "text-xs font-semibold tabular-nums", children: [
|
|
68
|
+
Math.round(pct * 100),
|
|
69
|
+
"%"
|
|
70
|
+
] })) })
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
ProgressRing
|
|
77
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
+
var _utils = require('../../lib/utils');
|
|
3
|
+
var _skeleton = require('../ui/skeleton');
|
|
4
|
+
function MetricSkeleton({ className, count = 3, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
"data-slot": "metric-skeleton",
|
|
9
|
+
className: _utils.cn.call(void 0, "flex gap-4", className),
|
|
10
|
+
...props,
|
|
11
|
+
children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-1 flex-col gap-1.5", children: [
|
|
12
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _skeleton.Skeleton, { className: "h-2.5 w-12" }),
|
|
13
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _skeleton.Skeleton, { className: "h-5 w-8" })
|
|
14
|
+
] }, i))
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function ListSkeleton({ className, count = 4, ...props }) {
|
|
19
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
"data-slot": "list-skeleton",
|
|
23
|
+
className: _utils.cn.call(void 0, "flex flex-col gap-1", className),
|
|
24
|
+
...props,
|
|
25
|
+
children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 rounded-md p-2", children: [
|
|
26
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _skeleton.Skeleton, { className: "size-2 rounded-full" }),
|
|
27
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _skeleton.Skeleton, { className: "h-3 flex-1" }),
|
|
28
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _skeleton.Skeleton, { className: "h-3 w-8" })
|
|
29
|
+
] }, i))
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function ActivitySkeleton({ className, count = 4, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
"data-slot": "activity-skeleton",
|
|
38
|
+
className: _utils.cn.call(void 0, "flex flex-col gap-2", className),
|
|
39
|
+
...props,
|
|
40
|
+
children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start gap-2", children: [
|
|
41
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _skeleton.Skeleton, { className: "mt-0.5 size-2 rounded-full" }),
|
|
42
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-1 flex-col gap-1", children: [
|
|
43
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _skeleton.Skeleton, { className: "h-3 w-3/4" }),
|
|
44
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _skeleton.Skeleton, { className: "h-2.5 w-1/2" })
|
|
45
|
+
] })
|
|
46
|
+
] }, i))
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
exports.ActivitySkeleton = ActivitySkeleton; exports.ListSkeleton = ListSkeleton; exports.MetricSkeleton = MetricSkeleton;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
interface SkeletonPatternProps extends React.ComponentProps<"div"> {
|
|
5
|
+
/** Number of rows / cells to render. */
|
|
6
|
+
count?: number;
|
|
7
|
+
}
|
|
8
|
+
/** A row of metric placeholders (label + value stacks). */
|
|
9
|
+
declare function MetricSkeleton({ className, count, ...props }: SkeletonPatternProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
/** A stack of list-row placeholders. */
|
|
11
|
+
declare function ListSkeleton({ className, count, ...props }: SkeletonPatternProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
/** A stack of activity-row placeholders (marker + label + timestamp). */
|
|
13
|
+
declare function ActivitySkeleton({ className, count, ...props }: SkeletonPatternProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { ActivitySkeleton, ListSkeleton, MetricSkeleton, type SkeletonPatternProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
interface SkeletonPatternProps extends React.ComponentProps<"div"> {
|
|
5
|
+
/** Number of rows / cells to render. */
|
|
6
|
+
count?: number;
|
|
7
|
+
}
|
|
8
|
+
/** A row of metric placeholders (label + value stacks). */
|
|
9
|
+
declare function MetricSkeleton({ className, count, ...props }: SkeletonPatternProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
/** A stack of list-row placeholders. */
|
|
11
|
+
declare function ListSkeleton({ className, count, ...props }: SkeletonPatternProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
/** A stack of activity-row placeholders (marker + label + timestamp). */
|
|
13
|
+
declare function ActivitySkeleton({ className, count, ...props }: SkeletonPatternProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { ActivitySkeleton, ListSkeleton, MetricSkeleton, type SkeletonPatternProps };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
import { Skeleton } from "../ui/skeleton";
|
|
4
|
+
function MetricSkeleton({ className, count = 3, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
"data-slot": "metric-skeleton",
|
|
9
|
+
className: cn("flex gap-4", className),
|
|
10
|
+
...props,
|
|
11
|
+
children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-1.5", children: [
|
|
12
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-2.5 w-12" }),
|
|
13
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-8" })
|
|
14
|
+
] }, i))
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function ListSkeleton({ className, count = 4, ...props }) {
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
"data-slot": "list-skeleton",
|
|
23
|
+
className: cn("flex flex-col gap-1", className),
|
|
24
|
+
...props,
|
|
25
|
+
children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md p-2", children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "size-2 rounded-full" }),
|
|
27
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 flex-1" }),
|
|
28
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-8" })
|
|
29
|
+
] }, i))
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function ActivitySkeleton({ className, count = 4, ...props }) {
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
"data-slot": "activity-skeleton",
|
|
38
|
+
className: cn("flex flex-col gap-2", className),
|
|
39
|
+
...props,
|
|
40
|
+
children: Array.from({ length: count }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "mt-0.5 size-2 rounded-full" }),
|
|
42
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-1", children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-3/4" }),
|
|
44
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-2.5 w-1/2" })
|
|
45
|
+
] })
|
|
46
|
+
] }, i))
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
ActivitySkeleton,
|
|
52
|
+
ListSkeleton,
|
|
53
|
+
MetricSkeleton
|
|
54
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
+
var _lucidereact = require('lucide-react');
|
|
3
|
+
var _utils = require('../../lib/utils');
|
|
4
|
+
var _typography = require('./typography');
|
|
5
|
+
var _iconbutton = require('./icon-button');
|
|
6
|
+
function StaleIndicator({
|
|
7
|
+
className,
|
|
8
|
+
lastUpdated,
|
|
9
|
+
onRefresh,
|
|
10
|
+
refreshing = false,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
"data-slot": "stale-indicator",
|
|
17
|
+
className: _utils.cn.call(void 0,
|
|
18
|
+
"flex items-center gap-1.5 text-[11px] text-[var(--text-muted)]",
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
...props,
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _typography.Icon, { icon: _lucidereact.Clock, size: "xs", tone: "warning" }),
|
|
24
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "truncate", children: _nullishCoalesce(lastUpdated, () => ( "Data may be out of date")) }),
|
|
25
|
+
onRefresh && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
26
|
+
_iconbutton.IconButton,
|
|
27
|
+
{
|
|
28
|
+
icon: _lucidereact.RotateCw,
|
|
29
|
+
label: "Refresh",
|
|
30
|
+
size: "xs",
|
|
31
|
+
onClick: onRefresh,
|
|
32
|
+
className: _utils.cn.call(void 0, "ml-auto", refreshing && "animate-spin"),
|
|
33
|
+
disabled: refreshing
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
exports.StaleIndicator = StaleIndicator;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
interface StaleIndicatorProps extends React.ComponentProps<"div"> {
|
|
5
|
+
/** Pre-formatted last-updated value, e.g. "Updated 5m ago". */
|
|
6
|
+
lastUpdated?: React.ReactNode;
|
|
7
|
+
/** Refresh handler. When provided, a refresh button is shown. */
|
|
8
|
+
onRefresh?: () => void;
|
|
9
|
+
/** Spin the refresh icon while a refresh is in flight. */
|
|
10
|
+
refreshing?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Compact "data may be stale" indicator with optional refresh. */
|
|
13
|
+
declare function StaleIndicator({ className, lastUpdated, onRefresh, refreshing, ...props }: StaleIndicatorProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { StaleIndicator, type StaleIndicatorProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
interface StaleIndicatorProps extends React.ComponentProps<"div"> {
|
|
5
|
+
/** Pre-formatted last-updated value, e.g. "Updated 5m ago". */
|
|
6
|
+
lastUpdated?: React.ReactNode;
|
|
7
|
+
/** Refresh handler. When provided, a refresh button is shown. */
|
|
8
|
+
onRefresh?: () => void;
|
|
9
|
+
/** Spin the refresh icon while a refresh is in flight. */
|
|
10
|
+
refreshing?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Compact "data may be stale" indicator with optional refresh. */
|
|
13
|
+
declare function StaleIndicator({ className, lastUpdated, onRefresh, refreshing, ...props }: StaleIndicatorProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { StaleIndicator, type StaleIndicatorProps };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Clock, RotateCw } from "lucide-react";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
import { Icon } from "./typography";
|
|
5
|
+
import { IconButton } from "./icon-button";
|
|
6
|
+
function StaleIndicator({
|
|
7
|
+
className,
|
|
8
|
+
lastUpdated,
|
|
9
|
+
onRefresh,
|
|
10
|
+
refreshing = false,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ jsxs(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
"data-slot": "stale-indicator",
|
|
17
|
+
className: cn(
|
|
18
|
+
"flex items-center gap-1.5 text-[11px] text-[var(--text-muted)]",
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
...props,
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ jsx(Icon, { icon: Clock, size: "xs", tone: "warning" }),
|
|
24
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: lastUpdated ?? "Data may be out of date" }),
|
|
25
|
+
onRefresh && /* @__PURE__ */ jsx(
|
|
26
|
+
IconButton,
|
|
27
|
+
{
|
|
28
|
+
icon: RotateCw,
|
|
29
|
+
label: "Refresh",
|
|
30
|
+
size: "xs",
|
|
31
|
+
onClick: onRefresh,
|
|
32
|
+
className: cn("ml-auto", refreshing && "animate-spin"),
|
|
33
|
+
disabled: refreshing
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
StaleIndicator
|
|
42
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
+
var _utils = require('../../lib/utils');
|
|
3
|
+
var _tone = require('./tone');
|
|
4
|
+
function Status({
|
|
5
|
+
className,
|
|
6
|
+
tone = "neutral",
|
|
7
|
+
variant = "dot",
|
|
8
|
+
pulse = false,
|
|
9
|
+
children,
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
const hasLabel = children != null && children !== "";
|
|
13
|
+
if (variant === "pill") {
|
|
14
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
15
|
+
"span",
|
|
16
|
+
{
|
|
17
|
+
"data-slot": "status",
|
|
18
|
+
"data-tone": tone,
|
|
19
|
+
className: _utils.cn.call(void 0,
|
|
20
|
+
"inline-flex w-fit items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium",
|
|
21
|
+
_tone.tonePill[tone],
|
|
22
|
+
className
|
|
23
|
+
),
|
|
24
|
+
...props,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _utils.cn.call(void 0, "size-1.5 shrink-0 rounded-full", _tone.toneDot[tone]) }),
|
|
27
|
+
children
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
"data-slot": "status",
|
|
36
|
+
"data-tone": tone,
|
|
37
|
+
role: hasLabel ? void 0 : "status",
|
|
38
|
+
className: _utils.cn.call(void 0,
|
|
39
|
+
"inline-flex items-center gap-1.5 text-xs font-medium text-[var(--text-secondary)]",
|
|
40
|
+
className
|
|
41
|
+
),
|
|
42
|
+
...props,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
45
|
+
"span",
|
|
46
|
+
{
|
|
47
|
+
className: _utils.cn.call(void 0,
|
|
48
|
+
"size-2 shrink-0 rounded-full",
|
|
49
|
+
_tone.toneDot[tone],
|
|
50
|
+
// ring-current picks up the tone's text colour for a matching glow.
|
|
51
|
+
pulse && _utils.cn.call(void 0, _tone.toneColor[tone], "ring-2 ring-current/25")
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
children
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
exports.Status = Status;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Tone } from './tone.cjs';
|
|
4
|
+
|
|
5
|
+
interface StatusProps extends React.ComponentProps<"span"> {
|
|
6
|
+
tone?: Tone;
|
|
7
|
+
/** Presentation: coloured dot + label, a tinted pill, or a bare dot. */
|
|
8
|
+
variant?: "dot" | "pill";
|
|
9
|
+
/** Add a soft glow to the dot (e.g. a live/active indicator). */
|
|
10
|
+
pulse?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Semantic status dot, label or pill with neutral/success/warning/error/info tones. */
|
|
13
|
+
declare function Status({ className, tone, variant, pulse, children, ...props }: StatusProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { Status, type StatusProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Tone } from './tone.js';
|
|
4
|
+
|
|
5
|
+
interface StatusProps extends React.ComponentProps<"span"> {
|
|
6
|
+
tone?: Tone;
|
|
7
|
+
/** Presentation: coloured dot + label, a tinted pill, or a bare dot. */
|
|
8
|
+
variant?: "dot" | "pill";
|
|
9
|
+
/** Add a soft glow to the dot (e.g. a live/active indicator). */
|
|
10
|
+
pulse?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Semantic status dot, label or pill with neutral/success/warning/error/info tones. */
|
|
13
|
+
declare function Status({ className, tone, variant, pulse, children, ...props }: StatusProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { Status, type StatusProps };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
import { toneColor, toneDot, tonePill } from "./tone";
|
|
4
|
+
function Status({
|
|
5
|
+
className,
|
|
6
|
+
tone = "neutral",
|
|
7
|
+
variant = "dot",
|
|
8
|
+
pulse = false,
|
|
9
|
+
children,
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
const hasLabel = children != null && children !== "";
|
|
13
|
+
if (variant === "pill") {
|
|
14
|
+
return /* @__PURE__ */ jsxs(
|
|
15
|
+
"span",
|
|
16
|
+
{
|
|
17
|
+
"data-slot": "status",
|
|
18
|
+
"data-tone": tone,
|
|
19
|
+
className: cn(
|
|
20
|
+
"inline-flex w-fit items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium",
|
|
21
|
+
tonePill[tone],
|
|
22
|
+
className
|
|
23
|
+
),
|
|
24
|
+
...props,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ jsx("span", { className: cn("size-1.5 shrink-0 rounded-full", toneDot[tone]) }),
|
|
27
|
+
children
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return /* @__PURE__ */ jsxs(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
"data-slot": "status",
|
|
36
|
+
"data-tone": tone,
|
|
37
|
+
role: hasLabel ? void 0 : "status",
|
|
38
|
+
className: cn(
|
|
39
|
+
"inline-flex items-center gap-1.5 text-xs font-medium text-[var(--text-secondary)]",
|
|
40
|
+
className
|
|
41
|
+
),
|
|
42
|
+
...props,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
"span",
|
|
46
|
+
{
|
|
47
|
+
className: cn(
|
|
48
|
+
"size-2 shrink-0 rounded-full",
|
|
49
|
+
toneDot[tone],
|
|
50
|
+
// ring-current picks up the tone's text colour for a matching glow.
|
|
51
|
+
pulse && cn(toneColor[tone], "ring-2 ring-current/25")
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
children
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
Status
|
|
62
|
+
};
|