Compare commits

..
Author SHA1 Message Date
Cursor AgentandJulius Marminge 7a0c606fb5 Add react-scan command palette recordings
Co-authored-by: Julius Marminge <[email protected]>
2026-05-18 16:19:00 +00:00
Cursor AgentandJulius Marminge 7dbf3105b4 Open command palette from sidebar store
Co-authored-by: Julius Marminge <[email protected]>
2026-05-18 16:13:16 +00:00
Cursor AgentandJulius Marminge fdf2210cfa Isolate command palette renders
Co-authored-by: Julius Marminge <[email protected]>
2026-05-18 16:10:42 +00:00
t3-code[bot] d1e85c4e8f chore(release): prepare v0.0.24 2026-05-15 06:40:13 +00:00
13 changed files with 366 additions and 300 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@t3tools/desktop",
"version": "0.0.23",
"version": "0.0.24",
"private": true,
"type": "module",
"main": "dist-electron/main.cjs",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "t3",
"version": "0.0.23",
"version": "0.0.24",
"license": "MIT",
"repository": {
"type": "git",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@t3tools/web",
"version": "0.0.23",
"version": "0.0.24",
"private": true,
"type": "module",
"scripts": {
+92 -39
View File
@@ -121,6 +121,8 @@ import type { ChatComposerHandle } from "./chat/ChatComposer";
const EMPTY_BROWSE_ENTRIES: FilesystemBrowseResult["entries"] = [];
const BROWSE_STALE_TIME_MS = 30_000;
type CommandPaletteOpenIntent = ReturnType<typeof useCommandPaletteStore.getState>["openIntent"];
type BrowseEntry = FilesystemBrowseResult["entries"][number];
function getLocalFileManagerName(platform: string): string {
if (isMacPlatform(platform)) {
@@ -327,11 +329,31 @@ function errorMessage(error: unknown): string {
}
export function CommandPalette({ children }: { children: ReactNode }) {
const composerHandleRef = useRef<ChatComposerHandle | null>(null);
return (
<ComposerHandleContext value={composerHandleRef}>
{children}
<CommandPaletteController />
</ComposerHandleContext>
);
}
function CommandPaletteController() {
const open = useCommandPaletteStore((store) => store.open);
const setOpen = useCommandPaletteStore((store) => store.setOpen);
useCommandPaletteShortcut();
return (
<CommandDialog open={open} onOpenChange={setOpen}>
<CommandPaletteDialog />
</CommandDialog>
);
}
function useCommandPaletteShortcut() {
const toggleOpen = useCommandPaletteStore((store) => store.toggleOpen);
const keybindings = useServerKeybindings();
const composerHandleRef = useRef<ChatComposerHandle | null>(null);
const routeTarget = useParams({
strict: false,
select: (params) => resolveThreadRouteTarget(params),
@@ -362,26 +384,12 @@ export function CommandPalette({ children }: { children: ReactNode }) {
window.addEventListener("keydown", onKeyDown);
return () => window.removeEventListener("keydown", onKeyDown);
}, [keybindings, terminalOpen, toggleOpen]);
return (
<ComposerHandleContext value={composerHandleRef}>
<CommandDialog open={open} onOpenChange={setOpen}>
{children}
<CommandPaletteDialog />
</CommandDialog>
</ComposerHandleContext>
);
}
function CommandPaletteDialog() {
const open = useCommandPaletteStore((store) => store.open);
const setOpen = useCommandPaletteStore((store) => store.setOpen);
useEffect(() => {
return () => {
setOpen(false);
};
}, [setOpen]);
useCloseCommandPaletteOnUnmount(setOpen);
if (!open) {
return null;
@@ -390,6 +398,70 @@ function CommandPaletteDialog() {
return <OpenCommandPaletteDialog />;
}
function useCloseCommandPaletteOnUnmount(setOpen: (open: boolean) => void) {
useEffect(() => {
return () => {
setOpen(false);
};
}, [setOpen]);
}
function usePrefetchBrowsePaths({
exactBrowseEntry,
filteredBrowseEntryCount,
highlightedBrowseEntry,
isBrowsing,
prefetchBrowsePath,
query,
}: {
readonly exactBrowseEntry: BrowseEntry | null;
readonly filteredBrowseEntryCount: number;
readonly highlightedBrowseEntry: BrowseEntry | null;
readonly isBrowsing: boolean;
readonly prefetchBrowsePath: (partialPath: string) => void;
readonly query: string;
}) {
// Prefetch the parent and the most likely next child so browse navigation
// stays warm without scanning every child directory in large trees.
useEffect(() => {
if (!isBrowsing || filteredBrowseEntryCount === 0) return;
if (canNavigateUp(query)) {
prefetchBrowsePath(getBrowseParentPath(query)!);
}
const nextChild = highlightedBrowseEntry ?? exactBrowseEntry;
if (nextChild) {
prefetchBrowsePath(appendBrowsePathSegment(query, nextChild.name));
}
}, [
exactBrowseEntry,
filteredBrowseEntryCount,
highlightedBrowseEntry,
isBrowsing,
prefetchBrowsePath,
query,
]);
}
function useOpenAddProjectIntent({
clearOpenIntent,
openAddProjectFlow,
openIntent,
}: {
readonly clearOpenIntent: () => void;
readonly openAddProjectFlow: () => void;
readonly openIntent: CommandPaletteOpenIntent;
}) {
useLayoutEffect(() => {
if (openIntent?.kind !== "add-project") {
return;
}
clearOpenIntent();
openAddProjectFlow();
}, [clearOpenIntent, openAddProjectFlow, openIntent]);
}
function OpenCommandPaletteDialog() {
const navigate = useNavigate();
const setOpen = useCommandPaletteStore((store) => store.setOpen);
@@ -587,27 +659,14 @@ function OpenCommandPaletteDialog() {
[browseEnvironmentId, currentProjectCwdForBrowse, fetchBrowseResult, queryClient],
);
// Prefetch the parent and the most likely next child so browse navigation
// stays warm without scanning every child directory in large trees.
useEffect(() => {
if (!isBrowsing || filteredBrowseEntries.length === 0) return;
if (canNavigateUp(query)) {
prefetchBrowsePath(getBrowseParentPath(query)!);
}
const nextChild = highlightedBrowseEntry ?? exactBrowseEntry;
if (nextChild) {
prefetchBrowsePath(appendBrowsePathSegment(query, nextChild.name));
}
}, [
usePrefetchBrowsePaths({
exactBrowseEntry,
filteredBrowseEntries.length,
filteredBrowseEntryCount: filteredBrowseEntries.length,
highlightedBrowseEntry,
isBrowsing,
prefetchBrowsePath,
query,
]);
});
const openProjectFromSearch = useMemo(
() => async (project: (typeof projects)[number]) => {
@@ -971,13 +1030,7 @@ function OpenCommandPaletteDialog() {
startAddProjectSourceSelection,
]);
useLayoutEffect(() => {
if (openIntent?.kind !== "add-project") {
return;
}
clearOpenIntent();
openAddProjectFlow();
}, [clearOpenIntent, openAddProjectFlow, openIntent]);
useOpenAddProjectIntent({ clearOpenIntent, openAddProjectFlow, openIntent });
const actionItems: Array<CommandPaletteActionItem | CommandPaletteSubmenuItem> = [];
+11 -10
View File
@@ -175,7 +175,6 @@ import {
import { sortThreads } from "../lib/threadSort";
import { SidebarUpdatePill } from "./sidebar/SidebarUpdatePill";
import { useCopyToClipboard } from "~/hooks/useCopyToClipboard";
import { CommandDialogTrigger } from "./ui/command";
import { readEnvironmentApi } from "../environmentApi";
import { useSettings, useUpdateSettings } from "~/hooks/useSettings";
import { useServerKeybindings } from "../rpc/serverState";
@@ -2619,20 +2618,22 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
},
[updateSettings],
);
const setCommandPaletteOpen = useCommandPaletteStore((store) => store.setOpen);
const handleCommandPaletteClick = useCallback(() => {
setCommandPaletteOpen(true);
}, [setCommandPaletteOpen]);
return (
<SidebarContent className="gap-0">
<SidebarGroup className="px-2 pt-2 pb-1">
<SidebarMenu>
<SidebarMenuItem>
<CommandDialogTrigger
render={
<SidebarMenuButton
size="sm"
className="gap-2 px-2 py-1.5 text-muted-foreground/70 hover:bg-accent hover:text-foreground focus-visible:ring-0"
data-testid="command-palette-trigger"
/>
}
<SidebarMenuButton
size="sm"
className="gap-2 px-2 py-1.5 text-muted-foreground/70 hover:bg-accent hover:text-foreground focus-visible:ring-0"
data-testid="command-palette-trigger"
aria-haspopup="dialog"
onClick={handleCommandPaletteClick}
>
<SearchIcon className="size-3.5" />
<span className="flex-1 truncate text-left text-xs">Search</span>
@@ -2641,7 +2642,7 @@ const SidebarProjectsContent = memo(function SidebarProjectsContent(
{commandPaletteShortcutLabel}
</Kbd>
) : null}
</CommandDialogTrigger>
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroup>
@@ -2,7 +2,7 @@
import { CheckIcon } from "lucide-react";
import { Radio as RadioPrimitive } from "@base-ui/react/radio";
import { useCallback, useMemo, useState } from "react";
import { useCallback, useEffect, useMemo, useState } from "react";
import {
ProviderInstanceId,
ProviderDriverKind,
@@ -114,21 +114,6 @@ interface AddProviderInstanceDialogProps {
}
export function AddProviderInstanceDialog({ open, onOpenChange }: AddProviderInstanceDialogProps) {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<AddProviderInstanceDialogContent
key={open ? "add-provider-open" : "add-provider-closed"}
onOpenChange={onOpenChange}
/>
</Dialog>
);
}
interface AddProviderInstanceDialogContentProps {
onOpenChange: (open: boolean) => void;
}
function AddProviderInstanceDialogContent({ onOpenChange }: AddProviderInstanceDialogContentProps) {
const settings = useSettings();
const { updateSettings } = useUpdateSettings();
@@ -136,7 +121,8 @@ function AddProviderInstanceDialogContent({ onOpenChange }: AddProviderInstanceD
const [driver, setDriver] = useState<ProviderDriverKind>(DEFAULT_DRIVER_KIND);
const [label, setLabel] = useState("");
const [accentColor, setAccentColor] = useState<string>("");
const [customInstanceId, setCustomInstanceId] = useState<string | null>(null);
const [instanceId, setInstanceId] = useState("");
const [instanceIdDirty, setInstanceIdDirty] = useState(false);
// Driver-specific config drafts keyed by driver so toggling between drivers
// during the same dialog session does not lose in-progress input.
const [configByDriver, setConfigByDriver] = useState<Record<string, Record<string, unknown>>>({});
@@ -149,12 +135,32 @@ function AddProviderInstanceDialogContent({ onOpenChange }: AddProviderInstanceD
[settings.providerInstances],
);
// Reset the form every time the dialog opens so each creation starts
// from a clean slate.
useEffect(() => {
if (!open) return;
setDriver(DEFAULT_DRIVER_KIND);
setLabel("");
setAccentColor("");
setInstanceId("");
setWizardStep(0);
setInstanceIdDirty(false);
setConfigByDriver({});
setHasAttemptedSubmit(false);
}, [open]);
// Auto-derive the instance id from driver + label until the user types
// in the Instance ID field directly (after which they own its value).
useEffect(() => {
if (instanceIdDirty) return;
setInstanceId(deriveInstanceId(driver, label));
}, [driver, label, instanceIdDirty]);
const driverOption = DRIVER_OPTION_BY_VALUE[driver] ?? DEFAULT_DRIVER_OPTION;
const driverSettingsFields = useMemo(
() => deriveProviderSettingsFields(driverOption),
[driverOption],
);
const instanceId = customInstanceId ?? deriveInstanceId(driver, label);
const instanceIdError = validateInstanceId(instanceId, existingIds);
const showInstanceIdError = hasAttemptedSubmit && instanceIdError !== null;
const previewLabel = label.trim() || `${driverOption.label} Workspace`;
@@ -230,250 +236,256 @@ function AddProviderInstanceDialogContent({ onOpenChange }: AddProviderInstanceD
]);
return (
<DialogPopup className="max-w-xl overflow-hidden">
<div className="flex min-h-0 flex-col overflow-hidden border-foreground/10 bg-background shadow-2xl">
<DialogHeader className="border-b border-border/70 bg-background">
<DialogTitle>Add provider instance</DialogTitle>
<DialogDescription>
Configure an additional provider instance — for example, a second Codex install pointed
at a different workspace.
</DialogDescription>
<div className="grid grid-cols-3 gap-2">
{wizardSteps.map((step, index) => (
<button
key={step}
type="button"
className={cn(
"grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] gap-x-2 rounded-lg border px-3 py-2 text-left",
index === wizardStep
? "border-primary bg-primary/10 ring-1 ring-primary/25"
: index < wizardStep
? "border-border bg-background"
: "border-border bg-muted/40",
)}
onClick={() => setWizardStep(index)}
>
<span
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogPopup className="max-w-xl overflow-hidden">
<div className="flex min-h-0 flex-col overflow-hidden border-foreground/10 bg-background shadow-2xl">
<DialogHeader className="border-b border-border/70 bg-background">
<DialogTitle>Add provider instance</DialogTitle>
<DialogDescription>
Configure an additional provider instance — for example, a second Codex install
pointed at a different workspace.
</DialogDescription>
<div className="grid grid-cols-3 gap-2">
{wizardSteps.map((step, index) => (
<button
key={step}
type="button"
className={cn(
"row-span-2 mt-0.5 grid size-4 place-items-center rounded-full border",
index < wizardStep
? "border-primary bg-primary text-primary-foreground"
: index === wizardStep
? "border-primary bg-background"
: "border-muted-foreground/35 bg-background",
"grid min-w-0 grid-cols-[1rem_minmax(0,1fr)] gap-x-2 rounded-lg border px-3 py-2 text-left",
index === wizardStep
? "border-primary bg-primary/10 ring-1 ring-primary/25"
: index < wizardStep
? "border-border bg-background"
: "border-border bg-muted/40",
)}
aria-hidden
onClick={() => setWizardStep(index)}
>
{index < wizardStep ? <CheckIcon className="size-3" /> : null}
</span>
<span className="text-[10px] font-medium uppercase text-muted-foreground">
Step {index + 1}
</span>
<span className="truncate text-xs font-semibold text-foreground">
{step}
{index < wizardStep && wizardStepSummaries[index]
? `: ${wizardStepSummaries[index]}`
: ""}
</span>
</button>
))}
</div>
</DialogHeader>
<div
data-slot="dialog-panel"
className="space-y-4 border-b border-border/70 bg-muted/20 px-6 py-5"
>
<AnimatedHeight>
<div className={cn("grid gap-2", wizardStep !== 0 && "hidden")}>
<span id="add-instance-driver-label" className="text-xs font-medium text-foreground">
Driver
</span>
<RadioGroup
value={driver}
onValueChange={(value) => setDriver(ProviderDriverKind.make(value))}
aria-labelledby="add-instance-driver-label"
className="grid grid-cols-2 gap-2.5"
>
{DRIVER_OPTIONS.map((option) => {
const IconComponent = option.icon;
const isSelected = option.value === driver;
return (
<RadioPrimitive.Root
key={option.value}
value={option.value}
className={cn(
"relative flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-left outline-none transition-[background-color,border-color,box-shadow]",
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
isSelected
? "border-primary bg-background shadow-sm ring-2 ring-primary/35"
: "border-border bg-background hover:border-foreground/20 hover:bg-muted/50",
)}
>
<IconComponent className="size-5 shrink-0" aria-hidden />
<span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">
{option.label}
</span>
{option.badgeLabel ? (
<Badge variant="warning" size="sm">
{option.badgeLabel}
</Badge>
) : null}
</RadioPrimitive.Root>
);
})}
{COMING_SOON_DRIVER_OPTIONS.map((option) => {
const IconComponent = option.icon;
return (
<RadioPrimitive.Root
key={option.value}
value={option.value}
disabled
className={cn(
"relative flex cursor-not-allowed items-center gap-3 rounded-lg border border-border bg-background px-3 py-3 text-left opacity-55 outline-none",
)}
>
<IconComponent
className="size-5 shrink-0 text-muted-foreground"
aria-hidden
/>
<span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">
{option.label}
</span>
<Badge variant="warning" size="sm">
Coming Soon
</Badge>
</RadioPrimitive.Root>
);
})}
</RadioGroup>
<span
className={cn(
"row-span-2 mt-0.5 grid size-4 place-items-center rounded-full border",
index < wizardStep
? "border-primary bg-primary text-primary-foreground"
: index === wizardStep
? "border-primary bg-background"
: "border-muted-foreground/35 bg-background",
)}
aria-hidden
>
{index < wizardStep ? <CheckIcon className="size-3" /> : null}
</span>
<span className="text-[10px] font-medium uppercase text-muted-foreground">
Step {index + 1}
</span>
<span className="truncate text-xs font-semibold text-foreground">
{step}
{index < wizardStep && wizardStepSummaries[index]
? `: ${wizardStepSummaries[index]}`
: ""}
</span>
</button>
))}
</div>
</DialogHeader>
<label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>
<span className="text-xs font-medium text-foreground">Label</span>
<Input
className="bg-background"
placeholder="e.g. Work"
value={label}
onChange={(event) => setLabel(event.target.value)}
/>
<span className="text-[11px] text-muted-foreground">
Shown in the provider list. Optional.
</span>
</label>
<label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>
<span className="text-xs font-medium text-foreground">Instance ID</span>
<Input
className="bg-background"
placeholder={`${driver}_work`}
value={instanceId}
onChange={(event) => {
setCustomInstanceId(event.target.value);
}}
aria-invalid={showInstanceIdError}
/>
{showInstanceIdError ? (
<span className="text-[11px] text-destructive">{instanceIdError}</span>
) : (
<span className="text-[11px] text-muted-foreground">
Routing key used by threads and sessions. Letters, digits, '-', or '_'.
<div
data-slot="dialog-panel"
className="space-y-4 border-b border-border/70 bg-muted/20 px-6 py-5"
>
<AnimatedHeight>
<div className={cn("grid gap-2", wizardStep !== 0 && "hidden")}>
<span
id="add-instance-driver-label"
className="text-xs font-medium text-foreground"
>
Driver
</span>
)}
</label>
<div className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>
<span className="text-xs font-medium text-foreground">Accent color</span>
<div className="flex min-w-0 flex-wrap items-center gap-2">
<input
type="color"
value={normalizeProviderAccentColor(accentColor) ?? PROVIDER_ACCENT_SWATCHES[0]}
onChange={(event) => setAccentColor(event.target.value)}
aria-label="Provider instance accent color"
className="h-8 w-10 cursor-pointer rounded-xl border border-input bg-background p-0.5"
/>
<div className="flex flex-wrap gap-1.5">
{PROVIDER_ACCENT_SWATCHES.map((swatch) => {
const selected = accentColor.toLowerCase() === swatch;
<RadioGroup
value={driver}
onValueChange={(value) => setDriver(ProviderDriverKind.make(value))}
aria-labelledby="add-instance-driver-label"
className="grid grid-cols-2 gap-2.5"
>
{DRIVER_OPTIONS.map((option) => {
const IconComponent = option.icon;
const isSelected = option.value === driver;
return (
<button
key={swatch}
type="button"
<RadioPrimitive.Root
key={option.value}
value={option.value}
className={cn(
"size-6 cursor-pointer rounded-full border transition",
selected
? "scale-110 border-foreground ring-2 ring-ring ring-offset-1 ring-offset-background"
: "border-black/10 hover:scale-105 dark:border-white/20",
"relative flex cursor-pointer items-center gap-3 rounded-lg border px-3 py-3 text-left outline-none transition-[background-color,border-color,box-shadow]",
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
isSelected
? "border-primary bg-background shadow-sm ring-2 ring-primary/35"
: "border-border bg-background hover:border-foreground/20 hover:bg-muted/50",
)}
style={{ backgroundColor: swatch }}
onClick={() => setAccentColor(swatch)}
aria-label={`Use ${swatch} accent`}
/>
>
<IconComponent className="size-5 shrink-0" aria-hidden />
<span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">
{option.label}
</span>
{option.badgeLabel ? (
<Badge variant="warning" size="sm">
{option.badgeLabel}
</Badge>
) : null}
</RadioPrimitive.Root>
);
})}
</div>
{accentColor ? (
<Button
type="button"
size="sm"
variant="ghost"
className="h-7 px-2 text-xs text-muted-foreground"
onClick={() => setAccentColor("")}
>
Clear
</Button>
) : null}
{COMING_SOON_DRIVER_OPTIONS.map((option) => {
const IconComponent = option.icon;
return (
<RadioPrimitive.Root
key={option.value}
value={option.value}
disabled
className={cn(
"relative flex cursor-not-allowed items-center gap-3 rounded-lg border border-border bg-background px-3 py-3 text-left opacity-55 outline-none",
)}
>
<IconComponent
className="size-5 shrink-0 text-muted-foreground"
aria-hidden
/>
<span className="min-w-0 flex-1 truncate text-sm font-medium text-foreground">
{option.label}
</span>
<Badge variant="warning" size="sm">
Coming Soon
</Badge>
</RadioPrimitive.Root>
);
})}
</RadioGroup>
</div>
<span className="text-[11px] text-muted-foreground">
Optional marker shown in the picker.
</span>
</div>
{driverSettingsFields.length > 0 ? (
<div className={cn("grid gap-4", wizardStep !== 2 && "hidden")}>
<ProviderSettingsForm
definition={driverOption}
value={configDraft}
idPrefix={`add-provider-${driver}`}
variant="dialog"
onChange={setConfigDraft}
<label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>
<span className="text-xs font-medium text-foreground">Label</span>
<Input
className="bg-background"
placeholder="e.g. Work"
value={label}
onChange={(event) => setLabel(event.target.value)}
/>
</div>
) : wizardStep === 2 ? (
<div className="grid gap-2">
<p className="text-sm text-muted-foreground">
This driver has no required configuration. You can add the instance now.
</p>
</div>
) : null}
</AnimatedHeight>
</div>
<span className="text-[11px] text-muted-foreground">
Shown in the provider list. Optional.
</span>
</label>
<DialogFooter className="border-t bg-background">
<Button
variant="outline"
size="sm"
onClick={() => {
if (wizardStep === 0) {
onOpenChange(false);
return;
}
setWizardStep((step) => Math.max(0, step - 1));
}}
>
{wizardStep === 0 ? "Cancel" : "Back"}
</Button>
{wizardStep < wizardSteps.length - 1 ? (
<Button size="sm" onClick={() => setWizardStep((step) => Math.min(2, step + 1))}>
Next
<label className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>
<span className="text-xs font-medium text-foreground">Instance ID</span>
<Input
className="bg-background"
placeholder={`${driver}_work`}
value={instanceId}
onChange={(event) => {
setInstanceIdDirty(true);
setInstanceId(event.target.value);
}}
aria-invalid={showInstanceIdError}
/>
{showInstanceIdError ? (
<span className="text-[11px] text-destructive">{instanceIdError}</span>
) : (
<span className="text-[11px] text-muted-foreground">
Routing key used by threads and sessions. Letters, digits, '-', or '_'.
</span>
)}
</label>
<div className={cn("grid gap-2", wizardStep !== 1 && "hidden")}>
<span className="text-xs font-medium text-foreground">Accent color</span>
<div className="flex min-w-0 flex-wrap items-center gap-2">
<input
type="color"
value={normalizeProviderAccentColor(accentColor) ?? PROVIDER_ACCENT_SWATCHES[0]}
onChange={(event) => setAccentColor(event.target.value)}
aria-label="Provider instance accent color"
className="h-8 w-10 cursor-pointer rounded-xl border border-input bg-background p-0.5"
/>
<div className="flex flex-wrap gap-1.5">
{PROVIDER_ACCENT_SWATCHES.map((swatch) => {
const selected = accentColor.toLowerCase() === swatch;
return (
<button
key={swatch}
type="button"
className={cn(
"size-6 cursor-pointer rounded-full border transition",
selected
? "scale-110 border-foreground ring-2 ring-ring ring-offset-1 ring-offset-background"
: "border-black/10 hover:scale-105 dark:border-white/20",
)}
style={{ backgroundColor: swatch }}
onClick={() => setAccentColor(swatch)}
aria-label={`Use ${swatch} accent`}
/>
);
})}
</div>
{accentColor ? (
<Button
type="button"
size="sm"
variant="ghost"
className="h-7 px-2 text-xs text-muted-foreground"
onClick={() => setAccentColor("")}
>
Clear
</Button>
) : null}
</div>
<span className="text-[11px] text-muted-foreground">
Optional marker shown in the picker.
</span>
</div>
{driverSettingsFields.length > 0 ? (
<div className={cn("grid gap-4", wizardStep !== 2 && "hidden")}>
<ProviderSettingsForm
definition={driverOption}
value={configDraft}
idPrefix={`add-provider-${driver}`}
variant="dialog"
onChange={setConfigDraft}
/>
</div>
) : wizardStep === 2 ? (
<div className="grid gap-2">
<p className="text-sm text-muted-foreground">
This driver has no required configuration. You can add the instance now.
</p>
</div>
) : null}
</AnimatedHeight>
</div>
<DialogFooter className="border-t bg-background">
<Button
variant="outline"
size="sm"
onClick={() => {
if (wizardStep === 0) {
onOpenChange(false);
return;
}
setWizardStep((step) => Math.max(0, step - 1));
}}
>
{wizardStep === 0 ? "Cancel" : "Back"}
</Button>
) : (
<Button size="sm" onClick={handleSave}>
Add instance
</Button>
)}
</DialogFooter>
</div>
</DialogPopup>
{wizardStep < wizardSteps.length - 1 ? (
<Button size="sm" onClick={() => setWizardStep((step) => Math.min(2, step + 1))}>
Next
</Button>
) : (
<Button size="sm" onClick={handleSave}>
Add instance
</Button>
)}
</DialogFooter>
</div>
</DialogPopup>
</Dialog>
);
}
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@t3tools/contracts",
"version": "0.0.23",
"version": "0.0.24",
"private": true,
"files": [
"dist"
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB