@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
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @sero-ai/ui changelog
|
|
2
|
+
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **Dashboard components** — a compact presentation set for dashboard widgets and
|
|
8
|
+
full plugin views, built from the existing primitives and design tokens.
|
|
9
|
+
Exported from the package root (`@sero-ai/ui`):
|
|
10
|
+
- Layout: `WidgetContent`, `Stack`, `Inline`, `Grid`, `Section`, `Divider`
|
|
11
|
+
- Typography: `Text`, `Heading`, `Icon`
|
|
12
|
+
- Data display: `Metric`, `MetricCard`, `MetricGroup`, `Status`, `KeyValue`,
|
|
13
|
+
`KeyValueList`, `ItemList`, `ItemListItem`, `ActivityList`, `ActivityListItem`,
|
|
14
|
+
`ProgressRing`, `StaleIndicator`
|
|
15
|
+
- Runtime states: `DataBoundary`, `EmptyState`, `MetricSkeleton`,
|
|
16
|
+
`ListSkeleton`, `ActivitySkeleton`
|
|
17
|
+
- Actions: `IconButton`
|
|
18
|
+
- Shared `Tone` vocabulary and `Gap` spacing scale
|
|
19
|
+
- **Dashboard component catalogue** metadata, exported from a new stable subpath
|
|
20
|
+
`@sero-ai/ui/dashboard-catalog` for discovery tooling and agent workflows.
|
|
21
|
+
- `Badge` gained semantic status tones: `success`, `warning`, `info`.
|
|
22
|
+
- **Glass styling for dashboard widgets.** A `.glass` token scope (canonical
|
|
23
|
+
`--glass-*` tokens, light + dark) makes the dashboard components render as
|
|
24
|
+
translucent surfaces on the frosted board. `WidgetContent` applies the scope
|
|
25
|
+
automatically (`glass` prop, default `true`; `glass={false}` for solid full
|
|
26
|
+
views); component surfaces route through new `--surface-*` tokens. No inner
|
|
27
|
+
`backdrop-filter` — the host tile provides the single blur; form controls and
|
|
28
|
+
portalled menus stay solid.
|
|
29
|
+
- **Shared glass-board fixture** — `@sero-ai/ui/styles/glass-board.css`
|
|
30
|
+
(`.glass-canvas` + `.glass-tile`), consumed by the desktop dashboard and the
|
|
31
|
+
styleguide so previews match the real board.
|
|
32
|
+
- **Reference widgets** on a new subpath `@sero-ai/ui/reference` — `StarterExample`,
|
|
33
|
+
`SchedulerExample`, `ResourceExample`, `ActivityExample`: pure-static, glass-styled
|
|
34
|
+
worked examples, importable to preview or copy-paste. (Replaces the removed
|
|
35
|
+
`sero-showcase-plugin`.)
|
|
36
|
+
|
|
37
|
+
See `docs/features/dashboard-ui/dashboard-widgets-plan.md` and
|
|
38
|
+
`glass-restyle-spec.md` for the design and authoring guidance.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
+
var _switch = require('../ui/switch');
|
|
3
|
+
var _parts = require('./parts');
|
|
4
|
+
function CapabilitySection({
|
|
5
|
+
icon,
|
|
6
|
+
title,
|
|
7
|
+
tint,
|
|
8
|
+
includeAllLabel,
|
|
9
|
+
emptyLabel,
|
|
10
|
+
items,
|
|
11
|
+
allDisabled,
|
|
12
|
+
enabledCount,
|
|
13
|
+
isEnabled,
|
|
14
|
+
onToggle,
|
|
15
|
+
onToggleAll
|
|
16
|
+
}) {
|
|
17
|
+
const badgeVariant = allDisabled ? "disabled" : enabledCount < items.length ? "partial" : "default";
|
|
18
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
19
|
+
_parts.ContextSection,
|
|
20
|
+
{
|
|
21
|
+
icon,
|
|
22
|
+
title,
|
|
23
|
+
tint,
|
|
24
|
+
count: items.length,
|
|
25
|
+
badge: items.length > 0 && enabledCount < items.length ? `${enabledCount}/${items.length} included` : void 0,
|
|
26
|
+
badgeVariant,
|
|
27
|
+
defaultOpen: false,
|
|
28
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-1", children: [
|
|
29
|
+
items.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-1 flex items-center justify-between rounded-md border-b border-border/20 px-2 pb-2", children: [
|
|
30
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[11px] font-medium text-[var(--text-secondary)]", children: includeAllLabel }),
|
|
31
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
32
|
+
_switch.Switch,
|
|
33
|
+
{
|
|
34
|
+
size: "sm",
|
|
35
|
+
checked: !allDisabled,
|
|
36
|
+
onCheckedChange: (checked) => onToggleAll(!checked)
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] }),
|
|
40
|
+
items.map((item) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
41
|
+
_parts.ToggleRow,
|
|
42
|
+
{
|
|
43
|
+
name: item.name,
|
|
44
|
+
description: item.description,
|
|
45
|
+
enabled: isEnabled(item.name),
|
|
46
|
+
onToggle: () => onToggle(item.name)
|
|
47
|
+
},
|
|
48
|
+
item.name
|
|
49
|
+
)),
|
|
50
|
+
items.length === 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[11px] italic text-[var(--text-muted)]", children: emptyLabel })
|
|
51
|
+
] })
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
exports.CapabilitySection = CapabilitySection;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
|
+
import { ContextToolInfo, ContextSkillInfo } from '@sero-ai/common';
|
|
4
|
+
|
|
5
|
+
interface CapabilitySectionProps<TItem extends ContextToolInfo | ContextSkillInfo> {
|
|
6
|
+
icon: LucideIcon;
|
|
7
|
+
title: string;
|
|
8
|
+
tint: 'amber' | 'violet';
|
|
9
|
+
includeAllLabel: string;
|
|
10
|
+
emptyLabel: string;
|
|
11
|
+
items: TItem[];
|
|
12
|
+
allDisabled: boolean;
|
|
13
|
+
enabledCount: number;
|
|
14
|
+
isEnabled: (name: string) => boolean;
|
|
15
|
+
onToggle: (name: string) => void;
|
|
16
|
+
onToggleAll: (disabled: boolean) => void;
|
|
17
|
+
}
|
|
18
|
+
declare function CapabilitySection<TItem extends ContextToolInfo | ContextSkillInfo>({ icon, title, tint, includeAllLabel, emptyLabel, items, allDisabled, enabledCount, isEnabled, onToggle, onToggleAll, }: CapabilitySectionProps<TItem>): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { CapabilitySection };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { LucideIcon } from 'lucide-react';
|
|
3
|
+
import { ContextToolInfo, ContextSkillInfo } from '@sero-ai/common';
|
|
4
|
+
|
|
5
|
+
interface CapabilitySectionProps<TItem extends ContextToolInfo | ContextSkillInfo> {
|
|
6
|
+
icon: LucideIcon;
|
|
7
|
+
title: string;
|
|
8
|
+
tint: 'amber' | 'violet';
|
|
9
|
+
includeAllLabel: string;
|
|
10
|
+
emptyLabel: string;
|
|
11
|
+
items: TItem[];
|
|
12
|
+
allDisabled: boolean;
|
|
13
|
+
enabledCount: number;
|
|
14
|
+
isEnabled: (name: string) => boolean;
|
|
15
|
+
onToggle: (name: string) => void;
|
|
16
|
+
onToggleAll: (disabled: boolean) => void;
|
|
17
|
+
}
|
|
18
|
+
declare function CapabilitySection<TItem extends ContextToolInfo | ContextSkillInfo>({ icon, title, tint, includeAllLabel, emptyLabel, items, allDisabled, enabledCount, isEnabled, onToggle, onToggleAll, }: CapabilitySectionProps<TItem>): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { CapabilitySection };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Switch } from "../ui/switch";
|
|
3
|
+
import { ContextSection, ToggleRow } from "./parts";
|
|
4
|
+
function CapabilitySection({
|
|
5
|
+
icon,
|
|
6
|
+
title,
|
|
7
|
+
tint,
|
|
8
|
+
includeAllLabel,
|
|
9
|
+
emptyLabel,
|
|
10
|
+
items,
|
|
11
|
+
allDisabled,
|
|
12
|
+
enabledCount,
|
|
13
|
+
isEnabled,
|
|
14
|
+
onToggle,
|
|
15
|
+
onToggleAll
|
|
16
|
+
}) {
|
|
17
|
+
const badgeVariant = allDisabled ? "disabled" : enabledCount < items.length ? "partial" : "default";
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
ContextSection,
|
|
20
|
+
{
|
|
21
|
+
icon,
|
|
22
|
+
title,
|
|
23
|
+
tint,
|
|
24
|
+
count: items.length,
|
|
25
|
+
badge: items.length > 0 && enabledCount < items.length ? `${enabledCount}/${items.length} included` : void 0,
|
|
26
|
+
badgeVariant,
|
|
27
|
+
defaultOpen: false,
|
|
28
|
+
children: /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
29
|
+
items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mb-1 flex items-center justify-between rounded-md border-b border-border/20 px-2 pb-2", children: [
|
|
30
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-[var(--text-secondary)]", children: includeAllLabel }),
|
|
31
|
+
/* @__PURE__ */ jsx(
|
|
32
|
+
Switch,
|
|
33
|
+
{
|
|
34
|
+
size: "sm",
|
|
35
|
+
checked: !allDisabled,
|
|
36
|
+
onCheckedChange: (checked) => onToggleAll(!checked)
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] }),
|
|
40
|
+
items.map((item) => /* @__PURE__ */ jsx(
|
|
41
|
+
ToggleRow,
|
|
42
|
+
{
|
|
43
|
+
name: item.name,
|
|
44
|
+
description: item.description,
|
|
45
|
+
enabled: isEnabled(item.name),
|
|
46
|
+
onToggle: () => onToggle(item.name)
|
|
47
|
+
},
|
|
48
|
+
item.name
|
|
49
|
+
)),
|
|
50
|
+
items.length === 0 && /* @__PURE__ */ jsx("span", { className: "text-[11px] italic text-[var(--text-muted)]", children: emptyLabel })
|
|
51
|
+
] })
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
CapabilitySection
|
|
57
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
+
var _react = require('react');
|
|
3
|
+
var _lucidereact = require('lucide-react');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _dialog = require('../ui/dialog');
|
|
12
|
+
var _scrollarea = require('../ui/scroll-area');
|
|
13
|
+
var _PresetBar = require('./PresetBar');
|
|
14
|
+
var _SkillsSection = require('./SkillsSection');
|
|
15
|
+
var _SystemPromptSection = require('./SystemPromptSection');
|
|
16
|
+
var _ToolsSection = require('./ToolsSection');
|
|
17
|
+
var _usecontexteditormodel = require('./use-context-editor-model');
|
|
18
|
+
function ContextEditor({
|
|
19
|
+
open,
|
|
20
|
+
onOpenChange,
|
|
21
|
+
available,
|
|
22
|
+
initialOverrides,
|
|
23
|
+
presets,
|
|
24
|
+
onApply,
|
|
25
|
+
onSavePreset,
|
|
26
|
+
onDeletePreset,
|
|
27
|
+
applyError,
|
|
28
|
+
title = "Context Editor",
|
|
29
|
+
description = "Configure what is included in the LLM context.",
|
|
30
|
+
systemPromptCopy,
|
|
31
|
+
applyLabel = "Apply",
|
|
32
|
+
hideTools = false
|
|
33
|
+
}) {
|
|
34
|
+
const model = _usecontexteditormodel.useContextEditorModel.call(void 0, { open, available, initialOverrides, presets, onSavePreset, onDeletePreset });
|
|
35
|
+
const [applying, setApplying] = _react.useState.call(void 0, false);
|
|
36
|
+
const handleApply = async () => {
|
|
37
|
+
setApplying(true);
|
|
38
|
+
try {
|
|
39
|
+
const ok = await onApply(model.buildOverrides());
|
|
40
|
+
if (ok !== false) onOpenChange(false);
|
|
41
|
+
} finally {
|
|
42
|
+
setApplying(false);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dialog.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
46
|
+
_dialog.DialogContent,
|
|
47
|
+
{
|
|
48
|
+
className: "max-h-[85vh] overflow-hidden bg-[var(--bg-surface)] sm:max-w-[58rem]",
|
|
49
|
+
showCloseButton: true,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dialog.DialogHeader, { children: [
|
|
52
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dialog.DialogTitle, { className: "flex items-center gap-2 text-sm", children: [
|
|
53
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Settings2, { className: "size-4 text-[var(--text-muted)]" }),
|
|
54
|
+
title
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dialog.DialogDescription, { className: "text-xs", children: description })
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _PresetBar.PresetBar, { ...model.preset }),
|
|
59
|
+
!available ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-center gap-2 py-8", children: [
|
|
60
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "size-4 animate-spin text-[var(--text-muted)]" }),
|
|
61
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-xs text-[var(--text-muted)]", children: "Loading context\u2026" })
|
|
62
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _scrollarea.ScrollArea, { className: "max-h-[65vh] overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "min-w-0 space-y-2 pr-2", children: [
|
|
63
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
64
|
+
_SystemPromptSection.SystemPromptSection,
|
|
65
|
+
{
|
|
66
|
+
displayedPrompt: model.displayedPrompt,
|
|
67
|
+
systemPrompt: model.systemPrompt,
|
|
68
|
+
onSystemPromptChange: model.setSystemPrompt,
|
|
69
|
+
copy: systemPromptCopy
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
!hideTools && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ToolsSection.ToolsSection, { ...model.tools }),
|
|
73
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _SkillsSection.SkillsSection, { ...model.skills })
|
|
74
|
+
] }) }),
|
|
75
|
+
applyError && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start gap-2 rounded-md border border-status-error-border bg-status-error-muted px-3 py-2", children: [
|
|
76
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "mt-0.5 size-3.5 shrink-0 text-status-error" }),
|
|
77
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[11px] text-status-error", children: applyError })
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dialog.DialogFooter, { children: [
|
|
80
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
type: "button",
|
|
84
|
+
onClick: () => onOpenChange(false),
|
|
85
|
+
className: "rounded-md border border-border/50 px-3 py-1.5 text-xs text-[var(--text-secondary)] transition-colors hover:bg-[var(--bg-elevated)]",
|
|
86
|
+
children: "Cancel"
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
type: "button",
|
|
93
|
+
onClick: () => {
|
|
94
|
+
void handleApply();
|
|
95
|
+
},
|
|
96
|
+
disabled: !available || applying,
|
|
97
|
+
className: "rounded-md bg-[var(--accent-primary)] px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-[var(--accent-hover)] disabled:opacity-50",
|
|
98
|
+
children: applyLabel
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] })
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
) });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
exports.ContextEditor = ContextEditor;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { AvailableContext, ContextOverrides, ContextPreset } from '@sero-ai/common';
|
|
3
|
+
import { SystemPromptCopy } from './SystemPromptSection.cjs';
|
|
4
|
+
import { ContextPresetBody } from './use-context-editor-model.cjs';
|
|
5
|
+
|
|
6
|
+
interface ContextEditorProps {
|
|
7
|
+
open: boolean;
|
|
8
|
+
onOpenChange: (open: boolean) => void;
|
|
9
|
+
available: AvailableContext | null;
|
|
10
|
+
initialOverrides: ContextOverrides | null;
|
|
11
|
+
presets: ContextPreset[];
|
|
12
|
+
/** Persist the chosen overrides. Return false to keep the dialog open (error). */
|
|
13
|
+
onApply: (overrides: ContextOverrides | null) => Promise<boolean> | boolean;
|
|
14
|
+
onSavePreset: (name: string, preset: ContextPresetBody) => void;
|
|
15
|
+
onDeletePreset: (id: string) => void;
|
|
16
|
+
applyError?: string | null;
|
|
17
|
+
title?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
systemPromptCopy?: SystemPromptCopy;
|
|
20
|
+
applyLabel?: string;
|
|
21
|
+
/** Hide the Tools section (e.g. the Orchestrator picks tools per step, not per loop). */
|
|
22
|
+
hideTools?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare function ContextEditor({ open, onOpenChange, available, initialOverrides, presets, onApply, onSavePreset, onDeletePreset, applyError, title, description, systemPromptCopy, applyLabel, hideTools, }: ContextEditorProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
export { ContextEditor, type ContextEditorProps };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { AvailableContext, ContextOverrides, ContextPreset } from '@sero-ai/common';
|
|
3
|
+
import { SystemPromptCopy } from './SystemPromptSection.js';
|
|
4
|
+
import { ContextPresetBody } from './use-context-editor-model.js';
|
|
5
|
+
|
|
6
|
+
interface ContextEditorProps {
|
|
7
|
+
open: boolean;
|
|
8
|
+
onOpenChange: (open: boolean) => void;
|
|
9
|
+
available: AvailableContext | null;
|
|
10
|
+
initialOverrides: ContextOverrides | null;
|
|
11
|
+
presets: ContextPreset[];
|
|
12
|
+
/** Persist the chosen overrides. Return false to keep the dialog open (error). */
|
|
13
|
+
onApply: (overrides: ContextOverrides | null) => Promise<boolean> | boolean;
|
|
14
|
+
onSavePreset: (name: string, preset: ContextPresetBody) => void;
|
|
15
|
+
onDeletePreset: (id: string) => void;
|
|
16
|
+
applyError?: string | null;
|
|
17
|
+
title?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
systemPromptCopy?: SystemPromptCopy;
|
|
20
|
+
applyLabel?: string;
|
|
21
|
+
/** Hide the Tools section (e.g. the Orchestrator picks tools per step, not per loop). */
|
|
22
|
+
hideTools?: boolean;
|
|
23
|
+
}
|
|
24
|
+
declare function ContextEditor({ open, onOpenChange, available, initialOverrides, presets, onApply, onSavePreset, onDeletePreset, applyError, title, description, systemPromptCopy, applyLabel, hideTools, }: ContextEditorProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
export { ContextEditor, type ContextEditorProps };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { AlertCircle, Loader2, Settings2 } from "lucide-react";
|
|
4
|
+
import {
|
|
5
|
+
Dialog,
|
|
6
|
+
DialogContent,
|
|
7
|
+
DialogDescription,
|
|
8
|
+
DialogFooter,
|
|
9
|
+
DialogHeader,
|
|
10
|
+
DialogTitle
|
|
11
|
+
} from "../ui/dialog";
|
|
12
|
+
import { ScrollArea } from "../ui/scroll-area";
|
|
13
|
+
import { PresetBar } from "./PresetBar";
|
|
14
|
+
import { SkillsSection } from "./SkillsSection";
|
|
15
|
+
import { SystemPromptSection } from "./SystemPromptSection";
|
|
16
|
+
import { ToolsSection } from "./ToolsSection";
|
|
17
|
+
import { useContextEditorModel } from "./use-context-editor-model";
|
|
18
|
+
function ContextEditor({
|
|
19
|
+
open,
|
|
20
|
+
onOpenChange,
|
|
21
|
+
available,
|
|
22
|
+
initialOverrides,
|
|
23
|
+
presets,
|
|
24
|
+
onApply,
|
|
25
|
+
onSavePreset,
|
|
26
|
+
onDeletePreset,
|
|
27
|
+
applyError,
|
|
28
|
+
title = "Context Editor",
|
|
29
|
+
description = "Configure what is included in the LLM context.",
|
|
30
|
+
systemPromptCopy,
|
|
31
|
+
applyLabel = "Apply",
|
|
32
|
+
hideTools = false
|
|
33
|
+
}) {
|
|
34
|
+
const model = useContextEditorModel({ open, available, initialOverrides, presets, onSavePreset, onDeletePreset });
|
|
35
|
+
const [applying, setApplying] = useState(false);
|
|
36
|
+
const handleApply = async () => {
|
|
37
|
+
setApplying(true);
|
|
38
|
+
try {
|
|
39
|
+
const ok = await onApply(model.buildOverrides());
|
|
40
|
+
if (ok !== false) onOpenChange(false);
|
|
41
|
+
} finally {
|
|
42
|
+
setApplying(false);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(
|
|
46
|
+
DialogContent,
|
|
47
|
+
{
|
|
48
|
+
className: "max-h-[85vh] overflow-hidden bg-[var(--bg-surface)] sm:max-w-[58rem]",
|
|
49
|
+
showCloseButton: true,
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
52
|
+
/* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2 text-sm", children: [
|
|
53
|
+
/* @__PURE__ */ jsx(Settings2, { className: "size-4 text-[var(--text-muted)]" }),
|
|
54
|
+
title
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "text-xs", children: description })
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ jsx(PresetBar, { ...model.preset }),
|
|
59
|
+
!available ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 py-8", children: [
|
|
60
|
+
/* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin text-[var(--text-muted)]" }),
|
|
61
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-[var(--text-muted)]", children: "Loading context\u2026" })
|
|
62
|
+
] }) : /* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[65vh] overflow-hidden", children: /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-2 pr-2", children: [
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
SystemPromptSection,
|
|
65
|
+
{
|
|
66
|
+
displayedPrompt: model.displayedPrompt,
|
|
67
|
+
systemPrompt: model.systemPrompt,
|
|
68
|
+
onSystemPromptChange: model.setSystemPrompt,
|
|
69
|
+
copy: systemPromptCopy
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
!hideTools && /* @__PURE__ */ jsx(ToolsSection, { ...model.tools }),
|
|
73
|
+
/* @__PURE__ */ jsx(SkillsSection, { ...model.skills })
|
|
74
|
+
] }) }),
|
|
75
|
+
applyError && /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 rounded-md border border-status-error-border bg-status-error-muted px-3 py-2", children: [
|
|
76
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "mt-0.5 size-3.5 shrink-0 text-status-error" }),
|
|
77
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-status-error", children: applyError })
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
type: "button",
|
|
84
|
+
onClick: () => onOpenChange(false),
|
|
85
|
+
className: "rounded-md border border-border/50 px-3 py-1.5 text-xs text-[var(--text-secondary)] transition-colors hover:bg-[var(--bg-elevated)]",
|
|
86
|
+
children: "Cancel"
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
type: "button",
|
|
93
|
+
onClick: () => {
|
|
94
|
+
void handleApply();
|
|
95
|
+
},
|
|
96
|
+
disabled: !available || applying,
|
|
97
|
+
className: "rounded-md bg-[var(--accent-primary)] px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-[var(--accent-hover)] disabled:opacity-50",
|
|
98
|
+
children: applyLabel
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] })
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
) });
|
|
105
|
+
}
|
|
106
|
+
export {
|
|
107
|
+
ContextEditor
|
|
108
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _select = require('../ui/select');
|
|
10
|
+
var _parts = require('./parts');
|
|
11
|
+
function PresetBar({
|
|
12
|
+
allPresets,
|
|
13
|
+
activePresetId,
|
|
14
|
+
activeUserPreset,
|
|
15
|
+
hasOverrides,
|
|
16
|
+
showSaveInput,
|
|
17
|
+
onPresetChange,
|
|
18
|
+
onDelete,
|
|
19
|
+
onReset,
|
|
20
|
+
onShowSave,
|
|
21
|
+
onSave,
|
|
22
|
+
onCancelSave
|
|
23
|
+
}) {
|
|
24
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
26
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[11px] font-medium text-[var(--text-muted)]", children: "Preset:" }),
|
|
27
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _select.Select, { value: _nullishCoalesce(activePresetId, () => ( "")), onValueChange: onPresetChange, children: [
|
|
28
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _select.SelectTrigger, { size: "sm", className: "h-7 w-40 text-xs", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _select.SelectValue, { placeholder: "Custom" }) }),
|
|
29
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _select.SelectContent, { children: allPresets.map((preset) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _select.SelectItem, { value: preset.id, children: preset.name }, preset.id)) })
|
|
30
|
+
] }),
|
|
31
|
+
activeUserPreset && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
type: "button",
|
|
35
|
+
onClick: () => onDelete(activeUserPreset.id),
|
|
36
|
+
className: "flex items-center gap-1 rounded-md px-1.5 py-1 text-[var(--text-muted)] transition-colors hover:bg-status-error-muted hover:text-status-error",
|
|
37
|
+
title: `Delete "${activeUserPreset.name}"`,
|
|
38
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Trash2, { className: "size-3" })
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
!showSaveInput && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
type: "button",
|
|
45
|
+
onClick: onShowSave,
|
|
46
|
+
className: "flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-[var(--text-muted)] transition-colors hover:bg-[var(--bg-elevated)] hover:text-[var(--text-secondary)]",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Save, { className: "size-3" }),
|
|
49
|
+
"Save as"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
hasOverrides && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
54
|
+
"button",
|
|
55
|
+
{
|
|
56
|
+
type: "button",
|
|
57
|
+
onClick: onReset,
|
|
58
|
+
className: "ml-auto flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-[var(--text-muted)] transition-colors hover:bg-[var(--bg-elevated)] hover:text-[var(--text-secondary)]",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcw, { className: "size-3" }),
|
|
61
|
+
"Reset"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] }),
|
|
66
|
+
showSaveInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _parts.SavePresetInput, { onSave, onCancel: onCancelSave })
|
|
67
|
+
] });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
exports.PresetBar = PresetBar;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ContextPreset } from '@sero-ai/common';
|
|
3
|
+
|
|
4
|
+
interface PresetBarProps {
|
|
5
|
+
allPresets: ContextPreset[];
|
|
6
|
+
activePresetId: string | null;
|
|
7
|
+
activeUserPreset: ContextPreset | null;
|
|
8
|
+
hasOverrides: boolean;
|
|
9
|
+
showSaveInput: boolean;
|
|
10
|
+
onPresetChange: (id: string) => void;
|
|
11
|
+
onDelete: (id: string) => void;
|
|
12
|
+
onReset: () => void;
|
|
13
|
+
onShowSave: () => void;
|
|
14
|
+
onSave: (name: string) => void;
|
|
15
|
+
onCancelSave: () => void;
|
|
16
|
+
}
|
|
17
|
+
declare function PresetBar({ allPresets, activePresetId, activeUserPreset, hasOverrides, showSaveInput, onPresetChange, onDelete, onReset, onShowSave, onSave, onCancelSave, }: PresetBarProps): react_jsx_runtime.JSX.Element;
|
|
18
|
+
|
|
19
|
+
export { PresetBar };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ContextPreset } from '@sero-ai/common';
|
|
3
|
+
|
|
4
|
+
interface PresetBarProps {
|
|
5
|
+
allPresets: ContextPreset[];
|
|
6
|
+
activePresetId: string | null;
|
|
7
|
+
activeUserPreset: ContextPreset | null;
|
|
8
|
+
hasOverrides: boolean;
|
|
9
|
+
showSaveInput: boolean;
|
|
10
|
+
onPresetChange: (id: string) => void;
|
|
11
|
+
onDelete: (id: string) => void;
|
|
12
|
+
onReset: () => void;
|
|
13
|
+
onShowSave: () => void;
|
|
14
|
+
onSave: (name: string) => void;
|
|
15
|
+
onCancelSave: () => void;
|
|
16
|
+
}
|
|
17
|
+
declare function PresetBar({ allPresets, activePresetId, activeUserPreset, hasOverrides, showSaveInput, onPresetChange, onDelete, onReset, onShowSave, onSave, onCancelSave, }: PresetBarProps): react_jsx_runtime.JSX.Element;
|
|
18
|
+
|
|
19
|
+
export { PresetBar };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { RotateCcw, Save, Trash2 } from "lucide-react";
|
|
3
|
+
import {
|
|
4
|
+
Select,
|
|
5
|
+
SelectContent,
|
|
6
|
+
SelectItem,
|
|
7
|
+
SelectTrigger,
|
|
8
|
+
SelectValue
|
|
9
|
+
} from "../ui/select";
|
|
10
|
+
import { SavePresetInput } from "./parts";
|
|
11
|
+
function PresetBar({
|
|
12
|
+
allPresets,
|
|
13
|
+
activePresetId,
|
|
14
|
+
activeUserPreset,
|
|
15
|
+
hasOverrides,
|
|
16
|
+
showSaveInput,
|
|
17
|
+
onPresetChange,
|
|
18
|
+
onDelete,
|
|
19
|
+
onReset,
|
|
20
|
+
onShowSave,
|
|
21
|
+
onSave,
|
|
22
|
+
onCancelSave
|
|
23
|
+
}) {
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
26
|
+
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-[var(--text-muted)]", children: "Preset:" }),
|
|
27
|
+
/* @__PURE__ */ jsxs(Select, { value: activePresetId ?? "", onValueChange: onPresetChange, children: [
|
|
28
|
+
/* @__PURE__ */ jsx(SelectTrigger, { size: "sm", className: "h-7 w-40 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Custom" }) }),
|
|
29
|
+
/* @__PURE__ */ jsx(SelectContent, { children: allPresets.map((preset) => /* @__PURE__ */ jsx(SelectItem, { value: preset.id, children: preset.name }, preset.id)) })
|
|
30
|
+
] }),
|
|
31
|
+
activeUserPreset && /* @__PURE__ */ jsx(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
type: "button",
|
|
35
|
+
onClick: () => onDelete(activeUserPreset.id),
|
|
36
|
+
className: "flex items-center gap-1 rounded-md px-1.5 py-1 text-[var(--text-muted)] transition-colors hover:bg-status-error-muted hover:text-status-error",
|
|
37
|
+
title: `Delete "${activeUserPreset.name}"`,
|
|
38
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "size-3" })
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
!showSaveInput && /* @__PURE__ */ jsxs(
|
|
42
|
+
"button",
|
|
43
|
+
{
|
|
44
|
+
type: "button",
|
|
45
|
+
onClick: onShowSave,
|
|
46
|
+
className: "flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-[var(--text-muted)] transition-colors hover:bg-[var(--bg-elevated)] hover:text-[var(--text-secondary)]",
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Save, { className: "size-3" }),
|
|
49
|
+
"Save as"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
hasOverrides && /* @__PURE__ */ jsxs(
|
|
54
|
+
"button",
|
|
55
|
+
{
|
|
56
|
+
type: "button",
|
|
57
|
+
onClick: onReset,
|
|
58
|
+
className: "ml-auto flex items-center gap-1 rounded-md px-2 py-1 text-[11px] text-[var(--text-muted)] transition-colors hover:bg-[var(--bg-elevated)] hover:text-[var(--text-secondary)]",
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ jsx(RotateCcw, { className: "size-3" }),
|
|
61
|
+
"Reset"
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] }),
|
|
66
|
+
showSaveInput && /* @__PURE__ */ jsx(SavePresetInput, { onSave, onCancel: onCancelSave })
|
|
67
|
+
] });
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
PresetBar
|
|
71
|
+
};
|