Files
notify-bridge/frontend/src/lib/components/CollapsibleSlot.svelte
T
alexei.dolgolyov 711f218622 fix(redesign): a11y, mobile, perf polish for production push
Comprehensive pre-production sweep across the Aurora redesign — drives
svelte-check to 0 errors / 0 warnings (was 61) without changing visual
intent. Highlights:

- Mobile: hero title shrinks at 480px, signal-list stacks timestamp
  under sentence below 640px, sidebar icon buttons bumped to 40x40
- Light theme: muted-foreground darkened to #3a3560 to clear WCAG AA
  on glass surfaces and the modal close button
- Perf: topbar backdrop-filter 28→14px, mobile-more sheet 28→12px to
  cut concurrent blur layers on mid-tier mobile
- a11y: prefers-reduced-motion mute for aurora drift / pulses /
  shimmer / stagger; aria-label on every icon-only button;
  aria-describedby on Hint; combobox/listbox/aria-activedescendant on
  SearchPalette; modal dialog tabindex; 47 label-without-control
  warnings across 14 form pages cleaned up via for=/id= or label→div
- Dashboard derived state split into topology- vs status-bound layers
  so polling no longer re-runs the full provider/wires computation
- Mobile bottom nav derived from baseNavEntries by key lookup so
  adding a top-level nav entry keeps the two trees in sync
- Bug: template-configs page now respects the global provider filter
  for both the count meter and the type pill (was reading the
  unfiltered cache)
- Misc: portal EventChart tooltip and switch its swatches to Aurora
  tokens; CollapsibleSlot warning state uses warning-fg/-bg tokens
  instead of #d97706; Hint z-index 99999→9999; element refs across
  Modal/EntitySelect/MultiEntitySelect/SearchPalette/IconGridSelect/
  Hint/targets converted to \$state for reactivity; 4 dead
  .topbar-cta selectors removed
2026-04-25 14:41:12 +03:00

118 lines
2.9 KiB
Svelte

<script lang="ts">
import { slide } from 'svelte/transition';
import MdiIcon from './MdiIcon.svelte';
let {
label,
description = '',
expanded = false,
status = 'empty',
ontoggle,
children,
} = $props<{
label: string;
description?: string;
expanded: boolean;
status: 'empty' | 'valid' | 'error' | 'warning';
ontoggle: () => void;
children: import('svelte').Snippet;
}>();
const STATUS_MAP: Record<string, { icon: string; color: string; bg: string }> = {
empty: { icon: 'mdiCircleOutline', color: 'var(--color-muted-foreground)', bg: 'transparent' },
valid: { icon: 'mdiCheckCircle', color: 'var(--color-success-fg)', bg: 'var(--color-success-bg)' },
warning: { icon: 'mdiAlert', color: 'var(--color-warning-fg)', bg: 'var(--color-warning-bg)' },
error: { icon: 'mdiAlertCircle', color: 'var(--color-error-fg)', bg: 'var(--color-error-bg)' },
};
const statusConfig = $derived(STATUS_MAP[status]);
</script>
<div class="slot-root" class:slot-expanded={expanded}>
<button type="button" class="slot-header" onclick={ontoggle}>
<span class="slot-chevron" class:slot-chevron-open={expanded}>
<MdiIcon name="mdiChevronRight" size={18} />
</span>
<span class="slot-label">{description || label}</span>
<span class="slot-status-pill" style="color: {statusConfig.color}; background: {statusConfig.bg};">
<MdiIcon name={statusConfig.icon} size={14} />
</span>
</button>
{#if expanded}
<div class="slot-body" transition:slide={{ duration: 150 }}>
{@render children()}
</div>
{/if}
</div>
<style>
.slot-root {
border: 1px solid var(--color-border);
border-radius: 0.5rem;
overflow: hidden;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.slot-root:hover {
border-color: color-mix(in srgb, var(--color-border) 60%, var(--color-primary) 40%);
}
.slot-expanded {
border-color: var(--color-primary);
box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-primary) 20%, transparent);
}
.slot-header {
display: flex;
align-items: center;
gap: 0.5rem;
width: 100%;
padding: 0.5rem 0.75rem;
background: transparent;
border: none;
cursor: pointer;
text-align: left;
color: var(--color-foreground);
font-size: 0.8125rem;
transition: background 0.15s ease;
}
.slot-header:hover {
background: color-mix(in srgb, var(--color-muted) 50%, transparent);
}
.slot-chevron {
display: inline-flex;
color: var(--color-muted-foreground);
transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
flex-shrink: 0;
}
.slot-chevron-open {
transform: rotate(90deg);
}
.slot-label {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.slot-status-pill {
display: inline-flex;
align-items: center;
padding: 0.125rem 0.25rem;
border-radius: 0.25rem;
flex-shrink: 0;
}
.slot-body {
padding: 0.75rem;
border-top: 1px solid var(--color-border);
}
</style>