Split shared UI knowledge into atomic topic directories
This commit is contained in:
1 parent
08ff987edb
commit
b0e6402d66
37 files changed
+600
-516
No files matched your search
@@ -9,69 +9,12 @@ Version: 1.5
|
||||
- Reuse shared toolbar/table/icon geometry from the base contract first, then define only
|
||||
controls-specific additions below.
|
||||
|
||||
## Buttons
|
||||
|
||||
- Use a small stable button taxonomy: `primary`, `secondary`, `ghost`, `danger`, `disabled`.
|
||||
- Destructive actions (`archive`, `delete`, `remove`) must use danger styling and explicit labels.
|
||||
- Button text should describe the action outcome, not implementation detail.
|
||||
- Inside a data-table row action column, buttons are icon-only. Each one must have a
|
||||
deterministic `title` and `aria-label`; text labels belong in toolbars, forms and
|
||||
confirmation dialogs, not repeated in every row.
|
||||
- Outside the documented icon-only row/toolbar controls, buttons are text-first; primary and
|
||||
destructive form/confirmation actions retain visible labels.
|
||||
- Base examples must show both `disabled` and `loading` states.
|
||||
- Any control that triggers a network or database call must show a visible busy state for the whole
|
||||
duration of that call (spinner on the control, disabled control, or an equivalent indicator), and
|
||||
must not be re-triggerable while busy. Without it, "slow" is indistinguishable from "broken".
|
||||
- This applies to every call, not only to long-running background tasks. The server-side half of the
|
||||
rule — a bounded timeout on the call itself — is owned by `go-api`.
|
||||
- Do not use a hyperlink (`<a>`/link-styled text) to open a modal, drawer, detail view, or any
|
||||
other in-page element. Use a `button` (or button-styled control) instead, unless the user
|
||||
explicitly asks for a hyperlink. Hyperlinks are reserved for navigation to another URL/page.
|
||||
## Topic Contracts
|
||||
|
||||
## Dropdowns and Popups
|
||||
Read only the topics used by the current controls; table geometry remains in table-management.
|
||||
|
||||
Applies to every floating panel anchored to a control: autocomplete/combobox lists, custom
|
||||
selects, multiselect filters, menus, date pickers.
|
||||
|
||||
- A panel opens below its control by default. When it does not fit below and there is more room
|
||||
above, it opens upward. Decide on every open and on scroll/resize while open, from the control's
|
||||
actual position in the viewport; never hardcode a direction.
|
||||
- A panel must never extend past the viewport edge. If it fits neither way, cap its height to the
|
||||
room available on the chosen side and let it scroll.
|
||||
- A panel must not be clipped by an ancestor's `overflow` (modal body, table wrapper). Position it
|
||||
against the viewport (`position: fixed` or a body-level layer), not inside the clipping container.
|
||||
- Implement placement once in the shared dropdown code; do not re-derive it per control.
|
||||
- A narrow table input may open a wider, content-sized suggestion panel. Clamp both horizontal
|
||||
position and width to the viewport, as well as vertical height. Keep option labels useful:
|
||||
identity, relevant status, quantity and price can share one compact line. Decorative price
|
||||
tiers must not replace the actual amount or imply a stock/risk status.
|
||||
|
||||
## Checkbox Selection
|
||||
|
||||
- Row checkboxes support bulk actions from a shared action bar.
|
||||
- Header checkbox semantics must be explicit:
|
||||
- select visible rows only, or
|
||||
- select all rows in query scope (must be clearly labeled)
|
||||
- In paginated views, the UI should distinguish selection on the current page from selection across the filtered/query scope.
|
||||
- Selection state should survive pagination/filter navigation via explicit state (query params, server session, or another deterministic mechanism).
|
||||
- Same-page interactions should preserve reading position (module anchor pattern is preferred in canonical server-rendered flows).
|
||||
|
||||
## Segmented Filters
|
||||
|
||||
- Segment/toggle filters are allowed for small enumerations (status, active/archived).
|
||||
- Segmented controls are grouped joined-buttons:
|
||||
- one shared outer shell,
|
||||
- rounded corners only on the first/last segment,
|
||||
- straight internal separators between middle segments.
|
||||
- Active segment color may vary by context (for example blue preset selector vs dark status scope tabs), but geometry must remain consistent.
|
||||
- Segment changes should preserve other active filters where possible.
|
||||
- A view switcher uses the same joined geometry; expose the selected view with `aria-pressed`.
|
||||
A single-choice form value uses radio semantics and keyboard behavior (native radios are
|
||||
preferred), not just a colored active button. Concrete options remain product-specific.
|
||||
|
||||
## Bulk Action Safety
|
||||
|
||||
- Bulk action click should preview count and target scope before execution.
|
||||
- Destructive bulk actions require confirmation.
|
||||
- Dense bulk action bars may move rare actions into an explicit overflow menu (`More actions`) while keeping primary actions visible.
|
||||
- [Button Semantics](buttons/contract.md)
|
||||
- [Dropdown Placement](popups/contract.md)
|
||||
- [Selection and Bulk Actions](selection/contract.md)
|
||||
- [Segmented Controls](segments/contract.md)
|
||||
Reference in new issue
Block a user