diff --git a/webui/src/components/form/form.module.css b/webui/src/components/form/form.module.css index df80eab7..ae8998b0 100644 --- a/webui/src/components/form/form.module.css +++ b/webui/src/components/form/form.module.css @@ -420,7 +420,21 @@ background: rgba(255, 255, 255, 0.08); } + &[data-variant='ghost'] { + border-color: transparent; + background: transparent; + color: rgba(255, 255, 255, 0.58); + } + + &[data-variant='ghost']:hover:not(:disabled) { + transform: none; + border-color: rgba(255, 255, 255, 0.12); + background: rgba(255, 255, 255, 0.06); + color: rgba(255, 255, 255, 0.85); + } + &[data-selected='true'] { + color: #fff; border-color: rgba(var(--accent-light-rgb), 0.5); background: rgba(var(--accent-rgb), 0.18); box-shadow: 0 0 0 1px rgba(var(--accent-light-rgb), 0.08); @@ -598,7 +612,6 @@ } &[data-variant='ghost']:hover:not(:disabled) { - transform: none; border-color: rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.07); color: #fff; @@ -610,7 +623,7 @@ } &[data-variant='ghost']:disabled { - opacity: 0.5; + opacity: 0.55; } } diff --git a/webui/src/components/form/form.test.tsx b/webui/src/components/form/form.test.tsx index 41e2d363..21e6abb3 100644 --- a/webui/src/components/form/form.test.tsx +++ b/webui/src/components/form/form.test.tsx @@ -172,21 +172,22 @@ describe('form primitives', () => { expect(screen.getByText('12')).toHaveAttribute('data-tone', 'warning'); expect(screen.getByRole('button', { name: 'Cancel' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'Save' })).toHaveAttribute( - 'data-variant', - 'primary', - ); + expect(screen.getByRole('button', { name: 'Save' })).toHaveAttribute('data-variant', 'primary'); }); it('supports compact option button groups', () => { const { container } = render( All - Pending + Pending , ); expect(container.querySelector('[data-size="sm"]')).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Pending' })).toHaveAttribute( + 'data-variant', + 'ghost', + ); }); it('supports compact select sizing', () => { diff --git a/webui/src/components/form/form.tsx b/webui/src/components/form/form.tsx index 065a123e..06cf217d 100644 --- a/webui/src/components/form/form.tsx +++ b/webui/src/components/form/form.tsx @@ -89,12 +89,7 @@ export const Select = forwardRef(function Select ref, ) { return ( - ); }); @@ -186,7 +181,10 @@ export const RangeInput = forwardRef(function R - + @@ -249,11 +247,7 @@ export interface OptionButtonGroupProps { size?: OptionButtonGroupSize; } -export function OptionButtonGroup({ - className, - children, - size = 'md', -}: OptionButtonGroupProps) { +export function OptionButtonGroup({ className, children, size = 'md' }: OptionButtonGroupProps) { return (
{children} @@ -261,14 +255,17 @@ export function OptionButtonGroup({ ); } +export type OptionButtonVariant = 'default' | 'ghost'; + export interface OptionButtonProps extends Omit, 'value'> { className?: string; selected?: boolean; + variant?: OptionButtonVariant; value?: string; } export const OptionButton = forwardRef(function OptionButton( - { className, children, selected = false, type = 'button', ...props }, + { className, children, selected = false, type = 'button', variant = 'default', ...props }, ref, ) { return ( @@ -277,6 +274,7 @@ export const OptionButton = forwardRef(fun pressed={selected} className={clsx(styles.optionButton, className)} data-selected={selected ? 'true' : undefined} + data-variant={variant} type={type} {...props} > @@ -298,14 +296,7 @@ export const Badge = forwardRef(function Badge( { className, tone = 'neutral', ...props }, ref, ) { - return ( - - ); + return ; }); type BaseButtonProps = ComponentPropsWithoutRef; diff --git a/webui/src/routes/import/-ui/auto-import-tab.tsx b/webui/src/routes/import/-ui/auto-import-tab.tsx index 0b874f21..c1576442 100644 --- a/webui/src/routes/import/-ui/auto-import-tab.tsx +++ b/webui/src/routes/import/-ui/auto-import-tab.tsx @@ -258,6 +258,7 @@ export function AutoImportPanel({ onFilterChange(filter)} > {getAutoImportFilterLabel(filter)}