Skip to content

Commit bde51be

Browse files
committed
docs(spec): SelectorOption scopes icon presentation to IconType and cites its own design authority
1 parent d097112 commit bde51be

1 file changed

Lines changed: 27 additions & 26 deletions

File tree

‎packages/core/src/Selector/SelectorOption.spec.md‎

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ system_specs: []
2424

2525
## Contract at a glance
2626

27-
| Area | Contract |
28-
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29-
| Public contract | `SelectorOption` is exported beside Selector and takes `label` (required), `icon`, `description`, `layout` (`stacked` by default, or `inline`), `endContent`, `xstyle`, `className`, and `style`. |
30-
| Behavior | Renders one Item row of an optional small secondary icon, the label, an optional description, and optional end content, with the row's own padding and corner radius removed so its host row lays it out. |
31-
| End-user impact | People see custom Selector options and the selected value in the same row shape as built-in options, and a long label ellipsizes instead of overflowing a narrow popover. |
32-
| Builder impact | Builders return it from `renderOption` or `renderValue` to keep the `selector-option` target and the shared row layout while choosing the content. |
33-
| Compatibility/readiness | Records shipped behavior; no API, default, or DOM change. |
34-
| Review checks | Reject a dropped icon, description, or end content, a layout that ignores the caller outside an InputGroup or stays stacked inside one, or a lost `selector-option` target. |
35-
| Governing rules | `architecture:component-theming-surface`; `architecture:public-component-api`; `component:Item` for the row it composes. |
27+
| Area | Contract |
28+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29+
| Public contract | `SelectorOption` is exported beside Selector and takes `label` (required), `icon`, `description`, `layout` (`stacked` by default, or `inline`), `endContent`, `xstyle`, `className`, and `style`. |
30+
| Behavior | Renders one Item row of an optional icon, the label, an optional description, and optional end content, with the row's own padding and corner radius removed so its host row lays it out. |
31+
| End-user impact | People see custom Selector options and the selected value in the same row shape as built-in options, and a long label ellipsizes instead of overflowing a narrow popover. |
32+
| Builder impact | Builders return it from `renderOption` or `renderValue` to keep the `selector-option` target and the shared row layout while choosing the content. |
33+
| Compatibility/readiness | Records shipped behavior; no API, default, or DOM change. |
34+
| Review checks | Reject a dropped icon, description, or end content, a layout that ignores the caller outside an InputGroup or stays stacked inside one, or a lost `selector-option` target. |
35+
| Governing rules | `architecture:component-theming-surface`; `architecture:public-component-api`; `component:Item` for the row it composes. |
3636

3737
This table is a review projection; the body below is authoritative.
3838

@@ -72,19 +72,19 @@ Consumer migration instructions belong in consumer docs and release notes.
7272

7373
## Public concepts
7474

75-
| Concept | Closed values or states | Meaning | Availability by variant/orientation |
76-
| ----------- | ----------------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
77-
| layout | `stacked`, `inline` | `stacked` puts the description on its own line; `inline` keeps label and description on one line. | Caller's choice, except inside an InputGroup (`inline`). |
78-
| icon | absent, present | A small secondary icon before the label. | Every layout. |
79-
| end content | absent, present | Caller content after the label and description. | Every layout. |
75+
| Concept | Closed values or states | Meaning | Availability by variant/orientation |
76+
| ----------- | ----------------------- | ---------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
77+
| layout | `stacked`, `inline` | `stacked` puts the description on its own line; `inline` keeps label and description on one line. | Caller's choice, except inside an InputGroup (`inline`). |
78+
| icon | absent, present | An `IconType` icon renders as a small secondary Icon before the label; a ReactNode renders as given. | Every layout. |
79+
| end content | absent, present | Caller content after the label and description. | Every layout. |
8080

8181
## Behavioral and layout contract
8282

