Skip to content

Rebuild NavButton, add MenuTriggerButton - #92

Draft
librowski wants to merge 2 commits into
ds2-repointfrom
ds2-nav-button
Draft

Rebuild NavButton, add MenuTriggerButton#92
librowski wants to merge 2 commits into
ds2-repointfrom
ds2-nav-button

Conversation

@librowski

Copy link
Copy Markdown
Collaborator

Rebuilds NavButton on the same shape as the new Button and adds MenuTriggerButton.

APIsize, styleVariant and explicit prefixIcon/suffixIcon slots. The label/icon/icon+label subtypes are gone, and with them the shared children-shape guards: nothing imports them any more, so guards.ts and its spec are deleted.

Selected is not pressed — this is the point of the layer. Selection (isSelected) survives hover, and pointer-down overrides it; each state draws its own token, exactly as the design defines and as the token export ships (nav-button-bg-primary-{default,hover,pressed,active,focus,disabled}).

Sizes — seven steps from the design set: boxes 48/42/36/32/28/24/20, icon-only padding 12/11/9/7/6/6/4, gap 8 (6 for the two smallest), radius 8/8/6/4/4/4/4, icon boxes 24/20/18/18/16/12/12. Nav labels keep the regular weight, unlike the emphasized button labels. styleVariant: 'plain' is the design's "no background" treatment — transparent by default, still lit on the other states.

MenuTriggerButton — new, composes NavButton and maps isOpen onto selection.

SegmentPicker keeps its public API: it consumed NavButton's subcomponent prop types, and now translates its own long-form sizes and shapes to the new slots internally.

Verified at the tip of the stack (so this covers the four layers below it): ui/sdk lint + typecheck, build:ui, build:lib, stylelint, all test suites, docs build (211 pages), demo build.

NavButton takes size, styleVariant and explicit icon slots, so the
label/icon/icon+label subtypes and the shared children-shape guards are
gone - nothing imports them any more, so they are deleted too.

The selected state and the mouse-down state are now separate: selection
survives hover and pointer-down overrides it, each on its own token,
which is what the design defines and what the token export ships.

Seven sizes carry the design's boxes, padding, gap, radius and icon
boxes; nav labels keep the regular weight. MenuTriggerButton composes
NavButton and maps its open state onto selection.

SegmentPicker keeps its public API and translates to the new slots
internally.
SegmentPicker accepted an icon, a label, or a mix of both as children;
the slot rewrite only handled the single-element form, so mixed content
lost its icon treatment. Children are normalised into slots again, the
selected segment reports its state to assistive technology, and
clicking it no longer emits a change it used to swallow.

NavButton's props became a union: a label button with optional icons,
or an icon button that requires its icon. Neither form can now be
written so that it renders nothing.

The visual treatment prop is called variant, matching the other
components. The language selector lets the button own its label
typography instead of composing a retired global class, and the two
style modules the rebuild orphaned are gone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant