fix(webui): share control layout for preset alignment
This commit is contained in:
1 parent
55ff1d8d1f
commit
763ae9c2ae
7 files changed
+49
-18
No files matched your search
@@ -80,7 +80,7 @@ export function ModelAPIControl({
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
) : (
|
) : (
|
||||||
<span className="block pe-3 text-[13px] text-muted-foreground sm:text-right">{fixedLabel}</span>
|
<span className="control-layout w-full justify-start border-transparent text-[13px] text-muted-foreground sm:justify-end">{fixedLabel}</span>
|
||||||
)}
|
)}
|
||||||
</SettingsRow>
|
</SettingsRow>
|
||||||
{configurable && selectedAPI === "responses" && (!requestAPIs || requestAPIs.includes("chat_completions")) ? (
|
{configurable && selectedAPI === "responses" && (!requestAPIs || requestAPIs.includes("chat_completions")) ? (
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { useAutoSave } from "@/components/settings/shared/useAutoSave";
|
|||||||
import { useEffect, useId, useRef, useState, type Dispatch, type SetStateAction } from "react";
|
import { useEffect, useId, useRef, useState, type Dispatch, type SetStateAction } from "react";
|
||||||
import { DisclosureContent } from "@/components/ui/disclosure";
|
import { DisclosureContent } from "@/components/ui/disclosure";
|
||||||
import {
|
import {
|
||||||
ChevronDown,
|
|
||||||
GripVertical,
|
GripVertical,
|
||||||
ListOrdered,
|
ListOrdered,
|
||||||
Loader2,
|
Loader2,
|
||||||
@@ -34,6 +33,7 @@ import {
|
|||||||
StatusPill,
|
StatusPill,
|
||||||
} from "@/components/settings/shared/SettingsControls";
|
} from "@/components/settings/shared/SettingsControls";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { ControlChevron } from "@/components/ui/control-chevron";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
@@ -530,9 +530,9 @@ export function ModelsSettings({
|
|||||||
aria-expanded={advancedOpen}
|
aria-expanded={advancedOpen}
|
||||||
aria-controls={advancedId}
|
aria-controls={advancedId}
|
||||||
onClick={() => setAdvancedOpen((value) => !value)}
|
onClick={() => setAdvancedOpen((value) => !value)}
|
||||||
className="flex min-h-[62px] w-full items-center justify-between gap-4 px-4 py-3.5 text-left transition-colors settings-hover sm:px-5"
|
className="settings-disclosure-row w-full text-left transition-colors settings-hover"
|
||||||
>
|
>
|
||||||
<span>
|
<span className="min-w-0">
|
||||||
<span className="block text-[14px] font-medium text-foreground">
|
<span className="block text-[14px] font-medium text-foreground">
|
||||||
{tx("settings.models.advancedOptions", "Advanced options")}
|
{tx("settings.models.advancedOptions", "Advanced options")}
|
||||||
</span>
|
</span>
|
||||||
@@ -545,13 +545,16 @@ export function ModelsSettings({
|
|||||||
})}</span>
|
})}</span>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<ChevronDown
|
<span className="settings-control">
|
||||||
className={cn(
|
<span className="control-layout justify-end border-transparent">
|
||||||
"me-3 h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200 motion-reduce:transition-none",
|
<ControlChevron
|
||||||
advancedOpen && "rotate-180",
|
className={cn(
|
||||||
)}
|
"transition-transform duration-200 motion-reduce:transition-none",
|
||||||
aria-hidden
|
advancedOpen && "rotate-180",
|
||||||
/>
|
)}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<DisclosureContent id={advancedId} open={advancedOpen}>
|
<DisclosureContent id={advancedId} open={advancedOpen}>
|
||||||
<div className="bg-muted/12 px-4 py-4 sm:px-5">
|
<div className="bg-muted/12 px-4 py-4 sm:px-5">
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {
|
|||||||
Bot,
|
Bot,
|
||||||
Brain,
|
Brain,
|
||||||
Check,
|
Check,
|
||||||
ChevronDown,
|
|
||||||
CircleAlert,
|
CircleAlert,
|
||||||
Cloud,
|
Cloud,
|
||||||
Cpu,
|
Cpu,
|
||||||
@@ -26,6 +25,7 @@ import {
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { ControlChevron } from "@/components/ui/control-chevron";
|
||||||
import { ComboboxOption, useComboboxNavigation } from "@/components/ui/combobox";
|
import { ComboboxOption, useComboboxNavigation } from "@/components/ui/combobox";
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
@@ -126,7 +126,7 @@ export function ProviderPicker({
|
|||||||
type="button"
|
type="button"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
className={cn(
|
className={cn(
|
||||||
"h-9 w-full justify-between rounded-full border-input bg-background px-3 text-[13px] font-normal shadow-none",
|
"w-full justify-between rounded-full border-input bg-background text-[13px] font-normal shadow-none",
|
||||||
"settings-hover focus-visible:ring-2 focus-visible:ring-ring",
|
"settings-hover focus-visible:ring-2 focus-visible:ring-ring",
|
||||||
disabled && "text-muted-foreground",
|
disabled && "text-muted-foreground",
|
||||||
)}
|
)}
|
||||||
@@ -364,8 +364,9 @@ export function ModelIdPicker({
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
|
size="control"
|
||||||
className={cn(
|
className={cn(
|
||||||
"h-9 w-full justify-between rounded-full border-input bg-background px-3 text-[13px] font-normal shadow-none",
|
"w-full justify-between rounded-full border-input bg-background text-[13px] font-normal shadow-none",
|
||||||
"settings-hover focus-visible:ring-2 focus-visible:ring-ring",
|
"settings-hover focus-visible:ring-2 focus-visible:ring-ring",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
@@ -384,7 +385,7 @@ export function ModelIdPicker({
|
|||||||
{value || emptyLabel || tx("settings.models.selectModel", "Select model")}
|
{value || emptyLabel || tx("settings.models.selectModel", "Select model")}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<ChevronDown className="ml-2 h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden />
|
<ControlChevron />
|
||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent
|
<PopoverContent
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ const buttonVariants = cva(
|
|||||||
size: {
|
size: {
|
||||||
default: "h-10 px-4 py-2",
|
default: "h-10 px-4 py-2",
|
||||||
sm: "h-9 px-3",
|
sm: "h-9 px-3",
|
||||||
|
control: "control-layout",
|
||||||
lg: "h-11 px-8",
|
lg: "h-11 px-8",
|
||||||
icon: "h-9 w-9",
|
icon: "h-9 w-9",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { ChevronDown } from "lucide-react";
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
export function ControlChevron({ className }: { className?: string }) {
|
||||||
|
return (
|
||||||
|
<ChevronDown
|
||||||
|
// Keep the horizontal viewBox around the artwork, including its stroke.
|
||||||
|
viewBox="5 0 14 24"
|
||||||
|
width={14}
|
||||||
|
height={24}
|
||||||
|
className={cn("h-3.5 w-auto shrink-0 text-muted-foreground", className)}
|
||||||
|
aria-hidden
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|||||||
import { floatingSurfaceElevationClassName, floatingItemClassName } from "@/components/ui/floating-surface";
|
import { floatingSurfaceElevationClassName, floatingItemClassName } from "@/components/ui/floating-surface";
|
||||||
import { useFloatingPortal } from "@/components/ui/floating-portal";
|
import { useFloatingPortal } from "@/components/ui/floating-portal";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
import { ControlChevron } from "@/components/ui/control-chevron";
|
||||||
|
|
||||||
export const Select = SelectPrimitive.Root;
|
export const Select = SelectPrimitive.Root;
|
||||||
export const SelectValue = SelectPrimitive.Value;
|
export const SelectValue = SelectPrimitive.Value;
|
||||||
@@ -14,9 +15,9 @@ export const SelectTrigger = React.forwardRef<
|
|||||||
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
||||||
>(({ className, children, ...props }, ref) => (
|
>(({ className, children, ...props }, ref) => (
|
||||||
<SelectPrimitive.Trigger ref={ref} {...props}
|
<SelectPrimitive.Trigger ref={ref} {...props}
|
||||||
className={cn("flex h-9 items-center justify-between gap-2 rounded-control border border-input bg-background px-3 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 [&>span:first-child]:truncate", className)}>
|
className={cn("control-layout justify-between rounded-control border-input bg-background text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 [&>span:first-child]:truncate", className)}>
|
||||||
{children}
|
{children}
|
||||||
<SelectPrimitive.Icon asChild><ChevronDown className="h-3.5 w-3.5 shrink-0 text-muted-foreground" aria-hidden /></SelectPrimitive.Icon>
|
<SelectPrimitive.Icon><ControlChevron /></SelectPrimitive.Icon>
|
||||||
</SelectPrimitive.Trigger>
|
</SelectPrimitive.Trigger>
|
||||||
));
|
));
|
||||||
SelectTrigger.displayName = "SelectTrigger";
|
SelectTrigger.displayName = "SelectTrigger";
|
||||||
|
|||||||
+10
-1
@@ -1398,7 +1398,15 @@
|
|||||||
}
|
}
|
||||||
.settings-section-heading > .settings-section-title { margin: 0; padding: 0; }
|
.settings-section-heading > .settings-section-title { margin: 0; padding: 0; }
|
||||||
.settings-stack > .settings-section-heading + :not([hidden]) { margin-block-start: 20px; }
|
.settings-stack > .settings-section-heading + :not([hidden]) { margin-block-start: 20px; }
|
||||||
.settings-row, .settings-footer {
|
.control-layout {
|
||||||
|
display: flex;
|
||||||
|
height: 2.25rem;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
border-width: 1px;
|
||||||
|
padding-inline: 0.75rem;
|
||||||
|
}
|
||||||
|
.settings-row, .settings-footer, .settings-disclosure-row {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(var(--settings-columns, 4), minmax(0, 1fr));
|
grid-template-columns: repeat(var(--settings-columns, 4), minmax(0, 1fr));
|
||||||
column-gap: var(--settings-gutter, 16px);
|
column-gap: var(--settings-gutter, 16px);
|
||||||
@@ -1408,6 +1416,7 @@
|
|||||||
min-block-size: 60px;
|
min-block-size: 60px;
|
||||||
}
|
}
|
||||||
.settings-row > *, .settings-footer > * { grid-column: 1 / -1; min-inline-size: 0; }
|
.settings-row > *, .settings-footer > * { grid-column: 1 / -1; min-inline-size: 0; }
|
||||||
|
.settings-disclosure-row { grid-template-columns: minmax(0, 1fr) auto; }
|
||||||
.settings-control { display: flex; align-items: center; max-inline-size: 100%; }
|
.settings-control { display: flex; align-items: center; max-inline-size: 100%; }
|
||||||
.settings-control > * { max-inline-size: 100%; }
|
.settings-control > * { max-inline-size: 100%; }
|
||||||
.settings-control input, .settings-control textarea { max-inline-size: 100%; text-align: start; }
|
.settings-control input, .settings-control textarea { max-inline-size: 100%; text-align: start; }
|
||||||
|
|||||||
Reference in new issue
Block a user