83-
| ID | Invariant | Basis |
84-
| --- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
85-
| FR1 | SelectorOption renders one `component:Item` row: `icon` as a small secondary icon in the start slot when present, `label`, `description` when present, and `endContent` when present. Selector's default option renderer draws each option through SelectorOption too. | Current source and tests |
86-
| FR2 | The row uses the caller's `layout` (`stacked` by default). When its host pins the row height (a Selector trigger inside an InputGroup), the row is `inline` whatever the caller passed. | Current source and tests |
87-
| FR3 | The row carries the `selector-option` target. Its own block and inline padding and corner radius are zero and its minimum width is zero, so a long label ellipsizes inside a narrow host. Caller `xstyle` merges after these base styles; `className` and `style` reach the row. | `architecture:component-theming-surface`; current source |
83+
| ID | Invariant | Basis |
84+
| --- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
85+
| FR1 | SelectorOption renders one `component:Item` row: `icon` in the start slot when present (an `IconType` icon as a small secondary Icon, a ReactNode as given), `label`, `description` when present, and `endContent` when present. Selector's default option renderer draws each option through SelectorOption too. | Current source and tests |
86+
| FR2 | The row uses the caller's `layout` (`stacked` by default). When its host pins the row height (a Selector trigger inside an InputGroup), the row is `inline` whatever the caller passed. | Current source and tests |
87+
| FR3 | The row carries the `selector-option` target. Its own block and inline padding and corner radius are zero and its minimum width is zero, so a long label ellipsizes inside a narrow host. Caller `xstyle` merges after these base styles; `className` and `style` reach the row. | `architecture:component-theming-surface`; current source |
8888

8989
### Allowed variation
9090

@@ -115,17 +115,18 @@ Consumer migration instructions belong in consumer docs and release notes.
115115
## Accessibility contract
116116

117117
- **AR1 — Content only.** SelectorOption adds no role, name, or state; the
118-
Selector option row it sits in owns them. The icon is decorative.
118+
Selector option row it sits in owns them. An `IconType` icon is decorative; a
119+
ReactNode icon keeps the semantics its caller gives it.
119120

120121
## Design relationships
121122

122123
| Anatomy or state | Design requirement | Representation authority | Hierarchy role | Component contract |
123124
| ---------------- | --------------------------------------------------- | ------------------------ | -------------- | ------------------ |
124-
| Row | Lays out the option content like a built-in option. | `component:Item` | Supporting | FR1, FR3 |
125-
| Icon | Identifies the option at a glance. | `component:Item` | Supporting | FR1 |
126-
| Label | Names the option. | `component:Item` | Prominent | FR1, FR3 |
127-
| Description | Adds secondary detail. | `component:Item` | Supporting | FR1, FR2 |
128-
| End content | Holds caller content after the text. | `component:Item` | Supporting | FR1 |
125+
| Row | Lays out the option content like a built-in option. | Current source | Supporting | FR1, FR3 |
126+
| Icon | Identifies the option at a glance. | Current source | Supporting | FR1 |
127+
| Label | Names the option. | Current source | Prominent | FR1, FR3 |
128+
| Description | Adds secondary detail. | Current source | Supporting | FR1, FR2 |
129+
| End content | Holds caller content after the text. | Current source | Supporting | FR1 |
129130

130131
`Selector.spec.md` maps the `selector-option` target in its theming anatomy as
131132
"SelectorOption-rendered content", so this record carries no anatomy-theming
@@ -143,7 +144,7 @@ map.
143144

144145
| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
145146
| -------------------- | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- |
146-
| FR1 | `Selector.test.tsx` "renders custom option endContent" and "renders the selected option through renderValue" | Option with end content; value with icon and description | A dropped end content, label, description, or icon fails. | `audit:SelectorOption/anatomy` |
147+
| FR1 | `Selector.test.tsx` "renders custom option endContent" and "renders the selected option through renderValue" | Option with end content; value with icon and description | A dropped end content, label, description, or icon fails. Evidence gap: no test asserts the small secondary presentation of an `IconType` icon. | `audit:SelectorOption/anatomy` |
147148
| FR2 | `Selector.test.tsx` "follows the caller's SelectorOption layout, but folds inline in a group" | Standalone trigger; trigger in an InputGroup | A stacked row in an InputGroup, or an inline row standalone by default, fails. Evidence gap: no test passes `layout="inline"` outside an InputGroup. | `audit:SelectorOption/layout` |
148149
| FR3 | `Selector.test.tsx` "lets a narrow list shrink an option so its label can ellipsize" | Default option in a narrow list | A missing `selector-option` row or a nonzero minimum width fails. Evidence gap: no test asserts the padding and radius reset, or `xstyle`, `className`, and `style` on the row. | `audit:SelectorOption/theming` |
149150
| ORD1, ORD2, PR1, AR1 | ORD1 is covered by the FR2 row. Evidence gap: no test asserts ORD2, PR1, or the decorative icon | — | — | `audit:SelectorOption/behavior` |

0 commit comments

Comments
 (0)