@estiva-app/ui 0.116.0 → 0.118.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 +37 -0
- package/dist/ActivityLine.d.ts.map +1 -0
- package/dist/CollapsibleSection.d.ts +6 -1
- package/dist/CollapsibleSection.d.ts.map +1 -1
- package/dist/ContainerHeader.d.ts +10 -1
- package/dist/ContainerHeader.d.ts.map +1 -1
- package/dist/DialogShell.d.ts +11 -3
- package/dist/DialogShell.d.ts.map +1 -1
- package/dist/ListTable.d.ts +71 -0
- package/dist/ListTable.d.ts.map +1 -0
- package/dist/MembersDialog.d.ts +1 -0
- package/dist/MembersDialog.d.ts.map +1 -1
- package/dist/Menu.d.ts +9 -2
- package/dist/Menu.d.ts.map +1 -1
- package/dist/NavItem.d.ts.map +1 -1
- package/dist/NavTree.d.ts +12 -1
- package/dist/NavTree.d.ts.map +1 -1
- package/dist/PageHeader.d.ts +11 -2
- package/dist/PageHeader.d.ts.map +1 -1
- package/dist/SectionHeader.d.ts.map +1 -1
- package/dist/WhoFollowsDialog.d.ts +12 -2
- package/dist/WhoFollowsDialog.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +816 -671
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/registry.json +272 -5
- package/src/ActivityLine.mdx +67 -0
- package/src/ActivityLine.stories.tsx +49 -0
- package/src/ActivityLine.test.tsx +47 -0
- package/src/ActivityLine.tsx +74 -0
- package/src/Button.mdx +5 -0
- package/src/CollapsibleSection.mdx +6 -0
- package/src/CollapsibleSection.stories.tsx +4 -1
- package/src/CollapsibleSection.test.tsx +11 -0
- package/src/CollapsibleSection.tsx +7 -2
- package/src/ContainerHeader.mdx +7 -0
- package/src/ContainerHeader.stories.tsx +3 -0
- package/src/ContainerHeader.test.tsx +12 -1
- package/src/ContainerHeader.tsx +38 -18
- package/src/DialogShell.mdx +8 -2
- package/src/DialogShell.stories.tsx +20 -7
- package/src/DialogShell.tsx +10 -4
- package/src/FollowSwitch.test.tsx +6 -4
- package/src/ListTable.mdx +112 -0
- package/src/ListTable.stories.tsx +133 -0
- package/src/ListTable.test.tsx +81 -0
- package/src/ListTable.tsx +178 -0
- package/src/MembersDialog.test.tsx +8 -0
- package/src/MembersDialog.tsx +3 -11
- package/src/Menu.mdx +3 -0
- package/src/Menu.stories.tsx +23 -0
- package/src/Menu.tsx +13 -3
- package/src/NavItem.mdx +2 -0
- package/src/NavItem.tsx +5 -1
- package/src/NavTree.mdx +6 -0
- package/src/NavTree.stories.tsx +14 -0
- package/src/NavTree.test.tsx +18 -0
- package/src/NavTree.tsx +16 -1
- package/src/PageHeader.mdx +13 -2
- package/src/PageHeader.stories.tsx +35 -1
- package/src/PageHeader.test.tsx +21 -0
- package/src/PageHeader.tsx +17 -5
- package/src/SectionHeader.mdx +2 -0
- package/src/SectionHeader.test.tsx +16 -0
- package/src/SectionHeader.tsx +4 -2
- package/src/WhoFollowsDialog.mdx +2 -0
- package/src/WhoFollowsDialog.stories.tsx +19 -0
- package/src/WhoFollowsDialog.test.tsx +40 -0
- package/src/WhoFollowsDialog.tsx +66 -10
- package/src/index.ts +2 -0
- package/src/registry/registry.test.ts +5 -5
- package/stories/Choosing.mdx +2 -0
package/src/PageHeader.tsx
CHANGED
|
@@ -37,7 +37,10 @@ export interface PageHeaderProps {
|
|
|
37
37
|
leading?: ReactNode
|
|
38
38
|
/** A lock before the title: only its members can open this page. Named "Private" to assistive technology and in a tooltip. */
|
|
39
39
|
private?: boolean
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Right after the title, 8px from it, and never cut short: a small `Button`, a `Chip`, a `Link`. Several, given
|
|
42
|
+
* together (a fragment), sit 8px apart: the bar spaces them, not a box of your own (Katerina, 16 November).
|
|
43
|
+
*/
|
|
41
44
|
after?: ReactNode
|
|
42
45
|
/** Quiet words at the right, before the members: counts. A dot between each, each in `MetaText` (in Signal, the mono micro-type). */
|
|
43
46
|
meta?: (string | PageHeaderMeta)[]
|
|
@@ -45,13 +48,19 @@ export interface PageHeaderProps {
|
|
|
45
48
|
time?: { label: string; exact: string }
|
|
46
49
|
/** Who is in it: a `MembersPill`. */
|
|
47
50
|
members?: ReactNode
|
|
51
|
+
/**
|
|
52
|
+
* A button with words, before the page's buttons and 8px clear of them: Join, Add to Open work. Two, given together
|
|
53
|
+
* (Follow and Join), sit 8px apart. Peek drew them in a box of its own beside the toolbar, for want of this place
|
|
54
|
+
* (Katerina, 16 November).
|
|
55
|
+
*/
|
|
56
|
+
button?: ReactNode
|
|
48
57
|
/** The page's own buttons, at the right edge: a `Toolbar` with `surface={false}` of `ToolbarButton`s, or one `IconButton`. */
|
|
49
58
|
actions?: ReactNode
|
|
50
59
|
/** Placement only. */
|
|
51
60
|
className?: string
|
|
52
61
|
}
|
|
53
62
|
|
|
54
|
-
export function PageHeader({ title, leading, private: locked = false, after, meta, time, members, actions, className }: PageHeaderProps) {
|
|
63
|
+
export function PageHeader({ title, leading, private: locked = false, after, meta, time, members, button, actions, className }: PageHeaderProps) {
|
|
55
64
|
const words = (meta ?? []).map((one) => (typeof one === 'string' ? { label: one } : one))
|
|
56
65
|
const quiet = words.length > 0 || time != null || members != null
|
|
57
66
|
|
|
@@ -64,17 +73,18 @@ export function PageHeader({ title, leading, private: locked = false, after, met
|
|
|
64
73
|
</WithTooltip>
|
|
65
74
|
)}
|
|
66
75
|
{typeof title === 'string' ? <span className="truncate text-body-2-strong text-text-primary">{title}</span> : <div className="flex min-w-0 items-center">{title}</div>}
|
|
67
|
-
{after != null && <span className="flex shrink-0 items-center">{after}</span>}
|
|
76
|
+
{after != null && <span className="flex shrink-0 items-center gap-2">{after}</span>}
|
|
68
77
|
</div>
|
|
69
78
|
)
|
|
70
79
|
|
|
80
|
+
const buttons = actions != null || button != null
|
|
71
81
|
const right =
|
|
72
|
-
quiet ||
|
|
82
|
+
quiet || buttons ? (
|
|
73
83
|
<>
|
|
74
84
|
{quiet && (
|
|
75
85
|
// The quiet group: 12px between its parts, and 12px clear of the buttons — the bar sets
|
|
76
86
|
// its actions 4px apart, so the group adds the other 8px, as Peek's and Leaf's bars do.
|
|
77
|
-
<div className={cn('flex items-center gap-3',
|
|
87
|
+
<div className={cn('flex items-center gap-3', buttons && 'pr-2')}>
|
|
78
88
|
{words.length > 0 && (
|
|
79
89
|
<div className="flex items-center gap-2">
|
|
80
90
|
{words.map((one, i) => (
|
|
@@ -97,6 +107,8 @@ export function PageHeader({ title, leading, private: locked = false, after, met
|
|
|
97
107
|
{members}
|
|
98
108
|
</div>
|
|
99
109
|
)}
|
|
110
|
+
{/* The bar sets its parts 4px apart; the other 4px keep the words 8px clear of the icons. */}
|
|
111
|
+
{button != null && <span className={cn('flex shrink-0 items-center gap-2', actions != null && 'pr-1')}>{button}</span>}
|
|
100
112
|
{actions}
|
|
101
113
|
</>
|
|
102
114
|
) : undefined
|
package/src/SectionHeader.mdx
CHANGED
|
@@ -30,6 +30,8 @@ title the toggle — that is where a section folds.
|
|
|
30
30
|
- `menu` gives the section a "More options" ⋮ after its actions, with what
|
|
31
31
|
acts on the whole section — a folder's Rename, Archive. It is **NavItem**'s
|
|
32
32
|
⋮, revealed with the actions, and stays while its menu is open.
|
|
33
|
+
Both menus open toward the page, as a row's: their left edge under the
|
|
34
|
+
button, spreading right.
|
|
33
35
|
|
|
34
36
|
<Canvas of={SectionHeaderStories.WithMenu} />
|
|
35
37
|
|
|
@@ -174,3 +174,19 @@ describe('SectionHeader, the trailing slot', () => {
|
|
|
174
174
|
expect(count.previousElementSibling?.textContent).toBe('Section')
|
|
175
175
|
})
|
|
176
176
|
})
|
|
177
|
+
|
|
178
|
+
describe('SectionHeader, the words it shows', () => {
|
|
179
|
+
it('shows only its title and count as words, whatever menus and actions it carries', async () => {
|
|
180
|
+
const { container } = render(
|
|
181
|
+
<SectionHeader
|
|
182
|
+
title="Item"
|
|
183
|
+
count={3}
|
|
184
|
+
actions={[{ icon: <svg aria-hidden />, tooltip: 'Sort', menu: <MenuItem label="Newest first" onClick={() => {}} /> }]}
|
|
185
|
+
menu={<MenuItem label="Rename" onClick={() => {}} />}
|
|
186
|
+
/>,
|
|
187
|
+
)
|
|
188
|
+
await screen.findByRole('button', { name: 'More options for Item' })
|
|
189
|
+
// A stray line of code in the markup draws as text beside the title, and squeezes it (Katerina, 16 November).
|
|
190
|
+
expect(container.textContent).toBe('Item3')
|
|
191
|
+
})
|
|
192
|
+
})
|
package/src/SectionHeader.tsx
CHANGED
|
@@ -238,8 +238,9 @@ export function SectionHeader({ title, chevron = false, icon, isExpanded = true,
|
|
|
238
238
|
action.menu != null ? (
|
|
239
239
|
// `data-section-menu`, as the ⋮ has: the row stays lit while its menu is open.
|
|
240
240
|
<div key={action.tooltip} data-section-menu className="flex items-center">
|
|
241
|
+
{/* Toward the page: its left edge under the button, spreading right (Katerina, 16 November). */}
|
|
241
242
|
<Menu
|
|
242
|
-
align="
|
|
243
|
+
align="left"
|
|
243
244
|
trigger={
|
|
244
245
|
<IconButton tooltip={action.tooltip} aria-label={action.tooltip}>
|
|
245
246
|
{action.icon}
|
|
@@ -257,8 +258,9 @@ export function SectionHeader({ title, chevron = false, icon, isExpanded = true,
|
|
|
257
258
|
)}
|
|
258
259
|
{menu != null && (
|
|
259
260
|
<div data-section-menu className="flex items-center">
|
|
261
|
+
{/* Toward the page, as a row's ⋮ opens (Katerina, 16 November). */}
|
|
260
262
|
<Menu
|
|
261
|
-
align="
|
|
263
|
+
align="left"
|
|
262
264
|
trigger={
|
|
263
265
|
<IconButton tooltip="More options" aria-label={menuLabel ?? `More options for ${title}`}>
|
|
264
266
|
<IconDotsVertical size={16} stroke={1.5} />
|
package/src/WhoFollowsDialog.mdx
CHANGED
|
@@ -46,6 +46,8 @@ const [open, setOpen] = useState(false)
|
|
|
46
46
|
- A row is **MembersDialog**'s: `{ id, name, picture?, bot?, caption? }`. The
|
|
47
47
|
caption says how they are in it ("Chose it", "Added by …").
|
|
48
48
|
- Each group is drawn with its count, and "Nobody" when it is empty.
|
|
49
|
+
- `self` gives the viewer their own Join or Leave, as **MembersDialog**'s: Leave on
|
|
50
|
+
their own row, first in its group; with no row of their own, Join or Leave on top.
|
|
49
51
|
- `onAdd` shows **Add someone**, which opens the same add layer as
|
|
50
52
|
**MembersDialog**'s, leaving out everyone listed by id. Return `false` to
|
|
51
53
|
stay on it; otherwise it returns to the list.
|
|
@@ -38,3 +38,22 @@ export const ListOnly: Story = { args: { onAdd: undefined } }
|
|
|
38
38
|
|
|
39
39
|
/** Opened from a menu's "Add someone…": straight on the add layer, whose back arrow returns to the list. */
|
|
40
40
|
export const Adding: Story = { args: { initialView: 'add' } }
|
|
41
|
+
|
|
42
|
+
/** `self` leave: your own row comes first in its group, with Leave on it. */
|
|
43
|
+
export const WithLeave: Story = { args: { self: { action: 'leave', id: 'me', onToggle: () => {} } } }
|
|
44
|
+
|
|
45
|
+
/** `self` join: not in it, so Join sits on top, above "Add someone". */
|
|
46
|
+
export const NotIn: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
important: [{ id: 'ravi', name: 'Ravi Mehta', caption: 'Added by Ana Duarte' }],
|
|
49
|
+
self: { action: 'join', id: 'me', onToggle: () => {} },
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** `self` leave with no row of your own (in it at a level not listed here): Leave on top, as Join is. */
|
|
54
|
+
export const LeaveOnTop: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
important: [{ id: 'ravi', name: 'Ravi Mehta', caption: 'Added by Ana Duarte' }],
|
|
57
|
+
self: { action: 'leave', id: 'me', onToggle: () => {} },
|
|
58
|
+
},
|
|
59
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
/** What the WhoFollowsDialog page claims about your own Join or Leave, pinned. */
|
|
3
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
4
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
5
|
+
import userEvent from '@testing-library/user-event'
|
|
6
|
+
import { WhoFollowsDialog } from './WhoFollowsDialog'
|
|
7
|
+
|
|
8
|
+
afterEach(cleanup)
|
|
9
|
+
|
|
10
|
+
const all = [{ id: 'ana', name: 'Ana Duarte' }]
|
|
11
|
+
const important = [
|
|
12
|
+
{ id: 'ravi', name: 'Ravi Mehta' },
|
|
13
|
+
{ id: 'me', name: 'You' },
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
describe('WhoFollowsDialog, your own Join or Leave', () => {
|
|
17
|
+
it('offers no Join or Leave when no self is given', async () => {
|
|
18
|
+
render(<WhoFollowsDialog title="Widgets" all={all} important={important} onClose={() => {}} />)
|
|
19
|
+
await screen.findByText('Ana Duarte')
|
|
20
|
+
expect(screen.queryByRole('button', { name: /^(Join|Leave)$/ })).toBeNull()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('puts Leave on your own row, first in its group, and calls onToggle once', async () => {
|
|
24
|
+
const onToggle = vi.fn()
|
|
25
|
+
render(<WhoFollowsDialog title="Widgets" all={all} important={important} self={{ action: 'leave', id: 'me', onToggle }} onClose={() => {}} />)
|
|
26
|
+
const leave = await screen.findByRole('button', { name: 'Leave' })
|
|
27
|
+
const names = screen.getAllByText(/^(Ana Duarte|Ravi Mehta|You)$/).map((el) => el.textContent)
|
|
28
|
+
expect(names).toEqual(['Ana Duarte', 'You', 'Ravi Mehta'])
|
|
29
|
+
expect(leave.parentElement?.textContent).toContain('You')
|
|
30
|
+
await userEvent.setup().click(leave)
|
|
31
|
+
expect(onToggle).toHaveBeenCalledTimes(1)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('puts Join on top when you are not in it', async () => {
|
|
35
|
+
const onToggle = vi.fn()
|
|
36
|
+
render(<WhoFollowsDialog title="Widgets" all={all} important={[important[0]]} self={{ action: 'join', id: 'me', onToggle }} onClose={() => {}} />)
|
|
37
|
+
await userEvent.setup().click(await screen.findByRole('button', { name: 'Join' }))
|
|
38
|
+
expect(onToggle).toHaveBeenCalledTimes(1)
|
|
39
|
+
})
|
|
40
|
+
})
|
package/src/WhoFollowsDialog.tsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
+
import { IconUserMinus, IconUserPlus } from '@tabler/icons-react'
|
|
3
|
+
import { Button } from './Button'
|
|
2
4
|
import { DialogShell } from './DialogShell'
|
|
3
5
|
import { EmptyState } from './EmptyState'
|
|
4
|
-
import { AddPeopleLayer, AddRow, RosterRow, type MembersDialogCandidate, type MembersDialogMember } from './MembersDialog'
|
|
5
|
-
import {
|
|
6
|
+
import { AddPeopleLayer, AddRow, LEADING_CLASSES, RosterRow, type MembersDialogCandidate, type MembersDialogMember, type MembersDialogSelfAction } from './MembersDialog'
|
|
7
|
+
import { MenuItem } from './Menu'
|
|
8
|
+
import { SectionHeader } from './SectionHeader'
|
|
6
9
|
|
|
7
10
|
export interface WhoFollowsDialogProps {
|
|
8
11
|
/** The place's name: the title reads "Who follows <title>". */
|
|
@@ -18,6 +21,16 @@ export interface WhoFollowsDialogProps {
|
|
|
18
21
|
* same add layer as `MembersDialog`'s. Return `false` to stay on it.
|
|
19
22
|
*/
|
|
20
23
|
onAdd?: (chosen: MembersDialogCandidate[]) => void | boolean | Promise<void | boolean>
|
|
24
|
+
/**
|
|
25
|
+
* The viewer's own Join or Leave, as `MembersDialog`'s: Leave on their own row, which comes first in its group; with no
|
|
26
|
+
* row of their own (not in it, or in it at no level shown here), Join or Leave on top, beside "Add someone".
|
|
27
|
+
*/
|
|
28
|
+
self?: {
|
|
29
|
+
action: MembersDialogSelfAction
|
|
30
|
+
onToggle: () => void | Promise<unknown>
|
|
31
|
+
/** The viewer's id: the row in `all` or `important` that carries Leave. */
|
|
32
|
+
id: string
|
|
33
|
+
}
|
|
21
34
|
/** `add` opens straight on the add layer, as a menu's "Add someone…" does. */
|
|
22
35
|
initialView?: 'list' | 'add'
|
|
23
36
|
onClose: () => void
|
|
@@ -29,8 +42,25 @@ export interface WhoFollowsDialogProps {
|
|
|
29
42
|
* `MembersDialog` uses. Nobody's level is changed here: each person changes
|
|
30
43
|
* their own on the place's `FollowSwitch`.
|
|
31
44
|
*/
|
|
32
|
-
export function WhoFollowsDialog({ title, all, important, candidates = [], onAdd, initialView = 'list', onClose }: WhoFollowsDialogProps) {
|
|
45
|
+
export function WhoFollowsDialog({ title, all, important, candidates = [], onAdd, self, initialView = 'list', onClose }: WhoFollowsDialogProps) {
|
|
33
46
|
const [view, setView] = useState<'list' | 'add'>(onAdd ? initialView : 'list')
|
|
47
|
+
const [toggling, setToggling] = useState(false)
|
|
48
|
+
const toggle = async () => {
|
|
49
|
+
if (!self) return
|
|
50
|
+
setToggling(true)
|
|
51
|
+
try {
|
|
52
|
+
await self.onToggle()
|
|
53
|
+
} finally {
|
|
54
|
+
setToggling(false)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// Leave sits on the viewer's own row, first in its group; with no row of their own, Join or Leave goes on top.
|
|
58
|
+
const ownId = self?.action === 'leave' && [...all, ...important].some((m) => m.id === self.id) ? self.id : undefined
|
|
59
|
+
const ownFirst = (rows: MembersDialogMember[]) => {
|
|
60
|
+
const own = rows.find((m) => m.id === ownId)
|
|
61
|
+
return own ? [own, ...rows.filter((m) => m !== own)] : rows
|
|
62
|
+
}
|
|
63
|
+
const selfOnTop = self && !ownId
|
|
34
64
|
const heading = `Who follows ${title}`
|
|
35
65
|
|
|
36
66
|
if (view === 'add' && onAdd) {
|
|
@@ -47,24 +77,50 @@ export function WhoFollowsDialog({ title, all, important, candidates = [], onAdd
|
|
|
47
77
|
)
|
|
48
78
|
}
|
|
49
79
|
|
|
80
|
+
/*
|
|
81
|
+
A group: the kit's SectionHeader with its count beside the title (Katerina, 7 October: a heading over a list says its
|
|
82
|
+
count as a tab does), and "Nobody" when it is empty. The heading's own 8px and the empty line's own 8px are each
|
|
83
|
+
brought to the rows' 20px with 12px of margin, so title, "Nobody" and the faces start on one line (Katerina,
|
|
84
|
+
15 November: the empty line sat 8px in from the heading, inside a 20px box of its own).
|
|
85
|
+
*/
|
|
50
86
|
const group = (label: string, rows: MembersDialogMember[]) => (
|
|
51
87
|
<div className="flex flex-col pt-2">
|
|
52
|
-
<
|
|
88
|
+
<SectionHeader title={label} count={rows.length} hover="none" className="mx-3" />
|
|
53
89
|
{rows.length === 0 ? (
|
|
54
|
-
<
|
|
55
|
-
<EmptyState scope="rows" message="Nobody" />
|
|
56
|
-
</div>
|
|
90
|
+
<EmptyState scope="rows" message="Nobody" className="mx-3" />
|
|
57
91
|
) : (
|
|
58
|
-
rows.map((m) =>
|
|
92
|
+
ownFirst(rows).map((m) => (
|
|
93
|
+
<RosterRow
|
|
94
|
+
key={m.id}
|
|
95
|
+
member={m}
|
|
96
|
+
trailing={
|
|
97
|
+
m.id === ownId && (
|
|
98
|
+
<Button variant="destructive" size="small" disabled={toggling} onClick={() => void toggle()}>
|
|
99
|
+
Leave
|
|
100
|
+
</Button>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
/>
|
|
104
|
+
))
|
|
59
105
|
)}
|
|
60
106
|
</div>
|
|
61
107
|
)
|
|
62
108
|
|
|
63
109
|
return (
|
|
64
110
|
<DialogShell title={heading} onClose={onClose} bodyMaxHeight="max-h-[400px]" bodyClassName="p-0 py-2">
|
|
65
|
-
{onAdd && (
|
|
111
|
+
{(selfOnTop || onAdd) && (
|
|
66
112
|
<div className="flex flex-col px-2">
|
|
67
|
-
|
|
113
|
+
{selfOnTop && (
|
|
114
|
+
<MenuItem
|
|
115
|
+
size="tall"
|
|
116
|
+
className="py-2"
|
|
117
|
+
disabled={toggling}
|
|
118
|
+
onClick={() => void toggle()}
|
|
119
|
+
leading={<span className={LEADING_CLASSES}>{self.action === 'join' ? <IconUserPlus size={16} stroke={1.5} /> : <IconUserMinus size={16} stroke={1.5} />}</span>}
|
|
120
|
+
label={self.action === 'join' ? 'Join' : 'Leave'}
|
|
121
|
+
/>
|
|
122
|
+
)}
|
|
123
|
+
{onAdd && <AddRow label="Add someone" onClick={() => setView('add')} />}
|
|
68
124
|
</div>
|
|
69
125
|
)}
|
|
70
126
|
{group('All', all)}
|
package/src/index.ts
CHANGED
|
@@ -139,6 +139,7 @@ export { TopBar, type TopBarProps } from './TopBar'
|
|
|
139
139
|
export { PersonTrigger, type PersonTriggerProps } from './PersonTrigger'
|
|
140
140
|
export { Property, type PropertyProps } from './Property'
|
|
141
141
|
export { Reaction, type ReactionProps } from './Reaction'
|
|
142
|
+
export { ActivityLine, type ActivityLineProps } from './ActivityLine'
|
|
142
143
|
export { ConversationActions, type ConversationActionsProps } from './ConversationActions'
|
|
143
144
|
export { ConversationCard, ReplyCard, type ConversationCardProps, type ConversationEntryProps, type ConversationPerson, type ReplyCardProps } from './ConversationCard'
|
|
144
145
|
export { ConversationLayout, type ConversationItem, type ConversationLayoutProps } from './ConversationLayout'
|
|
@@ -171,6 +172,7 @@ export { ContainerHeader, type ContainerHeaderProps } from './ContainerHeader'
|
|
|
171
172
|
export { Panel, type PanelProps } from './Panel'
|
|
172
173
|
export { PageHeader, type PageHeaderMeta, type PageHeaderProps } from './PageHeader'
|
|
173
174
|
export { ListColumn, type ListColumnProps } from './ListColumn'
|
|
175
|
+
export { ListTable, ListTableRow, type ListTableColumn, type ListTableColumnKeep, type ListTableColumnWidth, type ListTableProps, type ListTableRowProps } from './ListTable'
|
|
174
176
|
export { CollapsibleSection, useRememberedOpen, type CollapsibleSectionProps } from './CollapsibleSection'
|
|
175
177
|
export { SectionLabel } from './SectionLabel'
|
|
176
178
|
export { Tabs, type TabDef, type TabsProps } from './Tabs'
|
|
@@ -48,20 +48,20 @@ describe('the registry builds', () => {
|
|
|
48
48
|
expect(registry.entries.map((one) => one.name).sort()).toEqual(values.map((one) => one.name).sort())
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
it('counts
|
|
51
|
+
it('counts 256 names over 131 files: 170 components, 78 helpers and 8 hooks (ListTable and ListTableRow, a list of things on a page under column headings, and ActivityLine, one thing that happened in a list of what is new, from the navigation prototype, on 16 November; useShortcut, a key that works from anywhere on the page, for Peek’s Ctrl/Cmd+O to Add to Open work (TOPI-7), on 10 November; CornerMenu, the "…" over a row’s or a card’s corner with Show as and Remove (TOPI-5), on 10 November; ConversationHeading, which place a comment is on in a list mixing several places (TOPI-2), on 9 November; FollowSwitch, LevelIcon and WhoFollowsDialog, how you follow a place and who follows it (TEA-6), on 6 November; goneWords and GONE_CLOSED, what stands in a gone comment’s place and under its thread in every app (ONE-9), on 6 November; DeletedNotice and NoAccessNotice, the cards on a deleted file and on one you cannot open (ALO-4), on 3 November; useFormBusy, whether a Form around it is sending, read by the editor’s DocumentField from the main entry, in the review of 2 November; useLeftAt, sendsInLayout, useSeenOnScreen, showInConversation and showInConversationWhenDrawn, where a conversation scrolls, what was seen and a link landing on a comment, moved from Peek for every app, on 2 November; useRememberedOpen, the fold a section remembers, read by the app, and NAV_TREE_PENDING_MS and isPlainClick, Peek’s Folder timer and plain-click check, moved in, on 2 November; FormDialog, MoveDialog and ArchiveDialog, the dialogs Peek wired by hand, on 2 November; ConversationPlace, the line saying where a comment was said, and DocumentField, a rich-text field of a form, moved from Peek, on 2 November; ArchivedNotice, the card on an archived file, from Peek, Ship and Leaf, on 31 October; caretOnOpen, the box at a thread’s foot taking the caret when a ConversationLayout opens it, without scrolling, on 31 October; the conversation from Peek for every app, with PageHeader and PinnedComment, on 31 October, and ResolutionNote and ResolutionHistory gone with the resolved looks not picked, on 1 November; useSidebarFold, a folded sidebar kept folded in every app, on 31 October; cardShapeMemory, a card’s last shape on this device, lifted from Peek and Ship for Leaf, and ReferenceCards and useReferenceCards gone with their deprecated page, in the widget review, on 30 October; inTheBox, a card or part in a box being written in, on the files’ fill and in words, on 29 October; archivedLine, the line on an archived file in every app (PEEKM-2), on 23 October; keepCommentBoxWarm, a box built ahead, exported as 0.84.0 promised (PEEKM-1), on 21 October;linkedFrom and linkStateFrom, one card for a file in every app (5ebf2756), on 21 October; ComposeBox, ComposeKeys and COMPOSE_EDITOR_CLASSES gone into CommentBox’s own frame (one box), on 21 October; LinkPlaces with linkPlaceAt and staysChip, a link in a document drawn where it sits (WBD-4), on 20 October; DocumentEditor, one document editor for every app, and PersonReference, `@` in a document (WBD-3), on 20 October; toggleTableHeaderRow, a table’s header row on and off (LEAF-12), on 19 October;EntryShell, the screen while nobody is signed in, moved from Peek (AUT-3), on 17 October; CommentBox with commentBoxRows, and ReactionRow with AddReactionButton and whoReacted, the shared comment box and reaction row (COMM-2), on 17 October; the link widgets — LinkChip, LinkRow, LinkCard, CardUnder, PartCard, LinkPreview and their parts, with useCanHover, chosenOf, loadingShapeOf and unavailableMemory — from the Widgets 2 prototype, on 16 October; InlineText, a title or the line under it edited where it stands (SUM-4), on 16 October; ComposeBox with ComposeKeys and its classes, CommentHighlights with its five helpers, and keepSelection and releaseSelection, from the Leaf prototype (LEAF-4), on 16 October;NavTree, NavTreeSection, the composer triggers and UnreadDot joined on 2 October; BlockHandle and EditorBlockHandle (RIC-18) on 2 October, moveBlock and blockDropCursor, the drop in the gutter, on 5 October, MembersPill and MembersDialog, moved from Peek (SHI-31), on 6 October, ShowMore on 7 October, AppProvider on 8 October, and KindIcon, thingKindOf and PastedImages with its two helpers, moved from Peek, on 8 October; CodeBlockColours, the coloured code block of the editor, on 9 October; Checklist, Callout, isChecklistTick and calloutLook (RIC-19) on 13 October; EditorTableControls and its four actions (RIC-21) on 13 October; ReferenceCards, useReferenceCards and its three helpers, the card a chip in a document asks for, on 14 October; LinkChips and its two helpers, a URL in a document read as its chip, on 14 October; ReferenceMenu, ReferenceMenuView and three helpers, the menu of a chip while writing, on 14 October; PastedMarkdown, markdown pasted as the blocks it spells (LEAF-10), on 15 October; turnIntoRows, turnListInto and turnQuoteInto, the block menu’s Turn into for a list and a quote (LEAF-11), on 15 October)', () => {
|
|
52
52
|
// The reconciliation GATES.md §24 explains. If this changes, that changes.
|
|
53
53
|
// The `EDITOR_EXTENSIONS` count as components by their names; they are
|
|
54
54
|
// editor extensions, documented on SelectionToolbar's, BlockNodes' and
|
|
55
55
|
// ComposerTriggers' pages.
|
|
56
56
|
const kinds = registry.entries.reduce<Record<string, number>>((all, one) => ({ ...all, [one.kind]: (all[one.kind] ?? 0) + 1 }), {})
|
|
57
|
-
expect(kinds).toEqual({ component:
|
|
58
|
-
expect(new Set(registry.entries.map((one) => one.sourceFile)).size).toBe(
|
|
57
|
+
expect(kinds).toEqual({ component: 170, helper: 78, hook: 8 })
|
|
58
|
+
expect(new Set(registry.entries.map((one) => one.sourceFile)).size).toBe(131)
|
|
59
59
|
})
|
|
60
60
|
|
|
61
61
|
it('gives every entry a purpose, from its own page or from the comment above it', () => {
|
|
62
62
|
expect(registry.entries.filter((one) => one.purpose.trim() === '')).toEqual([])
|
|
63
|
-
expect(registry.entries.filter((one) => one.purposeFrom === 'page').length).toBe(
|
|
64
|
-
expect(registry.entries.filter((one) => one.purposeFrom === 'comment').length).toBe(
|
|
63
|
+
expect(registry.entries.filter((one) => one.purposeFrom === 'page').length).toBe(118)
|
|
64
|
+
expect(registry.entries.filter((one) => one.purposeFrom === 'comment').length).toBe(138)
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
it('takes a name with a page of its own from the page, and a name without one from the code', () => {
|
package/stories/Choosing.mdx
CHANGED
|
@@ -109,6 +109,7 @@ The same conversation in every app; only its colours are each app's.
|
|
|
109
109
|
| The strip on a pointed-at comment, and its ⋯ menu | **ConversationActions** and **ConversationMenu** — the cards draw both |
|
|
110
110
|
| A time beside a name, "(edited)", urgent and new | **MetaText**, **EditedMarker**, **UrgentMark** |
|
|
111
111
|
| How far back reactions were read | **ReactionHorizon** — draws nothing when every one was |
|
|
112
|
+
| One thing that happened, in a list of what is new: who, what they did, when, where | **ActivityLine** — a menu row’s look, a link or a button; the mark beside the first line |
|
|
112
113
|
|
|
113
114
|
## Structure and wayfinding
|
|
114
115
|
|
|
@@ -123,6 +124,7 @@ The same conversation in every app; only its colours are each app's.
|
|
|
123
124
|
| Something new on a row or a card, no count | **UnreadDot** — the 6px dot in a 24px slot; in a sidebar row, **NavItem** `unread` draws it; `quiet` for a dot that is always there with nothing new; `tone="reaction"` for a reaction to you (NavItem `unreadTone`) |
|
|
124
125
|
| One thing — a conversation, a project, an object — as a box you can pick | **Card** — the fill by what it sits on; `href` for a link, `hover="fill"` in a feed, `onPress` when a press opens it |
|
|
125
126
|
| A section heading, chevron, hover actions, a count beside the title | **SectionHeader** |
|
|
127
|
+
| A list of things on a page, under column headings, each row a link | **ListTable** with **ListTableRow** — the columns give way by the list’s own width; `headings={false}` where the part’s heading names it |
|
|
126
128
|
| A group of rows that opens and closes, and stays how you left it | **CollapsibleSection** — `storageKey` remembers |
|
|
127
129
|
| The uppercase micro-label | **SectionLabel** |
|
|
128
130
|
| A hairline, or a line with words in the middle | **Divider** — `label`; `look="section"` between stretches of a list, `sticky` while it scrolls |
|