refactor(web): one minimum width for menus, three widths for popovers (#13035)
Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
4c9fbf1f64
commit
d7736e06b6
43 files changed
+69
-98
No files matched your search
@@ -197,7 +197,7 @@ export function BrowserDeviceToolbar({
|
||||
>
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectPopup align="start" alignItemWithTrigger={false} className="min-w-64">
|
||||
<SelectPopup align="start" alignItemWithTrigger={false}>
|
||||
<SelectItem value={RESPONSIVE_VALUE}>Responsive</SelectItem>
|
||||
<SelectGroup>
|
||||
<SelectGroupLabel>Standard</SelectGroupLabel>
|
||||
|
||||
@@ -217,7 +217,7 @@ const MobileRunContextSelector = memo(function MobileRunContextSelector({
|
||||
{triggerContent}
|
||||
<ChevronDownIcon className="size-3 shrink-0 opacity-50" />
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="start" side="top" className="w-64" {...composerFloatingLayerProps}>
|
||||
<MenuPopup align="start" side="top" {...composerFloatingLayerProps}>
|
||||
{showEnvironmentPicker && availableEnvironments && onEnvironmentChange ? (
|
||||
<>
|
||||
<MenuGroup>
|
||||
|
||||
@@ -678,7 +678,7 @@ export default function DiffPanel({
|
||||
<span className="truncate">{selectedScopeLabel}</span>
|
||||
<ChevronDownIcon className="size-3.5 shrink-0 opacity-70" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start" className="w-60">
|
||||
<DropdownMenuContent align="start">
|
||||
<DropdownMenuRadioGroup value={selectedScopeValue} onValueChange={selectScopeValue}>
|
||||
<DropdownMenuRadioItem value="unstaged" closeOnClick>
|
||||
<span>Working tree</span>
|
||||
@@ -692,7 +692,7 @@ export default function DiffPanel({
|
||||
</DropdownMenuRadioGroup>
|
||||
<DropdownMenuSub>
|
||||
<DropdownMenuSubTrigger>Turn</DropdownMenuSubTrigger>
|
||||
<DropdownMenuSubContent className="w-64">
|
||||
<DropdownMenuSubContent>
|
||||
<DropdownMenuRadioGroup value={selectedTurnValue} onValueChange={selectScopeValue}>
|
||||
{orderedTurnDiffSummaries.map((summary) => {
|
||||
const turnCount =
|
||||
|
||||
@@ -1793,7 +1793,7 @@ export default function GitActionsControl({
|
||||
<SourceControlIcon className="size-4" />
|
||||
<MenuItemLabel>Git actions</MenuItemLabel>
|
||||
</MenuSubTrigger>
|
||||
<MenuSubPopup className="min-w-32 max-w-[calc(100vw-2rem)]">{gitItems}</MenuSubPopup>
|
||||
<MenuSubPopup>{gitItems}</MenuSubPopup>
|
||||
</MenuSub>
|
||||
</>
|
||||
)
|
||||
@@ -1859,9 +1859,7 @@ export default function GitActionsControl({
|
||||
>
|
||||
<ChevronDownIcon aria-hidden="true" className="size-4" />
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="end" className="w-full">
|
||||
{gitItems}
|
||||
</MenuPopup>
|
||||
<MenuPopup align="end">{gitItems}</MenuPopup>
|
||||
</Menu>
|
||||
</Group>
|
||||
)}
|
||||
|
||||
@@ -2747,7 +2747,7 @@ function ProjectSortMenu({
|
||||
</TooltipTrigger>
|
||||
<TooltipPopup side="right">Sidebar options</TooltipPopup>
|
||||
</Tooltip>
|
||||
<MenuPopup align="end" side="bottom" className="min-w-52">
|
||||
<MenuPopup align="end" side="bottom">
|
||||
<MenuGroup>
|
||||
<div className="px-2 py-1 sm:text-xs font-medium text-muted-foreground">
|
||||
Sort projects
|
||||
|
||||
@@ -258,9 +258,7 @@ export default function ProjectScriptsControl({
|
||||
<ScriptIcon icon="play" className="size-4" />
|
||||
<MenuItemLabel>Project actions</MenuItemLabel>
|
||||
</MenuSubTrigger>
|
||||
<MenuSubPopup className="min-w-32 max-w-[calc(100vw-2rem)]">
|
||||
{scriptItems}
|
||||
</MenuSubPopup>
|
||||
<MenuSubPopup>{scriptItems}</MenuSubPopup>
|
||||
</MenuSub>
|
||||
) : (
|
||||
<MenuItem
|
||||
|
||||
@@ -567,12 +567,7 @@ function RightPanelEmptyState(props: {
|
||||
>
|
||||
<ChevronDown className="size-3.5" />
|
||||
</MenuTrigger>
|
||||
<MenuPopup
|
||||
align="end"
|
||||
side="bottom"
|
||||
sideOffset={6}
|
||||
className="min-w-40 max-w-56"
|
||||
>
|
||||
<MenuPopup align="end" side="bottom" sideOffset={6} className="max-w-56">
|
||||
{props.browserProfiles.map((profile) => (
|
||||
<MenuItem
|
||||
key={profile.id}
|
||||
@@ -1273,7 +1268,6 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
|
||||
align="start"
|
||||
side="bottom"
|
||||
sideOffset={6}
|
||||
className="min-w-44"
|
||||
onKeyDownCapture={handleAddSurfaceMenuKeyDown}
|
||||
>
|
||||
{addSurfaceActions.map((action) => {
|
||||
@@ -1314,7 +1308,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
|
||||
and run to 48 characters, which would otherwise widen
|
||||
the popup to fit-content and wrap.
|
||||
*/}
|
||||
<MenuSubPopup className="min-w-40 max-w-56">
|
||||
<MenuSubPopup className="max-w-56">
|
||||
{browserProfiles.map((profile) => (
|
||||
<MenuItem
|
||||
key={profile.id}
|
||||
|
||||
@@ -475,7 +475,7 @@ function SnoozePopoverButton(props: {
|
||||
</TooltipTrigger>
|
||||
<TooltipPopup>Snooze thread</TooltipPopup>
|
||||
</Tooltip>
|
||||
<PopoverPopup side="bottom" align="end" className="w-56" viewportClassName="p-1">
|
||||
<PopoverPopup side="bottom" align="end" width="sm" viewportClassName="p-1">
|
||||
{presets.map((preset) => (
|
||||
<button
|
||||
key={preset.id}
|
||||
|
||||
@@ -186,7 +186,7 @@ export function AssistantCitationChip({
|
||||
return false;
|
||||
}}
|
||||
aria-label="Edit citation comment"
|
||||
className="w-72 max-w-[calc(100vw-1rem)]"
|
||||
width="md"
|
||||
viewportClassName="p-3"
|
||||
onPointerDown={(event) => event.stopPropagation()}
|
||||
>
|
||||
|
||||
@@ -516,7 +516,6 @@ export const ChatHeader = memo(function ChatHeader({
|
||||
keepMounted
|
||||
aria-label="Header actions"
|
||||
align="end"
|
||||
className="min-w-56 max-w-[calc(100vw-2rem)]"
|
||||
finalFocus={actionsCollapsed ? undefined : false}
|
||||
>
|
||||
<div ref={mountMenuActions} className="contents" />
|
||||
|
||||
@@ -73,12 +73,7 @@ export const ComposerPendingApprovalActions = memo(function ComposerPendingAppro
|
||||
>
|
||||
<EllipsisIcon />
|
||||
</MenuTrigger>
|
||||
<MenuPopup
|
||||
{...composerFloatingLayerProps}
|
||||
side="top"
|
||||
align="end"
|
||||
className="w-56 max-w-[calc(100vw-2rem)]"
|
||||
>
|
||||
<MenuPopup {...composerFloatingLayerProps} side="top" align="end">
|
||||
{moreOptions.map((option) => {
|
||||
const item = (
|
||||
<MenuItem
|
||||
|
||||
@@ -89,7 +89,8 @@ export function ContextWindowMeter(props: {
|
||||
side="top"
|
||||
align="end"
|
||||
viewportClassName="p-0"
|
||||
className="w-64 max-w-none text-left whitespace-normal"
|
||||
width="sm"
|
||||
className="text-left whitespace-normal"
|
||||
>
|
||||
<div className="flex flex-col gap-2 p-[var(--floating-content-inset)]">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
|
||||
@@ -149,7 +149,7 @@ export function DraftHeroHeadline({
|
||||
<TooltipPopup side="top">{activeProjectDisplayName}</TooltipPopup>
|
||||
) : null}
|
||||
</Tooltip>
|
||||
<MenuPopup align="center" className="max-h-80 min-w-40! w-max max-w-64 overflow-y-auto">
|
||||
<MenuPopup align="center" className="max-h-80 overflow-y-auto">
|
||||
<MenuRadioGroup
|
||||
value={activeProjectKey}
|
||||
onValueChange={(value) => {
|
||||
|
||||
@@ -2571,7 +2571,8 @@ function BackgroundWorktreeSetupChip({ snapshot }: { snapshot: WorktreeSetupSnap
|
||||
<PopoverPopup
|
||||
side="bottom"
|
||||
align="end"
|
||||
className="surface-glass! w-[28rem] max-w-[calc(100vw-2rem)]"
|
||||
width="lg"
|
||||
className="surface-glass!"
|
||||
viewportClassName="py-3 [--viewport-inline-padding:--spacing(3)]"
|
||||
>
|
||||
<WorktreeSetupCard
|
||||
|
||||
@@ -343,7 +343,7 @@ export const OpenInPicker = memo(function OpenInPicker({
|
||||
<SquareArrowOutUpRightIcon className="size-4" />
|
||||
<MenuItemLabel>Open in…</MenuItemLabel>
|
||||
</MenuSubTrigger>
|
||||
<MenuSubPopup className="min-w-32 max-w-[calc(100vw-2rem)]">{editorItems}</MenuSubPopup>
|
||||
<MenuSubPopup>{editorItems}</MenuSubPopup>
|
||||
</MenuSub>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -166,7 +166,7 @@ export function SnapShotContentsButton({
|
||||
<PopoverPopup
|
||||
side={side}
|
||||
align="center"
|
||||
className="w-[min(24rem,calc(100vw-2rem))]"
|
||||
width="md"
|
||||
viewportClassName="max-h-[min(28rem,70vh)]"
|
||||
>
|
||||
<div className="space-y-2">
|
||||
|
||||
@@ -100,7 +100,7 @@ export function useAutoBalanceUpdateBanner(
|
||||
>
|
||||
{title}
|
||||
</PopoverTrigger>
|
||||
<PopoverPopup side="top" align="start" className="w-80 max-w-[calc(100vw-2rem)]">
|
||||
<PopoverPopup side="top" align="start" width="md">
|
||||
<div className="space-y-3 text-xs">
|
||||
{machines.map((machine) => (
|
||||
<div key={machine.environmentId} className="space-y-1">
|
||||
|
||||
@@ -102,7 +102,8 @@ export function ContextChipPopover(props: {
|
||||
</PopoverTrigger>
|
||||
<PopoverPopup
|
||||
side="top"
|
||||
className={cn("w-[min(36rem,calc(100vw-2rem))]", props.popupClassName)}
|
||||
width="lg"
|
||||
className={props.popupClassName}
|
||||
viewportClassName={cn("overflow-x-auto p-2", props.viewportClassName)}
|
||||
>
|
||||
<PopoverTitle className="sr-only">{props.accessibleLabel}</PopoverTitle>
|
||||
|
||||
@@ -44,7 +44,7 @@ export function DeviceToolVersions({
|
||||
? "Versions unavailable"
|
||||
: "Versions"}
|
||||
</PopoverTrigger>
|
||||
<PopoverPopup align="end" className="w-80">
|
||||
<PopoverPopup align="end" width="md">
|
||||
<PopoverTitle>{kind ? label : "Device tools"}</PopoverTitle>
|
||||
{tools ? (
|
||||
<div className="mt-4 divide-y divide-border/50">
|
||||
|
||||
@@ -104,7 +104,6 @@ function BreadcrumbMenuContent(props: {
|
||||
<MenuPopup
|
||||
align="start"
|
||||
side="bottom"
|
||||
className="w-max min-w-32 max-w-[min(19rem,var(--available-width))]"
|
||||
onKeyDown={(event) => {
|
||||
if (event.key !== "ArrowLeft" || !canGoBack || parentPath === null) return;
|
||||
event.preventDefault();
|
||||
|
||||
@@ -108,7 +108,7 @@ export function PreviewMoreMenu({
|
||||
</TooltipTrigger>
|
||||
<TooltipPopup>More</TooltipPopup>
|
||||
</Tooltip>
|
||||
<MenuPopup align="end" sideOffset={6} className="min-w-56">
|
||||
<MenuPopup align="end" sideOffset={6}>
|
||||
<MenuItem onClick={callTab(bridge.hardReload)} disabled={tabDisabled}>
|
||||
Hard reload
|
||||
</MenuItem>
|
||||
@@ -125,7 +125,7 @@ export function PreviewMoreMenu({
|
||||
</MenuItem>
|
||||
<MenuSub>
|
||||
<MenuSubTrigger disabled={tabDisabled}>Appearance</MenuSubTrigger>
|
||||
<MenuSubPopup className="min-w-32">
|
||||
<MenuSubPopup>
|
||||
<MenuRadioGroup
|
||||
value={colorScheme}
|
||||
onValueChange={(value) => {
|
||||
|
||||
@@ -147,7 +147,7 @@ export function PullRequestChecksPopover({
|
||||
>
|
||||
<presentation.Icon aria-hidden className={cn("size-3.5", presentation.toneClassName)} />
|
||||
</PopoverTrigger>
|
||||
<PopoverPopup align="start" className="w-80 max-w-full" side="bottom">
|
||||
<PopoverPopup align="start" width="md" side="bottom">
|
||||
<p className="mb-2 font-medium text-sm">{presentation.label}</p>
|
||||
{summary === null ? null : <p className="mb-2 text-muted-foreground text-xs">{summary}</p>}
|
||||
{stale ? (
|
||||
|
||||
@@ -1077,7 +1077,7 @@ function PullRequestCodeTab({
|
||||
<span className="truncate">{scopeLabel}</span>
|
||||
<ChevronDownIcon className="size-3.5 shrink-0 opacity-70" />
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start" className="w-80">
|
||||
<DropdownMenuContent align="start">
|
||||
<DropdownMenuRadioGroup
|
||||
value={commit ?? "all"}
|
||||
onValueChange={(value) => onSelectedCommitChange(value === "all" ? null : value)}
|
||||
|
||||
@@ -110,7 +110,7 @@ export function PullRequestComposer({
|
||||
side="top"
|
||||
align="end"
|
||||
sideOffset={8}
|
||||
className="w-96 max-w-[calc(100vw-2rem)]"
|
||||
width="lg"
|
||||
initialFocus={mode === "review" ? reviewRef : commentRef}
|
||||
aria-label="Pull request composer"
|
||||
>
|
||||
|
||||
@@ -1569,7 +1569,7 @@ export function PullRequestDetailPanel({
|
||||
/>
|
||||
<TooltipPopup>Check out this pull request</TooltipPopup>
|
||||
</Tooltip>
|
||||
<MenuPopup align="end" side="bottom" className="min-w-72">
|
||||
<MenuPopup align="end" side="bottom">
|
||||
<MenuItem onClick={() => startCheckout("worktree")}>
|
||||
<GitBranchIcon className="mt-1 size-3.5 shrink-0 self-start" />
|
||||
<span className="flex min-w-0 flex-col">
|
||||
@@ -2020,7 +2020,7 @@ export function PullRequestDetailPanel({
|
||||
{refreshing ? "Refreshing pull request" : "More pull request actions"}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
<MenuPopup align="end" side="bottom" className="min-w-72">
|
||||
<MenuPopup align="end" side="bottom">
|
||||
<PullRequestThreadLinks
|
||||
display="menu-item"
|
||||
environmentId={environmentId}
|
||||
|
||||
@@ -232,7 +232,7 @@ function PullRequestFilterRadioSubmenu<Value extends string>({
|
||||
{current.label}
|
||||
</span>
|
||||
</MenuSubTrigger>
|
||||
<MenuSubPopup className="min-w-56">
|
||||
<MenuSubPopup>
|
||||
<PullRequestFilterRadioGroup
|
||||
label={label}
|
||||
value={value}
|
||||
@@ -277,7 +277,7 @@ function PullRequestAuthorFilter({
|
||||
{value ?? "Anyone"}
|
||||
</span>
|
||||
</MenuSubTrigger>
|
||||
<MenuSubPopup className="w-80">
|
||||
<MenuSubPopup>
|
||||
<div className="p-1 pb-2">
|
||||
<InputGroup>
|
||||
<InputGroupAddon>
|
||||
@@ -346,7 +346,7 @@ function PullRequestLabelFilter({
|
||||
{value.length === 0 ? "Any" : `${value.length} selected`}
|
||||
</span>
|
||||
</MenuSubTrigger>
|
||||
<MenuSubPopup className="w-72">
|
||||
<MenuSubPopup>
|
||||
{visible.length === 0 ? (
|
||||
<MenuItem disabled>No labels in this view</MenuItem>
|
||||
) : (
|
||||
@@ -509,7 +509,7 @@ export function PullRequestFiltersMenu({
|
||||
</span>
|
||||
) : null}
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="end" side="bottom" className="w-56">
|
||||
<MenuPopup align="end" side="bottom">
|
||||
<PullRequestFilterRadioSubmenu
|
||||
label="State"
|
||||
value={state}
|
||||
|
||||
@@ -134,7 +134,7 @@ export function PullRequestReactionBar({
|
||||
>
|
||||
<SmilePlusIcon aria-hidden className="size-3.5" />
|
||||
</PopoverTrigger>
|
||||
<PopoverPopup align="start" className="w-auto" side="top" viewportClassName="py-2">
|
||||
<PopoverPopup align="start" side="top" viewportClassName="py-2">
|
||||
<div className="flex items-center gap-0.5">
|
||||
{PULL_REQUEST_REACTION_ORDER.map((content) => {
|
||||
const reacted =
|
||||
|
||||
@@ -145,7 +145,7 @@ export function PullRequestStackMenu({
|
||||
{notice ? ` · ${notice}` : null}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
<MenuPopup align="start" className="w-96 max-w-[calc(100vw-2rem)]">
|
||||
<MenuPopup align="start">
|
||||
<MenuGroup>
|
||||
<PullRequestStackHeader number={stack.number} notice={notice} stale={!!onRetry} />
|
||||
{onRetry ? <MenuItem onClick={onRetry}>Retry stack refresh</MenuItem> : null}
|
||||
|
||||
@@ -85,7 +85,6 @@ export function PullRequestStackPopover({
|
||||
</Tooltip>
|
||||
<MenuPopup
|
||||
align="start"
|
||||
className="w-96 max-w-[calc(100vw-2rem)]"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
onKeyDown={(event) => event.stopPropagation()}
|
||||
>
|
||||
|
||||
@@ -1631,7 +1631,7 @@ function SavedBackendListRow({
|
||||
>
|
||||
<EllipsisIcon className="size-3.5" />
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="end" className="min-w-52">
|
||||
<MenuPopup align="end">
|
||||
<EnvironmentIconMenu
|
||||
environmentId={environmentId}
|
||||
serverConfig={environment.serverConfig}
|
||||
@@ -3295,7 +3295,7 @@ export function ConnectionsSettings() {
|
||||
>
|
||||
<EllipsisIcon className="size-3.5" />
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="end" className="min-w-52">
|
||||
<MenuPopup align="end">
|
||||
<EnvironmentIconMenu
|
||||
environmentId={primaryEnvironmentId}
|
||||
serverConfig={primaryServerConfig}
|
||||
|
||||
@@ -99,7 +99,7 @@ export function EnvironmentIconMenu({
|
||||
<EnvironmentMachineIcon kind={resolved} />
|
||||
Icon
|
||||
</MenuSubTrigger>
|
||||
<MenuSubPopup className="min-w-44">
|
||||
<MenuSubPopup>
|
||||
{lock !== null ? (
|
||||
<>
|
||||
<MenuItem disabled className="whitespace-normal text-xs">
|
||||
|
||||
@@ -304,7 +304,7 @@ function BrowserViewportSetting({ disabled }: { readonly disabled: boolean }) {
|
||||
>
|
||||
<SelectValue>{viewportSelectLabel(viewport)}</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectPopup align="end" alignItemWithTrigger={false} className="min-w-64">
|
||||
<SelectPopup align="end" alignItemWithTrigger={false}>
|
||||
<SelectItem value={FILL_VALUE}>Fill panel</SelectItem>
|
||||
<SelectItem value={RESPONSIVE_VALUE}>Responsive</SelectItem>
|
||||
<SelectGroup>
|
||||
@@ -1183,7 +1183,7 @@ function BrowserProfilesSetting({ disabled }: { readonly disabled: boolean }) {
|
||||
<PlusIcon />
|
||||
Add profile
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="end" className="min-w-56">
|
||||
<MenuPopup align="end">
|
||||
<MenuItem
|
||||
disabled={!settingsHydrated || atProfileLimit}
|
||||
onClick={() => createProfile("New profile")}
|
||||
@@ -1301,7 +1301,7 @@ function BrowserProfilesSetting({ disabled }: { readonly disabled: boolean }) {
|
||||
>
|
||||
<MoreVertical />
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="end" className="min-w-44">
|
||||
<MenuPopup align="end">
|
||||
<MenuItem
|
||||
disabled={!settingsHydrated || isDefault}
|
||||
onClick={() => {
|
||||
|
||||
@@ -324,12 +324,7 @@ function WhenVariableSelect({
|
||||
<UnknownWhenVariableWarning identifiers={unknownIdentifiers} focusable={false} />
|
||||
) : null}
|
||||
</SelectTrigger>
|
||||
<SelectContent
|
||||
alignItemWithTrigger={false}
|
||||
matchTriggerWidth={false}
|
||||
popupClassName="w-fit"
|
||||
className="max-h-72 w-fit min-w-44"
|
||||
>
|
||||
<SelectContent alignItemWithTrigger={false} matchTriggerWidth={false} className="max-h-72">
|
||||
{options.map((option) => (
|
||||
<SelectItem key={option} value={option} className="min-h-7 w-full py-1 text-[12px]">
|
||||
<span className="truncate">{option}</span>
|
||||
@@ -534,12 +529,7 @@ function WhenExpressionNodeEditor({
|
||||
<SelectTrigger size="compact" className="w-24">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent
|
||||
alignItemWithTrigger={false}
|
||||
matchTriggerWidth={false}
|
||||
popupClassName="w-fit"
|
||||
className="w-fit min-w-24"
|
||||
>
|
||||
<SelectContent alignItemWithTrigger={false} matchTriggerWidth={false}>
|
||||
<SelectItem value="and" className="min-h-7 py-1 text-[12px]">
|
||||
and
|
||||
</SelectItem>
|
||||
@@ -956,7 +946,7 @@ function KeybindingRowMenu({
|
||||
>
|
||||
<EllipsisIcon className="size-3.5" />
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="end" className="min-w-36">
|
||||
<MenuPopup align="end">
|
||||
{canReset ? (
|
||||
<MenuItem disabled={isSaving} onClick={() => onReset(row)}>
|
||||
Reset to default
|
||||
@@ -1153,11 +1143,7 @@ function NewKeybindingCommandSelect({
|
||||
<SelectTrigger size="sm" className={className}>
|
||||
<SelectValue placeholder="Command" />
|
||||
</SelectTrigger>
|
||||
<SelectContent
|
||||
alignItemWithTrigger={false}
|
||||
matchTriggerWidth={false}
|
||||
className="max-h-72 w-fit min-w-56"
|
||||
>
|
||||
<SelectContent alignItemWithTrigger={false} matchTriggerWidth={false} className="max-h-72">
|
||||
{commandOptions.map((command) => (
|
||||
<SelectItem key={command} value={command} className="min-h-7 w-full py-1 text-[12px]">
|
||||
<span className="truncate">{commandLabel(command)}</span>
|
||||
|
||||
@@ -156,7 +156,7 @@ export function ProjectActionsSettings() {
|
||||
Import scripts
|
||||
<ChevronDownIcon className="size-3.5" />
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="end" className="w-72">
|
||||
<MenuPopup align="end">
|
||||
<MenuGroup>
|
||||
<MenuGroupLabel>Import from t3.json</MenuGroupLabel>
|
||||
<p className="px-2 pb-2 text-pretty text-sm text-muted-foreground">
|
||||
|
||||
@@ -708,11 +708,7 @@ export function ProviderInstanceCard({
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<PopoverPopup
|
||||
side="bottom"
|
||||
align="end"
|
||||
className="w-[min(21rem,calc(100vw-1.5rem))] [--popup-width:min(21rem,calc(100vw-1.5rem))]"
|
||||
>
|
||||
<PopoverPopup side="bottom" align="end" width="md">
|
||||
<div className="grid min-w-0 gap-3">
|
||||
<div className="grid gap-0.5">
|
||||
<p className="text-[13px] font-semibold leading-tight text-foreground">
|
||||
|
||||
@@ -225,7 +225,7 @@ export function SettingInheritance({
|
||||
</Tooltip>
|
||||
<PopoverPopup
|
||||
align="start"
|
||||
className="w-72 max-w-[calc(100vw-2rem)]"
|
||||
width="md"
|
||||
viewportClassName="p-0 [--viewport-inline-padding:0px]"
|
||||
>
|
||||
<div className="divide-y divide-border/60">
|
||||
|
||||
@@ -119,9 +119,7 @@ function ScopeMenu({
|
||||
{icon}
|
||||
<span className="min-w-0 truncate">{label}</span>
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="start" className="w-64 max-w-[calc(100vw-2rem)]">
|
||||
{children}
|
||||
</MenuPopup>
|
||||
<MenuPopup align="start">{children}</MenuPopup>
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ function SidebarUpdateControl() {
|
||||
<PopoverPopup
|
||||
align="center"
|
||||
aria-label="Nightly update release notes"
|
||||
className="max-w-none text-balance shadow-xl shadow-black/25"
|
||||
className="text-balance shadow-xl shadow-black/25"
|
||||
initialFocus={false}
|
||||
onKeyDownCapture={(event) => {
|
||||
if (
|
||||
|
||||
@@ -35,13 +35,6 @@ function MenuPopup({
|
||||
anchor?: MenuPrimitive.Positioner.Props["anchor"];
|
||||
keepMounted?: boolean;
|
||||
}) {
|
||||
const hasExplicitWidthClass =
|
||||
typeof className === "string" &&
|
||||
className.split(/\s+/).some((classToken) => {
|
||||
const utility = classToken.split(":").at(-1) ?? classToken;
|
||||
return /^(?:min-|max-)?w-/.test(utility);
|
||||
});
|
||||
|
||||
return (
|
||||
<MenuPrimitive.Portal keepMounted={keepMounted}>
|
||||
<MenuPrimitive.Positioner
|
||||
@@ -60,7 +53,8 @@ function MenuPopup({
|
||||
// the Review panel header). Drag hit-testing ignores z-index, so
|
||||
// the topmost row would stay unhoverable without this opt-out.
|
||||
"[-webkit-app-region:no-drag]",
|
||||
!hasExplicitWidthClass && "min-w-32",
|
||||
// Menus size to their content from one minimum, never past the viewport.
|
||||
"min-w-[min(10rem,calc(100vw-2rem))] max-w-[calc(100vw-2rem)]",
|
||||
className,
|
||||
)}
|
||||
data-slot="menu-popup"
|
||||
|
||||
@@ -16,10 +16,20 @@ function PopoverTrigger({ className, children, ...props }: PopoverPrimitive.Trig
|
||||
);
|
||||
}
|
||||
|
||||
// Popovers hold prose and forms, so a width is fixed rather than a minimum,
|
||||
// and every width is capped to the viewport.
|
||||
const popoverPopupWidthClassName = {
|
||||
auto: "",
|
||||
sm: "w-64",
|
||||
md: "w-80",
|
||||
lg: "w-96",
|
||||
} as const;
|
||||
|
||||
function PopoverPopup({
|
||||
children,
|
||||
className,
|
||||
viewportClassName,
|
||||
width = "auto",
|
||||
side = "bottom",
|
||||
align = "center",
|
||||
sideOffset = 4,
|
||||
@@ -37,6 +47,7 @@ function PopoverPopup({
|
||||
tooltipStyle?: boolean;
|
||||
keepMounted?: PopoverPrimitive.Portal.Props["keepMounted"];
|
||||
anchor?: PopoverPrimitive.Positioner.Props["anchor"];
|
||||
width?: keyof typeof popoverPopupWidthClassName;
|
||||
}) {
|
||||
// Viewport rekeys its children when the active trigger clears on close. Persistent
|
||||
// single-trigger forms need a stable container to retain drafts and submit guards.
|
||||
@@ -59,6 +70,7 @@ function PopoverPopup({
|
||||
"w-fit text-balance rounded-md text-xs shadow-md/5 before:rounded-[calc(var(--radius-md)-1px)]",
|
||||
!tooltipStyle &&
|
||||
"shadow-[0_16px_40px_-18px_rgb(0_0_0/55%)] dark:shadow-[0_18px_44px_-18px_rgb(0_0_0/80%)]",
|
||||
width !== "auto" && ["max-w-[calc(100vw-2rem)]", popoverPopupWidthClassName[width]],
|
||||
className,
|
||||
)}
|
||||
data-slot="popover-popup"
|
||||
|
||||
@@ -762,7 +762,7 @@ function UsageEnvironmentFilter({
|
||||
)}
|
||||
</span>
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="start" className="w-80 max-w-[calc(100vw-2rem)]">
|
||||
<MenuPopup align="start">
|
||||
<MenuCheckboxItem
|
||||
checked={allSelected}
|
||||
closeOnClick={false}
|
||||
|
||||
@@ -269,7 +269,7 @@ export function UsagePriceOverrides({
|
||||
</span>
|
||||
<ChevronDownIcon className="size-3.5 shrink-0" aria-hidden />
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="start" className="w-80 max-w-[calc(100vw-2rem)]">
|
||||
<MenuPopup align="start">
|
||||
<MenuCheckboxItem
|
||||
checked={selectedIds === null}
|
||||
closeOnClick={false}
|
||||
|
||||
@@ -2259,7 +2259,7 @@ function CompactFilterMenu<Value extends string>({
|
||||
</>
|
||||
)}
|
||||
</MenuTrigger>
|
||||
<MenuPopup align="start" side="bottom" className="min-w-40">
|
||||
<MenuPopup align="start" side="bottom">
|
||||
<MenuRadioGroup value={value} onValueChange={(next) => onChange(next as Value)}>
|
||||
{options.map((option) => {
|
||||
const item = (
|
||||
|
||||
Reference in new issue
Block a user