swarm-ui: table filters move to a per-header icon + popover
Replaces the permanent filter-row under Table's headers with a small filter-icon button in each filterable column's own header cell. The icon fades in on header hover/focus via a CSS opacity transition, or stays visible outright once that column actually has a filter set (mara: "instead of a filter row, add little filter icons on header hover with fade in out animation ... when a filter is set, the filter icon does not disappear"). Clicking it opens a small anchored popover directly under the header holding the exact same filter control filterMode already provides (text input or select) -- the underlying filter mechanism from hyperhive#4088 is unchanged, only where the control lives moved. Close-on-outside-click/Escape mirrors the contract Dropdown already gives its own popover, adapted to a shared listener across every column instead of a ref per column since only one popover is ever open at a time. New FilterIcon in @hive/shared's icons.tsx (a plain inline SVG funnel, same Feather/lucide-style shape as the existing GearIcon/LinkIcon) -- found and reused that pattern rather than reaching for an emoji glyph, matching the documented reason those two exist as SVG in the first place (mara, on the old emoji icons: inconsistent size/weight across platforms).
This commit is contained in:
parent
17d22f9e16
commit
e234afa26a
3 changed files with 244 additions and 73 deletions
|
|
@ -63,12 +63,67 @@
|
|||
opacity: 1;
|
||||
}
|
||||
|
||||
/* The per-column filter inputs' row — same cell padding as a header row,
|
||||
no bottom border of its own (the header row above already has one). */
|
||||
.ui-table-filter-row th {
|
||||
padding-top: 0;
|
||||
padding-bottom: 0.5em;
|
||||
font-weight: 400;
|
||||
/* A filterable header cell anchors its own popover — `position: relative`
|
||||
is what lets `.ui-table-filter-popover`'s `position: absolute` below
|
||||
sit under this `<th>` specifically rather than the page. */
|
||||
.ui-table-th-filterable {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* The filter-icon trigger — invisible by default, `opacity` transition
|
||||
rather than a hard show/hide (mara: "fade in out animation"). Shown
|
||||
on three signals, matching Table.tsx's own comment on `filterValue`:
|
||||
hovering/focusing the header cell (so it's discoverable without a
|
||||
filter already set), the popover being open (still visible while
|
||||
you're using it, even if the pointer has moved off the header), or
|
||||
`.ui-table-filter-icon-active` — a filter is *set* on this column,
|
||||
so the icon stays put as a persistent "this column is filtered"
|
||||
indicator rather than disappearing the moment the header isn't
|
||||
hovered (mara: "when a filter is set, the filter icon does not
|
||||
disappear"). `:focus-within` (not just `:hover`) so a keyboard user
|
||||
tabbing to the icon sees it appear too, not just a mouse hovering. */
|
||||
.ui-table-filter-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 0.35em;
|
||||
padding: 0.15em;
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
color: var(--muted);
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
.ui-table-th-filterable:hover .ui-table-filter-icon,
|
||||
.ui-table-th-filterable:focus-within .ui-table-filter-icon,
|
||||
.ui-table-filter-icon-active {
|
||||
opacity: 1;
|
||||
}
|
||||
.ui-table-filter-icon:hover {
|
||||
color: var(--fg);
|
||||
background: var(--bg);
|
||||
}
|
||||
/* A filter is live on this column — `--purple`, theme.css's own "active
|
||||
tabs, links, highlights" accent, so an operator scanning the header
|
||||
row reads it the same way anything else marked active does. */
|
||||
.ui-table-filter-icon-active {
|
||||
color: var(--purple);
|
||||
}
|
||||
|
||||
.ui-table-filter-popover {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 5;
|
||||
margin-top: 0.35em;
|
||||
min-width: 12em;
|
||||
padding: 0.5em;
|
||||
background: var(--bg-elev);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.ui-table-filter-input,
|
||||
.ui-table-filter-select {
|
||||
|
|
|
|||
Loading…
Reference in a new issue