@estiva-app/ui 0.120.0 → 0.122.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/ActivityLine.d.ts.map +1 -1
- package/dist/CollapsibleSection.d.ts.map +1 -1
- package/dist/ListTable.d.ts +4 -2
- package/dist/ListTable.d.ts.map +1 -1
- package/dist/MembersPill.d.ts +7 -1
- package/dist/MembersPill.d.ts.map +1 -1
- package/dist/NavItem.d.ts.map +1 -1
- package/dist/NavTree.d.ts +7 -1
- package/dist/NavTree.d.ts.map +1 -1
- package/dist/SectionHeader.d.ts.map +1 -1
- package/dist/Skeleton.d.ts +1 -1
- package/dist/Skeleton.d.ts.map +1 -1
- package/dist/index.js +32 -16
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/registry.json +16 -3
- package/src/ActivityLine.mdx +3 -1
- package/src/ActivityLine.test.tsx +9 -0
- package/src/ActivityLine.tsx +6 -1
- package/src/CollapsibleSection.mdx +6 -3
- package/src/CollapsibleSection.test.tsx +22 -0
- package/src/CollapsibleSection.tsx +2 -1
- package/src/ListTable.mdx +7 -5
- package/src/ListTable.test.tsx +17 -0
- package/src/ListTable.tsx +12 -9
- package/src/MembersPill.mdx +6 -0
- package/src/MembersPill.stories.tsx +5 -0
- package/src/MembersPill.test.tsx +38 -0
- package/src/MembersPill.tsx +18 -2
- package/src/NavItem.mdx +2 -2
- package/src/NavItem.test.tsx +10 -1
- package/src/NavItem.tsx +9 -4
- package/src/NavTree.mdx +10 -0
- package/src/NavTree.stories.tsx +33 -0
- package/src/NavTree.test.tsx +26 -0
- package/src/NavTree.tsx +9 -2
- package/src/SectionHeader.mdx +3 -3
- package/src/SectionHeader.tsx +2 -1
- package/src/Skeleton.mdx +2 -2
- package/src/Skeleton.tsx +2 -2
- package/src/heights.test.tsx +8 -1
package/package.json
CHANGED
package/registry.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"kind": "package",
|
|
5
5
|
"repo": "estiva-ui",
|
|
6
6
|
"package": "@estiva-app/ui",
|
|
7
|
-
"packageVersion": "0.
|
|
7
|
+
"packageVersion": "0.122.0",
|
|
8
8
|
"exports": 256,
|
|
9
9
|
"typeExports": 270,
|
|
10
10
|
"files": null
|
|
@@ -7128,6 +7128,12 @@
|
|
|
7128
7128
|
"required": false,
|
|
7129
7129
|
"note": "Opens the list — usually a `MembersDialog`."
|
|
7130
7130
|
},
|
|
7131
|
+
{
|
|
7132
|
+
"name": "readOnly",
|
|
7133
|
+
"takes": "true/false",
|
|
7134
|
+
"required": false,
|
|
7135
|
+
"note": "Says who is in it and is nothing to press: the pill's own look, not greyed as a disabled one — in a list's row, which opens its thing (Katerina, 17 November: \"clicking on the pill should not show the members list."
|
|
7136
|
+
},
|
|
7131
7137
|
{
|
|
7132
7138
|
"name": "label",
|
|
7133
7139
|
"takes": "text",
|
|
@@ -7150,6 +7156,7 @@
|
|
|
7150
7156
|
"docPage": "src/MembersPill.mdx",
|
|
7151
7157
|
"app": null,
|
|
7152
7158
|
"looks": [
|
|
7159
|
+
"rounded-md border border-border-default font-sans font-medium text-btn-default text-text-primary",
|
|
7153
7160
|
"text-caption text-text-secondary signal:font-mono signal:text-small signal:tabular-nums"
|
|
7154
7161
|
]
|
|
7155
7162
|
},
|
|
@@ -8060,6 +8067,12 @@
|
|
|
8060
8067
|
"takes": "text",
|
|
8061
8068
|
"required": false,
|
|
8062
8069
|
"note": "Remember each group open or closed in this browser, under this key and the group's id."
|
|
8070
|
+
},
|
|
8071
|
+
{
|
|
8072
|
+
"name": "spaced",
|
|
8073
|
+
"takes": "true/false",
|
|
8074
|
+
"required": false,
|
|
8075
|
+
"note": "8px between the items an app draws as `children`, none above the first: a tree whose items are each a place with rows under it — Peek's teams (Katerina, 17 November: \"a bit more spacing between the parent expandable items\")."
|
|
8063
8076
|
}
|
|
8064
8077
|
],
|
|
8065
8078
|
"variants": [],
|
|
@@ -10437,7 +10450,7 @@
|
|
|
10437
10450
|
"kind": "component",
|
|
10438
10451
|
"importPath": "@estiva-app/ui",
|
|
10439
10452
|
"sourceFile": "src/SectionHeader.tsx",
|
|
10440
|
-
"purpose": "The
|
|
10453
|
+
"purpose": "The 28px row a section starts with, a list row's height: a SectionLabel, and actions that appear while the row is hovered or keyboard-focused, as IconButtons with tooltips — always, on a screen with no hover.",
|
|
10441
10454
|
"purposeFrom": "page",
|
|
10442
10455
|
"props": [
|
|
10443
10456
|
{
|
|
@@ -11206,7 +11219,7 @@
|
|
|
11206
11219
|
"kind": "component",
|
|
11207
11220
|
"importPath": "@estiva-app/ui",
|
|
11208
11221
|
"sourceFile": "src/Skeleton.tsx",
|
|
11209
|
-
"purpose": "A
|
|
11222
|
+
"purpose": "A 28px row, a list row's height: a 16px square and a bar, like a row with a face and a name.",
|
|
11210
11223
|
"purposeFrom": "comment",
|
|
11211
11224
|
"props": [
|
|
11212
11225
|
{
|
package/src/ActivityLine.mdx
CHANGED
|
@@ -18,7 +18,9 @@ One thing that happened, in a list of them: a mark for what kind of thing it is,
|
|
|
18
18
|
- `did`: what they did, after their name, in the app's words.
|
|
19
19
|
- `where`: the place it was said, before the words, on a list that mixes
|
|
20
20
|
places; absent on the place's own list.
|
|
21
|
-
- `seen`: an Earlier line — the name in the secondary text.
|
|
21
|
+
- `seen`: an Earlier line — the name in the secondary text, and no tint. A
|
|
22
|
+
new line (the default) wears the accent's wash, so what is new reads apart
|
|
23
|
+
at a glance; the pointer's fill still shows over it.
|
|
22
24
|
|
|
23
25
|
<Canvas of={ActivityLineStories.Seen} />
|
|
24
26
|
|
|
@@ -44,4 +44,13 @@ describe('ActivityLine', () => {
|
|
|
44
44
|
expect(row.className).toContain('rounded-lg')
|
|
45
45
|
expect(row.className).not.toMatch(/\bborder\b/)
|
|
46
46
|
})
|
|
47
|
+
|
|
48
|
+
it('a new line wears the accent’s wash, a seen one none; the pointer’s fill still shows over it (Katerina, 16 November)', () => {
|
|
49
|
+
const { rerender } = render(<ActivityLine {...line} />)
|
|
50
|
+
const row = () => screen.getByRole('button')
|
|
51
|
+
expect(row().className).toContain('bg-accent-wash')
|
|
52
|
+
expect(row().className).toContain('hover:bg-bg-hover')
|
|
53
|
+
rerender(<ActivityLine {...line} seen />)
|
|
54
|
+
expect(row().className).not.toContain('bg-accent-wash')
|
|
55
|
+
})
|
|
47
56
|
})
|
package/src/ActivityLine.tsx
CHANGED
|
@@ -58,7 +58,12 @@ export function ActivityLine({ person, did, time, mark, where, words, seen = fal
|
|
|
58
58
|
</span>
|
|
59
59
|
</MenuItemBody>
|
|
60
60
|
)
|
|
61
|
-
|
|
61
|
+
/*
|
|
62
|
+
A new line wears the accent's wash, the open replies row's tint, so what is new reads apart from what was seen at a
|
|
63
|
+
glance, under its "New" heading too (Katerina, 6 November: "We also need to have new stuff with bg color"; 16
|
|
64
|
+
November: "let's use background color on new items"). Seen, it is plain. The pointer's fill still shows over it.
|
|
65
|
+
*/
|
|
66
|
+
const row = menuItemClassName({ size: 'default', className: cn(!seen && 'bg-accent-wash', className) })
|
|
62
67
|
if (href) {
|
|
63
68
|
return (
|
|
64
69
|
<Link href={href} variant="plain" className={row} {...(onClick ? { onClick } : {})} {...rest}>
|
|
@@ -46,13 +46,16 @@ toggle, and the rows under it, sliding shut and open.
|
|
|
46
46
|
revealed while the row is hovered or keyboard-focused.
|
|
47
47
|
- `look="row"` when the section is a row among rows — a folder in a
|
|
48
48
|
sidebar, under a quiet label: the title at a row's weight, and its rows
|
|
49
|
-
indented under it, past the chevron
|
|
49
|
+
indented under it, past the chevron, the tree's line beside them, 1px
|
|
50
|
+
down from the chevron's middle (Katerina, 17 November), as a **NavItem**'s
|
|
51
|
+
rows have it.
|
|
50
52
|
|
|
51
53
|
<Canvas of={CollapsibleSectionStories.AsARow} />
|
|
52
54
|
|
|
53
55
|
- `indent` with the standard heading: its rows start under its title, past
|
|
54
|
-
the chevron — a group in a sidebar whose rows
|
|
55
|
-
draws its groups this way.
|
|
56
|
+
the chevron, the tree's line beside them — a group in a sidebar whose rows
|
|
57
|
+
read as inside it. **NavTree** draws its groups this way. The standard
|
|
58
|
+
heading without `indent` has no line: its rows are level with its title.
|
|
56
59
|
|
|
57
60
|
<Canvas of={CollapsibleSectionStories.Indented} />
|
|
58
61
|
|
|
@@ -93,6 +93,28 @@ describe('CollapsibleSection', () => {
|
|
|
93
93
|
})
|
|
94
94
|
|
|
95
95
|
/** Opened before its rows are in (0.65.1, OPT-11): the title says open, the panel waits. */
|
|
96
|
+
// The tree's line, as a row's (Katerina, 17 November).
|
|
97
|
+
describe('CollapsibleSection, its rows', () => {
|
|
98
|
+
it('a row-look fold draws the tree’s line beside its rows, 24px in', () => {
|
|
99
|
+
render(
|
|
100
|
+
<CollapsibleSection look="row" title="Files">
|
|
101
|
+
<a href="#one">One</a>
|
|
102
|
+
</CollapsibleSection>,
|
|
103
|
+
)
|
|
104
|
+
const classes = screen.getByRole('link', { name: 'One' }).parentElement!.className.split(' ')
|
|
105
|
+
expect(classes).toEqual(expect.arrayContaining(['border-l', 'border-border-default', 'ml-[15px]', 'pl-2']))
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
it('a heading draws no line: its rows are level with its title', () => {
|
|
109
|
+
render(
|
|
110
|
+
<CollapsibleSection title="Starred">
|
|
111
|
+
<a href="#one">One</a>
|
|
112
|
+
</CollapsibleSection>,
|
|
113
|
+
)
|
|
114
|
+
expect(screen.getByRole('link', { name: 'One' }).parentElement!.className.split(' ')).not.toContain('border-l')
|
|
115
|
+
})
|
|
116
|
+
})
|
|
117
|
+
|
|
96
118
|
describe('CollapsibleSection, pending', () => {
|
|
97
119
|
it('the title says open and busy while the rows stay shut, then they open', () => {
|
|
98
120
|
const { rerender } = render(<CollapsibleSection title="Section" open pending>{rows}</CollapsibleSection>)
|
|
@@ -191,7 +191,8 @@ export function CollapsibleSection({ title, defaultOpen = true, open: openProp,
|
|
|
191
191
|
>
|
|
192
192
|
{/* A row's rows start under its title: the 16px chevron and its 8px gap
|
|
193
193
|
(pl-6). An indented heading's: the same — its arrow is a row's now (5 October). */}
|
|
194
|
-
|
|
194
|
+
{/* The tree's line, as NavItem's (Katerina, 17 November): under the arrow's middle, the rows 24px in as before. */}
|
|
195
|
+
<div className={cn('flex flex-col', look === 'row' || indent ? 'ml-[15px] mt-0.5 border-l border-border-default pl-2' : 'pt-0.5', contentClassName)}>{children}</div>
|
|
195
196
|
</Collapsible.Panel>
|
|
196
197
|
</Collapsible.Root>
|
|
197
198
|
)
|
package/src/ListTable.mdx
CHANGED
|
@@ -46,10 +46,12 @@ A list of things on a page, under column headings: each row leads to its thing,
|
|
|
46
46
|
|
|
47
47
|
<Canvas of={ListTableStories.NotReadYet} />
|
|
48
48
|
|
|
49
|
-
- It takes the whole width it is given. The name
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
- It takes the whole width it is given. The name and what it is about take
|
|
50
|
+
the room on the left; the facts sit together on the right, before the end,
|
|
51
|
+
24px apart, as are the name and the first fact (Katerina, 17 November:
|
|
52
|
+
"everything is crammed together on the left … we need air for them to
|
|
53
|
+
breathe"). From 16 November the name was capped at 384px with the facts
|
|
54
|
+
beside it; they read as one crammed block.
|
|
53
55
|
|
|
54
56
|
<Canvas of={ListTableStories.OnAWidePage} />
|
|
55
57
|
|
|
@@ -105,7 +107,7 @@ import { Button, ListTable, ListTableRow } from '@estiva-app/ui'
|
|
|
105
107
|
| Hides columns by its own width, `low` first | `hidden sm:block` on a column |
|
|
106
108
|
| Draws a row's fill, its 8px corners and no edge | `rounded-md hover:bg-bg-hover` on a row |
|
|
107
109
|
| Makes the whole row the link, its end above it | a covering link and `relative` by hand |
|
|
108
|
-
|
|
|
110
|
+
| Gives the name the room on the left and puts the facts together on the right, 24px apart | a width of your own on the name, a gap by hand |
|
|
109
111
|
|
|
110
112
|
## Props
|
|
111
113
|
|
package/src/ListTable.test.tsx
CHANGED
|
@@ -13,6 +13,23 @@ afterEach(cleanup)
|
|
|
13
13
|
const columns = [{ label: 'Team', width: 'large' as const }, { label: 'Active', keep: 'low' as const }]
|
|
14
14
|
|
|
15
15
|
describe('ListTable', () => {
|
|
16
|
+
// "Everything is crammed together on the left … names/desc at the left and the rest on the right" (Katerina, 17 November).
|
|
17
|
+
it('gives the name the room on the left and puts the facts together on the right, 24px apart', () => {
|
|
18
|
+
render(
|
|
19
|
+
<ListTable aria-label="Items" columns={columns}>
|
|
20
|
+
<ListTableRow href="/one" label="Item one" cells={['Group one', undefined]} />
|
|
21
|
+
</ListTable>,
|
|
22
|
+
)
|
|
23
|
+
const row = screen.getByText('Item one').closest('[role=row]') as HTMLElement
|
|
24
|
+
const name = within(row).getAllByRole('cell')[0]!
|
|
25
|
+
expect(name.className.split(' ')).toContain('flex-1')
|
|
26
|
+
expect(name.className.split(' ')).not.toContain('max-w-sm')
|
|
27
|
+
expect(row.className.split(' ')).toContain('gap-6')
|
|
28
|
+
const heads = screen.getAllByRole('columnheader')[0]!.parentElement!
|
|
29
|
+
expect(heads.className.split(' ')).toContain('gap-6')
|
|
30
|
+
expect(screen.getAllByRole('columnheader')[0]!.className.split(' ')).not.toContain('max-w-sm')
|
|
31
|
+
})
|
|
32
|
+
|
|
16
33
|
it('heads its columns, and each row has one cell per heading, a dash where it is not read', () => {
|
|
17
34
|
render(
|
|
18
35
|
<ListTable aria-label="Items" columns={columns}>
|
package/src/ListTable.tsx
CHANGED
|
@@ -71,8 +71,8 @@ const DEFAULT_WIDTH = 'medium'
|
|
|
71
71
|
const sizeOf = (column: ListTableColumn) => column.width ?? DEFAULT_WIDTH
|
|
72
72
|
/** The row's 12px either side, the icon and its 12px gap. */
|
|
73
73
|
const ROW_FRAME_PX = 24 + 16 + 12
|
|
74
|
-
/** Each column's
|
|
75
|
-
const GAP_PX =
|
|
74
|
+
/** Each column's 24px gap before it: room between the facts (Katerina, 17 November: "we need air for them to breathe"). */
|
|
75
|
+
const GAP_PX = 24
|
|
76
76
|
const END_PX = 64
|
|
77
77
|
|
|
78
78
|
type Shown = 'all' | 'high' | 'none'
|
|
@@ -87,8 +87,10 @@ const widthOf = (columns: ListTableColumn[], end: boolean) =>
|
|
|
87
87
|
* A list of things on a page, under column headings: each row leads to its thing, with its name and what it is about,
|
|
88
88
|
* then a few short facts in columns, then an action at its end. The columns give way to the name by the list's own
|
|
89
89
|
* width, not the window's — `low` ones first, then `high` ones — so a list beside a sidebar keeps its names. The name
|
|
90
|
-
* is
|
|
91
|
-
*
|
|
90
|
+
* and what it is about take the room on the left, the facts sit together on the right before the end, 24px apart
|
|
91
|
+
* (Katerina, 17 November: "everything is crammed together on the left … the names/desc at the left and the rest on the
|
|
92
|
+
* right was a more correct way"; from 16 November the name was capped at 384px with the facts beside it). The list
|
|
93
|
+
* takes the whole width it is given, as every page's body does (16 November).
|
|
92
94
|
*
|
|
93
95
|
* Peek's Explore topics, Ship's Topics and Leaf's Explore topics each drew this by hand, class for class, and their
|
|
94
96
|
* columns hid only at the phone's width: in a narrow window the names were cut to two letters (Katerina, 16 November).
|
|
@@ -117,9 +119,9 @@ export function ListTable({ 'aria-label': label, nameLabel = 'Name', columns, en
|
|
|
117
119
|
{/* With no columns there is nothing to head: the part's own heading names the list, and a lone "Name" said nothing (Katerina, 16 November). */}
|
|
118
120
|
{columns.length > 0 && (
|
|
119
121
|
// Hidden, it is out of the flow too: the rows start where the list does, with no gap for it.
|
|
120
|
-
<div role="row" className={cn('flex items-center gap-
|
|
122
|
+
<div role="row" className={cn('flex items-center gap-6 px-3 text-caption text-text-muted', !headings && 'sr-only')}>
|
|
121
123
|
{/* Over the name, past the icon; as wide as the names' cells. */}
|
|
122
|
-
<span role="columnheader" className="min-w-0
|
|
124
|
+
<span role="columnheader" className="min-w-0 flex-1 pl-7">
|
|
123
125
|
{nameLabel}
|
|
124
126
|
</span>
|
|
125
127
|
{columns.map((column) =>
|
|
@@ -147,9 +149,10 @@ export function ListTableRow({ href, label, description, icon, cells, end, onCli
|
|
|
147
149
|
if (!table) throw new Error('ListTableRow is a row of a ListTable: put it inside one.')
|
|
148
150
|
return (
|
|
149
151
|
// A row's look in every list: 8px corners, the fill under the pointer and no edge.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
// 24px between the name and each fact, and before the end (Katerina, 17 November): they touched at 12.
|
|
153
|
+
<div role="row" className="relative flex min-w-0 items-center gap-6 rounded-lg px-3 py-2 hover:bg-bg-hover" {...rest}>
|
|
154
|
+
{/* The name takes the room left, so the facts sit together on the right (Katerina, 17 November). */}
|
|
155
|
+
<span role="cell" className="flex min-w-0 flex-1 items-center gap-3">
|
|
153
156
|
{icon != null && <span className="flex shrink-0 items-center text-text-secondary">{icon}</span>}
|
|
154
157
|
{/* 2px between the name and its line, as every two-line row in the kit (LinkCard, LinkRow, PartCard, a tall MenuItem); they touched (Katerina, 16 November). */}
|
|
155
158
|
<Link href={href} variant="plain" cover className="flex min-w-0 flex-1 flex-col gap-0.5" {...(onClick ? { onClick } : {})}>
|
package/src/MembersPill.mdx
CHANGED
|
@@ -35,6 +35,12 @@ const [open, setOpen] = useState(false)
|
|
|
35
35
|
- `count` is the number beside the faces when it is not `members.length` —
|
|
36
36
|
pass three faces and the real total.
|
|
37
37
|
- No `onClick` disables it; no members draws nothing.
|
|
38
|
+
- `readOnly` says who is in it and is nothing to press: the same pixels, not
|
|
39
|
+
greyed as a disabled pill — in a list's row, which opens its thing; the row
|
|
40
|
+
is what is pressed (Katerina, 17 November: "clicking on the pill should not
|
|
41
|
+
show the members list").
|
|
42
|
+
|
|
43
|
+
<Canvas of={MembersPillStories.ReadOnly} />
|
|
38
44
|
|
|
39
45
|
## What it owns
|
|
40
46
|
|
|
@@ -32,6 +32,11 @@ export const Disabled: Story = {
|
|
|
32
32
|
args: { onClick: undefined },
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/** `readOnly`: who is in it and nothing to press — the pill's own look, not greyed — in a list's row, which opens its thing (Katerina, 17 November). */
|
|
36
|
+
export const ReadOnly: Story = {
|
|
37
|
+
args: { onClick: undefined, readOnly: true },
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
/** No members draws nothing at all. */
|
|
36
41
|
export const Empty: Story = {
|
|
37
42
|
args: { members: [] },
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
/**
|
|
3
|
+
* The pill: up to three faces and the number; it opens the list, is disabled with nothing to open, and read-only it is
|
|
4
|
+
* nothing to press at all, in its own look (Katerina, 17 November).
|
|
5
|
+
*/
|
|
6
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
7
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
8
|
+
import userEvent from '@testing-library/user-event'
|
|
9
|
+
import { MembersPill } from './MembersPill'
|
|
10
|
+
|
|
11
|
+
afterEach(cleanup)
|
|
12
|
+
|
|
13
|
+
const people = [{ name: 'Ana Duarte' }, { name: 'Ben Okafor' }, { name: 'Chloé Martin' }]
|
|
14
|
+
|
|
15
|
+
describe('MembersPill', () => {
|
|
16
|
+
it('opens the list when pressed', async () => {
|
|
17
|
+
const onClick = vi.fn()
|
|
18
|
+
render(<MembersPill members={people} count={9} onClick={onClick} />)
|
|
19
|
+
await userEvent.click(screen.getByRole('button', { name: '9 members' }))
|
|
20
|
+
expect(onClick).toHaveBeenCalled()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
// "Clicking on the pill should not show the members list. And we need to use the estiva ui component" (Katerina, 17 November).
|
|
24
|
+
it('read-only, it says who is in it and is nothing to press, in the pill’s own look, not greyed', () => {
|
|
25
|
+
render(<MembersPill members={people} count={9} readOnly />)
|
|
26
|
+
expect(screen.queryByRole('button')).toBeNull()
|
|
27
|
+
const pill = screen.getByRole('img', { name: '9 members' })
|
|
28
|
+
expect(pill.textContent).toContain('9')
|
|
29
|
+
const classes = pill.className.split(' ')
|
|
30
|
+
expect(classes).toEqual(expect.arrayContaining(['h-8', 'border', 'border-border-default', 'text-text-primary']))
|
|
31
|
+
expect(classes).not.toContain('bg-bg-disabled')
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('read-only with nobody in it draws nothing', () => {
|
|
35
|
+
const { container } = render(<MembersPill members={[]} readOnly />)
|
|
36
|
+
expect(container.firstChild).toBeNull()
|
|
37
|
+
})
|
|
38
|
+
})
|
package/src/MembersPill.tsx
CHANGED
|
@@ -10,6 +10,12 @@ export interface MembersPillProps {
|
|
|
10
10
|
count?: number
|
|
11
11
|
/** Opens the list — usually a `MembersDialog`. Without it the pill is disabled. */
|
|
12
12
|
onClick?: () => void
|
|
13
|
+
/**
|
|
14
|
+
* Says who is in it and is nothing to press: the pill's own look, not greyed as a disabled one — in a list's row,
|
|
15
|
+
* which opens its thing (Katerina, 17 November: "clicking on the pill should not show the members list. And we need to
|
|
16
|
+
* use the estiva ui component"). `onClick` is not taken with it.
|
|
17
|
+
*/
|
|
18
|
+
readOnly?: boolean
|
|
13
19
|
/** The button's accessible name, when the list it opens is not "members" — "Who follows <name>: 4". Defaults to "4 members". */
|
|
14
20
|
label?: string
|
|
15
21
|
className?: string
|
|
@@ -25,11 +31,21 @@ export interface MembersPillProps {
|
|
|
25
31
|
* pick of 15 September). `disabled` rather than another element when there is
|
|
26
32
|
* nothing to press, so one element keeps one set of pixels.
|
|
27
33
|
*/
|
|
28
|
-
export function MembersPill({ members, count, onClick, label, className }: MembersPillProps) {
|
|
34
|
+
export function MembersPill({ members, count, onClick, readOnly = false, label, className }: MembersPillProps) {
|
|
29
35
|
const total = count ?? members.length
|
|
30
36
|
if (total === 0) return null
|
|
37
|
+
const name = label ?? `${total} ${total === 1 ? 'member' : 'members'}`
|
|
38
|
+
if (readOnly)
|
|
39
|
+
return (
|
|
40
|
+
// The outlined Button's own pixels — its height, corners, line and words — with nothing to press: one picture, read as one.
|
|
41
|
+
// @estiva-escape(no-copied-look): the read-only pill IS the outlined Button's look, drawn without a button
|
|
42
|
+
<span role="img" aria-label={name} className={cn('inline-flex h-8 min-h-8 shrink-0 items-center gap-2 rounded-md border border-border-default pl-[3px] pr-2 font-sans font-medium text-btn-default text-text-primary', className)}>
|
|
43
|
+
<AvatarGroup members={members} />
|
|
44
|
+
<span className={cn(MONO_CAPTION_CLASSES, 'signal:tabular-nums')}>{total}</span>
|
|
45
|
+
</span>
|
|
46
|
+
)
|
|
31
47
|
return (
|
|
32
|
-
<Button variant="outlined" aria-label={
|
|
48
|
+
<Button variant="outlined" aria-label={name} disabled={!onClick} onClick={onClick} className={cn('gap-2 pl-[3px] pr-2', className)}>
|
|
33
49
|
<AvatarGroup members={members} />
|
|
34
50
|
<span className={cn(MONO_CAPTION_CLASSES, 'signal:tabular-nums')}>{total}</span>
|
|
35
51
|
</Button>
|
package/src/NavItem.mdx
CHANGED
|
@@ -142,7 +142,7 @@ import { NavItem } from '@estiva-app/ui'
|
|
|
142
142
|
place for that row; another site's address, a `target` and a `download` stay
|
|
143
143
|
the browser's.
|
|
144
144
|
|
|
145
|
-
- A row is 32px
|
|
145
|
+
- A row is 28px tall (32px until 17 November), 8px in on each side, 8px between the icon and the label,
|
|
146
146
|
the label 14px regular (medium when unread), 8px corners as a **MenuItem**'s.
|
|
147
147
|
|
|
148
148
|
## What it owns
|
|
@@ -152,7 +152,7 @@ It does these by itself. Write none of them around it.
|
|
|
152
152
|
| It does | So you never write | Refused when written by hand |
|
|
153
153
|
|---|---|---|
|
|
154
154
|
| Marks the current place for assistive technology when `active` | `aria-current` | |
|
|
155
|
-
| Keeps its
|
|
155
|
+
| Keeps its 28px in a scrolling column | `shrink-0` | |
|
|
156
156
|
| Shows a ⋮ over the count while pointed at, focused or open, and keeps the row's hover look under it | a positioned `IconButton` + `Menu` over the row, `group-hover` reveals | |
|
|
157
157
|
| Turns its icon into the arrow that folds `children` while pointed at or focused, and slides them | a positioned `IconButton` over the icon, open state, `group-hover` reveals, an indented box | |
|
|
158
158
|
| Tells assistive technology whether its rows are open | `aria-expanded`, `aria-controls` | |
|
package/src/NavItem.test.tsx
CHANGED
|
@@ -85,6 +85,14 @@ describe('NavItem with rows under it', () => {
|
|
|
85
85
|
</NavItem>
|
|
86
86
|
)
|
|
87
87
|
|
|
88
|
+
// "Show some vertical line for the tree", "a little stronger just a bit"; the indent kept (Katerina, 17 November).
|
|
89
|
+
it('draws the tree’s line beside its rows: 1px, a step above the quietest border, under the middle of its icon, the rows 24px in', () => {
|
|
90
|
+
render(tree())
|
|
91
|
+
const rows = screen.getByText('Item two').closest('a')!.parentElement!.closest('div[class*="border-l"]')!
|
|
92
|
+
const classes = rows.className.split(' ')
|
|
93
|
+
expect(classes).toEqual(expect.arrayContaining(['border-l', 'border-border-default', 'ml-[15px]', 'pl-2']))
|
|
94
|
+
})
|
|
95
|
+
|
|
88
96
|
it('starts open: the arrow says so and names what it folds, and the rows are there', () => {
|
|
89
97
|
render(tree())
|
|
90
98
|
const button = arrow(/Hide what is under Item one/)
|
|
@@ -288,7 +296,8 @@ describe('NavItem with a tooltip', () => {
|
|
|
288
296
|
render(<NavItem href="#" label="Item one" tooltip="A sentence about item one." />)
|
|
289
297
|
const link = screen.getByRole('link', { name: 'Item one' })
|
|
290
298
|
expect(link.contains(screen.getByText('Item one'))).toBe(true)
|
|
291
|
-
|
|
299
|
+
// 28px (Katerina, 17 November); 32px until then.
|
|
300
|
+
expect(link.className.split(' ')).toContain('h-7')
|
|
292
301
|
expect(screen.getByText('Item one').className.split(' ')).toContain('truncate')
|
|
293
302
|
})
|
|
294
303
|
|
package/src/NavItem.tsx
CHANGED
|
@@ -177,10 +177,11 @@ export function NavItem({
|
|
|
177
177
|
href={href}
|
|
178
178
|
aria-current={active ? 'page' : undefined}
|
|
179
179
|
className={cn(
|
|
180
|
-
// shrink-0: the row keeps its
|
|
180
|
+
// shrink-0: the row keeps its 28px inside an overflowing flex column
|
|
181
181
|
// — without it the list compresses instead of scrolling (the missing-
|
|
182
182
|
// shrink-0 family; Katerina, 2026-09-02).
|
|
183
|
-
|
|
183
|
+
// 28px (Katerina, 17 November: "what if we make the height of the items 28px"); 32px until then.
|
|
184
|
+
'flex h-7 min-w-0 shrink-0 items-center gap-2 px-2 text-body-2',
|
|
184
185
|
SIDEBAR_ROW_CLASSES,
|
|
185
186
|
active ? 'bg-bg-nav-active text-text-primary' : cn(unread ? 'text-text-primary' : SIDEBAR_ROW_TEXT_CLASSES, 'hover:bg-bg-hover'),
|
|
186
187
|
// With a menu the ⋮ sits beside the link, so the row keeps its hover
|
|
@@ -330,8 +331,12 @@ export function NavItem({
|
|
|
330
331
|
hiddenUntilFound
|
|
331
332
|
className={COLLAPSIBLE_PANEL_CLASSES}
|
|
332
333
|
>
|
|
333
|
-
{/*
|
|
334
|
-
|
|
334
|
+
{/*
|
|
335
|
+
The tree's line (Katerina, 17 November: "show some vertical line for the tree", "a little stronger just a
|
|
336
|
+
bit"): 1px down from the middle of this row's icon (8px in, 16px wide), and the rows past it 24px in, as
|
|
337
|
+
before, their icons under this row's label (the indent she kept: "i dont like the indentation change").
|
|
338
|
+
*/}
|
|
339
|
+
<div className="ml-[15px] mt-0.5 flex flex-col gap-0.5 border-l border-border-default pl-2">{children}</div>
|
|
335
340
|
</Collapsible.Panel>
|
|
336
341
|
</Collapsible.Root>
|
|
337
342
|
)
|
package/src/NavTree.mdx
CHANGED
|
@@ -81,6 +81,16 @@ rows to any depth.
|
|
|
81
81
|
- A group folds with a row's arrow, 16px — every folding heading does — so a
|
|
82
82
|
group and the rows under it fold with the same arrow; its title starts 8px
|
|
83
83
|
after it, as a row's label.
|
|
84
|
+
- Rows under a row, or under a group, have the tree's line beside them: 1px,
|
|
85
|
+
a step above the quietest border, down from the middle of the icon or the
|
|
86
|
+
arrow above them; the rows stay 24px in (Katerina, 17 November).
|
|
87
|
+
- `spaced` puts 8px between the items the app draws as `children`, none
|
|
88
|
+
above the first: a tree whose items are each a place with rows under it,
|
|
89
|
+
as Peek's teams are ("a bit more spacing between the parent expandable
|
|
90
|
+
items", Katerina, 17 November). Groups from `groups` keep their 4px.
|
|
91
|
+
|
|
92
|
+
<Canvas of={NavTreeStories.Spaced} />
|
|
93
|
+
|
|
84
94
|
- A group's `icon` sits before its title — a folder's — and the arrow takes
|
|
85
95
|
its place under the pointer, as a row's icon turns into its arrow. Its rows
|
|
86
96
|
then start under the title, past the icon.
|
package/src/NavTree.stories.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { useEffect, useState, type ReactNode } from 'react'
|
|
|
4
4
|
import { IconArrowUpRight, IconFolder, IconPlus } from '@tabler/icons-react'
|
|
5
5
|
import { Button } from './Button'
|
|
6
6
|
import { Chip } from './Chip'
|
|
7
|
+
import { CollapsibleSection } from './CollapsibleSection'
|
|
7
8
|
import { UnreadDot } from './UnreadDot'
|
|
8
9
|
import { MenuItem, MenuSeparator } from './Menu'
|
|
9
10
|
import { NavItem } from './NavItem'
|
|
@@ -201,6 +202,38 @@ export const AppDrawnGroups: Story = {
|
|
|
201
202
|
},
|
|
202
203
|
}
|
|
203
204
|
|
|
205
|
+
/**
|
|
206
|
+
* `spaced`: 8px between the items the app draws, none above the first — a tree whose items are each a place with rows
|
|
207
|
+
* under it, as Peek's teams are (Katerina, 17 November). The tree's line runs beside each one's rows.
|
|
208
|
+
*/
|
|
209
|
+
export const Spaced: Story = {
|
|
210
|
+
args: { groups: undefined },
|
|
211
|
+
render: function Render() {
|
|
212
|
+
return (
|
|
213
|
+
<div className="flex h-screen bg-bg-base">
|
|
214
|
+
<Sidebar>
|
|
215
|
+
<NavTree spaced>
|
|
216
|
+
<NavItem href="#" label="Team one" icon={placeholder}>
|
|
217
|
+
<NavItem href="#" label="Item one" icon={placeholder} />
|
|
218
|
+
<NavItem href="#" label="Item two" icon={placeholder} active />
|
|
219
|
+
<CollapsibleSection look="row" title="A fold" icon={placeholder} defaultOpen>
|
|
220
|
+
<NavItem href="#" label="Item three" icon={placeholder} />
|
|
221
|
+
</CollapsibleSection>
|
|
222
|
+
</NavItem>
|
|
223
|
+
<NavItem href="#" label="Team two" icon={placeholder}>
|
|
224
|
+
<NavItem href="#" label="Item four" icon={placeholder} />
|
|
225
|
+
</NavItem>
|
|
226
|
+
<CollapsibleSection look="row" title="The rest" count={2} defaultOpen={false}>
|
|
227
|
+
<NavItem href="#" label="Team three" icon={placeholder} />
|
|
228
|
+
<NavItem href="#" label="Team four" icon={placeholder} />
|
|
229
|
+
</CollapsibleSection>
|
|
230
|
+
</NavTree>
|
|
231
|
+
</Sidebar>
|
|
232
|
+
</div>
|
|
233
|
+
)
|
|
234
|
+
},
|
|
235
|
+
}
|
|
236
|
+
|
|
204
237
|
/** A group the app draws, its rows read when it opens: pending while the read is out, and once it has taken `NAV_TREE_PENDING_MS` the skeleton. */
|
|
205
238
|
function ReadOnOpen({ title, ms }: { title: string; ms: number }) {
|
|
206
239
|
const [open, setOpen] = useState(false)
|
package/src/NavTree.test.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { act, cleanup, render, screen } from '@testing-library/react'
|
|
|
9
9
|
import userEvent from '@testing-library/user-event'
|
|
10
10
|
import { MenuItem } from './Menu'
|
|
11
11
|
import { NAV_TREE_PENDING_MS, NavTree, NavTreeSection, type NavTreeGroup } from './NavTree'
|
|
12
|
+
import { NavItem } from './NavItem'
|
|
12
13
|
|
|
13
14
|
afterEach(cleanup)
|
|
14
15
|
|
|
@@ -179,6 +180,31 @@ describe('NavTree spaces its groups', () => {
|
|
|
179
180
|
})
|
|
180
181
|
})
|
|
181
182
|
|
|
183
|
+
// "A bit more spacing between the parent expandable items" (Katerina, 17 November): Peek's teams.
|
|
184
|
+
describe('NavTree spaced', () => {
|
|
185
|
+
it('puts 8px above each item the app draws but the first', () => {
|
|
186
|
+
const { container } = render(
|
|
187
|
+
<NavTree spaced>
|
|
188
|
+
<NavItem href="#one" label="One" />
|
|
189
|
+
<NavItem href="#two" label="Two" />
|
|
190
|
+
</NavTree>,
|
|
191
|
+
)
|
|
192
|
+
const box = screen.getByRole('link', { name: 'One' }).closest('div[class*="mt-2"]')
|
|
193
|
+
expect(box?.className.split(' ')).toEqual(expect.arrayContaining(['contents', '[&>*+*]:mt-2']))
|
|
194
|
+
expect(container.querySelectorAll('[class*="[&>*+*]:mt-2"]')).toHaveLength(1)
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
it('without it, nothing is put between them, as before', () => {
|
|
198
|
+
const { container } = render(
|
|
199
|
+
<NavTree>
|
|
200
|
+
<NavItem href="#one" label="One" />
|
|
201
|
+
<NavItem href="#two" label="Two" />
|
|
202
|
+
</NavTree>,
|
|
203
|
+
)
|
|
204
|
+
expect(container.querySelector('[class*="[&>*+*]:mt-2"]')).toBeNull()
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
|
|
182
208
|
describe('NavTree with no groups and no words', () => {
|
|
183
209
|
it('draws no line at all', () => {
|
|
184
210
|
const { container } = render(<NavTree groups={[]} />)
|
package/src/NavTree.tsx
CHANGED
|
@@ -118,6 +118,12 @@ export interface NavTreeProps {
|
|
|
118
118
|
emptyMessage?: string
|
|
119
119
|
/** Remember each group open or closed in this browser, under this key and the group's id. The app prefixes it. */
|
|
120
120
|
storageKey?: string
|
|
121
|
+
/**
|
|
122
|
+
* 8px between the items an app draws as `children`, none above the first: a tree whose items are each a place with
|
|
123
|
+
* rows under it — Peek's teams (Katerina, 17 November: "a bit more spacing between the parent expandable items").
|
|
124
|
+
* Groups drawn from `groups` keep their own 4px.
|
|
125
|
+
*/
|
|
126
|
+
spaced?: boolean
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
/** How long the pointer rests on a group before `onIntent` (Peek's FolderTree, 150ms). */
|
|
@@ -364,7 +370,7 @@ export function NavTreeSection({ id, title, message, loading = false, pending =
|
|
|
364
370
|
* and the column scrolls to it. Groups the app draws itself take `openFor`
|
|
365
371
|
* for that; the scroll is the tree's either way.
|
|
366
372
|
*/
|
|
367
|
-
export function NavTree({ title, titleActions, groups, children, selected, selectedParent, selectedGroup, onSelect, emptyMessage = '', storageKey }: NavTreeProps) {
|
|
373
|
+
export function NavTree({ title, titleActions, groups, children, selected, selectedParent, selectedGroup, onSelect, emptyMessage = '', storageKey, spaced = false }: NavTreeProps) {
|
|
368
374
|
const opening = groups ? openingFor(groups, selected, selectedParent) : null
|
|
369
375
|
/*
|
|
370
376
|
Once per current row, when it is drawn and shown, however late: a row a part inside the tree draws itself (a fold
|
|
@@ -391,7 +397,8 @@ export function NavTree({ title, titleActions, groups, children, selected, selec
|
|
|
391
397
|
<groupLinked.Provider value={selectedGroup}>
|
|
392
398
|
{title && <SectionHeader title={title} look="quiet" showActions="always" actions={titleActions} className="mt-4 shrink-0" />}
|
|
393
399
|
{groups === undefined ? (
|
|
394
|
-
|
|
400
|
+
// `contents` again: the items stay the column's own; the margin is on each one that follows another.
|
|
401
|
+
spaced ? <div className="contents [&>*+*]:mt-2">{children}</div> : children
|
|
395
402
|
) : groups === null ? (
|
|
396
403
|
<SkeletonList rows={5} />
|
|
397
404
|
) : groups.length === 0 ? (
|
package/src/SectionHeader.mdx
CHANGED
|
@@ -5,7 +5,7 @@ import * as SectionHeaderStories from './SectionHeader.stories'
|
|
|
5
5
|
|
|
6
6
|
# SectionHeader
|
|
7
7
|
|
|
8
|
-
The
|
|
8
|
+
The 28px row a section starts with, a list row's height: a SectionLabel, and actions that
|
|
9
9
|
appear while the row is hovered or keyboard-focused, as IconButtons with
|
|
10
10
|
tooltips — always, on a screen with no hover. It is also the
|
|
11
11
|
header of a **CollapsibleSection**, which draws the chevron and makes the
|
|
@@ -83,7 +83,7 @@ import { IconPlus } from '@tabler/icons-react'
|
|
|
83
83
|
actions are always shown (`showActions="always"`), where the buttons light up
|
|
84
84
|
on their own. The default, `fill`, lights a row that toggles or has actions.
|
|
85
85
|
|
|
86
|
-
- The row is 32px
|
|
86
|
+
- The row is 28px tall (32px until 17 November), 8px in on each side, 4px between the title and the
|
|
87
87
|
actions, with 8px corners.
|
|
88
88
|
|
|
89
89
|
## What it owns
|
|
@@ -94,7 +94,7 @@ It does these by itself. Write none of them around it.
|
|
|
94
94
|
|---|---|---|
|
|
95
95
|
| With `chevron`, its title is a button that calls `onToggle` on a click, Enter or Space, and says whether it is open | a button of your own, or `aria-expanded` | |
|
|
96
96
|
| Shows its actions while the keyboard is in the row — on the title or on one of them — and always on a screen with no hover | a focus style of your own | |
|
|
97
|
-
| Keeps its
|
|
97
|
+
| Keeps its 28px in a scrolling column | `shrink-0` | |
|
|
98
98
|
| Keeps a long title on one line, cut short with "…", in every look | `truncate` around the title | |
|
|
99
99
|
|
|
100
100
|
## Keys
|