refactor(ui): flatten shared fields, rows and disclosures on host tokens
The clue surfaces were carrying raw details markers, mismatched field backdrops and doubled docked title bars. Give the shared layer a Disclosure pattern, align the SearchField frame and window chrome on the host tokens, and let docked windows drop their duplicate title row. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
7c6ab16362
commit
e32546bd25
8 files changed
+165
-22
No files matched your search
@@ -37,7 +37,7 @@
|
||||
justify-content: space-between;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
flex: none;
|
||||
min-height: 40px;
|
||||
min-height: 36px;
|
||||
box-sizing: border-box;
|
||||
padding: 4px var(--ds-sidebar-gutter);
|
||||
border-bottom: 1px solid var(--dsw-alias-border-l1);
|
||||
@@ -46,6 +46,20 @@
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* Native right-sidebar tabs already carry the title and close button; docked
|
||||
windows keep only a slim utility strip for Back + "Pop out". */
|
||||
.dockedBar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
flex: none;
|
||||
min-height: 30px;
|
||||
box-sizing: border-box;
|
||||
padding: 2px var(--ds-sidebar-gutter);
|
||||
border-bottom: 1px solid var(--dsw-alias-border-l1);
|
||||
background: var(--dsw-alias-bg-base);
|
||||
}
|
||||
|
||||
.titleBar:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
@@ -92,6 +106,7 @@
|
||||
align-items: center;
|
||||
gap: var(--ds-sidebar-space-1);
|
||||
flex: none;
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
|
||||
.windowControl,
|
||||
@@ -152,10 +167,10 @@
|
||||
gap: 8px;
|
||||
flex: none;
|
||||
box-sizing: border-box;
|
||||
min-height: 48px;
|
||||
padding: 8px var(--ds-sidebar-gutter);
|
||||
min-height: 42px;
|
||||
padding: 6px var(--ds-sidebar-gutter);
|
||||
border-top: 1px solid var(--dsw-alias-border-l1);
|
||||
background: var(--dsw-alias-bg-layer-1);
|
||||
background: inherit;
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
@@ -209,13 +224,16 @@
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
background: var(--dsw-alias-bg-base);
|
||||
}
|
||||
.window[data-window-docked='true'] .titleBar { cursor: default; }
|
||||
.window[data-window-docked='true'] .toolbar { background: var(--dsw-alias-bg-base); }
|
||||
.surfaceControl {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-sidebar-space-1);
|
||||
flex: none;
|
||||
padding-inline: 6px;
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.surfaceControl svg { flex: none; }
|
||||
|
||||
@@ -455,11 +455,15 @@ export function FloatingWindow(props: FloatingWindowProps): ReactNode {
|
||||
onPointerDownCapture={() => { layer.raise() }}
|
||||
onFocusCapture={() => { layer.raise() }}
|
||||
>
|
||||
<div className={css.titleBar} data-window-handle onPointerDown={docked ? undefined : onTitlePointerDown}>
|
||||
<div
|
||||
className={docked ? css.dockedBar : css.titleBar}
|
||||
data-window-handle
|
||||
onPointerDown={docked ? undefined : onTitlePointerDown}
|
||||
>
|
||||
{titleLeading !== undefined && (
|
||||
<span className={css.titleLeading} data-window-no-drag>{titleLeading}</span>
|
||||
)}
|
||||
<span className={css.title} title={title}>{title}</span>
|
||||
{!docked && <span className={css.title} title={title}>{title}</span>}
|
||||
{dirty === true && (
|
||||
<span
|
||||
className={css.dirty}
|
||||
@@ -495,14 +499,16 @@ export function FloatingWindow(props: FloatingWindowProps): ReactNode {
|
||||
onClick={toggleMaximize}
|
||||
/>
|
||||
)}
|
||||
<IconButton
|
||||
size="sm"
|
||||
className={css.close}
|
||||
icon={<IconCloseFillRegular size={14} />}
|
||||
label={closeText}
|
||||
title={closeText}
|
||||
onClick={() => { void requestCloseRef.current() }}
|
||||
/>
|
||||
{!docked && (
|
||||
<IconButton
|
||||
size="sm"
|
||||
className={css.close}
|
||||
icon={<IconCloseFillRegular size={14} />}
|
||||
label={closeText}
|
||||
title={closeText}
|
||||
onClick={() => { void requestCloseRef.current() }}
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
{hasNode(toolbarRow) && (
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
--ds-sidebar-space-3: 12px;
|
||||
--ds-sidebar-space-4: 16px;
|
||||
--ds-sidebar-space-6: 24px;
|
||||
--ds-sidebar-gutter: 16px;
|
||||
--ds-sidebar-gutter: 12px;
|
||||
--ds-sidebar-control-height: 32px;
|
||||
--ds-sidebar-control-sm: 26px;
|
||||
/* The one workbench section bar (VSCode explorer density). */
|
||||
|
||||
@@ -12,8 +12,8 @@ export { WorkbenchSection, type WorkbenchSectionProps } from './WorkbenchSection
|
||||
export { SelectMenu, type SelectMenuProps, type SelectOption } from './SelectMenu.tsx'
|
||||
export { TextInput, TextArea, NumberInput, Checkbox, ToggleSwitch, Tabs, SettingRow, type TabOption } from './controls.tsx'
|
||||
export {
|
||||
ActionFooter, ChoiceCard, EmptyState, ErrorBlock, FactList, FactRow, Field, ListRow, StatusLine,
|
||||
type ActionFooterProps, type ChoiceCardProps, type ChoiceOption, type EmptyStateProps,
|
||||
ActionFooter, ChoiceCard, Disclosure, EmptyState, ErrorBlock, FactList, FactRow, Field, ListRow, StatusLine,
|
||||
type ActionFooterProps, type ChoiceCardProps, type ChoiceOption, type DisclosureProps, type EmptyStateProps,
|
||||
type ErrorBlockProps, type Fact, type FactListProps, type FactRowProps, type FieldProps,
|
||||
type ListRowProps, type PatternTone, type StatusLineProps,
|
||||
} from './patterns.tsx'
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
gap: var(--ds-sidebar-space-2);
|
||||
min-width: 0;
|
||||
min-height: 30px;
|
||||
padding: 0 var(--ds-sidebar-space-3);
|
||||
padding: 4px var(--ds-sidebar-space-2);
|
||||
border-radius: var(--ds-sidebar-radius);
|
||||
color: var(--dsw-alias-label-primary);
|
||||
font: var(--dsw-font-xxs-12);
|
||||
@@ -109,6 +109,8 @@
|
||||
the measured overflow. */
|
||||
.listRowName {
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -481,3 +483,78 @@
|
||||
@media (pointer: coarse) {
|
||||
.actionFooter { min-height: 44px; }
|
||||
}
|
||||
|
||||
/* ── Disclosure ─────────────────────────────────────────────────────────── */
|
||||
|
||||
.disclosure {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.disclosureSummary {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-height: 28px;
|
||||
padding: 2px 0;
|
||||
list-style: none;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
color: var(--dsw-alias-label-secondary);
|
||||
font: var(--dsw-font-xxs-12);
|
||||
}
|
||||
|
||||
.disclosureSummary::-webkit-details-marker {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.disclosureSummary:hover {
|
||||
color: var(--dsw-alias-label-primary);
|
||||
}
|
||||
|
||||
.disclosureSummary:focus-visible {
|
||||
outline: 2px solid var(--dsw-alias-brand-primary);
|
||||
outline-offset: 2px;
|
||||
border-radius: var(--ds-sidebar-radius);
|
||||
}
|
||||
|
||||
.disclosureChevron {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: none;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
transition: transform 140ms ease;
|
||||
}
|
||||
|
||||
.disclosure[open] > .disclosureSummary > .disclosureChevron {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.disclosureLabel {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.disclosureMeta {
|
||||
margin-inline-start: auto;
|
||||
flex: none;
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
font: var(--dsw-font-xxxs-11);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.disclosureBody {
|
||||
min-width: 0;
|
||||
padding-top: var(--ds-sidebar-space-1);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.disclosureChevron { transition: none; }
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
.disclosureSummary { min-height: 44px; }
|
||||
}
|
||||
@@ -28,6 +28,7 @@
|
||||
*/
|
||||
import type { CSSProperties, MouseEvent, ReactNode } from 'react'
|
||||
import clsx from 'clsx'
|
||||
import { IconChevronRightOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
||||
import { ActionButton } from './kit.tsx'
|
||||
import css from './patterns.module.css'
|
||||
|
||||
@@ -423,3 +424,39 @@ export function ActionFooter({ start, end, bleed, className, ...dataProps }: Act
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/** Props of {@link Disclosure}. */
|
||||
export interface DisclosureProps extends DataAttributes {
|
||||
readonly summary: ReactNode
|
||||
readonly meta?: ReactNode
|
||||
readonly open?: boolean
|
||||
readonly className?: string
|
||||
readonly summaryClassName?: string
|
||||
readonly bodyClassName?: string
|
||||
readonly summaryAriaLabel?: string
|
||||
readonly children?: ReactNode
|
||||
}
|
||||
|
||||
/**
|
||||
* Native `<details>` disclosure with a crisp chevron instead of the browser UA
|
||||
* triangle. Keyboard and touch behaviour remain native.
|
||||
*/
|
||||
export function Disclosure({
|
||||
summary, meta, open, className, summaryClassName, bodyClassName, summaryAriaLabel, children, ...dataProps
|
||||
}: DisclosureProps): ReactNode {
|
||||
return (
|
||||
<details {...dataProps} className={clsx(css.disclosure, className)} open={open}>
|
||||
<summary
|
||||
className={clsx(css.disclosureSummary, summaryClassName)}
|
||||
{...(summaryAriaLabel === undefined ? {} : { 'aria-label': summaryAriaLabel })}
|
||||
>
|
||||
<span className={css.disclosureChevron} aria-hidden="true">
|
||||
<IconChevronRightOutlineRegular size={12} />
|
||||
</span>
|
||||
<span className={css.disclosureLabel}>{summary}</span>
|
||||
{meta !== undefined && <span className={css.disclosureMeta}>{meta}</span>}
|
||||
</summary>
|
||||
<div className={clsx(css.disclosureBody, bodyClassName)}>{children}</div>
|
||||
</details>
|
||||
)
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
padding: 0 8px;
|
||||
border: 1px solid var(--dsw-alias-border-l2);
|
||||
border-radius: 6px;
|
||||
background: var(--dsw-alias-bg-layer-1);
|
||||
background: var(--dsw-alias-bg-base);
|
||||
color: var(--dsw-alias-label-tertiary);
|
||||
}
|
||||
.root:focus-within { border-color: var(--dsw-alias-state-business-primary); }
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
}
|
||||
|
||||
.document {
|
||||
background: var(--dsw-alias-bg-layer-1);
|
||||
background: var(--dsw-alias-bg-base);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
@@ -84,10 +84,15 @@
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex: none;
|
||||
padding: var(--ds-sidebar-space-2) var(--ds-sidebar-gutter);
|
||||
padding: 4px var(--ds-sidebar-gutter);
|
||||
border-bottom: 1px solid var(--dsw-alias-border-l1);
|
||||
}
|
||||
|
||||
.modeBar > [role="tablist"] {
|
||||
border-bottom: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.modeTab {
|
||||
min-height: var(--ds-sidebar-control-height);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user