refactor(web): ui components drop their secondary className props (#13193)
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
266d70cc4d
commit
361b047f5f
30 files changed
+127
-205
No files matched your search
@@ -10378,7 +10378,6 @@ export default function ChatView(props: ChatViewProps) {
|
||||
<RightPanelSheet
|
||||
animationDurationMs={panelAnimationsActive ? panelAnimationDurationMs : 0}
|
||||
open={rightPanelOpen}
|
||||
underFloatingPreview={previewMiniPlayerVisible}
|
||||
onClose={closePreviewPanel}
|
||||
>
|
||||
<RightPanelTabs
|
||||
|
||||
@@ -2966,9 +2966,6 @@ function OpenCommandPaletteDialog(props: {
|
||||
})
|
||||
: undefined,
|
||||
placeholder: inputPlaceholder,
|
||||
wrapperClassName: isSubmenu
|
||||
? "[&_[data-slot=autocomplete-start-addon]]:pointer-events-auto"
|
||||
: undefined,
|
||||
...(isSubmenu
|
||||
? {
|
||||
startAddon: (
|
||||
|
||||
@@ -775,7 +775,6 @@ export default function DiffPanel({
|
||||
<ComboboxList className="max-h-64 min-w-0 overflow-x-hidden">
|
||||
<ComboboxItem
|
||||
className="w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)]"
|
||||
contentClassName="w-full min-w-0 overflow-hidden"
|
||||
value={AUTOMATIC_BASE_REF}
|
||||
>
|
||||
<span className="block min-w-0 truncate">Automatic</span>
|
||||
@@ -788,7 +787,6 @@ export default function DiffPanel({
|
||||
<ComboboxItem
|
||||
key={choice.id}
|
||||
className="w-full min-w-0 grid-cols-[1rem_minmax(0,1fr)]"
|
||||
contentClassName="w-full min-w-0 overflow-hidden"
|
||||
value={item}
|
||||
>
|
||||
<div className="grid w-full min-w-0 grid-cols-[minmax(0,1fr)_2rem] items-center overflow-hidden">
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import { type ReactNode } from "react";
|
||||
|
||||
import {
|
||||
RIGHT_PANEL_SHEET_CLASS_NAME,
|
||||
RIGHT_PANEL_SHEET_LAYER_CLASS_NAME,
|
||||
} from "../rightPanelLayout";
|
||||
import { RIGHT_PANEL_SHEET_CLASS_NAME } from "../rightPanelLayout";
|
||||
import { Sheet, SheetPopup } from "./ui/sheet";
|
||||
|
||||
export function RightPanelSheet(props: {
|
||||
animationDurationMs: number;
|
||||
children: ReactNode;
|
||||
open: boolean;
|
||||
underFloatingPreview?: boolean;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
return (
|
||||
@@ -27,12 +23,6 @@ export function RightPanelSheet(props: {
|
||||
side="right"
|
||||
showCloseButton={false}
|
||||
keepMounted
|
||||
{...(props.underFloatingPreview
|
||||
? {
|
||||
backdropClassName: RIGHT_PANEL_SHEET_LAYER_CLASS_NAME,
|
||||
viewportClassName: RIGHT_PANEL_SHEET_LAYER_CLASS_NAME,
|
||||
}
|
||||
: {})}
|
||||
className={RIGHT_PANEL_SHEET_CLASS_NAME}
|
||||
>
|
||||
{props.children}
|
||||
|
||||
@@ -235,7 +235,7 @@ import {
|
||||
import { SidebarContent, SidebarGroup, useSidebar } from "./ui/sidebar";
|
||||
import { SidebarChromeFooter, SidebarChromeHeader } from "./sidebar/SidebarChrome";
|
||||
import { SidebarHeaderIconButton, SidebarThreadHeader } from "./sidebar/SidebarThreadHeader";
|
||||
import { Popover, PopoverPopup, PopoverTrigger } from "./ui/popover";
|
||||
import { Menu, MenuItem, MenuPopup, MenuSeparator, MenuShortcut, MenuTrigger } from "./ui/menu";
|
||||
import { Tooltip, TooltipPopup, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
|
||||
import { MiddleTruncate } from "./ui/middle-truncate";
|
||||
import {
|
||||
@@ -440,7 +440,7 @@ function SidebarThreadTooltip({
|
||||
* Controlled by the row (which also uses the open state to pin its hover
|
||||
* actions while the menu is up).
|
||||
*/
|
||||
function SnoozePopoverButton(props: {
|
||||
function SnoozeMenuButton(props: {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onSnooze: (preset: Pick<SnoozePreset, "snoozedUntil">) => void;
|
||||
@@ -454,11 +454,11 @@ function SnoozePopoverButton(props: {
|
||||
[open, timestampFormat],
|
||||
);
|
||||
return (
|
||||
<Popover open={open} onOpenChange={onOpenChange}>
|
||||
<Menu open={open} onOpenChange={onOpenChange}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<PopoverTrigger
|
||||
<MenuTrigger
|
||||
render={
|
||||
<button
|
||||
type="button"
|
||||
@@ -475,39 +475,31 @@ function SnoozePopoverButton(props: {
|
||||
</TooltipTrigger>
|
||||
<TooltipPopup>Snooze thread</TooltipPopup>
|
||||
</Tooltip>
|
||||
<PopoverPopup side="bottom" align="end" width="sm" viewportClassName="p-1">
|
||||
<MenuPopup side="bottom" align="end">
|
||||
{presets.map((preset) => (
|
||||
<button
|
||||
<MenuItem
|
||||
key={preset.id}
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onOpenChange(false);
|
||||
onSnooze(preset);
|
||||
}}
|
||||
className="flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs text-foreground/90 hover:bg-accent hover:text-foreground"
|
||||
>
|
||||
<span className="flex-1">{preset.label}</span>
|
||||
<span className="font-mono text-[10px] text-muted-foreground/60 tabular-nums">
|
||||
{preset.whenLabel}
|
||||
</span>
|
||||
</button>
|
||||
{preset.label}
|
||||
<MenuShortcut>{preset.whenLabel}</MenuShortcut>
|
||||
</MenuItem>
|
||||
))}
|
||||
<div className="my-1 border-t border-border/60" />
|
||||
<button
|
||||
type="button"
|
||||
className="flex w-full cursor-pointer rounded-md px-2 py-1.5 text-left text-xs text-foreground/90 hover:bg-accent hover:text-foreground"
|
||||
<MenuSeparator />
|
||||
<MenuItem
|
||||
onClick={async (event) => {
|
||||
event.stopPropagation();
|
||||
onOpenChange(false);
|
||||
const choice = await requestCustomSnooze();
|
||||
if (choice) onSnooze(choice);
|
||||
}}
|
||||
>
|
||||
Custom…
|
||||
</button>
|
||||
</PopoverPopup>
|
||||
</Popover>
|
||||
</MenuItem>
|
||||
</MenuPopup>
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1883,7 +1875,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
|
||||
</Tooltip>
|
||||
) : null}
|
||||
{showSnoozeButton ? (
|
||||
<SnoozePopoverButton
|
||||
<SnoozeMenuButton
|
||||
open={snoozeMenuOpen}
|
||||
onOpenChange={setSnoozeMenuOpen}
|
||||
onSnooze={handleSnoozePreset}
|
||||
@@ -4492,7 +4484,6 @@ export default function Sidebar() {
|
||||
hideIndicator
|
||||
value={item}
|
||||
className="font-medium"
|
||||
contentClassName="flex min-w-0 items-center gap-2"
|
||||
onContextMenu={(event) => {
|
||||
if (project) handleProjectSettings(event, project);
|
||||
}}
|
||||
|
||||
@@ -171,7 +171,7 @@ export function AssistantCitationChip({
|
||||
}}
|
||||
aria-label="Edit citation comment"
|
||||
width="md"
|
||||
viewportClassName="p-3"
|
||||
padding="compact"
|
||||
onPointerDown={(event) => event.stopPropagation()}
|
||||
>
|
||||
<AssistantCitationCommentEditor
|
||||
|
||||
@@ -88,7 +88,7 @@ export function ContextWindowMeter(props: {
|
||||
tooltipStyle
|
||||
side="top"
|
||||
align="end"
|
||||
viewportClassName="p-0"
|
||||
padding="none"
|
||||
width="sm"
|
||||
className="text-left whitespace-normal"
|
||||
>
|
||||
|
||||
@@ -179,8 +179,6 @@ export const ExpandedImageDialog = memo(function ExpandedImageDialog({
|
||||
variant="media"
|
||||
showCloseButton={false}
|
||||
bottomStickOnMobile={false}
|
||||
backdropClassName="z-[60]"
|
||||
viewportClassName="z-[60] grid-rows-1 place-items-center px-4 py-6 [-webkit-app-region:no-drag]"
|
||||
className="row-start-1 max-h-[92vh] w-[92vw] max-w-[92vw] items-center overflow-visible [--media-width:92vw] [--media-height:min(86vh,calc(100vh-160px))] sm:[--media-width:calc(92vw-96px)]"
|
||||
onKeyDown={onKeyDown}
|
||||
initialFocus={closeButtonRef}
|
||||
|
||||
@@ -2567,7 +2567,7 @@ function BackgroundWorktreeSetupChip({ snapshot }: { snapshot: WorktreeSetupSnap
|
||||
align="end"
|
||||
width="lg"
|
||||
className="surface-glass!"
|
||||
viewportClassName="py-3 [--viewport-inline-padding:--spacing(3)]"
|
||||
padding="compact"
|
||||
>
|
||||
<WorktreeSetupCard
|
||||
snapshot={snapshot}
|
||||
|
||||
@@ -52,7 +52,6 @@ export const ModelListRow = memo(function ModelListRow(props: {
|
||||
index={props.index}
|
||||
value={modelPickerModelKey(props.instanceId, props.model.slug)}
|
||||
disabled={Boolean(props.disabledReason)}
|
||||
contentClassName="flex w-full items-center gap-3"
|
||||
className={cn(
|
||||
"group relative w-full !min-w-0 max-w-full cursor-pointer rounded-md px-2 py-2 transition-[background-color,box-shadow,color]",
|
||||
"hover:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-highlighted:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))] data-selected:bg-foreground/[0.08] data-selected:text-foreground data-selected:ring-0 [&[data-highlighted][data-selected]]:bg-[color-mix(in_srgb,var(--popover)_90%,var(--contrast-foreground))]",
|
||||
|
||||
@@ -8,7 +8,7 @@ import { resolveSelectableModel } from "@t3tools/shared/model";
|
||||
import { useAtomValue } from "@effect/atom-react";
|
||||
import { LegendList, type LegendListRef } from "@legendapp/list/react";
|
||||
import { memo, useMemo, useState, useCallback, useEffect, useLayoutEffect, useRef } from "react";
|
||||
import { ChevronRightIcon, SearchIcon } from "lucide-react";
|
||||
import { ChevronRightIcon } from "lucide-react";
|
||||
import { ModelListRow } from "./ModelListRow";
|
||||
import { ModelPickerSidebar } from "./ModelPickerSidebar";
|
||||
import { getProviderStatusMessage, hasProviderSetup } from "./ProviderStatusBanner";
|
||||
@@ -22,7 +22,7 @@ import { buildModelPickerSearchText, scoreModelPickerSearch } from "./modelPicke
|
||||
import {
|
||||
Combobox,
|
||||
ComboboxEmpty,
|
||||
ComboboxInput,
|
||||
ComboboxSearchInput,
|
||||
ComboboxItem,
|
||||
ComboboxListVirtualized,
|
||||
} from "../ui/combobox";
|
||||
@@ -882,77 +882,62 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
|
||||
showSidebar && "border-l border-border/70",
|
||||
)}
|
||||
>
|
||||
{/* Search bar */}
|
||||
<div className="px-2 pt-2">
|
||||
<div className="border-b border-border/70 pb-2.5 transition-colors focus-within:border-ring">
|
||||
<ComboboxInput
|
||||
ref={searchInputRef}
|
||||
className="[&_input]:h-6.5 [&_input]:font-sans [&_input]:leading-6.5"
|
||||
inputClassName="rounded-none bg-transparent text-sm"
|
||||
placeholder="Search models..."
|
||||
showTrigger={false}
|
||||
startAddon={
|
||||
<SearchIcon className="-translate-x-0.5 size-4 shrink-0 text-muted-foreground opacity-70" />
|
||||
}
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (
|
||||
showSidebar &&
|
||||
!e.altKey &&
|
||||
!e.ctrlKey &&
|
||||
!e.metaKey &&
|
||||
((e.key === "ArrowLeft" && !e.shiftKey && searchQuery.length === 0) ||
|
||||
(e.key === "Tab" && e.shiftKey))
|
||||
) {
|
||||
const sidebar = e.currentTarget
|
||||
.closest("[data-model-picker-content]")
|
||||
?.querySelector("[data-model-picker-sidebar]");
|
||||
const button =
|
||||
sidebar?.querySelector<HTMLButtonElement>(
|
||||
'button[aria-pressed="true"]:not(:disabled)',
|
||||
) ?? sidebar?.querySelector<HTMLButtonElement>("button:not(:disabled)");
|
||||
if (button) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
button.focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (e.key === "Escape") {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
props.onRequestClose?.();
|
||||
return;
|
||||
}
|
||||
if (e.key === "Enter" && highlightedModelKeyRef.current) {
|
||||
(
|
||||
e as typeof e & { preventBaseUIHandler?: () => void }
|
||||
).preventBaseUIHandler?.();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const legacyInstanceId = parseModelPickerLegacySectionKey(
|
||||
highlightedModelKeyRef.current,
|
||||
);
|
||||
if (legacyInstanceId) {
|
||||
toggleLegacySection(legacyInstanceId);
|
||||
return;
|
||||
}
|
||||
const model = parseModelPickerModelKey(highlightedModelKeyRef.current);
|
||||
if (model) {
|
||||
handleModelSelect(model.slug, model.instanceId, e.shiftKey);
|
||||
}
|
||||
return;
|
||||
}
|
||||
<ComboboxSearchInput
|
||||
ref={searchInputRef}
|
||||
placeholder="Search models..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => setSearchQuery(e.target.value)}
|
||||
onKeyDown={(e) => {
|
||||
if (
|
||||
showSidebar &&
|
||||
!e.altKey &&
|
||||
!e.ctrlKey &&
|
||||
!e.metaKey &&
|
||||
((e.key === "ArrowLeft" && !e.shiftKey && searchQuery.length === 0) ||
|
||||
(e.key === "Tab" && e.shiftKey))
|
||||
) {
|
||||
const sidebar = e.currentTarget
|
||||
.closest("[data-model-picker-content]")
|
||||
?.querySelector("[data-model-picker-sidebar]");
|
||||
const button =
|
||||
sidebar?.querySelector<HTMLButtonElement>(
|
||||
'button[aria-pressed="true"]:not(:disabled)',
|
||||
) ?? sidebar?.querySelector<HTMLButtonElement>("button:not(:disabled)");
|
||||
if (button) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}}
|
||||
onMouseDown={(e) => e.stopPropagation()}
|
||||
onTouchStart={(e) => e.stopPropagation()}
|
||||
size="sm"
|
||||
unstyled
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
button.focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (e.key === "Escape") {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
props.onRequestClose?.();
|
||||
return;
|
||||
}
|
||||
if (e.key === "Enter" && highlightedModelKeyRef.current) {
|
||||
(e as typeof e & { preventBaseUIHandler?: () => void }).preventBaseUIHandler?.();
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const legacyInstanceId = parseModelPickerLegacySectionKey(
|
||||
highlightedModelKeyRef.current,
|
||||
);
|
||||
if (legacyInstanceId) {
|
||||
toggleLegacySection(legacyInstanceId);
|
||||
return;
|
||||
}
|
||||
const model = parseModelPickerModelKey(highlightedModelKeyRef.current);
|
||||
if (model) {
|
||||
handleModelSelect(model.slug, model.instanceId, e.shiftKey);
|
||||
}
|
||||
return;
|
||||
}
|
||||
e.stopPropagation();
|
||||
}}
|
||||
onMouseDown={(e) => e.stopPropagation()}
|
||||
onTouchStart={(e) => e.stopPropagation()}
|
||||
/>
|
||||
|
||||
{/* Model list */}
|
||||
<div className="relative min-h-0 flex-1 overflow-hidden pr-px">
|
||||
@@ -971,7 +956,6 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
|
||||
value={modelKey}
|
||||
aria-expanded={legacySection.isExpanded}
|
||||
className="group w-full cursor-pointer rounded-md px-2 py-2"
|
||||
contentClassName="flex w-full items-center gap-3"
|
||||
>
|
||||
<div className="min-w-0 flex-1 text-left">
|
||||
<div className="text-xs font-medium leading-snug">Legacy models</div>
|
||||
|
||||
@@ -284,8 +284,8 @@ export const ProviderModelPicker = memo(function ProviderModelPicker(props: {
|
||||
<PopoverPopup
|
||||
{...(props.isComposerOwned ? composerFloatingLayerProps : {})}
|
||||
align="start"
|
||||
className="before:hidden [--viewport-inline-padding:0]"
|
||||
viewportClassName="overflow-hidden! rounded-[calc(var(--radius-lg)-1px)] p-0 [clip-path:inset(0_round_calc(var(--radius-lg)-1px))]"
|
||||
className="before:hidden"
|
||||
padding="none"
|
||||
>
|
||||
<ModelPickerContent
|
||||
activeInstanceId={activeInstanceId}
|
||||
|
||||
@@ -163,13 +163,8 @@ export function SnapShotContentsButton({
|
||||
</TooltipTrigger>
|
||||
<TooltipPopup side={side}>{tooltip}</TooltipPopup>
|
||||
</Tooltip>
|
||||
<PopoverPopup
|
||||
side={side}
|
||||
align="center"
|
||||
width="md"
|
||||
viewportClassName="max-h-[min(28rem,70vh)]"
|
||||
>
|
||||
<div className="space-y-2">
|
||||
<PopoverPopup side={side} align="center" width="md">
|
||||
<div className="max-h-[min(28rem,70vh)] space-y-2 overflow-y-auto">
|
||||
<PopoverTitle>Accessibility data</PopoverTitle>
|
||||
{accessibilityDetails ? (
|
||||
<SnapShotAccessibilityData
|
||||
|
||||
@@ -23,8 +23,6 @@ export function TerminalContextInlineChip(props: TerminalContextInlineChipProps)
|
||||
icon={<TerminalIcon />}
|
||||
label={label}
|
||||
accessibleLabel={`Terminal excerpt, ${label}`}
|
||||
popupClassName="w-[min(40rem,calc(100vw-2rem))]"
|
||||
viewportClassName="overflow-hidden p-2"
|
||||
>
|
||||
<div className="overflow-hidden rounded-md border border-border/70 bg-background/80">
|
||||
<div className="flex items-center gap-2 border-b border-border/70 px-3 py-2">
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
type ReactNode,
|
||||
} from "react";
|
||||
|
||||
import { cn } from "~/lib/utils";
|
||||
import { PULL_REQUEST_STATE_PRESENTATION } from "~/components/pullRequest/pullRequestIcons";
|
||||
import type { PullRequestContextDisplayState } from "~/lib/composerContextRecords";
|
||||
import { PierreEntryIcon } from "./chat/PierreEntryIcon";
|
||||
@@ -70,8 +69,6 @@ export function ContextChipPopover(props: {
|
||||
copyMarkdown?: string;
|
||||
accessibleLabel: string;
|
||||
children: ReactNode;
|
||||
popupClassName?: string;
|
||||
viewportClassName?: string;
|
||||
}) {
|
||||
return (
|
||||
<Popover>
|
||||
@@ -88,12 +85,7 @@ export function ContextChipPopover(props: {
|
||||
{props.icon}
|
||||
<ContextChipLabel>{props.label}</ContextChipLabel>
|
||||
</PopoverTrigger>
|
||||
<PopoverPopup
|
||||
side="top"
|
||||
width="lg"
|
||||
className={props.popupClassName}
|
||||
viewportClassName={cn("overflow-x-auto p-2", props.viewportClassName)}
|
||||
>
|
||||
<PopoverPopup side="top" width="lg" padding="compact">
|
||||
<PopoverTitle className="sr-only">{props.accessibleLabel}</PopoverTitle>
|
||||
{props.children}
|
||||
</PopoverPopup>
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { DeviceScreenSize } from "@t3tools/client-runtime/device/stream";
|
||||
|
||||
export const PREVIEW_MINI_PLAYER_EDGE_GAP = 12;
|
||||
export const PREVIEW_MINI_PLAYER_CORNER_RADIUS = 12;
|
||||
// The mini-player shell straddles this webview at 47 and 49; dialogs begin at 50.
|
||||
// The mini-player shell straddles this webview at 47 and 49: above --z-sheet, under dialogs (50).
|
||||
export const PREVIEW_MINI_PLAYER_WEBVIEW_Z_INDEX = 48;
|
||||
// A fresh player is the largest box at the source aspect ratio that fits here.
|
||||
const PREVIEW_MINI_PLAYER_DEFAULT_BOX = { width: 320, height: 320 } as const;
|
||||
|
||||
@@ -147,7 +147,6 @@ export function PullRequestCandidatePicker<T>({
|
||||
index={index}
|
||||
value={keys[index]}
|
||||
disabled={disabled}
|
||||
contentClassName="flex min-w-0 items-center gap-2"
|
||||
>
|
||||
{children(candidate)}
|
||||
</ComboboxItem>
|
||||
|
||||
@@ -388,12 +388,7 @@ function PullRequestBaseFreshnessWarning({
|
||||
{children}
|
||||
<TriangleAlertIcon aria-hidden className={cn("size-3.5 shrink-0", iconClassName)} />
|
||||
</PopoverTrigger>
|
||||
<PopoverPopup
|
||||
align="start"
|
||||
side="bottom"
|
||||
className="max-w-80"
|
||||
viewportClassName="py-2.5 [--viewport-inline-padding:--spacing(3)]"
|
||||
>
|
||||
<PopoverPopup align="start" side="bottom" className="max-w-80" padding="compact">
|
||||
<p className="text-xs text-foreground">{summary}</p>
|
||||
<p className="mt-0.5 text-xs text-muted-foreground">Changes can be cleanly merged.</p>
|
||||
{/* Each way the host offers and this reader may take, as its own button: a split button
|
||||
|
||||
@@ -134,7 +134,7 @@ export function PullRequestReactionBar({
|
||||
>
|
||||
<SmilePlusIcon aria-hidden className="size-3.5" />
|
||||
</PopoverTrigger>
|
||||
<PopoverPopup align="start" side="top" viewportClassName="py-2">
|
||||
<PopoverPopup align="start" side="top" padding="compact">
|
||||
<div className="flex items-center gap-0.5">
|
||||
{PULL_REQUEST_REACTION_ORDER.map((content) => {
|
||||
const reacted =
|
||||
|
||||
@@ -223,11 +223,7 @@ export function SettingInheritance({
|
||||
</TooltipTrigger>
|
||||
<TooltipPopup side="top">{overrideSummary}</TooltipPopup>
|
||||
</Tooltip>
|
||||
<PopoverPopup
|
||||
align="start"
|
||||
width="md"
|
||||
viewportClassName="p-0 [--viewport-inline-padding:0px]"
|
||||
>
|
||||
<PopoverPopup align="start" width="md" padding="none">
|
||||
<div className="divide-y divide-border/60">
|
||||
{chains.map(({ target, environment, machine, layers }) => (
|
||||
<section
|
||||
|
||||
@@ -30,7 +30,7 @@ function AutocompleteInput({
|
||||
{startAddon && (
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="[&_svg]:-mx-0.5 pointer-events-none absolute inset-y-0 start-px z-10 flex items-center ps-[calc(--spacing(3)-1px)] opacity-80 has-[+[data-size=sm]]:ps-[calc(--spacing(2.5)-1px)] [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4"
|
||||
className="[&_svg]:-mx-0.5 pointer-events-none has-[button]:pointer-events-auto absolute inset-y-0 start-px z-10 flex items-center ps-[calc(--spacing(3)-1px)] opacity-80 has-[+[data-size=sm]]:ps-[calc(--spacing(2.5)-1px)] [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4"
|
||||
data-slot="autocomplete-start-addon"
|
||||
>
|
||||
{startAddon}
|
||||
|
||||
@@ -30,7 +30,6 @@ function Combobox<Value, Multiple extends boolean | undefined = false>(
|
||||
|
||||
function ComboboxInput({
|
||||
className,
|
||||
inputClassName,
|
||||
showTrigger = true,
|
||||
showClear = false,
|
||||
startAddon,
|
||||
@@ -38,7 +37,6 @@ function ComboboxInput({
|
||||
unstyled = false,
|
||||
...props
|
||||
}: Omit<ComboboxPrimitive.Input.Props, "size"> & {
|
||||
inputClassName?: string;
|
||||
showTrigger?: boolean;
|
||||
showClear?: boolean;
|
||||
startAddon?: React.ReactNode;
|
||||
@@ -71,7 +69,10 @@ function ComboboxInput({
|
||||
data-slot="combobox-input"
|
||||
render={
|
||||
<Input
|
||||
className={cn("has-disabled:opacity-100", inputClassName)}
|
||||
className={cn(
|
||||
"has-disabled:opacity-100",
|
||||
unstyled && "rounded-none bg-transparent text-sm",
|
||||
)}
|
||||
nativeInput
|
||||
size={sizeValue}
|
||||
unstyled={unstyled}
|
||||
@@ -116,7 +117,6 @@ function ComboboxSearchInput(props: React.ComponentProps<typeof ComboboxInput>)
|
||||
<ComboboxInput
|
||||
{...props}
|
||||
className="[&_input]:h-6.5 [&_input]:ps-5 [&_input]:font-sans [&_input]:leading-6.5"
|
||||
inputClassName="rounded-none bg-transparent text-sm"
|
||||
showTrigger={false}
|
||||
size="sm"
|
||||
unstyled
|
||||
@@ -185,12 +185,10 @@ function ComboboxPopup({
|
||||
|
||||
function ComboboxItem({
|
||||
className,
|
||||
contentClassName,
|
||||
children,
|
||||
hideIndicator: _hideIndicator = false,
|
||||
...props
|
||||
}: ComboboxPrimitive.Item.Props & {
|
||||
contentClassName?: string;
|
||||
hideIndicator?: boolean;
|
||||
}) {
|
||||
return (
|
||||
@@ -202,11 +200,9 @@ function ComboboxItem({
|
||||
data-slot="combobox-item"
|
||||
{...props}
|
||||
>
|
||||
{/* Children lay out as one row: a label that truncates, then any trailing meta. */}
|
||||
<div
|
||||
className={cn(
|
||||
"min-w-0 flex-1 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
||||
contentClassName,
|
||||
)}
|
||||
className="flex min-w-0 flex-1 items-center gap-2 [&_svg:not([class*='text-'])]:text-muted-foreground"
|
||||
data-slot="combobox-item-content"
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -93,19 +93,11 @@ function Command({
|
||||
|
||||
function CommandInput({
|
||||
className,
|
||||
wrapperClassName,
|
||||
placeholder,
|
||||
...props
|
||||
}: React.ComponentProps<typeof AutocompleteInput> & {
|
||||
wrapperClassName?: string | undefined;
|
||||
}) {
|
||||
}: React.ComponentProps<typeof AutocompleteInput>) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"px-[var(--command-shell-inset)] py-1.5 [&_[data-slot=autocomplete-start-addon]]:ps-[calc(var(--command-shell-inset)+0.0625rem)]",
|
||||
wrapperClassName,
|
||||
)}
|
||||
>
|
||||
<div className="px-[var(--command-shell-inset)] py-1.5 [&_[data-slot=autocomplete-start-addon]]:ps-[calc(var(--command-shell-inset)+0.0625rem)]">
|
||||
<AutocompleteInput
|
||||
autoFocus
|
||||
className={cn(
|
||||
|
||||
@@ -61,24 +61,22 @@ function DialogPopup({
|
||||
children,
|
||||
showCloseButton = true,
|
||||
bottomStickOnMobile = true,
|
||||
backdropClassName,
|
||||
viewportClassName,
|
||||
variant = "default",
|
||||
...props
|
||||
}: DialogPrimitive.Popup.Props & {
|
||||
showCloseButton?: boolean;
|
||||
bottomStickOnMobile?: boolean;
|
||||
backdropClassName?: string;
|
||||
viewportClassName?: string;
|
||||
variant?: "default" | "media";
|
||||
}) {
|
||||
return (
|
||||
<DialogPortal>
|
||||
<DialogBackdrop className={backdropClassName} variant={variant} />
|
||||
{/* Media opens from inside other overlays (a composer chip, a popover), so it sits above them. */}
|
||||
<DialogBackdrop className={variant === "media" ? "z-[60]" : undefined} variant={variant} />
|
||||
<DialogViewport
|
||||
className={cn(
|
||||
bottomStickOnMobile && "max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12",
|
||||
viewportClassName,
|
||||
variant === "media" &&
|
||||
"z-[60] grid-rows-1 place-items-center px-4 py-6 [-webkit-app-region:no-drag]",
|
||||
)}
|
||||
>
|
||||
<DialogPrimitive.Popup
|
||||
|
||||
@@ -25,10 +25,19 @@ const popoverPopupWidthClassName = {
|
||||
lg: "w-96",
|
||||
} as const;
|
||||
|
||||
// The inset around the content. "compact" suits dense content (a list, a code excerpt, a
|
||||
// row of reactions); "none" is for content that draws its own frame edge to edge.
|
||||
const popoverViewportPaddingClassName = {
|
||||
default: "py-4 [--viewport-inline-padding:--spacing(4)]",
|
||||
compact: "py-2 [--viewport-inline-padding:--spacing(3)]",
|
||||
// Rounded to the popup so edge-to-edge content clips to its corners.
|
||||
none: "rounded-[calc(var(--radius-lg)-1px)] py-0 [--viewport-inline-padding:0px]",
|
||||
} as const;
|
||||
|
||||
function PopoverPopup({
|
||||
children,
|
||||
className,
|
||||
viewportClassName,
|
||||
padding = "default",
|
||||
width = "auto",
|
||||
side = "bottom",
|
||||
align = "center",
|
||||
@@ -39,7 +48,7 @@ function PopoverPopup({
|
||||
anchor,
|
||||
...props
|
||||
}: PopoverPrimitive.Popup.Props & {
|
||||
viewportClassName?: string;
|
||||
padding?: keyof typeof popoverViewportPaddingClassName;
|
||||
side?: PopoverPrimitive.Positioner.Props["side"];
|
||||
align?: PopoverPrimitive.Positioner.Props["align"];
|
||||
sideOffset?: PopoverPrimitive.Positioner.Props["sideOffset"];
|
||||
@@ -78,11 +87,11 @@ function PopoverPopup({
|
||||
>
|
||||
<Viewport
|
||||
className={cn(
|
||||
"relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) py-4 [--viewport-inline-padding:--spacing(4)] has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity",
|
||||
tooltipStyle
|
||||
"relative size-full max-h-(--available-height) overflow-clip px-(--viewport-inline-padding) has-data-[slot=calendar]:p-2 data-instant:transition-none **:data-current:data-ending-style:opacity-0 **:data-current:data-starting-style:opacity-0 **:data-previous:data-ending-style:opacity-0 **:data-previous:data-starting-style:opacity-0 **:data-current:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-previous:w-[calc(var(--popup-width)-2*var(--viewport-inline-padding)-2px)] **:data-current:opacity-100 **:data-previous:opacity-100 **:data-current:transition-opacity **:data-previous:transition-opacity",
|
||||
tooltipStyle && padding === "default"
|
||||
? "py-1 [--viewport-inline-padding:--spacing(2)]"
|
||||
: "not-data-transitioning:overflow-y-auto",
|
||||
viewportClassName,
|
||||
: popoverViewportPaddingClassName[padding],
|
||||
!tooltipStyle && "not-data-transitioning:overflow-y-auto",
|
||||
)}
|
||||
data-slot="popover-viewport"
|
||||
>
|
||||
|
||||
@@ -102,7 +102,6 @@ function SelectValue({ className, ...props }: SelectPrimitive.Value.Props) {
|
||||
|
||||
function SelectPopup({
|
||||
className,
|
||||
popupClassName,
|
||||
children,
|
||||
side = "bottom",
|
||||
sideOffset = 4,
|
||||
@@ -113,7 +112,6 @@ function SelectPopup({
|
||||
anchor,
|
||||
...props
|
||||
}: SelectPrimitive.Popup.Props & {
|
||||
popupClassName?: string;
|
||||
side?: SelectPrimitive.Positioner.Props["side"];
|
||||
sideOffset?: SelectPrimitive.Positioner.Props["sideOffset"];
|
||||
align?: SelectPrimitive.Positioner.Props["align"];
|
||||
@@ -149,7 +147,6 @@ function SelectPopup({
|
||||
className={cn(
|
||||
"dropdown-glass relative h-full rounded-lg shadow-[0_16px_40px_-18px_rgb(0_0_0/55%)] dark:shadow-[0_18px_44px_-18px_rgb(0_0_0/80%)]",
|
||||
matchTriggerWidth && "min-w-(--anchor-width)",
|
||||
popupClassName,
|
||||
)}
|
||||
>
|
||||
<SelectPrimitive.List
|
||||
|
||||
@@ -10,11 +10,13 @@ const Sheet = SheetPrimitive.Root;
|
||||
|
||||
const SheetPortal = SheetPrimitive.Portal;
|
||||
|
||||
// Sheets are docked panels, not dialogs: their layer (--z-sheet) sits under dialogs that open
|
||||
// from inside them and under anything the app floats above panels.
|
||||
function SheetBackdrop({ className, ...props }: SheetPrimitive.Backdrop.Props) {
|
||||
return (
|
||||
<SheetPrimitive.Backdrop
|
||||
className={cn(
|
||||
"fixed inset-0 z-50 bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
|
||||
"fixed inset-0 z-(--z-sheet) bg-background/60 backdrop-blur-xs transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
|
||||
className,
|
||||
)}
|
||||
data-slot="sheet-backdrop"
|
||||
@@ -35,7 +37,7 @@ function SheetViewport({
|
||||
return (
|
||||
<SheetPrimitive.Viewport
|
||||
className={cn(
|
||||
"fixed inset-0 z-50 grid",
|
||||
"fixed inset-0 z-(--z-sheet) grid",
|
||||
side === "bottom" && "grid grid-rows-[1fr_auto] pt-12",
|
||||
side === "top" && "grid grid-rows-[auto_1fr] pb-12",
|
||||
side === "left" && "flex justify-start",
|
||||
@@ -55,8 +57,6 @@ function SheetPopup({
|
||||
showCloseButton = true,
|
||||
keepMounted = false,
|
||||
transitionDurationMs,
|
||||
backdropClassName,
|
||||
viewportClassName,
|
||||
side = "right",
|
||||
variant = "default",
|
||||
style,
|
||||
@@ -65,8 +65,6 @@ function SheetPopup({
|
||||
showCloseButton?: boolean;
|
||||
keepMounted?: boolean;
|
||||
transitionDurationMs?: number;
|
||||
backdropClassName?: string;
|
||||
viewportClassName?: string;
|
||||
side?: "right" | "left" | "top" | "bottom";
|
||||
variant?: "default" | "inset";
|
||||
}) {
|
||||
@@ -79,14 +77,14 @@ function SheetPopup({
|
||||
return (
|
||||
<SheetPortal keepMounted={keepMounted}>
|
||||
<SheetBackdrop
|
||||
className={cn(
|
||||
instant &&
|
||||
"transition-none! data-ending-style:opacity-100! data-starting-style:opacity-100!",
|
||||
backdropClassName,
|
||||
)}
|
||||
className={
|
||||
instant
|
||||
? "transition-none! data-ending-style:opacity-100! data-starting-style:opacity-100!"
|
||||
: undefined
|
||||
}
|
||||
style={transitionStyle}
|
||||
/>
|
||||
<SheetViewport className={viewportClassName} side={side} variant={variant}>
|
||||
<SheetViewport side={side} variant={variant}>
|
||||
<SheetPrimitive.Popup
|
||||
className={cn(
|
||||
"relative flex max-h-full min-h-0 w-full min-w-0 flex-col bg-popover not-dark:bg-clip-padding text-popover-foreground shadow-lg/5 transition-[opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:shadow-[0_1px_--theme(--color-black/4%)] data-ending-style:opacity-0 data-starting-style:opacity-0 max-sm:before:hidden dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
|
||||
|
||||
@@ -101,6 +101,9 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
--command-shell-inset: 0.5rem;
|
||||
--command-content-inset: 1rem;
|
||||
--floating-content-inset: 0.75rem;
|
||||
/* App layer order: docked sheets, then the floating preview player (47–49, see
|
||||
previewMiniPlayerLayout.ts), then dialogs and popovers (50 and up). */
|
||||
--z-sheet: 46;
|
||||
--glass-blur: 12px;
|
||||
--glass-opacity: 80%;
|
||||
--glass-saturation: 1.14;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
export const RIGHT_PANEL_INLINE_LAYOUT_MEDIA_QUERY = "(max-width: 980px)";
|
||||
// Applied only while a floating preview overlaps the compact sheet.
|
||||
export const RIGHT_PANEL_SHEET_LAYER_CLASS_NAME = "z-[35]";
|
||||
export const RIGHT_PANEL_SHEET_CLASS_NAME =
|
||||
"w-[min(42vw,28rem)] min-w-80 max-w-[28rem] p-0 max-[760px]:w-[min(88vw,24rem)] max-[760px]:min-w-0 wco:mt-[env(titlebar-area-height)] wco:h-[calc(100%-env(titlebar-area-height))] wco:max-h-[calc(100%-env(titlebar-area-height))]";
|
||||
@@ -8,7 +8,7 @@ import * as NodeURL from "node:url";
|
||||
// components/ui exports are migrated to variants (see vite.config.ts). This gate keeps the
|
||||
// count from growing: CI fails when findings exceed the ceiling. Lower the ceiling when you
|
||||
// migrate a file, and delete this script when the rule becomes an error.
|
||||
export const RESTYLE_CEILING = 603;
|
||||
export const RESTYLE_CEILING = 582;
|
||||
|
||||
const RULE = "shadcn(no-restyle)";
|
||||
|
||||
|
||||
Reference in new issue
Block a user