feat(Selector): add selector-option-row theme target on the option row - #5179
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsBottomSheet (@astryxdesign/core) · View in Storybook
Dialog (@astryxdesign/core) · View in Storybook
Selector (@astryxdesign/core) · View in Storybook
Drawer (@astryxdesign/lab) · View in Storybook
ListInput (@astryxdesign/lab) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
b88a785 to
31dee66
Compare
|
Added test parity with One separate follow-up worth a maintainer's eye (not part of this PR): the |
cixzhang
left a comment
There was a problem hiding this comment.
Thanks this is good. Checked in Chrome that a theme reaches the row, its states and its size — merging as is.
[Reviewed by Robohands]
| isSelected && styles.itemSelected, | ||
| item.disabled && styles.itemDisabled, | ||
| {...mergeProps( | ||
| // Stable theme target on the option row itself, mirroring |
There was a problem hiding this comment.
Comment could be a line or two; the naming rationale already lives in the description.
The branch was 33 commits behind and conflicted. The only conflict was in Selector.test.tsx, where main appended `Selector option descriptions and trigger value` at the same place this branch appended `Selector option-row theme target` — git could not tell two adjacent additions apart. Both are kept; neither test touches the other's subject. Selector.tsx and Selector.doc.mjs merged cleanly, and the option-row target still lands on the row main now also renders descriptions into.
Summary
The
Selectordropdown option row is a barediv[role="option"]carrying only StyleX hashes — it has no theme target. Consumers who want to restyle row padding or density have to reach it with a structural selector likediv[role='listbox'] [role='option'], which is brittle and leaks across unrelated listboxes.This adds
selector-option-rowon that row, mirroring themulti-selector-optiontargetMultiSelectoralready exposes. It carriessizeplusselected/disabledstate, so a theme can express "selected option at large" or adjust a given row density directly.Why
-option-rowand not-optionselector-optionis already taken: it's the publicSelectorOptioncontent primitive (theItemholding a row's icon/label/description), not the row container.MultiSelectorhas no equivalent content primitive, so it could usemulti-selector-optionfor its row. Here the row and the content are distinct elements, so the row target is disambiguated asselector-option-row. State/size vocabulary matchesmulti-selector-optionfor cross-component consistency.Motivating case: the row's padding is split across a base (
--spacing-2, 8px) and a per-size override where the defaultmdtrims only the block axis to--spacing-1-5(6px). Reaching that to normalize row density previously required a structural selector; now it's a first-class seam.Test plan
pnpm -F @astryxdesign/core test—Selectorsuite passes, plus three added tests: the target lands on every dropdown row with itsdata-size, reflectsdata-selected, and adefineThemegeneration check proves a theme reaches the row + its states + per-size density.pnpm -F @astryxdesign/core build/typecheck— clean.astryx component Selectorlists the new target..doc.mjstheming targets) and a changeset are included. Purely additive — the class/attributes change nothing until a theme targets them.