@jonmilner/ui 0.24.0 → 0.25.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/dist/Sidebar/index.mjs
CHANGED
package/dist/docs/Sidebar.md
CHANGED
|
@@ -24,6 +24,7 @@ An app's sidebar: a named `aside` on the `bgPanel` surface, with a header row, t
|
|
|
24
24
|
- The toggle is a `sm` `IconButton` in its default look, with no style of its own: the muted ghost (`fgMuted` at rest, `fg` on hover and focus) in the rail; open, its `aria-expanded="true"` gives it the open look every expanded button shows (ADR 0063). It sits at the header's inline end, named `toggleLabel` ("Toggle sidebar" by default). Its name stays the same in both states and `aria-expanded` says which is on. Its panel icon points at the sidebar's edge, mirrored in a right-to-left page.
|
|
25
25
|
- `header` sits before the toggle (a brand); `footer` sits after a rule at the bottom (theme, account), its children in a row. In the rail both stack in a column and center: pass what fits 40px (a mark, icon-only controls). `sm` IconButtons in their default muted ghost match the toggle in the rail; each keeps its `label` as its name in both states. Anything wider (an account's name) is yours to swap for an icon when `collapsed`.
|
|
26
26
|
- In the rail, every `NavList.Item` needs an `icon` or an `avatar`: it is the one part left in sight. Group headings, labels and counts are visually hidden, never removed.
|
|
27
|
+
- The body, between header and footer, is a flex column that takes the height they leave. Its children stack and take its width, not their content's, as blocks would (a long `NavList` label wraps, a `nowrap` child clips if you give it `overflow`), but adjacent margins don't collapse and inline children (text, a link) become stacked items: space blocks with a `Stack`, and wrap inline content in one. To pin a child to the body's foot, directly above the footer (a status block, a secondary list), give it `marginBlockStart="auto"`; in a wide SidebarLayout that is the bottom of the viewport.
|
|
27
28
|
- In a wide SidebarLayout the sidebar fills the viewport's height, so the footer sits at the bottom; stacked, it takes the whole row and its own height, with its rule below it. Outside a SidebarLayout it is the width above and its content's height: size it yourself.
|
|
28
29
|
- Its width is CSS keyed to the layout's container query, not a default style prop, and component CSS outranks style props: another width goes in your own `className`. In the rail the sidebar is a size container, so a rail width of your own must be a fixed length, never `max-content`; it is also the containing block for its fixed and absolute descendants and a stacking context, so a popup inside it should portal out, as the library's do. `backgroundColor` (`bgPanel`), `display` and `flexDirection` are default style props; the consumer's win.
|
|
29
30
|
- No hooks: a server component can render it. Pass `onCollapsedChange` from a client component; the toggle is the only client part.
|
package/dist/docs/manifest.json
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# 0.25.0
|
|
2
|
+
|
|
3
|
+
Sidebar's body, between its header and footer, is now a flex column that fills the height they leave, so a child with `marginBlockStart="auto"` pins itself directly above the footer. Most sidebars look the same; two kinds of children shift.
|
|
4
|
+
|
|
5
|
+
## Find
|
|
6
|
+
|
|
7
|
+
In the app's source (`*.tsx`), every Sidebar: regex `<Sidebar\b`. For each, read the children it passes (everything between the opening and closing tags, outside `header` and `footer`):
|
|
8
|
+
|
|
9
|
+
- Two or more block children spaced with margins (`marginBlockStart`, `marginBlockEnd`, or a margin in their own CSS): adjacent margins used to collapse into the larger one and now add up.
|
|
10
|
+
- Inline children passed directly: text, a link, a `span` or an `<a>`, not wrapped in a block. Each one is now its own stacked item instead of flowing in one line.
|
|
11
|
+
|
|
12
|
+
Every workaround that restyled the body as a grid or flex column to pin a block to its foot: regex `globalStyle\(` in `*.css.ts` near a Sidebar part, or `sidebar-library-parts`.
|
|
13
|
+
|
|
14
|
+
## Replace
|
|
15
|
+
|
|
16
|
+
Margins between children: wrap them in one `Stack` with a `gap`.
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
// Before
|
|
20
|
+
<Sidebar aria-label="Sidebar">
|
|
21
|
+
<NavList aria-label="Pages">…</NavList>
|
|
22
|
+
<Box marginBlockStart="16">…</Box>
|
|
23
|
+
</Sidebar>
|
|
24
|
+
|
|
25
|
+
// After
|
|
26
|
+
<Sidebar aria-label="Sidebar">
|
|
27
|
+
<Stack gap="16">
|
|
28
|
+
<NavList aria-label="Pages">…</NavList>
|
|
29
|
+
<Box>…</Box>
|
|
30
|
+
</Stack>
|
|
31
|
+
</Sidebar>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Inline children: wrap the run in one block.
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
// Before
|
|
38
|
+
<Sidebar aria-label="Sidebar">
|
|
39
|
+
Signed in as <a href="/me">Jon</a>
|
|
40
|
+
</Sidebar>
|
|
41
|
+
|
|
42
|
+
// After
|
|
43
|
+
<Sidebar aria-label="Sidebar">
|
|
44
|
+
<Body>
|
|
45
|
+
Signed in as <a href="/me">Jon</a>
|
|
46
|
+
</Body>
|
|
47
|
+
</Sidebar>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
A body restyled to pin a block: delete the `globalStyle` and its exception marker, and give the block `marginBlockStart="auto"`.
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
// Before: a globalStyle on the body part (display: grid), and
|
|
54
|
+
<Stack blockSize="full">
|
|
55
|
+
<NavList aria-label="Pages">…</NavList>
|
|
56
|
+
<Box className={pinnedToFoot}>…</Box>
|
|
57
|
+
</Stack>
|
|
58
|
+
|
|
59
|
+
// After
|
|
60
|
+
<NavList aria-label="Pages">…</NavList>
|
|
61
|
+
<Box marginBlockStart="auto">…</Box>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Verify
|
|
65
|
+
|
|
66
|
+
Run the app's typecheck and its browser or visual tests on every page with a Sidebar. Passing: no type errors, and the sidebar's rows, spacing and footer sit where they did, with any pinned block directly above the footer in a wide layout.
|