Unify theme sizing and spacing on Base UI metrics
- Read only mode, accent, accessibility, and native window material from the OS. - Replace platform palettes, metrics, type ramps, borders, and elevations with unified tokens. - Align controls, overlays, and data rows with Base UI sizing.
This commit is contained in:
@@ -7,7 +7,7 @@ use gpui::{
|
||||
Window, canvas,
|
||||
};
|
||||
use gpui_native_icons::{Icon, IconRole, icon};
|
||||
use gpui_native_theme::{ActiveTheme as _, BORDER_WIDTH, Size};
|
||||
use gpui_native_theme::{ActiveTheme as _, Size};
|
||||
use gpui_native_utils::{focus_handle, focus_ring};
|
||||
|
||||
use crate::common::{Sizable, StyledExt, h_flex};
|
||||
@@ -182,8 +182,6 @@ where
|
||||
let muted_foreground = theme.colors.muted_foreground;
|
||||
let radius = theme.radius.control;
|
||||
let icon_size = metrics.dense_icon_size;
|
||||
let fields_bordered = theme.borders.fields;
|
||||
let focus_ring_on = theme.borders.focus_ring;
|
||||
|
||||
let label = self
|
||||
.a11y_label
|
||||
@@ -209,18 +207,8 @@ where
|
||||
let is_open = *open.read(cx);
|
||||
let open_for_items = open.clone();
|
||||
|
||||
let (rest_border, hover_border) = if fields_bordered {
|
||||
(
|
||||
if is_open && !focus_ring_on {
|
||||
ring
|
||||
} else {
|
||||
border
|
||||
},
|
||||
border,
|
||||
)
|
||||
} else {
|
||||
(input, muted)
|
||||
};
|
||||
let rest_border = border;
|
||||
let hover_border = border;
|
||||
|
||||
let selected_index = self.selected.as_ref().and_then(|value| {
|
||||
self.options
|
||||
@@ -266,10 +254,11 @@ where
|
||||
})
|
||||
.cursor_pointer()
|
||||
.justify_between()
|
||||
.gap_2()
|
||||
.gap_3()
|
||||
.w_full()
|
||||
.h(metrics.input_height + BORDER_WIDTH * 2.0)
|
||||
.px(metrics.dense_padding_x)
|
||||
.h(metrics.input_height)
|
||||
.pl(metrics.dense_padding_x)
|
||||
.pr(metrics.plate_inset * 2.0)
|
||||
.rounded(radius)
|
||||
.border_1()
|
||||
.border_color(rest_border)
|
||||
@@ -280,9 +269,7 @@ where
|
||||
} else {
|
||||
muted_foreground
|
||||
})
|
||||
.when(is_open && focus_ring_on, |trigger| {
|
||||
trigger.shadow(focus_ring(ring))
|
||||
})
|
||||
.when(is_open, |trigger| trigger.shadow(focus_ring(ring)))
|
||||
.hover(|style| style.bg(muted).border_color(hover_border))
|
||||
.child(trigger_text.clone())
|
||||
.child(
|
||||
|
||||
Reference in New Issue
Block a user