shelving 1.236.2 → 1.237.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extract/IndexExtractor.js +9 -2
- package/extract/MergingExtractor.d.ts +3 -1
- package/extract/MergingExtractor.js +41 -3
- package/extract/TypescriptExtractor.d.ts +1 -0
- package/extract/TypescriptExtractor.js +12 -2
- package/package.json +1 -1
- package/ui/README.md +19 -274
- package/ui/app/App.d.ts +1 -0
- package/ui/app/App.js +1 -0
- package/ui/app/App.md +58 -0
- package/ui/app/App.tsx +1 -0
- package/ui/block/Card.d.ts +1 -0
- package/ui/block/Card.js +1 -0
- package/ui/block/Card.md +85 -0
- package/ui/block/Card.tsx +1 -0
- package/ui/block/Heading.d.ts +1 -0
- package/ui/block/Heading.js +1 -0
- package/ui/block/Heading.md +70 -0
- package/ui/block/Heading.tsx +1 -0
- package/ui/block/List.d.ts +1 -0
- package/ui/block/List.js +1 -0
- package/ui/block/List.md +51 -0
- package/ui/block/List.tsx +1 -0
- package/ui/block/Panel.d.ts +1 -0
- package/ui/block/Panel.js +1 -0
- package/ui/block/Panel.md +50 -0
- package/ui/block/Panel.tsx +1 -0
- package/ui/block/Paragraph.d.ts +1 -0
- package/ui/block/Paragraph.js +1 -0
- package/ui/block/Paragraph.md +48 -0
- package/ui/block/Paragraph.tsx +1 -0
- package/ui/block/Prose.d.ts +1 -0
- package/ui/block/Prose.js +1 -0
- package/ui/block/Prose.md +49 -0
- package/ui/block/Prose.tsx +1 -0
- package/ui/block/Section.d.ts +6 -0
- package/ui/block/Section.js +6 -0
- package/ui/block/Section.md +56 -0
- package/ui/block/Section.tsx +6 -0
- package/ui/block/Subheading.d.ts +1 -0
- package/ui/block/Subheading.js +1 -0
- package/ui/block/Subheading.md +58 -0
- package/ui/block/Subheading.tsx +1 -0
- package/ui/block/Table.d.ts +1 -0
- package/ui/block/Table.js +1 -0
- package/ui/block/Table.md +54 -0
- package/ui/block/Table.tsx +1 -0
- package/ui/block/Title.d.ts +1 -0
- package/ui/block/Title.js +1 -0
- package/ui/block/Title.md +57 -0
- package/ui/block/Title.tsx +1 -0
- package/ui/dialog/Dialog.d.ts +1 -0
- package/ui/dialog/Dialog.js +1 -0
- package/ui/dialog/Dialog.md +73 -0
- package/ui/dialog/Dialog.tsx +1 -0
- package/ui/dialog/Modal.d.ts +1 -0
- package/ui/dialog/Modal.js +1 -0
- package/ui/dialog/Modal.md +40 -0
- package/ui/dialog/Modal.tsx +1 -0
- package/ui/docs/DocumentationButtons.d.ts +2 -0
- package/ui/docs/DocumentationButtons.js +2 -0
- package/ui/docs/DocumentationButtons.md +38 -0
- package/ui/docs/DocumentationButtons.tsx +2 -0
- package/ui/docs/DocumentationCard.d.ts +1 -0
- package/ui/docs/DocumentationCard.js +1 -0
- package/ui/docs/DocumentationCard.md +35 -0
- package/ui/docs/DocumentationCard.tsx +1 -0
- package/ui/docs/DocumentationKind.d.ts +1 -1
- package/ui/docs/DocumentationKind.js +9 -4
- package/ui/docs/DocumentationKind.tsx +10 -5
- package/ui/docs/DocumentationPage.d.ts +1 -0
- package/ui/docs/DocumentationPage.js +2 -0
- package/ui/docs/DocumentationPage.md +46 -0
- package/ui/docs/DocumentationPage.tsx +2 -0
- package/ui/form/Button.d.ts +1 -0
- package/ui/form/Button.js +1 -0
- package/ui/form/Button.md +88 -0
- package/ui/form/Button.tsx +1 -0
- package/ui/form/Field.d.ts +6 -1
- package/ui/form/Field.js +6 -1
- package/ui/form/Field.md +59 -0
- package/ui/form/Field.tsx +6 -1
- package/ui/form/Form.d.ts +1 -0
- package/ui/form/Form.md +118 -0
- package/ui/form/Form.tsx +1 -0
- package/ui/form/FormStore.md +47 -0
- package/ui/form/SchemaInput.d.ts +1 -0
- package/ui/form/SchemaInput.md +64 -0
- package/ui/form/SchemaInput.tsx +1 -0
- package/ui/inline/Code.d.ts +1 -0
- package/ui/inline/Code.js +1 -0
- package/ui/inline/Code.md +58 -0
- package/ui/inline/Code.tsx +1 -0
- package/ui/inline/Link.d.ts +1 -0
- package/ui/inline/Link.js +1 -0
- package/ui/inline/Link.md +47 -0
- package/ui/inline/Link.tsx +1 -0
- package/ui/inline/Mark.d.ts +1 -0
- package/ui/inline/Mark.js +1 -0
- package/ui/inline/Mark.md +40 -0
- package/ui/inline/Mark.tsx +1 -0
- package/ui/inline/Strong.d.ts +1 -0
- package/ui/inline/Strong.js +1 -0
- package/ui/inline/Strong.md +34 -0
- package/ui/inline/Strong.tsx +1 -0
- package/ui/layout/CenteredLayout.d.ts +1 -0
- package/ui/layout/CenteredLayout.js +1 -0
- package/ui/layout/CenteredLayout.md +38 -0
- package/ui/layout/CenteredLayout.tsx +1 -0
- package/ui/layout/SidebarLayout.d.ts +1 -0
- package/ui/layout/SidebarLayout.js +1 -0
- package/ui/layout/SidebarLayout.md +65 -0
- package/ui/layout/SidebarLayout.tsx +1 -0
- package/ui/menu/Menu.d.ts +2 -0
- package/ui/menu/Menu.js +2 -0
- package/ui/menu/Menu.md +51 -0
- package/ui/menu/Menu.tsx +2 -0
- package/ui/menu/MenuItem.md +54 -0
- package/ui/misc/Catcher.d.ts +1 -0
- package/ui/misc/Catcher.js +1 -0
- package/ui/misc/Catcher.md +41 -0
- package/ui/misc/Catcher.tsx +1 -0
- package/ui/misc/Loading.d.ts +1 -0
- package/ui/misc/Loading.js +1 -0
- package/ui/misc/Loading.md +28 -0
- package/ui/misc/Loading.tsx +1 -0
- package/ui/misc/Mapper.md +40 -0
- package/ui/misc/Markup.d.ts +1 -0
- package/ui/misc/Markup.js +1 -0
- package/ui/misc/Markup.md +34 -0
- package/ui/misc/Markup.tsx +1 -0
- package/ui/misc/StatusIcon.d.ts +1 -0
- package/ui/misc/StatusIcon.js +1 -0
- package/ui/misc/StatusIcon.md +25 -0
- package/ui/misc/StatusIcon.tsx +1 -0
- package/ui/misc/Tag.d.ts +1 -0
- package/ui/misc/Tag.js +1 -0
- package/ui/misc/Tag.md +47 -0
- package/ui/misc/Tag.tsx +1 -0
- package/ui/notice/Notice.d.ts +1 -0
- package/ui/notice/Notice.js +1 -0
- package/ui/notice/Notice.md +53 -0
- package/ui/notice/Notice.tsx +1 -0
- package/ui/notice/Notices.d.ts +1 -0
- package/ui/notice/Notices.js +1 -0
- package/ui/notice/Notices.md +59 -0
- package/ui/notice/Notices.tsx +1 -0
- package/ui/page/HTML.d.ts +1 -0
- package/ui/page/HTML.js +1 -0
- package/ui/page/HTML.md +36 -0
- package/ui/page/HTML.tsx +1 -0
- package/ui/page/Head.d.ts +1 -0
- package/ui/page/Head.js +1 -0
- package/ui/page/Head.md +26 -0
- package/ui/page/Head.tsx +1 -0
- package/ui/page/Page.d.ts +1 -0
- package/ui/page/Page.js +1 -0
- package/ui/page/Page.md +42 -0
- package/ui/page/Page.tsx +1 -0
- package/ui/router/Navigation.d.ts +1 -0
- package/ui/router/Navigation.js +1 -0
- package/ui/router/Navigation.md +41 -0
- package/ui/router/Navigation.tsx +1 -0
- package/ui/router/NavigationStore.md +34 -0
- package/ui/router/Router.d.ts +1 -0
- package/ui/router/Router.js +1 -0
- package/ui/router/Router.md +143 -0
- package/ui/router/Router.tsx +1 -0
- package/ui/style/TINT_CLASS.md +55 -0
- package/ui/transition/CollapseTransition.d.ts +1 -0
- package/ui/transition/CollapseTransition.js +1 -0
- package/ui/transition/CollapseTransition.md +34 -0
- package/ui/transition/CollapseTransition.tsx +1 -0
- package/ui/transition/FadeTransition.d.ts +1 -0
- package/ui/transition/FadeTransition.js +1 -0
- package/ui/transition/FadeTransition.md +36 -0
- package/ui/transition/FadeTransition.tsx +1 -0
- package/ui/transition/HorizontalTransition.d.ts +1 -0
- package/ui/transition/HorizontalTransition.js +1 -0
- package/ui/transition/HorizontalTransition.md +44 -0
- package/ui/transition/HorizontalTransition.tsx +1 -0
- package/ui/transition/Transition.d.ts +1 -0
- package/ui/transition/Transition.js +1 -0
- package/ui/transition/Transition.md +70 -0
- package/ui/transition/Transition.tsx +1 -0
- package/ui/transition/VerticalTransition.d.ts +1 -0
- package/ui/transition/VerticalTransition.js +1 -0
- package/ui/transition/VerticalTransition.md +34 -0
- package/ui/transition/VerticalTransition.tsx +1 -0
- package/ui/tree/TreeApp.d.ts +1 -0
- package/ui/tree/TreeApp.js +1 -0
- package/ui/tree/TreeApp.md +59 -0
- package/ui/tree/TreeApp.tsx +1 -0
- package/ui/tree/TreeMenu.d.ts +1 -0
- package/ui/tree/TreeMenu.js +1 -0
- package/ui/tree/TreeMenu.md +35 -0
- package/ui/tree/TreeMenu.tsx +1 -0
- package/ui/tree/TreeSidebar.d.ts +1 -0
- package/ui/tree/TreeSidebar.js +1 -0
- package/ui/tree/TreeSidebar.md +24 -0
- package/ui/tree/TreeSidebar.tsx +1 -0
- package/ui/util/getClass.md +55 -0
- package/ui/util/notify.md +50 -0
- package/ui/util/requireContext.md +24 -0
- package/ui/app/README.md +0 -32
- package/ui/block/README.md +0 -144
- package/ui/dialog/README.md +0 -80
- package/ui/docs/README.md +0 -71
- package/ui/form/README.md +0 -165
- package/ui/inline/README.md +0 -86
- package/ui/layout/README.md +0 -71
- package/ui/menu/README.md +0 -33
- package/ui/misc/README.md +0 -121
- package/ui/notice/README.md +0 -94
- package/ui/page/README.md +0 -56
- package/ui/router/README.md +0 -186
- package/ui/transition/README.md +0 -80
- package/ui/tree/README.md +0 -78
- package/ui/util/README.md +0 -153
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Section
|
|
2
|
+
|
|
3
|
+
A landmark content region — renders a `<section>` with block-level spacing and a constrained content width. `Section.tsx` exports the whole family of semantic landmarks (`Section`, `Header`, `Footer`, `Nav`, `Aside`, `Figure`) — they share `SectionProps` and differ only in the HTML element they render.
|
|
4
|
+
|
|
5
|
+
**Things to know:**
|
|
6
|
+
|
|
7
|
+
- Pick the component whose HTML element matches the semantic meaning rather than reaching for a generic [`Block`](/ui/Block). `<Section>` is a `<section>`, `<Nav>` a `<nav>`, `<Figure>` a `<figure>`, and so on.
|
|
8
|
+
- Every section centres its content and caps the line length so text never touches the viewport edges. Nested sections relax that cap so they can fill their parent.
|
|
9
|
+
- Pass `narrow` / `wide` / `full` to constrain or unconstrain the width, and the usual `color` / `space` / typography variants to retint and respace.
|
|
10
|
+
- Pair [`Figure`](/ui/Section) with [`Caption`](/ui/Caption) for a `<figure>` / `<figcaption>` pair.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Structured page section
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { Section, Heading, Definitions } from "shelving/ui";
|
|
18
|
+
|
|
19
|
+
<Section narrow>
|
|
20
|
+
<Heading>Account details</Heading>
|
|
21
|
+
<Definitions>
|
|
22
|
+
<dt>Name</dt><dd>Alice Smith</dd>
|
|
23
|
+
<dt>Email</dt><dd>alice@example.com</dd>
|
|
24
|
+
<dt>Plan</dt><dd>Pro</dd>
|
|
25
|
+
</Definitions>
|
|
26
|
+
</Section>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Landmark elements
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { Header, Nav, Footer } from "shelving/ui";
|
|
33
|
+
|
|
34
|
+
<Header><Title>Welcome</Title></Header>
|
|
35
|
+
<Nav><Link href="/">Home</Link></Nav>
|
|
36
|
+
<Footer><Small>© 2026</Small></Footer>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Styling
|
|
40
|
+
|
|
41
|
+
`Section` exposes hooks for its width and rhythm; it paints no colour of its own, so it inherits the surrounding tint.
|
|
42
|
+
|
|
43
|
+
| Variable | Styles | Default |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `--section-width` | Content width | `100%` |
|
|
46
|
+
| `--section-indent` | Inline gutter kept on each side so text doesn't touch the edges | `var(--space-normal)` (16px) |
|
|
47
|
+
| `--section-space` | Outer block margin (top + bottom) | `var(--space-section)` (2rem) |
|
|
48
|
+
|
|
49
|
+
**Global tokens it reads:** `--space-normal` and `--space-section`. The `narrow` / `wide` / `full` width variants come from the shared [`ui`](/ui) styling system.
|
|
50
|
+
|
|
51
|
+
## See also
|
|
52
|
+
|
|
53
|
+
- [`Block`](/ui/Block) — the unstyled `<div>` equivalent when no landmark semantics are needed.
|
|
54
|
+
- [`Panel`](/ui/Panel) — a full-width band that paints the surface; sections sit inside the inner block.
|
|
55
|
+
- [`Caption`](/ui/Caption) — the `<figcaption>` that pairs with `Figure`.
|
|
56
|
+
- [`ui`](/ui) — the styling system: width variants, tint ladder, and theming.
|
package/ui/block/Section.tsx
CHANGED
|
@@ -60,6 +60,7 @@ function renderSection(
|
|
|
60
60
|
* `<section>` block with block-level spacing.
|
|
61
61
|
* - Pass `as` to render a different semantic element.
|
|
62
62
|
*
|
|
63
|
+
* @kind component
|
|
63
64
|
* @param props Colour, space, typography, and width variants plus optional `as` override and `children`.
|
|
64
65
|
* @returns Rendered `<section>` element.
|
|
65
66
|
* @example <Section><Heading>About</Heading></Section>
|
|
@@ -72,6 +73,7 @@ export function Section(props: SectionProps): ReactElement {
|
|
|
72
73
|
/**
|
|
73
74
|
* `<header>` block with block-level spacing.
|
|
74
75
|
*
|
|
76
|
+
* @kind component
|
|
75
77
|
* @param props Colour, space, typography, and width variants plus optional `as` override and `children`.
|
|
76
78
|
* @returns Rendered `<header>` element.
|
|
77
79
|
* @example <Header><Title>Welcome</Title></Header>
|
|
@@ -84,6 +86,7 @@ export function Header(props: SectionProps): ReactElement {
|
|
|
84
86
|
/**
|
|
85
87
|
* `<footer>` block with block-level spacing.
|
|
86
88
|
*
|
|
89
|
+
* @kind component
|
|
87
90
|
* @param props Colour, space, typography, and width variants plus optional `as` override and `children`.
|
|
88
91
|
* @returns Rendered `<footer>` element.
|
|
89
92
|
* @example <Footer><Small>© 2026</Small></Footer>
|
|
@@ -96,6 +99,7 @@ export function Footer(props: SectionProps): ReactElement {
|
|
|
96
99
|
/**
|
|
97
100
|
* `<nav>` block with block-level spacing.
|
|
98
101
|
*
|
|
102
|
+
* @kind component
|
|
99
103
|
* @param props Colour, space, typography, and width variants plus optional `as` override and `children`.
|
|
100
104
|
* @returns Rendered `<nav>` element.
|
|
101
105
|
* @example <Nav><Link href="/">Home</Link></Nav>
|
|
@@ -108,6 +112,7 @@ export function Nav(props: SectionProps): ReactElement {
|
|
|
108
112
|
/**
|
|
109
113
|
* `<aside>` block with block-level spacing.
|
|
110
114
|
*
|
|
115
|
+
* @kind component
|
|
111
116
|
* @param props Colour, space, typography, and width variants plus optional `as` override and `children`.
|
|
112
117
|
* @returns Rendered `<aside>` element.
|
|
113
118
|
* @example <Aside narrow><Paragraph>Sidebar</Paragraph></Aside>
|
|
@@ -120,6 +125,7 @@ export function Aside(props: SectionProps): ReactElement {
|
|
|
120
125
|
/**
|
|
121
126
|
* `<figure>` block with block-level spacing. Pair with `<Caption>` for `<figcaption>` content.
|
|
122
127
|
*
|
|
128
|
+
* @kind component
|
|
123
129
|
* @param props Colour, space, typography, and width variants plus optional `as` override and `children`.
|
|
124
130
|
* @returns Rendered `<figure>` element.
|
|
125
131
|
* @example <Figure><Image src="/cat.jpg" /><Caption>A cat</Caption></Figure>
|
package/ui/block/Subheading.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type SubheadingProps = HeadingProps;
|
|
|
22
22
|
* Subsection heading — renders an `<h3>`.
|
|
23
23
|
* - Only marginally larger than body text; its bold weight is the main differentiator.
|
|
24
24
|
*
|
|
25
|
+
* @kind component
|
|
25
26
|
* @param props Colour, space, and typography variants plus an optional `level` override and `children`.
|
|
26
27
|
* @returns Rendered `<h3>` heading element.
|
|
27
28
|
* @example <Subheading>Details</Subheading>
|
package/ui/block/Subheading.js
CHANGED
|
@@ -20,6 +20,7 @@ export const SUBHEADING_PROSE_CLASS = getModuleClass(SUBHEADING_CSS, "prose");
|
|
|
20
20
|
* Subsection heading — renders an `<h3>`.
|
|
21
21
|
* - Only marginally larger than body text; its bold weight is the main differentiator.
|
|
22
22
|
*
|
|
23
|
+
* @kind component
|
|
23
24
|
* @param props Colour, space, and typography variants plus an optional `level` override and `children`.
|
|
24
25
|
* @returns Rendered `<h3>` heading element.
|
|
25
26
|
* @example <Subheading>Details</Subheading>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Subheading
|
|
2
|
+
|
|
3
|
+
A subsection heading — renders an `<h3>`. It is the smallest member of the three-level heading family: [`Title`](/ui/Title) (`<h1>`), [`Heading`](/ui/Heading) (`<h2>`), `Subheading` (`<h3>`). Use it for card titles, in-section labels, and panel titles.
|
|
4
|
+
|
|
5
|
+
**Things to know:**
|
|
6
|
+
|
|
7
|
+
- Only marginally larger than body text; its bold weight is the main differentiator.
|
|
8
|
+
- Pick the component that matches the level rather than overriding `level` — that keeps the visual size and the document outline in step.
|
|
9
|
+
- The `level` prop (`1`–`6`) is an escape hatch for the rare case where the outline level must differ from the visual size — avoid it in normal use.
|
|
10
|
+
- Inherits text colour by default so it picks up the surrounding tint; accepts `color=` and the typography variants.
|
|
11
|
+
- Inside [`Prose`](/ui/Prose) raw `<h3>`–`<h6>` are styled by the same rules, so Markdown-rendered subheadings match component ones.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Card title
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Card, Subheading, Paragraph } from "shelving/ui";
|
|
19
|
+
|
|
20
|
+
<Card>
|
|
21
|
+
<Subheading>Storage</Subheading>
|
|
22
|
+
<Paragraph>1.2 GB of 5 GB used.</Paragraph>
|
|
23
|
+
</Card>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### The heading family together
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { Title, Heading, Subheading } from "shelving/ui";
|
|
30
|
+
|
|
31
|
+
<Title>Account</Title> {/* <h1> */}
|
|
32
|
+
<Heading>Security</Heading> {/* <h2> */}
|
|
33
|
+
<Subheading>Sessions</Subheading> {/* <h3> */}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Styling
|
|
37
|
+
|
|
38
|
+
`Subheading` exposes hooks for its rhythm and type. It inherits text colour by default; set `--subheading-color` only to override that.
|
|
39
|
+
|
|
40
|
+
| Variable | Styles | Default |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| `--subheading-tint` | Tint anchor for the subheading scope | `inherit` (flows from `color=` / parent) |
|
|
43
|
+
| `--subheading-color` | Text colour | `inherit` |
|
|
44
|
+
| `--subheading-space-before` | Top margin | `var(--space-section)` (2rem) |
|
|
45
|
+
| `--subheading-space` | Bottom margin | `var(--space-paragraph)` (16px) |
|
|
46
|
+
| `--subheading-font` | Font family | `var(--font-title)` |
|
|
47
|
+
| `--subheading-weight` | Font weight | `var(--weight-strong)` (700) |
|
|
48
|
+
| `--subheading-size` | Font size | `var(--size-large)` |
|
|
49
|
+
| `--subheading-leading` | Line height | `var(--leading)` |
|
|
50
|
+
|
|
51
|
+
**Global tokens it reads:** `--space-section`, `--space-paragraph`, `--font-title`, `--weight-strong`, `--size-large`, and `--leading`.
|
|
52
|
+
|
|
53
|
+
## See also
|
|
54
|
+
|
|
55
|
+
- [`Heading`](/ui/Heading) — the `<h2>` section heading one level up.
|
|
56
|
+
- [`Title`](/ui/Title) — the top-level page `<h1>`.
|
|
57
|
+
- [`Card`](/ui/Card) — a boxed surface whose title is usually a `Subheading`.
|
|
58
|
+
- [`ui`](/ui) — the styling system: tint ladder, typography variants, and theming.
|
package/ui/block/Subheading.tsx
CHANGED
|
@@ -31,6 +31,7 @@ export type SubheadingProps = HeadingProps;
|
|
|
31
31
|
* Subsection heading — renders an `<h3>`.
|
|
32
32
|
* - Only marginally larger than body text; its bold weight is the main differentiator.
|
|
33
33
|
*
|
|
34
|
+
* @kind component
|
|
34
35
|
* @param props Colour, space, and typography variants plus an optional `level` override and `children`.
|
|
35
36
|
* @returns Rendered `<h3>` heading element.
|
|
36
37
|
* @example <Subheading>Details</Subheading>
|
package/ui/block/Table.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface TableProps extends ColorVariants, SpaceVariants, TypographyVari
|
|
|
27
27
|
* - Wrap in a `<Scroll horizontal>` if the table may exceed the container width on small screens.
|
|
28
28
|
* - `<th>` / `<td>` cells draw the borders (the `<table>` element itself has none); override their weight via the `--table-border` / `--table-stroke` hooks.
|
|
29
29
|
*
|
|
30
|
+
* @kind component
|
|
30
31
|
* @param props Colour, space, and typography variants plus `children`.
|
|
31
32
|
* @returns Rendered `<table>` element.
|
|
32
33
|
* @example <Table><tbody><tr><td>Cell</td></tr></tbody></Table>
|
package/ui/block/Table.js
CHANGED
|
@@ -21,6 +21,7 @@ export const TABLE_PROSE_CLASS = getModuleClass(TABLE_CSS, "prose");
|
|
|
21
21
|
* - Wrap in a `<Scroll horizontal>` if the table may exceed the container width on small screens.
|
|
22
22
|
* - `<th>` / `<td>` cells draw the borders (the `<table>` element itself has none); override their weight via the `--table-border` / `--table-stroke` hooks.
|
|
23
23
|
*
|
|
24
|
+
* @kind component
|
|
24
25
|
* @param props Colour, space, and typography variants plus `children`.
|
|
25
26
|
* @returns Rendered `<table>` element.
|
|
26
27
|
* @example <Table><tbody><tr><td>Cell</td></tr></tbody></Table>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
A data table — renders a `<table>`. Compose the usual `<thead>` / `<tbody>` / `<tfoot>`, `<tr>`, `<th>`, and `<td>` markup inside it; the component supplies the spacing, borders, and label typography.
|
|
4
|
+
|
|
5
|
+
**Things to know:**
|
|
6
|
+
|
|
7
|
+
- The `<table>` element itself draws no borders — the `<th>` / `<td>` cells do. Header (`<thead>`) and footer (`<tfoot>`) cells render in the smaller, uppercase label style.
|
|
8
|
+
- First and last cells in a row drop their outer inline padding so the table aligns flush with the surrounding text column.
|
|
9
|
+
- Wrap a wide table in a horizontally scrollable container if it may exceed the content width on small screens.
|
|
10
|
+
- Like the other block components it collapses its outer block margin when it is the first or last child.
|
|
11
|
+
- Inside [`Prose`](/ui/Prose) a raw `<table>` picks up the same styling, so Markdown-rendered tables match component ones.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Basic table
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Table } from "shelving/ui";
|
|
19
|
+
|
|
20
|
+
<Table>
|
|
21
|
+
<thead>
|
|
22
|
+
<tr><th>Name</th><th>Plan</th></tr>
|
|
23
|
+
</thead>
|
|
24
|
+
<tbody>
|
|
25
|
+
<tr><td>Alice</td><td>Pro</td></tr>
|
|
26
|
+
<tr><td>Bob</td><td>Free</td></tr>
|
|
27
|
+
</tbody>
|
|
28
|
+
</Table>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Styling
|
|
32
|
+
|
|
33
|
+
`Table` exposes hooks for its rhythm, cell padding, and border; it paints no surface of its own, so it inherits the surrounding tint.
|
|
34
|
+
|
|
35
|
+
| Variable | Styles | Default |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `--table-space` | Outer block margin (top + bottom) | `var(--space-paragraph)` (16px) |
|
|
38
|
+
| `--table-padding` | Cell padding (block + inline) | `var(--space-xsmall)` |
|
|
39
|
+
| `--table-border` | Cell border shorthand | `var(--table-stroke)` |
|
|
40
|
+
| `--table-stroke` | Cell border thickness/colour | `var(--stroke-normal) solid var(--tint-80)` |
|
|
41
|
+
| `--table-header-weight` | Weight of `<thead>` / `<tfoot>` / `<tbody> <th>` cells | `var(--weight-strong)` |
|
|
42
|
+
| `--table-label-font` | Label font for `<thead>` / `<tfoot>` `<th>` | `var(--font-label)` |
|
|
43
|
+
| `--table-label-weight` | Label weight | `var(--weight-label)` |
|
|
44
|
+
| `--table-label-size` | Label size | `var(--size-label)` |
|
|
45
|
+
| `--table-label-case` | Label letter case | `var(--case-label)` |
|
|
46
|
+
| `--table-label-color` | Label colour | `var(--tint-70)` |
|
|
47
|
+
|
|
48
|
+
**Global tokens it reads:** `--space-paragraph`, `--space-xsmall`, `--stroke-normal`, the tint-ladder steps `--tint-70` / `--tint-80`, and the label tokens `--font-label` / `--weight-label` / `--size-label` / `--case-label` / `--weight-strong`.
|
|
49
|
+
|
|
50
|
+
## See also
|
|
51
|
+
|
|
52
|
+
- [`Definitions`](/ui/Definitions) — term/value pairs when a two-column key/value layout fits better than a grid.
|
|
53
|
+
- [`Prose`](/ui/Prose) — styles raw `<table>` inside longform content.
|
|
54
|
+
- [`ui`](/ui) — the styling system: tint ladder, label tokens, and theming.
|
package/ui/block/Table.tsx
CHANGED
|
@@ -32,6 +32,7 @@ export interface TableProps extends ColorVariants, SpaceVariants, TypographyVari
|
|
|
32
32
|
* - Wrap in a `<Scroll horizontal>` if the table may exceed the container width on small screens.
|
|
33
33
|
* - `<th>` / `<td>` cells draw the borders (the `<table>` element itself has none); override their weight via the `--table-border` / `--table-stroke` hooks.
|
|
34
34
|
*
|
|
35
|
+
* @kind component
|
|
35
36
|
* @param props Colour, space, and typography variants plus `children`.
|
|
36
37
|
* @returns Rendered `<table>` element.
|
|
37
38
|
* @example <Table><tbody><tr><td>Cell</td></tr></tbody></Table>
|
package/ui/block/Title.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type TitleProps = HeadingProps;
|
|
|
22
22
|
* Page title — renders an `<h1>`.
|
|
23
23
|
* - The most prominent heading on a page; there should normally be exactly one.
|
|
24
24
|
*
|
|
25
|
+
* @kind component
|
|
25
26
|
* @param props Colour, space, and typography variants plus an optional `level` override and `children`.
|
|
26
27
|
* @returns Rendered `<h1>` heading element.
|
|
27
28
|
* @example <Title>Welcome</Title>
|
package/ui/block/Title.js
CHANGED
|
@@ -20,6 +20,7 @@ export const TITLE_PROSE_CLASS = getModuleClass(TITLE_CSS, "prose");
|
|
|
20
20
|
* Page title — renders an `<h1>`.
|
|
21
21
|
* - The most prominent heading on a page; there should normally be exactly one.
|
|
22
22
|
*
|
|
23
|
+
* @kind component
|
|
23
24
|
* @param props Colour, space, and typography variants plus an optional `level` override and `children`.
|
|
24
25
|
* @returns Rendered `<h1>` heading element.
|
|
25
26
|
* @example <Title>Welcome</Title>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Title
|
|
2
|
+
|
|
3
|
+
The top-level page heading — renders an `<h1>`. It is the most prominent member of the three-level heading family: `Title` (`<h1>`), [`Heading`](/ui/Heading) (`<h2>`), [`Subheading`](/ui/Subheading) (`<h3>`). There should normally be exactly one `Title` per page.
|
|
4
|
+
|
|
5
|
+
**Things to know:**
|
|
6
|
+
|
|
7
|
+
- Pick the component that matches the level rather than overriding `level`. Choosing `Title` / `Heading` / `Subheading` keeps the visual size and the document outline in step.
|
|
8
|
+
- The `level` prop (`1`–`6`) is an escape hatch for the rare case where the outline level must differ from the visual size — avoid it in normal use.
|
|
9
|
+
- Inherits text colour by default so it picks up the surrounding tint; accepts `color=` and the typography variants.
|
|
10
|
+
- Inside [`Prose`](/ui/Prose) a raw `<h1>` is styled by the same rules, so Markdown-rendered titles match component ones.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Page title
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { Title, Paragraph } from "shelving/ui";
|
|
18
|
+
|
|
19
|
+
<Title>Account</Title>
|
|
20
|
+
<Paragraph>Manage your profile and settings.</Paragraph>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Inside a panel header
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Panel, Block, Title } from "shelving/ui";
|
|
27
|
+
|
|
28
|
+
<Panel as="header" color="primary">
|
|
29
|
+
<Block narrow>
|
|
30
|
+
<Title>Welcome</Title>
|
|
31
|
+
</Block>
|
|
32
|
+
</Panel>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Styling
|
|
36
|
+
|
|
37
|
+
`Title` exposes hooks for its rhythm and type. It inherits text colour by default; set `--title-color` only to override that.
|
|
38
|
+
|
|
39
|
+
| Variable | Styles | Default |
|
|
40
|
+
|---|---|---|
|
|
41
|
+
| `--title-tint` | Tint anchor for the title scope | `inherit` (flows from `color=` / parent) |
|
|
42
|
+
| `--title-color` | Text colour | `inherit` |
|
|
43
|
+
| `--title-space-before` | Top margin | `var(--space-section)` (2rem) |
|
|
44
|
+
| `--title-space` | Bottom margin | `var(--space-paragraph)` (16px) |
|
|
45
|
+
| `--title-font` | Font family | `var(--font-title)` |
|
|
46
|
+
| `--title-weight` | Font weight | `var(--weight-strong)` (700) |
|
|
47
|
+
| `--title-size` | Font size | `var(--size-xxxlarge)` |
|
|
48
|
+
| `--title-leading` | Line height | `var(--leading)` |
|
|
49
|
+
|
|
50
|
+
**Global tokens it reads:** `--space-section`, `--space-paragraph`, `--font-title`, `--weight-strong`, `--size-xxxlarge`, and `--leading`.
|
|
51
|
+
|
|
52
|
+
## See also
|
|
53
|
+
|
|
54
|
+
- [`Heading`](/ui/Heading) — the `<h2>` section heading that pairs with `Title`.
|
|
55
|
+
- [`Subheading`](/ui/Subheading) — the `<h3>` subsection heading.
|
|
56
|
+
- [`Section`](/ui/Section) — wraps a title and its content as a landmark region.
|
|
57
|
+
- [`ui`](/ui) — the styling system: tint ladder, typography variants, and theming.
|
package/ui/block/Title.tsx
CHANGED
|
@@ -31,6 +31,7 @@ export type TitleProps = HeadingProps;
|
|
|
31
31
|
* Page title — renders an `<h1>`.
|
|
32
32
|
* - The most prominent heading on a page; there should normally be exactly one.
|
|
33
33
|
*
|
|
34
|
+
* @kind component
|
|
34
35
|
* @param props Colour, space, and typography variants plus an optional `level` override and `children`.
|
|
35
36
|
* @returns Rendered `<h1>` heading element.
|
|
36
37
|
* @example <Title>Welcome</Title>
|
package/ui/dialog/Dialog.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface DialogProps extends OptionalChildProps {
|
|
|
16
16
|
* - Opens via `showModal()` when mounted and closes on backdrop clicks, link/nav-button clicks, or the close button.
|
|
17
17
|
* - Wraps content in `<Suspense>` so lazy children can stream in.
|
|
18
18
|
*
|
|
19
|
+
* @kind component
|
|
19
20
|
* @example dialogs.show(<Dialog><p>Are you sure?</p></Dialog>);
|
|
20
21
|
* @see https://dhoulb.github.io/shelving/ui/dialog/Dialog/Dialog
|
|
21
22
|
*/
|
package/ui/dialog/Dialog.js
CHANGED
|
@@ -9,6 +9,7 @@ import styles from "./Dialog.module.css";
|
|
|
9
9
|
* - Opens via `showModal()` when mounted and closes on backdrop clicks, link/nav-button clicks, or the close button.
|
|
10
10
|
* - Wraps content in `<Suspense>` so lazy children can stream in.
|
|
11
11
|
*
|
|
12
|
+
* @kind component
|
|
12
13
|
* @example dialogs.show(<Dialog><p>Are you sure?</p></Dialog>);
|
|
13
14
|
* @see https://dhoulb.github.io/shelving/ui/dialog/Dialog/Dialog
|
|
14
15
|
*/
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Dialog
|
|
2
|
+
|
|
3
|
+
A native `<dialog>` element opened in modal mode. It opens via `showModal()` when mounted and includes a built-in close button, so it works equally well mounted declaratively in the tree or pushed imperatively through a [`DialogsStore`](/ui/DialogsStore).
|
|
4
|
+
|
|
5
|
+
**Things to know:**
|
|
6
|
+
|
|
7
|
+
- Closes on a backdrop click, on any link or `<nav>` button clicked inside it, or via the built-in [`DialogCloseButton`](/ui/DialogCloseButton) (an X icon, top-right).
|
|
8
|
+
- Children render inside a `<Suspense>` boundary, so lazy content can stream in.
|
|
9
|
+
- `onClose` fires when the dialog closes — use it to clear the React state that mounts the dialog, or (when pushed via a store) to remove it from the list.
|
|
10
|
+
- Pair with [`DialogsStore`](/ui/DialogsStore), [`DialogsContext`](/ui/DialogsContext), and [`Dialogs`](/ui/Dialogs) to open dialogs imperatively from anywhere in the app. For a non-blocking persistent overlay, reach for [`Modal`](/ui/Modal) instead.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Declarative
|
|
15
|
+
|
|
16
|
+
Mount `<Dialog>` directly when its lifetime matches a React state variable.
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { Dialog, DialogCloseButton } from "shelving/ui";
|
|
20
|
+
|
|
21
|
+
function ConfirmDelete({ onConfirm, onClose }: { onConfirm: () => void; onClose: () => void }) {
|
|
22
|
+
return (
|
|
23
|
+
<Dialog onClose={onClose}>
|
|
24
|
+
<p>Delete this item?</p>
|
|
25
|
+
<button type="button" onClick={onConfirm}>Delete</button>
|
|
26
|
+
<DialogCloseButton />
|
|
27
|
+
</Dialog>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// In the parent:
|
|
32
|
+
{showConfirm && <ConfirmDelete onConfirm={handleDelete} onClose={() => setShowConfirm(false)} />}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Imperative
|
|
36
|
+
|
|
37
|
+
Set up the context once near the app root (see [`DialogsContext`](/ui/DialogsContext) and [`Dialogs`](/ui/Dialogs)), then push a `<Dialog>` from anywhere with [`requireDialogs()`](/ui/requireDialogs).
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { requireDialogs } from "shelving/ui";
|
|
41
|
+
|
|
42
|
+
function DeleteButton({ id }: { id: string }) {
|
|
43
|
+
const dialogs = requireDialogs();
|
|
44
|
+
const open = () => dialogs.show(
|
|
45
|
+
<ConfirmDelete id={id} onConfirm={() => handleDelete(id)} />,
|
|
46
|
+
);
|
|
47
|
+
return <button type="button" onClick={open}>Delete</button>;
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`dialogs.show()` wraps the content in a `<Dialog>` for you, so you pass plain children rather than a `<Dialog>` element.
|
|
52
|
+
|
|
53
|
+
## Styling
|
|
54
|
+
|
|
55
|
+
`Dialog` paints the full-screen overlay; the inner panel is laid out by its children. Override these hooks at `:root` (or any ancestor scope) to retheme.
|
|
56
|
+
|
|
57
|
+
| Variable | Styles | Default |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `--dialog-padding` | Padding around the centred content | `var(--space-normal)` (16px) |
|
|
60
|
+
| `--dialog-color-overlay` | Backdrop fill behind the content | `var(--color-shadow)` |
|
|
61
|
+
| `--dialog-transition` | Open / close transition | `all var(--duration-fast)` (150ms) |
|
|
62
|
+
| `--dialog-close-offset` | Inset of the close button from the top-right corner | `var(--space-small)` (8px) |
|
|
63
|
+
|
|
64
|
+
**Global tokens it reads** — move these to retheme broadly: `--space-normal`, `--space-small`, `--color-shadow`, and `--duration-fast`.
|
|
65
|
+
|
|
66
|
+
## See also
|
|
67
|
+
|
|
68
|
+
- [`Modal`](/ui/Modal) — a non-blocking `<aside>` overlay for persistent panels.
|
|
69
|
+
- [`DialogsStore`](/ui/DialogsStore) — push dialogs imperatively; `.show()` and `.hideAll()`.
|
|
70
|
+
- [`DialogsContext`](/ui/DialogsContext) / [`Dialogs`](/ui/Dialogs) — provide a store and render its open dialogs.
|
|
71
|
+
- [`notice`](/ui) — inline and global notices (toasts, banners).
|
|
72
|
+
- [`form`](/ui) — form components to put inside dialogs.
|
|
73
|
+
- [`transition`](/ui) — animate dialog enter / leave.
|
package/ui/dialog/Dialog.tsx
CHANGED
|
@@ -21,6 +21,7 @@ export interface DialogProps extends OptionalChildProps {
|
|
|
21
21
|
* - Opens via `showModal()` when mounted and closes on backdrop clicks, link/nav-button clicks, or the close button.
|
|
22
22
|
* - Wraps content in `<Suspense>` so lazy children can stream in.
|
|
23
23
|
*
|
|
24
|
+
* @kind component
|
|
24
25
|
* @example dialogs.show(<Dialog><p>Are you sure?</p></Dialog>);
|
|
25
26
|
* @see https://dhoulb.github.io/shelving/ui/dialog/Dialog/Dialog
|
|
26
27
|
*/
|
package/ui/dialog/Modal.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface ModalProps extends OptionalChildProps {
|
|
|
10
10
|
/**
|
|
11
11
|
* Styled `<aside>` overlay container for modal content.
|
|
12
12
|
*
|
|
13
|
+
* @kind component
|
|
13
14
|
* @param children The modal content.
|
|
14
15
|
* @returns The modal container element.
|
|
15
16
|
* @example <Modal><p>Modal content</p></Modal>
|
package/ui/dialog/Modal.js
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Modal
|
|
2
|
+
|
|
3
|
+
A non-blocking `<aside>` overlay for persistent panels — drawers, toasts, and side-sheets that coexist with the page rather than blocking interaction with it. Unlike [`Dialog`](/ui/Dialog), it is not a native `<dialog>` and does not trap focus or dim the page.
|
|
4
|
+
|
|
5
|
+
**Things to know:**
|
|
6
|
+
|
|
7
|
+
- Reach for `Modal` when the overlay should sit alongside the page (a notification panel, a side drawer); reach for [`Dialog`](/ui/Dialog) when it should block interaction until dismissed.
|
|
8
|
+
- It only styles the box — lay out its contents with the usual block components.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { Modal } from "shelving/ui";
|
|
14
|
+
|
|
15
|
+
<Modal>
|
|
16
|
+
<NotificationPanel />
|
|
17
|
+
</Modal>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Styling
|
|
21
|
+
|
|
22
|
+
`Modal` paints a bordered, shadowed surface. Override these hooks at `:root` (or any ancestor scope) to retheme.
|
|
23
|
+
|
|
24
|
+
| Variable | Styles | Default |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| `--modal-width` | Box width | `var(--width-narrow)` |
|
|
27
|
+
| `--modal-border` | Border shorthand | `var(--stroke-normal)` solid, 50% of `--tint-50` |
|
|
28
|
+
| `--modal-radius` | Corner radius | `var(--radius-normal)` (16px) |
|
|
29
|
+
| `--modal-color-bg` | Surface fill | `var(--tint-100)` |
|
|
30
|
+
| `--modal-padding` | Inner padding | `var(--space-normal)` (16px) |
|
|
31
|
+
| `--modal-color-text` | Text colour | `var(--tint-00)` |
|
|
32
|
+
| `--modal-transition` | Transition | `all var(--duration-fast)` (150ms) |
|
|
33
|
+
| `--modal-shadow` | Drop shadow | `var(--shadow-normal)` |
|
|
34
|
+
|
|
35
|
+
**Global tokens it reads** — move these to retheme broadly: the tint ladder `--tint-00` / `--tint-50` / `--tint-100`, plus `--width-narrow`, `--space-normal`, `--radius-normal`, `--stroke-normal`, `--shadow-normal`, and `--duration-fast`.
|
|
36
|
+
|
|
37
|
+
## See also
|
|
38
|
+
|
|
39
|
+
- [`Dialog`](/ui/Dialog) — a blocking modal `<dialog>` with backdrop and close button.
|
|
40
|
+
- [`Dialogs`](/ui/Dialogs) — render imperatively-pushed dialogs near the app root.
|
package/ui/dialog/Modal.tsx
CHANGED
|
@@ -12,6 +12,7 @@ export interface ModalProps extends OptionalChildProps {}
|
|
|
12
12
|
/**
|
|
13
13
|
* Styled `<aside>` overlay container for modal content.
|
|
14
14
|
*
|
|
15
|
+
* @kind component
|
|
15
16
|
* @param children The modal content.
|
|
16
17
|
* @returns The modal container element.
|
|
17
18
|
* @example <Modal><p>Modal content</p></Modal>
|
|
@@ -15,5 +15,7 @@ export interface DocumentationButtonsProps extends Pick<DocumentationElementProp
|
|
|
15
15
|
* - The target is a `<DocumentationButton>`, so it links to the referenced page when it exists in the tree and stays a plain label otherwise.
|
|
16
16
|
* - Block spacing defaults to paragraph spacing (via `PARAGRAPH_CLASS`); pass `space` to override. Inner spacing is the flex gap.
|
|
17
17
|
* - Renders nothing when the symbol has no relations.
|
|
18
|
+
*
|
|
19
|
+
* @kind component
|
|
18
20
|
*/
|
|
19
21
|
export declare function DocumentationButtons({ wrap, left, gap, ...props }: DocumentationButtonsProps): ReactElement | null;
|
|
@@ -20,6 +20,8 @@ function* _relations({ class: className, extends: extendsName, implements: imple
|
|
|
20
20
|
* - The target is a `<DocumentationButton>`, so it links to the referenced page when it exists in the tree and stays a plain label otherwise.
|
|
21
21
|
* - Block spacing defaults to paragraph spacing (via `PARAGRAPH_CLASS`); pass `space` to override. Inner spacing is the flex gap.
|
|
22
22
|
* - Renders nothing when the symbol has no relations.
|
|
23
|
+
*
|
|
24
|
+
* @kind component
|
|
23
25
|
*/
|
|
24
26
|
export function DocumentationButtons({ wrap = true, left = true, gap = "none", ...props }) {
|
|
25
27
|
const relations = Array.from(_relations(props));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# DocumentationButtons
|
|
2
|
+
|
|
3
|
+
Renders a documented symbol's relational metadata as a `<nav>` column of labelled links — `extends AbstractStore`, `implements Serializable`, `member of Store`. Used by both [`DocumentationPage`](/ui/DocumentationPage) (below the title) and [`DocumentationCard`](/ui/DocumentationCard).
|
|
4
|
+
|
|
5
|
+
**Things to know:**
|
|
6
|
+
|
|
7
|
+
- Each relation reads as `"{label} {Target}"`. The target is a [`TreeButton`](/ui/TreeButton), so it resolves the reference against the flattened tree map from [`TreeProvider`](/ui/TreeProvider): a hit becomes a link, a miss (e.g. a builtin like `Serializable`) renders as a plain non-linking label so the text still reads.
|
|
8
|
+
- Relations come from the raw metadata the extractor records — `extends` and `implements` first, then the broader `member of` (the `class` relation) last.
|
|
9
|
+
- It renders nothing when the symbol has no relations.
|
|
10
|
+
- Block spacing defaults to paragraph spacing (it composes `PARAGRAPH_CLASS`); pass `space` to override. Inner spacing is the flex gap.
|
|
11
|
+
- Exported (plural) from `docs/DocumentationButtons.tsx`.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Used automatically by [`DocumentationPage`](/ui/DocumentationPage) and [`DocumentationCard`](/ui/DocumentationCard). To render relations directly, pass the symbol's relational props.
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { DocumentationButtons } from "shelving/ui";
|
|
19
|
+
|
|
20
|
+
<DocumentationButtons class="Store" extends="AbstractStore" implements={["Serializable"]} />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Drop a relation by omitting it, or tighten spacing with `space`.
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<DocumentationButtons extends="AbstractStore" space="none" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Styling
|
|
30
|
+
|
|
31
|
+
`DocumentationButtons` has no own CSS hooks — it composes `PARAGRAPH_CLASS` for block spacing and the flex utilities for layout, and renders its links as [`TreeButton`](/ui/TreeButton)s. Retheme through those.
|
|
32
|
+
|
|
33
|
+
## See also
|
|
34
|
+
|
|
35
|
+
- [`DocumentationPage`](/ui/DocumentationPage) — renders these relations below the title.
|
|
36
|
+
- [`DocumentationCard`](/ui/DocumentationCard) — renders these relations inside the card (minus `member of`).
|
|
37
|
+
- [`TreeButton`](/ui/TreeButton) — resolves each reference to a link or plain label.
|
|
38
|
+
- [`TreeProvider`](/ui/TreeProvider) — provides the flattened tree map references are resolved against.
|
|
@@ -34,6 +34,8 @@ function* _relations({
|
|
|
34
34
|
* - The target is a `<DocumentationButton>`, so it links to the referenced page when it exists in the tree and stays a plain label otherwise.
|
|
35
35
|
* - Block spacing defaults to paragraph spacing (via `PARAGRAPH_CLASS`); pass `space` to override. Inner spacing is the flex gap.
|
|
36
36
|
* - Renders nothing when the symbol has no relations.
|
|
37
|
+
*
|
|
38
|
+
* @kind component
|
|
37
39
|
*/
|
|
38
40
|
export function DocumentationButtons({ wrap = true, left = true, gap = "none", ...props }: DocumentationButtonsProps): ReactElement | null {
|
|
39
41
|
const relations = Array.from(_relations(props));
|
|
@@ -5,6 +5,7 @@ import type { DocumentationElementProps } from "../../util/tree.js";
|
|
|
5
5
|
* - Leads with the symbol's signature(s) as calm code blocks (`<DocumentationSignatures>`, same as the detail page), which already carry the name; falls back to the bare name for symbols with no signature (classes, interfaces, modules).
|
|
6
6
|
* - The card is tinted by `kind` (colour carries the method/property/etc. distinction — no separate tag).
|
|
7
7
|
*
|
|
8
|
+
* @kind component
|
|
8
9
|
* @param props The documentation element's flattened props (`path`, `title`, `name`, `kind`, `description`, `signatures`, plus relational metadata); the `class` relation is dropped so member cards omit the redundant "member of" link.
|
|
9
10
|
* @returns A `<Card>` linking to the symbol's own page.
|
|
10
11
|
* @example <DocumentationCard {...element.props} />
|
|
@@ -11,6 +11,7 @@ import { DocumentationSignatures } from "./DocumentationSignatures.js";
|
|
|
11
11
|
* - Leads with the symbol's signature(s) as calm code blocks (`<DocumentationSignatures>`, same as the detail page), which already carry the name; falls back to the bare name for symbols with no signature (classes, interfaces, modules).
|
|
12
12
|
* - The card is tinted by `kind` (colour carries the method/property/etc. distinction — no separate tag).
|
|
13
13
|
*
|
|
14
|
+
* @kind component
|
|
14
15
|
* @param props The documentation element's flattened props (`path`, `title`, `name`, `kind`, `description`, `signatures`, plus relational metadata); the `class` relation is dropped so member cards omit the redundant "member of" link.
|
|
15
16
|
* @returns A `<Card>` linking to the symbol's own page.
|
|
16
17
|
* @example <DocumentationCard {...element.props} />
|