The add card's panels are now derived from the shown mode and the modes visited since it opened, and each renders only while its mode is still offered, so a refresh that changes which modes are offered — every configurable row gone, the pi-ai namespace unmounted, a route freed after the catalog was exhausted — can neither leave the card without a panel nor keep a form whose write the Host would refuse. The catalog draft resolves to the chosen row while its namespace can take the write, else to the first addable row; closing either panel forgets it, so a later refresh cannot open a row editor unasked. Both cards report a write or an endpoint interrogation in flight, and the switch and the catalog select lock while one is, since a switch underneath it would orphan the answer or the picker it opens. The SegmentedControl takes the owner's id and pairs each tab with its panel through `aria-controls` and `aria-labelledby`; a card offering one mode carries that mode as its title instead of an orphan tabpanel, and a locked segment names its reason as hover text. `fullWidth` goes: no consumer asked for it.
77 lines
2.0 KiB
CSS
77 lines
2.0 KiB
CSS
/* The track is the same translucent fill the hover state uses, so it reads as
|
|
* a place rather than a second button; the one raised part is the indicator,
|
|
* a white pill that slides under the selected segment. Its stroke rides inside
|
|
* the soft elevation shadow (border: 0), the way every elevated surface draws
|
|
* its edge, so the elevation gate keeps it off the alias-border set.
|
|
*
|
|
* Segments are equal-width grid tracks sized to the widest label, which is
|
|
* what lets one indicator be placed arithmetically: the tablist carries the
|
|
* segment count and the selected index as custom properties, and the indicator
|
|
* derives its width and offset from them instead of measuring the DOM. */
|
|
.control {
|
|
position: relative;
|
|
display: inline-grid;
|
|
grid-auto-flow: column;
|
|
grid-auto-columns: 1fr;
|
|
gap: 2px;
|
|
padding: 3px;
|
|
border-radius: 9px;
|
|
background: var(--dsw-alias-interactive-bg-hover);
|
|
}
|
|
|
|
.indicator {
|
|
position: absolute;
|
|
top: 3px;
|
|
left: 3px;
|
|
width: calc((100% - 6px - 2px * (var(--dsh-segment-count) - 1)) / var(--dsh-segment-count));
|
|
height: calc(100% - 6px);
|
|
border: 0;
|
|
border-radius: 7px;
|
|
background: var(--dsw-alias-bg-layer-1);
|
|
box-shadow: var(--dsw-elevation-soft);
|
|
transform: translateX(calc(var(--dsh-segment-index) * (100% + 2px)));
|
|
transition: transform 160ms ease;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.tab {
|
|
box-sizing: border-box;
|
|
position: relative;
|
|
z-index: 1;
|
|
height: 28px;
|
|
padding: 0 16px;
|
|
border: 0;
|
|
border-radius: 7px;
|
|
background: transparent;
|
|
color: var(--dsw-alias-label-secondary);
|
|
font: inherit;
|
|
font-size: 13px;
|
|
line-height: 20px;
|
|
font-weight: 500;
|
|
white-space: nowrap;
|
|
cursor: pointer;
|
|
transition: color 120ms ease;
|
|
}
|
|
|
|
.tab:hover:not(:disabled),
|
|
.tab[aria-selected='true'] {
|
|
color: var(--dsw-alias-label-primary);
|
|
}
|
|
|
|
.tab:disabled {
|
|
cursor: default;
|
|
opacity: 0.4;
|
|
}
|
|
|
|
.tab:focus-visible {
|
|
outline: 2px solid var(--dsw-alias-brand-primary);
|
|
outline-offset: -2px;
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.indicator,
|
|
.tab {
|
|
transition: none;
|
|
}
|
|
}
|