@estiva-app/ui 0.95.0 → 0.97.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/AppShell.d.ts +25 -7
- package/dist/AppShell.d.ts.map +1 -1
- package/dist/ArchivedNotice.d.ts +28 -0
- package/dist/ArchivedNotice.d.ts.map +1 -0
- package/dist/Avatar.d.ts +6 -1
- package/dist/Avatar.d.ts.map +1 -1
- package/dist/AvatarGroup.d.ts +2 -0
- package/dist/AvatarGroup.d.ts.map +1 -1
- package/dist/Button.d.ts +4 -3
- package/dist/Button.d.ts.map +1 -1
- package/dist/Card.d.ts.map +1 -1
- package/dist/CommentBox.d.ts.map +1 -1
- package/dist/ComposerTriggers.d.ts +2 -0
- package/dist/ComposerTriggers.d.ts.map +1 -1
- package/dist/ConversationActions.d.ts +24 -0
- package/dist/ConversationActions.d.ts.map +1 -0
- package/dist/ConversationCard.d.ts +90 -0
- package/dist/ConversationCard.d.ts.map +1 -0
- package/dist/ConversationLayout.d.ts +50 -0
- package/dist/ConversationLayout.d.ts.map +1 -0
- package/dist/ConversationMenu.d.ts +24 -0
- package/dist/ConversationMenu.d.ts.map +1 -0
- package/dist/Divider.d.ts +23 -4
- package/dist/Divider.d.ts.map +1 -1
- package/dist/EditedMarker.d.ts +11 -0
- package/dist/EditedMarker.d.ts.map +1 -0
- package/dist/IconButton.d.ts +3 -3
- package/dist/IconButton.d.ts.map +1 -1
- package/dist/LinkParts.d.ts +4 -1
- package/dist/LinkParts.d.ts.map +1 -1
- package/dist/ListColumn.d.ts +3 -1
- package/dist/ListColumn.d.ts.map +1 -1
- package/dist/MembersDialog.d.ts +4 -0
- package/dist/MembersDialog.d.ts.map +1 -1
- package/dist/MetaText.d.ts +22 -0
- package/dist/MetaText.d.ts.map +1 -0
- package/dist/NavItem.d.ts.map +1 -1
- package/dist/PageHeader.d.ts +50 -0
- package/dist/PageHeader.d.ts.map +1 -0
- package/dist/Panel.d.ts +6 -0
- package/dist/Panel.d.ts.map +1 -1
- package/dist/Person.d.ts +3 -1
- package/dist/Person.d.ts.map +1 -1
- package/dist/PersonTrigger.d.ts +1 -1
- package/dist/PersonTrigger.d.ts.map +1 -1
- package/dist/PinnedComment.d.ts +17 -0
- package/dist/PinnedComment.d.ts.map +1 -0
- package/dist/QuotedLine.d.ts +16 -0
- package/dist/QuotedLine.d.ts.map +1 -0
- package/dist/ReactionHorizon.d.ts +14 -0
- package/dist/ReactionHorizon.d.ts.map +1 -0
- package/dist/RepliesRow.d.ts +27 -0
- package/dist/RepliesRow.d.ts.map +1 -0
- package/dist/ResolveDialog.d.ts +13 -0
- package/dist/ResolveDialog.d.ts.map +1 -0
- package/dist/Select.d.ts +1 -1
- package/dist/Select.d.ts.map +1 -1
- package/dist/Skeleton.d.ts +8 -4
- package/dist/Skeleton.d.ts.map +1 -1
- package/dist/Thread.d.ts +38 -0
- package/dist/Thread.d.ts.map +1 -0
- package/dist/TopBar.d.ts +3 -2
- package/dist/TopBar.d.ts.map +1 -1
- package/dist/UrgentMark.d.ts +6 -0
- package/dist/UrgentMark.d.ts.map +1 -0
- package/dist/commentBoxFrame.d.ts +3 -1
- package/dist/commentBoxFrame.d.ts.map +1 -1
- package/dist/conversation.examples.d.ts +52 -0
- package/dist/conversation.examples.d.ts.map +1 -0
- package/dist/editor.js +33 -25
- package/dist/editor.js.map +2 -2
- package/dist/eslint/index.js +2 -1
- package/dist/eslint/index.js.map +2 -2
- package/dist/eslint/no-native-title.d.ts +1 -1
- package/dist/eslint/no-native-title.d.ts.map +1 -1
- package/dist/eslint/no-restyled-part.d.ts.map +1 -1
- package/dist/index.d.ts +18 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1412 -448
- package/dist/index.js.map +4 -4
- package/dist/linked.d.ts +4 -0
- package/dist/linked.d.ts.map +1 -1
- package/dist/linkedFrom.d.ts +2 -0
- package/dist/linkedFrom.d.ts.map +1 -1
- package/dist/looks.d.ts +13 -1
- package/dist/looks.d.ts.map +1 -1
- package/dist/threadCard.d.ts +46 -0
- package/dist/threadCard.d.ts.map +1 -0
- package/package.json +1 -1
- package/registry.json +1889 -544
- package/src/AppShell.mdx +24 -10
- package/src/AppShell.stories.tsx +65 -31
- package/src/AppShell.test.tsx +92 -10
- package/src/AppShell.tsx +108 -18
- package/src/ArchivedNotice.mdx +46 -0
- package/src/ArchivedNotice.stories.tsx +52 -0
- package/src/ArchivedNotice.test.tsx +42 -0
- package/src/ArchivedNotice.tsx +71 -0
- package/src/Avatar.agent.test.tsx +63 -0
- package/src/Avatar.mdx +25 -0
- package/src/Avatar.stories.tsx +13 -0
- package/src/Avatar.tsx +51 -3
- package/src/AvatarGroup.tsx +3 -1
- package/src/Button.mdx +2 -2
- package/src/Button.tsx +8 -6
- package/src/Card.test.tsx +4 -4
- package/src/Card.tsx +6 -2
- package/src/CommentBox.test.tsx +2 -1
- package/src/CommentBox.tsx +14 -7
- package/src/ComposerTriggers.stories.tsx +2 -0
- package/src/ComposerTriggers.tsx +3 -1
- package/src/ConfirmDialog.stories.tsx +12 -0
- package/src/ConversationActions.mdx +47 -0
- package/src/ConversationActions.stories.tsx +39 -0
- package/src/ConversationActions.tsx +96 -0
- package/src/ConversationCard.mdx +72 -0
- package/src/ConversationCard.states.test.tsx +330 -0
- package/src/ConversationCard.stories.tsx +135 -0
- package/src/ConversationCard.test.tsx +159 -0
- package/src/ConversationCard.tsx +524 -0
- package/src/ConversationLayout.mdx +61 -0
- package/src/ConversationLayout.stories.tsx +161 -0
- package/src/ConversationLayout.test.tsx +240 -0
- package/src/ConversationLayout.tsx +233 -0
- package/src/ConversationMenu.mdx +47 -0
- package/src/ConversationMenu.stories.tsx +42 -0
- package/src/ConversationMenu.test.tsx +47 -0
- package/src/ConversationMenu.tsx +57 -0
- package/src/Divider.mdx +36 -1
- package/src/Divider.stories.tsx +57 -0
- package/src/Divider.test.tsx +24 -1
- package/src/Divider.tsx +49 -9
- package/src/EditedMarker.mdx +36 -0
- package/src/EditedMarker.stories.tsx +24 -0
- package/src/EditedMarker.tsx +20 -0
- package/src/IconButton.mdx +2 -1
- package/src/IconButton.tsx +8 -5
- package/src/LinkCard.tsx +3 -3
- package/src/LinkChip.tsx +1 -1
- package/src/LinkParts.mdx +4 -0
- package/src/LinkParts.stories.tsx +10 -0
- package/src/LinkParts.tsx +9 -5
- package/src/LinkRow.tsx +1 -1
- package/src/ListColumn.tsx +9 -3
- package/src/MembersDialog.stories.tsx +11 -0
- package/src/MembersDialog.tsx +7 -3
- package/src/MetaText.mdx +41 -0
- package/src/MetaText.stories.tsx +29 -0
- package/src/MetaText.tsx +38 -0
- package/src/NavItem.tsx +2 -11
- package/src/PageHeader.mdx +123 -0
- package/src/PageHeader.stories.tsx +174 -0
- package/src/PageHeader.test.tsx +99 -0
- package/src/PageHeader.tsx +105 -0
- package/src/Panel.mdx +12 -0
- package/src/Panel.stories.tsx +47 -5
- package/src/Panel.test.tsx +40 -0
- package/src/Panel.tsx +8 -2
- package/src/Person.tsx +4 -2
- package/src/PersonTrigger.tsx +3 -3
- package/src/PinnedComment.mdx +40 -0
- package/src/PinnedComment.stories.tsx +21 -0
- package/src/PinnedComment.tsx +40 -0
- package/src/QuotedLine.mdx +44 -0
- package/src/QuotedLine.stories.tsx +30 -0
- package/src/QuotedLine.test.tsx +34 -0
- package/src/QuotedLine.tsx +33 -0
- package/src/ReactionHorizon.mdx +36 -0
- package/src/ReactionHorizon.stories.tsx +27 -0
- package/src/ReactionHorizon.tsx +27 -0
- package/src/RepliesRow.mdx +45 -0
- package/src/RepliesRow.stories.tsx +33 -0
- package/src/RepliesRow.test.tsx +47 -0
- package/src/RepliesRow.tsx +86 -0
- package/src/ReplyCard.mdx +50 -0
- package/src/ReplyCard.stories.tsx +68 -0
- package/src/ResolveDialog.mdx +44 -0
- package/src/ResolveDialog.stories.tsx +23 -0
- package/src/ResolveDialog.test.tsx +53 -0
- package/src/ResolveDialog.tsx +58 -0
- package/src/Select.tsx +12 -2
- package/src/Skeleton.stories.tsx +4 -1
- package/src/Skeleton.tsx +33 -4
- package/src/Thread.mdx +53 -0
- package/src/Thread.stories.tsx +167 -0
- package/src/Thread.test.tsx +83 -0
- package/src/Thread.tsx +113 -0
- package/src/TopBar.mdx +8 -6
- package/src/TopBar.stories.tsx +4 -3
- package/src/TopBar.tsx +8 -3
- package/src/UrgentMark.mdx +37 -0
- package/src/UrgentMark.stories.tsx +27 -0
- package/src/UrgentMark.tsx +15 -0
- package/src/commentBoxFrame.tsx +8 -4
- package/src/conversation.examples.tsx +135 -0
- package/src/eslint/no-native-title.ts +1 -1
- package/src/eslint/no-restyled-part.ts +1 -0
- package/src/index.ts +19 -2
- package/src/linked.ts +4 -0
- package/src/linkedFrom.ts +5 -3
- package/src/looks.ts +18 -2
- package/src/registry/registry.test.ts +9 -7
- package/src/threadCard.ts +84 -0
- package/stories/Choosing.mdx +21 -1
- package/tokens.css +14 -10
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
/** What the PageHeader page claims, pinned: what a person sees and reaches in the bar, slot by slot. */
|
|
3
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
4
|
+
import { cleanup, render, screen, within } from '@testing-library/react'
|
|
5
|
+
import userEvent from '@testing-library/user-event'
|
|
6
|
+
import { IconDotsVertical, IconSquareRounded } from '@tabler/icons-react'
|
|
7
|
+
import { Breadcrumb } from './Breadcrumb'
|
|
8
|
+
import { Button } from './Button'
|
|
9
|
+
import { MembersPill } from './MembersPill'
|
|
10
|
+
import { PageHeader } from './PageHeader'
|
|
11
|
+
import { Toolbar, ToolbarButton } from './Toolbar'
|
|
12
|
+
|
|
13
|
+
afterEach(cleanup)
|
|
14
|
+
|
|
15
|
+
const toolbar = (
|
|
16
|
+
<Toolbar aria-label="Page actions" surface={false}>
|
|
17
|
+
<ToolbarButton tooltip="Action" aria-label="Action">
|
|
18
|
+
<IconSquareRounded size={16} stroke={1.5} />
|
|
19
|
+
</ToolbarButton>
|
|
20
|
+
<ToolbarButton tooltip="More" aria-label="More">
|
|
21
|
+
<IconDotsVertical size={16} stroke={1.5} />
|
|
22
|
+
</ToolbarButton>
|
|
23
|
+
</Toolbar>
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
describe('PageHeader', () => {
|
|
27
|
+
it('shows the title, and nothing else when given nothing else', () => {
|
|
28
|
+
const { container } = render(<PageHeader title="Item one" />)
|
|
29
|
+
expect(container.textContent).toBe('Item one')
|
|
30
|
+
expect(screen.queryByRole('button')).toBeNull()
|
|
31
|
+
expect(screen.queryByRole('img', { name: 'Private' })).toBeNull()
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('a private page has a lock named "Private" before its title', () => {
|
|
35
|
+
const { container } = render(<PageHeader title="Item one" private />)
|
|
36
|
+
const lock = screen.getByRole('img', { name: 'Private' })
|
|
37
|
+
// Before the title in reading order.
|
|
38
|
+
expect(lock.compareDocumentPosition(screen.getByText('Item one')) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
|
|
39
|
+
expect(container.textContent).toBe('Item one')
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('names the lock in a tooltip when the pointer is on it', async () => {
|
|
43
|
+
const user = userEvent.setup()
|
|
44
|
+
render(<PageHeader title="Item one" private />)
|
|
45
|
+
await user.hover(screen.getByRole('img', { name: 'Private' }))
|
|
46
|
+
expect((await screen.findByRole('tooltip')).textContent).toBe('Private')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('draws the counts in the order given, as words', () => {
|
|
50
|
+
render(<PageHeader title="Item one" meta={['6 open', { label: '2 done', done: true }]} />)
|
|
51
|
+
const open = screen.getByText('6 open')
|
|
52
|
+
const done = screen.getByText('2 done')
|
|
53
|
+
expect(open.compareDocumentPosition(done) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('shows when it last changed, and the exact time in a tooltip under the pointer', async () => {
|
|
57
|
+
const user = userEvent.setup()
|
|
58
|
+
render(<PageHeader title="Item one" time={{ label: 'Edited 2 minutes ago', exact: '31 October 2026, 14:02' }} />)
|
|
59
|
+
const when = screen.getByText('Edited 2 minutes ago')
|
|
60
|
+
expect(screen.queryByRole('tooltip')).toBeNull()
|
|
61
|
+
await user.hover(when)
|
|
62
|
+
expect((await screen.findByRole('tooltip')).textContent).toBe('31 October 2026, 14:02')
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('the members pill is a button that opens the list', async () => {
|
|
66
|
+
const user = userEvent.setup()
|
|
67
|
+
let opened = 0
|
|
68
|
+
render(<PageHeader title="Item one" members={<MembersPill members={[{ name: 'Ana Duarte' }, { name: 'Ravi Mehta' }]} onClick={() => opened++} />} />)
|
|
69
|
+
await user.click(screen.getByRole('button', { name: '2 members' }))
|
|
70
|
+
expect(opened).toBe(1)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('the buttons come after everything else, in reading order and in the Tab order', async () => {
|
|
74
|
+
const user = userEvent.setup()
|
|
75
|
+
render(
|
|
76
|
+
<PageHeader
|
|
77
|
+
title="Item one"
|
|
78
|
+
after={<Button size="small">Open</Button>}
|
|
79
|
+
meta={['6 open']}
|
|
80
|
+
members={<MembersPill members={[{ name: 'Ana Duarte' }]} onClick={() => {}} />}
|
|
81
|
+
actions={toolbar}
|
|
82
|
+
/>,
|
|
83
|
+
)
|
|
84
|
+
await user.tab()
|
|
85
|
+
expect(document.activeElement).toBe(screen.getByRole('button', { name: 'Open' }))
|
|
86
|
+
await user.tab()
|
|
87
|
+
expect(document.activeElement).toBe(screen.getByRole('button', { name: '1 member' }))
|
|
88
|
+
await user.tab()
|
|
89
|
+
// The toolbar is one stop; its first button takes it.
|
|
90
|
+
expect(document.activeElement).toBe(within(screen.getByRole('toolbar', { name: 'Page actions' })).getByRole('button', { name: 'Action' }))
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
it('a title that is not a string is drawn as given: a breadcrumb trail stays a trail', () => {
|
|
94
|
+
render(<PageHeader title={<Breadcrumb items={[{ label: 'Items', href: '#' }, { label: 'ITM-12', mono: true }]} />} />)
|
|
95
|
+
const trail = screen.getByRole('navigation', { name: 'Breadcrumb' })
|
|
96
|
+
expect(within(trail).getByRole('link', { name: 'Items' })).toBeTruthy()
|
|
97
|
+
expect(within(trail).getByText('ITM-12').getAttribute('aria-current')).toBe('page')
|
|
98
|
+
})
|
|
99
|
+
})
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Fragment, type ReactNode } from 'react'
|
|
2
|
+
import { IconLock } from '@tabler/icons-react'
|
|
3
|
+
import { cn } from './cn'
|
|
4
|
+
import { ContainerHeader } from './ContainerHeader'
|
|
5
|
+
import { MetaText } from './MetaText'
|
|
6
|
+
import { WithTooltip } from './Tooltip'
|
|
7
|
+
|
|
8
|
+
/** One of the quiet words at the right of a `PageHeader`: a count, and whether it is about what is finished. */
|
|
9
|
+
export interface PageHeaderMeta {
|
|
10
|
+
/** The words: "6 open", "2 done". */
|
|
11
|
+
label: string
|
|
12
|
+
/** Words about what is finished: in the success colour. Default: the secondary text. */
|
|
13
|
+
done?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The bar at the top of a page: what the page is, and what acts on all of it.
|
|
18
|
+
* ContainerHeader's bar (48px, a hairline under it, 16px in at each end) with
|
|
19
|
+
* a fixed place for each thing the apps' own page bars hold, so they stop
|
|
20
|
+
* laying them out one by one.
|
|
21
|
+
*
|
|
22
|
+
* At the left, in this order, 8px apart: an icon or a face, a lock, the title,
|
|
23
|
+
* something right after it. At the right, 12px apart: quiet words (counts),
|
|
24
|
+
* when it last changed, the members, then the page's buttons. Those numbers
|
|
25
|
+
* are Peek's page bar and Leaf's, measured on 31 October: the counts and the
|
|
26
|
+
* members are one group 12px clear of the buttons (Katerina, 8 October), and
|
|
27
|
+
* the buttons sit 4px apart, as every bar's do.
|
|
28
|
+
*/
|
|
29
|
+
export interface PageHeaderProps {
|
|
30
|
+
/**
|
|
31
|
+
* The page's name. A string is one line in `body-2-strong`, cut short with
|
|
32
|
+
* an ellipsis when there is no room. A node — a `Breadcrumb`, an
|
|
33
|
+
* `InlineText` — is drawn as given, in the room that is left.
|
|
34
|
+
*/
|
|
35
|
+
title: ReactNode
|
|
36
|
+
/** Before the title, 16px: an icon at stroke 1.5, or a face (`Avatar size={16}`). A bare icon takes the secondary text colour. */
|
|
37
|
+
leading?: ReactNode
|
|
38
|
+
/** A lock before the title: only its members can open this page. Named "Private" to assistive technology and in a tooltip. */
|
|
39
|
+
private?: boolean
|
|
40
|
+
/** Right after the title, 8px from it, and never cut short: a small `Button`, a `Chip`. */
|
|
41
|
+
after?: ReactNode
|
|
42
|
+
/** Quiet words at the right, before the members: counts. A dot between each, each in `MetaText` (in Signal, the mono micro-type). */
|
|
43
|
+
meta?: (string | PageHeaderMeta)[]
|
|
44
|
+
/** When it last changed, in words — "Edited 2 minutes ago" — 12px italic, with the exact time in a tooltip. */
|
|
45
|
+
time?: { label: string; exact: string }
|
|
46
|
+
/** Who is in it: a `MembersPill`. */
|
|
47
|
+
members?: ReactNode
|
|
48
|
+
/** The page's own buttons, at the right edge: a `Toolbar` with `surface={false}` of `ToolbarButton`s, or one `IconButton`. */
|
|
49
|
+
actions?: ReactNode
|
|
50
|
+
/** Placement only. */
|
|
51
|
+
className?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function PageHeader({ title, leading, private: locked = false, after, meta, time, members, actions, className }: PageHeaderProps) {
|
|
55
|
+
const words = (meta ?? []).map((one) => (typeof one === 'string' ? { label: one } : one))
|
|
56
|
+
const quiet = words.length > 0 || time != null || members != null
|
|
57
|
+
|
|
58
|
+
const name = (
|
|
59
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
60
|
+
{leading != null && <span className="flex shrink-0 items-center text-text-secondary">{leading}</span>}
|
|
61
|
+
{locked && (
|
|
62
|
+
<WithTooltip label="Private">
|
|
63
|
+
<IconLock size={16} stroke={1.5} role="img" aria-label="Private" className="shrink-0 text-text-secondary" />
|
|
64
|
+
</WithTooltip>
|
|
65
|
+
)}
|
|
66
|
+
{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>}
|
|
68
|
+
</div>
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
const right =
|
|
72
|
+
quiet || actions != null ? (
|
|
73
|
+
<>
|
|
74
|
+
{quiet && (
|
|
75
|
+
// The quiet group: 12px between its parts, and 12px clear of the buttons — the bar sets
|
|
76
|
+
// 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', actions != null && 'pr-2')}>
|
|
78
|
+
{words.length > 0 && (
|
|
79
|
+
<div className="flex items-center gap-2">
|
|
80
|
+
{words.map((one, i) => (
|
|
81
|
+
<Fragment key={`${one.label}-${i}`}>
|
|
82
|
+
{i > 0 && (
|
|
83
|
+
// eslint-disable-next-line token-spacing/no-restricted-classes -- @estiva-escape: Peek's dot between its counts, 3px measured on 31 October; the scale steps from 2px to 4px
|
|
84
|
+
<span aria-hidden="true" className="size-[3px] shrink-0 rounded-full bg-text-muted" />
|
|
85
|
+
)}
|
|
86
|
+
<MetaText tone={one.done ? 'success' : 'secondary'}>{one.label}</MetaText>
|
|
87
|
+
</Fragment>
|
|
88
|
+
))}
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
91
|
+
{time && (
|
|
92
|
+
<WithTooltip label={time.exact}>
|
|
93
|
+
{/* Quieter than the title: 12px and italic, as every "time ago" line is (Katerina, 30 October), in the muted words (1 November). */}
|
|
94
|
+
<span className="whitespace-nowrap text-caption italic text-text-muted">{time.label}</span>
|
|
95
|
+
</WithTooltip>
|
|
96
|
+
)}
|
|
97
|
+
{members}
|
|
98
|
+
</div>
|
|
99
|
+
)}
|
|
100
|
+
{actions}
|
|
101
|
+
</>
|
|
102
|
+
) : undefined
|
|
103
|
+
|
|
104
|
+
return <ContainerHeader title={name} actions={right} className={className} />
|
|
105
|
+
}
|
package/src/Panel.mdx
CHANGED
|
@@ -56,6 +56,18 @@ import { Panel, IconButton } from '@estiva-app/ui'
|
|
|
56
56
|
ContainerHeader's: 48px, a hairline under it.
|
|
57
57
|
- A panel that follows its scroll (a thread that opens at its newest reply)
|
|
58
58
|
reads it with `bodyRef` and `onBodyScroll`.
|
|
59
|
+
- A **Chip** in `actions`, before the close button, says the state of what
|
|
60
|
+
the panel shows. The bar sets its actions 4px apart, so the chip sits 4px
|
|
61
|
+
from the button. Here at 384px, the right column's width in every app.
|
|
62
|
+
|
|
63
|
+
<Canvas of={PanelStories.WithAChip} />
|
|
64
|
+
|
|
65
|
+
- A panel that is the page — a file's or a document's — takes the page's
|
|
66
|
+
own bar in `header`: a **PageHeader**, drawn in place of the panel's.
|
|
67
|
+
`title` still names the panel if it breaks.
|
|
68
|
+
|
|
69
|
+
<Canvas of={PanelStories.WithAPageHeader} />
|
|
70
|
+
|
|
59
71
|
- **A crash stays inside it.** If its body, its actions or its footer break,
|
|
60
72
|
it keeps its title and shows "Something went wrong in the panel… try again"
|
|
61
73
|
in the room the body had. It is **ErrorBoundary**'s.
|
package/src/Panel.stories.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
import { IconDotsVertical } from '@tabler/icons-react'
|
|
2
|
+
import { IconDotsVertical, IconX } from '@tabler/icons-react'
|
|
3
|
+
import { Chip } from './Chip'
|
|
3
4
|
import { IconButton } from './IconButton'
|
|
5
|
+
import { PageHeader } from './PageHeader'
|
|
4
6
|
import { Panel } from './Panel'
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -13,11 +15,12 @@ const meta = {
|
|
|
13
15
|
component: Panel,
|
|
14
16
|
parameters: { layout: 'fullscreen' },
|
|
15
17
|
args: { title: 'Details', children: null, bodyClassName: 'flex flex-col gap-3 px-4 pt-3 pb-4' },
|
|
16
|
-
argTypes: { children: { control: false }, actions: { control: false }, footer: { control: false } },
|
|
17
|
-
// A side column of the frame: 380px wide and a fixed height, where a panel sits beside a page
|
|
18
|
+
argTypes: { children: { control: false }, actions: { control: false }, header: { control: false }, footer: { control: false } },
|
|
19
|
+
// A side column of the frame: 380px wide and a fixed height, where a panel sits beside a page;
|
|
20
|
+
// 384px, the right column's width in every app (Katerina, 31 October), where a story says so.
|
|
18
21
|
decorators: [
|
|
19
|
-
(Story) => (
|
|
20
|
-
<div className=
|
|
22
|
+
(Story, { parameters }) => (
|
|
23
|
+
<div className={parameters.rightColumn ? 'flex h-[560px] w-[384px] flex-col border-l border-border-subtle bg-bg-surface' : 'flex h-[560px] w-[380px] flex-col border-l border-border-subtle bg-bg-surface'}>
|
|
21
24
|
{Story()}
|
|
22
25
|
</div>
|
|
23
26
|
),
|
|
@@ -70,6 +73,45 @@ export const WithAFooter: Story = {
|
|
|
70
73
|
),
|
|
71
74
|
}
|
|
72
75
|
|
|
76
|
+
/** A chip before the close button, saying the state of what the panel shows; the right column's width, 384px. */
|
|
77
|
+
export const WithAChip: Story = {
|
|
78
|
+
parameters: { rightColumn: true },
|
|
79
|
+
args: {
|
|
80
|
+
actions: (
|
|
81
|
+
<>
|
|
82
|
+
<Chip type="success" label="Label" />
|
|
83
|
+
<IconButton tooltip="Close" aria-label="Close">
|
|
84
|
+
<IconX size={16} stroke={1.5} />
|
|
85
|
+
</IconButton>
|
|
86
|
+
</>
|
|
87
|
+
),
|
|
88
|
+
},
|
|
89
|
+
render: (args) => <Panel {...args}>{paragraphs(3)}</Panel>,
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** A page's own bar in place of the panel's: a PageHeader, where the panel is the page. The body still scrolls under it. */
|
|
93
|
+
export const WithAPageHeader: Story = {
|
|
94
|
+
name: 'With a page header',
|
|
95
|
+
args: {
|
|
96
|
+
header: (
|
|
97
|
+
<PageHeader
|
|
98
|
+
title="Item one"
|
|
99
|
+
time={{ label: 'Edited 2 minutes ago', exact: '1 November 2026, 14:02' }}
|
|
100
|
+
actions={
|
|
101
|
+
<IconButton tooltip="More" aria-label="More">
|
|
102
|
+
<IconDotsVertical size={16} stroke={1.5} />
|
|
103
|
+
</IconButton>
|
|
104
|
+
}
|
|
105
|
+
/>
|
|
106
|
+
),
|
|
107
|
+
children: Array.from({ length: 24 }, (_, i) => (
|
|
108
|
+
<p key={i} className="text-body-2 text-text-secondary">
|
|
109
|
+
A line of the page, number {i + 1}.
|
|
110
|
+
</p>
|
|
111
|
+
)),
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
|
|
73
115
|
/** Two panels in one column: the first capped at three fifths, each scrolls in its own room. */
|
|
74
116
|
export const TwoInAColumn: Story = {
|
|
75
117
|
render: (args) => (
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
3
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
4
|
+
import { Panel } from './Panel'
|
|
5
|
+
|
|
6
|
+
afterEach(cleanup)
|
|
7
|
+
|
|
8
|
+
function Breaks(): never {
|
|
9
|
+
throw new Error('the body broke')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
describe('Panel', () => {
|
|
13
|
+
it('draws its own bar from its title', () => {
|
|
14
|
+
render(<Panel title="Details">Body</Panel>)
|
|
15
|
+
expect(screen.getByText('Details')).toBeTruthy()
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('draws a page’s own bar in place of its own, with `header`', () => {
|
|
19
|
+
render(
|
|
20
|
+
<Panel title="Details" header={<div>The page’s bar</div>}>
|
|
21
|
+
Body
|
|
22
|
+
</Panel>,
|
|
23
|
+
)
|
|
24
|
+
expect(screen.getByText('The page’s bar')).toBeTruthy()
|
|
25
|
+
expect(screen.queryByText('Details')).toBeNull()
|
|
26
|
+
expect(screen.getByText('Body')).toBeTruthy()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('keeps its title when it breaks, even with a page’s bar, which may be what broke', () => {
|
|
30
|
+
vi.spyOn(console, 'error').mockImplementation(() => {})
|
|
31
|
+
render(
|
|
32
|
+
<Panel title="Details" header={<div>The page’s bar</div>}>
|
|
33
|
+
<Breaks />
|
|
34
|
+
</Panel>,
|
|
35
|
+
)
|
|
36
|
+
expect(screen.getByText('Details')).toBeTruthy()
|
|
37
|
+
expect(screen.queryByText('The page’s bar')).toBeNull()
|
|
38
|
+
vi.restoreAllMocks()
|
|
39
|
+
})
|
|
40
|
+
})
|
package/src/Panel.tsx
CHANGED
|
@@ -35,6 +35,12 @@ export interface PanelProps {
|
|
|
35
35
|
chevron?: boolean
|
|
36
36
|
/** The panel's own actions, at the header's right — a `Toolbar` of `ToolbarButton`s, or one `IconButton`. */
|
|
37
37
|
actions?: ReactNode
|
|
38
|
+
/**
|
|
39
|
+
* A page's own bar, in place of the one `title`, `chevron` and `actions` draw: a `PageHeader`, where the panel is
|
|
40
|
+
* the page (Peek's file pages, Leaf's documents), so the page's bar and its scrolling body are one panel. `title`
|
|
41
|
+
* still names the panel if it breaks.
|
|
42
|
+
*/
|
|
43
|
+
header?: ReactNode
|
|
38
44
|
/** The body. It scrolls when it is taller than the panel. */
|
|
39
45
|
children: ReactNode
|
|
40
46
|
/** A row fixed under the body that never scrolls — a reply box. */
|
|
@@ -49,10 +55,10 @@ export interface PanelProps {
|
|
|
49
55
|
className?: string
|
|
50
56
|
}
|
|
51
57
|
|
|
52
|
-
function Frame({ title, chevron = false, actions, children, footer, bodyClassName, bodyRef, onBodyScroll, className, broken = false }: PanelProps & { broken?: boolean }) {
|
|
58
|
+
function Frame({ title, chevron = false, actions, header, children, footer, bodyClassName, bodyRef, onBodyScroll, className, broken = false }: PanelProps & { broken?: boolean }) {
|
|
53
59
|
return (
|
|
54
60
|
<div className={cn('flex h-full min-h-0 flex-1 flex-col', className)}>
|
|
55
|
-
<ContainerHeader title={title} chevron={chevron} actions={actions} />
|
|
61
|
+
{header ?? <ContainerHeader title={title} chevron={chevron} actions={actions} />}
|
|
56
62
|
{broken ? (
|
|
57
63
|
// The message takes the room the body had and centres itself in it.
|
|
58
64
|
<div className="flex min-h-0 flex-1 flex-col px-4">{children}</div>
|
package/src/Person.tsx
CHANGED
|
@@ -20,19 +20,21 @@ import { Avatar } from './Avatar'
|
|
|
20
20
|
export interface PersonProps {
|
|
21
21
|
name?: string
|
|
22
22
|
picture?: string
|
|
23
|
+
/** An agent: its face is a robot, as Avatar's `bot`. */
|
|
24
|
+
bot?: boolean
|
|
23
25
|
/** Shown in place of a missing name. */
|
|
24
26
|
fallback?: string
|
|
25
27
|
size?: number
|
|
26
28
|
className?: string
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
export function Person({ name, picture, fallback = '—', size = 20, className }: PersonProps) {
|
|
31
|
+
export function Person({ name, picture, bot, fallback = '—', size = 20, className }: PersonProps) {
|
|
30
32
|
return (
|
|
31
33
|
// gap-2: the face-to-name distance is one rule (8px) wherever a person
|
|
32
34
|
// appears — Katerina, 2026-09-01, set on Person so PersonTrigger and every
|
|
33
35
|
// row agree by construction.
|
|
34
36
|
<span className={cn('flex min-w-0 items-center gap-2', className)}>
|
|
35
|
-
<Avatar name={name} src={picture} size={size} />
|
|
37
|
+
<Avatar name={name} src={picture} bot={bot} size={size} />
|
|
36
38
|
<span className={cn('truncate', !name && 'text-text-muted')}>{name ?? fallback}</span>
|
|
37
39
|
</span>
|
|
38
40
|
)
|
package/src/PersonTrigger.tsx
CHANGED
|
@@ -29,7 +29,7 @@ export interface PersonTriggerProps
|
|
|
29
29
|
compact?: boolean
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export function PersonTrigger({ name, picture, fallback, size, open = false, compact = false, className, ...props }: PersonTriggerProps) {
|
|
32
|
+
export function PersonTrigger({ name, picture, bot, fallback, size, open = false, compact = false, className, ...props }: PersonTriggerProps) {
|
|
33
33
|
if (compact) {
|
|
34
34
|
return (
|
|
35
35
|
<BaseButton
|
|
@@ -56,7 +56,7 @@ export function PersonTrigger({ name, picture, fallback, size, open = false, com
|
|
|
56
56
|
className={cn('cursor-pointer rounded-full', className)}
|
|
57
57
|
{...props}
|
|
58
58
|
>
|
|
59
|
-
<Avatar name={name} src={picture} size={size ?? 36} />
|
|
59
|
+
<Avatar name={name} src={picture} bot={bot} size={size ?? 36} />
|
|
60
60
|
</BaseButton>
|
|
61
61
|
)
|
|
62
62
|
}
|
|
@@ -78,7 +78,7 @@ export function PersonTrigger({ name, picture, fallback, size, open = false, com
|
|
|
78
78
|
)}
|
|
79
79
|
{...props}
|
|
80
80
|
>
|
|
81
|
-
<Person name={name} picture={picture} fallback={fallback} size={size ?? 22} />
|
|
81
|
+
<Person name={name} picture={picture} bot={bot} fallback={fallback} size={size ?? 22} />
|
|
82
82
|
<IconChevronDown size={14} stroke={1.5} className="shrink-0 text-text-muted" />
|
|
83
83
|
</BaseButton>
|
|
84
84
|
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
|
|
2
|
+
import * as Stories from './PinnedComment.stories'
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# PinnedComment
|
|
7
|
+
|
|
8
|
+
The comment a thread answers, pinned at the top of the replies column: who, when, and its first line.
|
|
9
|
+
|
|
10
|
+
<Canvas of={Stories.Pinned} />
|
|
11
|
+
|
|
12
|
+
## When
|
|
13
|
+
|
|
14
|
+
- At the top of a **Thread** in the right column. Thread draws it from its `start`.
|
|
15
|
+
|
|
16
|
+
<Canvas of={Stories.Deleted} />
|
|
17
|
+
|
|
18
|
+
## When not
|
|
19
|
+
|
|
20
|
+
- The comment itself, in the list → **ConversationCard**.
|
|
21
|
+
|
|
22
|
+
## How
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { Thread } from '@estiva-app/ui'
|
|
26
|
+
|
|
27
|
+
<Thread start={{ author: author, time: time, words: words }} onClose={onClose} box={box}>
|
|
28
|
+
{replies}
|
|
29
|
+
</Thread>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- Give `time` its day: no day line stands above it here.
|
|
33
|
+
|
|
34
|
+
## What it owns
|
|
35
|
+
|
|
36
|
+
Nothing. It only draws. Clicks and keys are yours.
|
|
37
|
+
|
|
38
|
+
## Props
|
|
39
|
+
|
|
40
|
+
<Controls />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import { Column, ONE, WORDS } from './conversation.examples'
|
|
3
|
+
import { PinnedComment } from './PinnedComment'
|
|
4
|
+
|
|
5
|
+
/** The comment a thread answers, at the top of the replies column. */
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Conversation/PinnedComment',
|
|
8
|
+
component: PinnedComment,
|
|
9
|
+
parameters: { layout: 'padded' },
|
|
10
|
+
args: { author: ONE, time: 'Today 11:08 AM', words: WORDS },
|
|
11
|
+
decorators: [(Story) => <Column>{Story()}</Column>],
|
|
12
|
+
} satisfies Meta<typeof PinnedComment>
|
|
13
|
+
|
|
14
|
+
export default meta
|
|
15
|
+
type Story = StoryObj<typeof meta>
|
|
16
|
+
|
|
17
|
+
/** Who, when, and its first line. */
|
|
18
|
+
export const Pinned: Story = {}
|
|
19
|
+
|
|
20
|
+
/** It was deleted; its replies stay under it. */
|
|
21
|
+
export const Deleted: Story = { args: { deleted: true } }
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { Avatar } from './Avatar'
|
|
3
|
+
import { Card } from './Card'
|
|
4
|
+
import type { ConversationPerson } from './ConversationCard'
|
|
5
|
+
import { MetaText } from './MetaText'
|
|
6
|
+
|
|
7
|
+
export interface PinnedCommentProps {
|
|
8
|
+
author: ConversationPerson
|
|
9
|
+
/** When it was written, in the app's words, with its day: no day line stands above it here. */
|
|
10
|
+
time: ReactNode
|
|
11
|
+
/** Its words, cut to one line: plain words read best. */
|
|
12
|
+
words: ReactNode
|
|
13
|
+
/** It was deleted; its replies stay. */
|
|
14
|
+
deleted?: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The comment a thread answers, pinned at the top of the replies column: who, when, and its first line, on a raised
|
|
19
|
+
* card. Peek's pinned message, moved with the conversation.
|
|
20
|
+
*/
|
|
21
|
+
export function PinnedComment({ author, time, words, deleted = false }: PinnedCommentProps) {
|
|
22
|
+
return (
|
|
23
|
+
<Card fill="elevated" clip>
|
|
24
|
+
{deleted ? (
|
|
25
|
+
<p className="p-2 text-caption italic text-text-muted">This comment was deleted.</p>
|
|
26
|
+
) : (
|
|
27
|
+
<div className="flex flex-col p-2">
|
|
28
|
+
<div className="flex items-center gap-2">
|
|
29
|
+
<Avatar size={24} src={author.picture} alt={author.name} bot={author.bot} />
|
|
30
|
+
<span className="min-w-0 truncate text-body-2-strong text-text-primary">{author.name}</span>
|
|
31
|
+
<MetaText className="shrink-0">{time}</MetaText>
|
|
32
|
+
</div>
|
|
33
|
+
<div className="pb-2 pl-8 pr-2 pt-1">
|
|
34
|
+
<div className="truncate text-caption text-text-secondary">{words}</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
)}
|
|
38
|
+
</Card>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
|
|
2
|
+
import * as Stories from './QuotedLine.stories'
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# QuotedLine
|
|
7
|
+
|
|
8
|
+
On a comment on a part of the page: the words it is on, in the page's own highlight, under the name and above the comment's words.
|
|
9
|
+
|
|
10
|
+
<Canvas of={Stories.Words} />
|
|
11
|
+
|
|
12
|
+
## When
|
|
13
|
+
|
|
14
|
+
- On a **ConversationCard** about a part of the page, in its `about`.
|
|
15
|
+
|
|
16
|
+
<Canvas of={Stories.Reworded} />
|
|
17
|
+
|
|
18
|
+
<Canvas of={Stories.Gone} />
|
|
19
|
+
|
|
20
|
+
## When not
|
|
21
|
+
|
|
22
|
+
- A whole block quoted in the words → **PartCard**.
|
|
23
|
+
|
|
24
|
+
## How
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { ConversationCard, QuotedLine } from '@estiva-app/ui'
|
|
28
|
+
|
|
29
|
+
<ConversationCard author={author} time={time} about={<QuotedLine words={quote} state="reworded" />}>
|
|
30
|
+
{words}
|
|
31
|
+
</ConversationCard>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- Two lines at most; the whole words are in the tooltip.
|
|
35
|
+
- A part with no words, a picture or a block: `label`, its name in your words.
|
|
36
|
+
- Made for the card's `about`: the card puts it under the name, where the words start.
|
|
37
|
+
|
|
38
|
+
## What it owns
|
|
39
|
+
|
|
40
|
+
Nothing. It only draws. Clicks and keys are yours.
|
|
41
|
+
|
|
42
|
+
## Props
|
|
43
|
+
|
|
44
|
+
<Controls />
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import { Column } from './conversation.examples'
|
|
3
|
+
import { QuotedLine } from './QuotedLine'
|
|
4
|
+
|
|
5
|
+
/** On a comment on a part of the page, under the name and above its words: the words it is on, in the page's highlight. */
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Conversation/QuotedLine',
|
|
8
|
+
component: QuotedLine,
|
|
9
|
+
parameters: { layout: 'padded' },
|
|
10
|
+
args: { words: 'the words this comment is on' },
|
|
11
|
+
decorators: [(Story) => <Column>{Story()}</Column>],
|
|
12
|
+
} satisfies Meta<typeof QuotedLine>
|
|
13
|
+
|
|
14
|
+
export default meta
|
|
15
|
+
type Story = StoryObj<typeof meta>
|
|
16
|
+
|
|
17
|
+
/** The words the comment is on, still in the text: in the page's highlight, so the two read as one. */
|
|
18
|
+
export const Words: Story = { name: 'Words' }
|
|
19
|
+
|
|
20
|
+
/** The words were changed since: the highlight goes grey, and "Changed since". */
|
|
21
|
+
export const Reworded: Story = { name: 'Words changed', args: { state: 'reworded' } }
|
|
22
|
+
|
|
23
|
+
/** The part was deleted from the page: the words struck through, and "Deleted from the page". */
|
|
24
|
+
export const Gone: Story = { name: 'Part deleted', args: { state: 'gone' } }
|
|
25
|
+
|
|
26
|
+
/** On a part with no words of its own, a picture: its name, in the app's words. */
|
|
27
|
+
export const Part: Story = { name: 'No words', args: { words: undefined, label: 'Picture: plan-sketch.png' } }
|
|
28
|
+
|
|
29
|
+
/** Words longer than two lines: cut, the whole in the tooltip. */
|
|
30
|
+
export const Long: Story = { name: 'Long words', args: { words: 'the words this comment is on, which run on past the width of the column, and on again, so that two lines are not enough and the words have to be cut before their end' } }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
3
|
+
import { cleanup, render, screen } from '@testing-library/react'
|
|
4
|
+
import { QuotedLine } from './QuotedLine'
|
|
5
|
+
|
|
6
|
+
afterEach(cleanup)
|
|
7
|
+
|
|
8
|
+
describe('QuotedLine', () => {
|
|
9
|
+
it('marks the words in the page’s highlight while they are still in the text', () => {
|
|
10
|
+
const { container } = render(<QuotedLine words="the words this comment is on" />)
|
|
11
|
+
const mark = screen.getByText('the words this comment is on')
|
|
12
|
+
expect(mark.tagName).toBe('MARK')
|
|
13
|
+
expect(mark.className).toMatch(/\bbg-warning-muted\b/)
|
|
14
|
+
expect(container.querySelector('[data-quoted="here"]')).not.toBeNull()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('says the words changed since, and loses the highlight', () => {
|
|
18
|
+
render(<QuotedLine words="the words" state="reworded" />)
|
|
19
|
+
expect(screen.getByText('Changed since')).toBeTruthy()
|
|
20
|
+
expect(screen.getByText('the words').className).not.toMatch(/\bbg-warning-muted\b/)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('says the part was deleted, and strikes the words through', () => {
|
|
24
|
+
render(<QuotedLine words="the words" state="gone" />)
|
|
25
|
+
expect(screen.getByText('Deleted from the page')).toBeTruthy()
|
|
26
|
+
expect(screen.getByText('the words').className).toMatch(/\bline-through\b/)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('gives a part with no words its name', () => {
|
|
30
|
+
const { container } = render(<QuotedLine label="Picture: plan-sketch.png" />)
|
|
31
|
+
expect(screen.getByText('Picture: plan-sketch.png')).toBeTruthy()
|
|
32
|
+
expect(container.querySelector('[data-quoted="part"]')).not.toBeNull()
|
|
33
|
+
})
|
|
34
|
+
})
|