@estiva-app/ui 0.95.0 → 0.96.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/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/ConversationActions.d.ts +24 -0
- package/dist/ConversationActions.d.ts.map +1 -0
- package/dist/ConversationCard.d.ts +88 -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 +3 -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/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/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 +26 -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 +32 -24
- 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 +1376 -433
- package/dist/index.js.map +4 -4
- 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 +1873 -546
- 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/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/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 +522 -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/LinkParts.mdx +4 -0
- package/src/LinkParts.stories.tsx +10 -0
- package/src/LinkParts.tsx +5 -1
- package/src/ListColumn.tsx +9 -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/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/looks.ts +18 -2
- package/src/registry/registry.test.ts +7 -6
- package/src/threadCard.ts +84 -0
- package/stories/Choosing.mdx +21 -1
- package/tokens.css +14 -10
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import { archivedLine } from './archivedLine'
|
|
4
|
+
import { Card } from './Card'
|
|
5
|
+
import { ConversationCard, ReplyCard } from './ConversationCard'
|
|
6
|
+
import { ConversationLayout } from './ConversationLayout'
|
|
7
|
+
import { ONE, SHORT, SOME, THREE, TWO, WORDS, WriteBox, YOU, useReactions } from './conversation.examples'
|
|
8
|
+
import { MembersPill } from './MembersPill'
|
|
9
|
+
import { Thread } from './Thread'
|
|
10
|
+
|
|
11
|
+
/** A comment's replies, with the box to write one: in the right column, or under its comment. */
|
|
12
|
+
const meta = {
|
|
13
|
+
title: 'Conversation/Thread',
|
|
14
|
+
component: Thread,
|
|
15
|
+
parameters: { layout: 'padded' },
|
|
16
|
+
} satisfies Meta<typeof Thread>
|
|
17
|
+
|
|
18
|
+
export default meta
|
|
19
|
+
type Story = StoryObj<typeof meta>
|
|
20
|
+
|
|
21
|
+
/** The right column: 384px, the height of the page. */
|
|
22
|
+
function Side({ children }: { children: ReactNode }) {
|
|
23
|
+
return (
|
|
24
|
+
<Card fill="surface" clip className="flex h-[640px] w-[384px] flex-col">
|
|
25
|
+
{children}
|
|
26
|
+
</Card>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const START = { author: ONE, time: '11:08 AM', words: WORDS }
|
|
31
|
+
|
|
32
|
+
function Replies({ readOnly = false }: { readOnly?: boolean }) {
|
|
33
|
+
const one = useReactions(SOME)
|
|
34
|
+
const two = useReactions()
|
|
35
|
+
return (
|
|
36
|
+
<>
|
|
37
|
+
<ReplyCard author={TWO} time="11:40 AM" reactions={one} readOnly={readOnly}>
|
|
38
|
+
{SHORT}
|
|
39
|
+
</ReplyCard>
|
|
40
|
+
<ReplyCard author={THREE} time="11:52 AM" reactions={two} readOnly={readOnly}>
|
|
41
|
+
A second reply, under the first, in the order they were written.
|
|
42
|
+
</ReplyCard>
|
|
43
|
+
</>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** In the right column: the comment pinned at the top, its replies, and the box. */
|
|
48
|
+
export const Column: Story = {
|
|
49
|
+
render: () => (
|
|
50
|
+
<Side>
|
|
51
|
+
<Thread start={START} onClose={() => {}} box={<WriteBox />}>
|
|
52
|
+
<Replies />
|
|
53
|
+
</Thread>
|
|
54
|
+
</Side>
|
|
55
|
+
),
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Resolved: "Resolved" at the top. Who resolved it, and the note, are said on the comment, not among the replies. */
|
|
59
|
+
export const Resolved: Story = {
|
|
60
|
+
render: () => (
|
|
61
|
+
<Side>
|
|
62
|
+
<Thread start={START} resolved onClose={() => {}} box={<WriteBox />}>
|
|
63
|
+
<Replies />
|
|
64
|
+
</Thread>
|
|
65
|
+
</Side>
|
|
66
|
+
),
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** With the column's own actions before Close: who is in it. */
|
|
70
|
+
export const WithMembers: Story = {
|
|
71
|
+
name: 'With members',
|
|
72
|
+
render: () => (
|
|
73
|
+
<Side>
|
|
74
|
+
<Thread start={START} onClose={() => {}} actions={<MembersPill members={[ONE, TWO, THREE]} count={3} />} box={<WriteBox />}>
|
|
75
|
+
<Replies />
|
|
76
|
+
</Thread>
|
|
77
|
+
</Side>
|
|
78
|
+
),
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Still reading the replies. */
|
|
82
|
+
export const Loading: Story = {
|
|
83
|
+
render: () => (
|
|
84
|
+
<Side>
|
|
85
|
+
<Thread start={START} loading onClose={() => {}} box={<WriteBox />} />
|
|
86
|
+
</Side>
|
|
87
|
+
),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Nobody has replied yet. */
|
|
91
|
+
export const NoReplies: Story = {
|
|
92
|
+
name: 'No replies',
|
|
93
|
+
render: () => (
|
|
94
|
+
<Side>
|
|
95
|
+
<Thread start={START} onClose={() => {}} box={<WriteBox />} />
|
|
96
|
+
</Side>
|
|
97
|
+
),
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** The comment was deleted: its replies stay, and no new one can be written. */
|
|
101
|
+
export const StartDeleted: Story = {
|
|
102
|
+
name: 'Comment deleted',
|
|
103
|
+
render: () => (
|
|
104
|
+
<Side>
|
|
105
|
+
<Thread start={{ ...START, deleted: true }} onClose={() => {}} notice={<WriteBox closed="The comment was deleted, so its thread takes no new replies." />}>
|
|
106
|
+
<Replies />
|
|
107
|
+
</Thread>
|
|
108
|
+
</Side>
|
|
109
|
+
),
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Archived: nothing can be changed. The reactions show but cannot be pressed, and the box says why, in every app's words (`archivedLine`). */
|
|
113
|
+
export const ReadOnly: Story = {
|
|
114
|
+
name: 'Read-only',
|
|
115
|
+
render: () => (
|
|
116
|
+
<Side>
|
|
117
|
+
<Thread start={START} onClose={() => {}} notice={<WriteBox closed={archivedLine({})} />}>
|
|
118
|
+
<Replies readOnly />
|
|
119
|
+
</Thread>
|
|
120
|
+
</Side>
|
|
121
|
+
),
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Under its comment, in one column: one card with the comment, its replies hung from a line, and the box. */
|
|
125
|
+
export const Under: Story = {
|
|
126
|
+
render: function Render() {
|
|
127
|
+
const reacting = useReactions()
|
|
128
|
+
return (
|
|
129
|
+
<div className="flex h-[640px]">
|
|
130
|
+
<ConversationLayout
|
|
131
|
+
threads="under"
|
|
132
|
+
open="c1"
|
|
133
|
+
items={[
|
|
134
|
+
{
|
|
135
|
+
id: 'c1',
|
|
136
|
+
card: (
|
|
137
|
+
<ConversationCard author={ONE} time="11:08 AM" reactions={reacting} replies={{ count: 2, faces: [TWO, THREE], last: '11:52 AM' }}>
|
|
138
|
+
{WORDS}
|
|
139
|
+
</ConversationCard>
|
|
140
|
+
),
|
|
141
|
+
thread: (
|
|
142
|
+
<Thread place="under" box={<WriteBox />}>
|
|
143
|
+
<Replies />
|
|
144
|
+
</Thread>
|
|
145
|
+
),
|
|
146
|
+
},
|
|
147
|
+
]}
|
|
148
|
+
/>
|
|
149
|
+
</div>
|
|
150
|
+
)
|
|
151
|
+
},
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Your reply among them. */
|
|
155
|
+
export const WithYours: Story = {
|
|
156
|
+
name: 'With yours',
|
|
157
|
+
render: () => (
|
|
158
|
+
<Side>
|
|
159
|
+
<Thread start={START} onClose={() => {}} box={<WriteBox />}>
|
|
160
|
+
<Replies />
|
|
161
|
+
<ReplyCard author={YOU} time="12:01 PM" own onDelete={() => {}}>
|
|
162
|
+
Your own reply, with Edit and Delete in its menu.
|
|
163
|
+
</ReplyCard>
|
|
164
|
+
</Thread>
|
|
165
|
+
</Side>
|
|
166
|
+
),
|
|
167
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
3
|
+
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
|
4
|
+
import { Thread } from './Thread'
|
|
5
|
+
|
|
6
|
+
afterEach(cleanup)
|
|
7
|
+
|
|
8
|
+
const START = { author: { name: 'Person one' }, time: '11:08 AM', words: 'The comment it answers' }
|
|
9
|
+
|
|
10
|
+
describe('Thread, beside (the right column)', () => {
|
|
11
|
+
it('pins the comment it answers at the top, then "Replies", then the replies, and the box under them', () => {
|
|
12
|
+
render(
|
|
13
|
+
<Thread start={START} box={<p>The box</p>}>
|
|
14
|
+
<p>A reply</p>
|
|
15
|
+
</Thread>,
|
|
16
|
+
)
|
|
17
|
+
const order = ['The comment it answers', 'A reply', 'The box'].map((words) => screen.getByText(words))
|
|
18
|
+
expect(order[0].compareDocumentPosition(order[1]) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
|
|
19
|
+
expect(order[1].compareDocumentPosition(order[2]) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
|
|
20
|
+
// "Replies" twice: the column's name, and the line between the comment and its replies.
|
|
21
|
+
expect(screen.getAllByText('Replies').length).toBe(2)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('says when nobody replied yet, and shows placeholders while reading', () => {
|
|
25
|
+
render(<Thread start={START} />)
|
|
26
|
+
expect(screen.getByText('No replies yet.')).toBeTruthy()
|
|
27
|
+
cleanup()
|
|
28
|
+
render(<Thread start={START} loading />)
|
|
29
|
+
expect(screen.queryByText('No replies yet.')).toBeNull()
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('closes with its Close button, and says "Resolved" at the top when it is', () => {
|
|
33
|
+
const onClose = vi.fn()
|
|
34
|
+
render(<Thread start={START} resolved onClose={onClose} />)
|
|
35
|
+
expect(screen.getByText('Resolved')).toBeTruthy()
|
|
36
|
+
fireEvent.click(screen.getByRole('button', { name: 'Close' }))
|
|
37
|
+
expect(onClose).toHaveBeenCalledOnce()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('says why no reply can be written in place of the box', () => {
|
|
41
|
+
render(<Thread start={START} box={<p>The box</p>} notice={<p>This file is archived.</p>} />)
|
|
42
|
+
expect(screen.getByText('This file is archived.')).toBeTruthy()
|
|
43
|
+
expect(screen.queryByText('The box')).toBeNull()
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
describe('Thread, with an empty list of replies (an app’s replies.map with none)', () => {
|
|
48
|
+
it('beside: says nobody replied yet', () => {
|
|
49
|
+
render(<Thread start={START}>{[]}</Thread>)
|
|
50
|
+
expect(screen.getByText('No replies yet.')).toBeTruthy()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('under: draws no empty line of replies, only the box', () => {
|
|
54
|
+
const { container } = render(
|
|
55
|
+
<Thread place="under" box={<p>The box</p>}>
|
|
56
|
+
{[]}
|
|
57
|
+
</Thread>,
|
|
58
|
+
)
|
|
59
|
+
expect(container.querySelector('[data-thread-replies]')).toBeNull()
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
describe('Thread, under its comment (one column)', () => {
|
|
64
|
+
it('draws no header, no Close and no pinned comment: its replies, then the box', () => {
|
|
65
|
+
render(
|
|
66
|
+
<Thread place="under" start={START} onClose={() => {}} box={<p>The box</p>}>
|
|
67
|
+
<p>A reply</p>
|
|
68
|
+
</Thread>,
|
|
69
|
+
)
|
|
70
|
+
expect(screen.queryByText('Replies')).toBeNull()
|
|
71
|
+
expect(screen.queryByRole('button', { name: 'Close' })).toBeNull()
|
|
72
|
+
expect(screen.queryByText('The comment it answers')).toBeNull()
|
|
73
|
+
const reply = screen.getByText('A reply')
|
|
74
|
+
expect(reply.compareDocumentPosition(screen.getByText('The box')) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy()
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it('with no replies yet, only the box: no line saying so', () => {
|
|
78
|
+
const { container } = render(<Thread place="under" box={<p>The box</p>} />)
|
|
79
|
+
expect(screen.getByText('The box')).toBeTruthy()
|
|
80
|
+
expect(screen.queryByText('No replies yet.')).toBeNull()
|
|
81
|
+
expect(container.querySelector('[data-thread-replies]')).toBeNull()
|
|
82
|
+
})
|
|
83
|
+
})
|
package/src/Thread.tsx
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Children, type ReactNode, type Ref } from 'react'
|
|
2
|
+
import { IconX } from '@tabler/icons-react'
|
|
3
|
+
import { Chip } from './Chip'
|
|
4
|
+
import { cn } from './cn'
|
|
5
|
+
import { Divider } from './Divider'
|
|
6
|
+
import { EmptyState } from './EmptyState'
|
|
7
|
+
import { IconButton } from './IconButton'
|
|
8
|
+
import { Panel } from './Panel'
|
|
9
|
+
import { PinnedComment, type PinnedCommentProps } from './PinnedComment'
|
|
10
|
+
import { SkeletonConversation } from './Skeleton'
|
|
11
|
+
import { useContext } from 'react'
|
|
12
|
+
import { caretOnOpen, LineByLayout } from './threadCard'
|
|
13
|
+
|
|
14
|
+
/** The comment a thread answers, pinned at the top of its column. */
|
|
15
|
+
export type ThreadStart = PinnedCommentProps
|
|
16
|
+
|
|
17
|
+
export interface ThreadProps {
|
|
18
|
+
/** `beside`: in the right column, beside the comments, under its own header. `under`: open under its comment, in a one-column conversation: its replies hang from a line, quiet, and the box is under them; ConversationLayout makes the comment and its thread one card. */
|
|
19
|
+
place?: 'beside' | 'under'
|
|
20
|
+
/** The comment it answers, pinned at the top of the column. Under its comment it is not repeated. */
|
|
21
|
+
start?: ThreadStart
|
|
22
|
+
/** Its replies, in time order: `ReplyCard`s. How it was resolved is said on its comment, not among them (Katerina, 1 November). */
|
|
23
|
+
children?: ReactNode
|
|
24
|
+
/** Still reading the replies: placeholders in their place. */
|
|
25
|
+
loading?: boolean
|
|
26
|
+
/** Resolved: "Resolved" at the top of the column, in green. */
|
|
27
|
+
resolved?: boolean
|
|
28
|
+
/** The box a reply is written in: the app's `CommentBox`. */
|
|
29
|
+
box?: ReactNode
|
|
30
|
+
/** Said in place of the box: why no reply can be written (an archived page, a deleted comment). */
|
|
31
|
+
notice?: ReactNode
|
|
32
|
+
/** The column's own actions, before Close: a `MembersPill`, an `IconButton` to where it was first said. */
|
|
33
|
+
actions?: ReactNode
|
|
34
|
+
/** Closes the column. */
|
|
35
|
+
onClose?: () => void
|
|
36
|
+
/** The column's name. */
|
|
37
|
+
title?: ReactNode
|
|
38
|
+
/** The column's scrolling box, for opening at the newest reply. */
|
|
39
|
+
bodyRef?: Ref<HTMLDivElement>
|
|
40
|
+
/** Placement only. */
|
|
41
|
+
className?: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Whether there are replies: an app's `replies.map(…)` with none is an empty list, which is not nothing to React but is to the reader. */
|
|
45
|
+
const anyIn = (children: ReactNode) => Children.toArray(children).length > 0
|
|
46
|
+
|
|
47
|
+
function Replies({ children, loading }: { children?: ReactNode; loading: boolean }) {
|
|
48
|
+
if (loading) return <SkeletonConversation />
|
|
49
|
+
if (!anyIn(children)) return <EmptyState scope="section" message="No replies yet." />
|
|
50
|
+
return <>{children}</>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A comment's replies, with the box to write one. In the right column (two columns: Peek's file pages), under its
|
|
55
|
+
* own header with the comment pinned at the top, "Replies", and the box fixed at the bottom. Under its comment (one
|
|
56
|
+
* column: Ship's and Leaf's), the replies hung from a line, quiet, and the box under them, all one card with the
|
|
57
|
+
* comment (Ship's way). Peek's replies column, moved with the conversation.
|
|
58
|
+
*/
|
|
59
|
+
export function Thread({ place = 'beside', start, children, loading = false, resolved = false, box, notice, actions, onClose, title = 'Replies', bodyRef, className }: ThreadProps) {
|
|
60
|
+
const foot = notice ?? box
|
|
61
|
+
// In a ConversationLayout the layout draws the line, from the comment's face to the last reply, as one bar.
|
|
62
|
+
const layoutLine = useContext(LineByLayout)
|
|
63
|
+
if (place === 'under') {
|
|
64
|
+
return (
|
|
65
|
+
<div data-thread="under" className={cn('flex flex-col', className)}>
|
|
66
|
+
{(loading || anyIn(children)) && (
|
|
67
|
+
// The replies hang from a line under the comment's face (20px in: its 8px and half its 24px), one step in (Ship's way).
|
|
68
|
+
// 8px from the one card's right edge too, as the box under them: a hovered reply never touches it (Katerina, 31 October).
|
|
69
|
+
// 2px, as the line from the comment's face that runs into it (Katerina, 1 November), and drawn the same way, a
|
|
70
|
+
// filled bar rather than a border: a border snaps to the screen's pixels on its own, and at some zooms the two
|
|
71
|
+
// stood a pixel apart (Katerina: "the line breaks in the middle").
|
|
72
|
+
<div data-thread-replies className="relative ml-[19px] mr-2 flex flex-col gap-1 pl-2.5">
|
|
73
|
+
{!layoutLine && <span aria-hidden className="absolute bottom-0 left-0 top-0 w-0.5 bg-border-default" />}
|
|
74
|
+
<caretOnOpen.Provider value={0}>{loading ? <SkeletonConversation /> : children}</caretOnOpen.Provider>
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
77
|
+
{foot && <div className="px-2 pt-2">{foot}</div>}
|
|
78
|
+
</div>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
return (
|
|
82
|
+
<Panel
|
|
83
|
+
className={className}
|
|
84
|
+
bodyRef={bodyRef}
|
|
85
|
+
bodyClassName="flex flex-col"
|
|
86
|
+
title={title}
|
|
87
|
+
actions={
|
|
88
|
+
<>
|
|
89
|
+
{resolved && <Chip type="success" label="Resolved" />}
|
|
90
|
+
{actions}
|
|
91
|
+
{onClose && (
|
|
92
|
+
<IconButton tooltip="Close" aria-label="Close" onClick={onClose}>
|
|
93
|
+
<IconX size={16} stroke={1.5} />
|
|
94
|
+
</IconButton>
|
|
95
|
+
)}
|
|
96
|
+
</>
|
|
97
|
+
}
|
|
98
|
+
footer={foot && <div className="p-3">{foot}</div>}
|
|
99
|
+
>
|
|
100
|
+
{start && (
|
|
101
|
+
<div className="px-4 pb-2 pt-4">
|
|
102
|
+
<PinnedComment {...start} />
|
|
103
|
+
</div>
|
|
104
|
+
)}
|
|
105
|
+
<Divider look="section" label="Replies" className="px-4 py-2" />
|
|
106
|
+
<div className="flex flex-col gap-2 px-4 pb-4">
|
|
107
|
+
<caretOnOpen.Provider value={0}>
|
|
108
|
+
<Replies loading={loading}>{children}</Replies>
|
|
109
|
+
</caretOnOpen.Provider>
|
|
110
|
+
</div>
|
|
111
|
+
</Panel>
|
|
112
|
+
)
|
|
113
|
+
}
|
package/src/TopBar.mdx
CHANGED
|
@@ -24,9 +24,10 @@ bar ignores the pointer so the content underneath stays reachable.
|
|
|
24
24
|
- **`floating`** — an app whose content runs to the top edge; the bar
|
|
25
25
|
floats over it and only its clusters catch clicks (AppShell's
|
|
26
26
|
`floating` variant).
|
|
27
|
-
- `menu` is the menu button, in an app whose navigation
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
- `menu` is the menu button, in an app whose navigation folds. Inside an
|
|
28
|
+
**AppShell** it is the frame's fold ("Hide the sidebar" / "Show the
|
|
29
|
+
sidebar"), the same button in every app (Katerina, 31 October): pass
|
|
30
|
+
nothing. `logo` sits beside it: the app's name as text, or a mark.
|
|
30
31
|
- `onSearch` is what searching opens — your command launcher. With it the
|
|
31
32
|
bar draws the search field itself: **SearchInput**'s look, 290px, as a
|
|
32
33
|
button showing `searchPlaceholder` ("Search…") and the shortcut. A click on
|
|
@@ -61,7 +62,8 @@ import { TopBar, IdentityMenu } from '@estiva-app/ui'
|
|
|
61
62
|
```
|
|
62
63
|
|
|
63
64
|
- Geometry is fixed: 52px, `pl-5 pr-[26px]`, right cluster `gap-[6px]` —
|
|
64
|
-
don't restyle it per app.
|
|
65
|
+
don't restyle it per app. With a menu button in the solid or inset bar it
|
|
66
|
+
starts at `pl-3.5`, so the button's icon lines up with the Sidebar's.
|
|
65
67
|
- `onSearch` is called on every Ctrl+K, open or not: to close the launcher
|
|
66
68
|
on a second Ctrl+K, toggle in your handler.
|
|
67
69
|
- A click on the field leaves focus where it was, so a launcher can act on the
|
|
@@ -69,8 +71,8 @@ import { TopBar, IdentityMenu } from '@estiva-app/ui'
|
|
|
69
71
|
- The frame is desktop-only for now — there is no narrow-screen
|
|
70
72
|
behaviour; the menu button collapses panels, it does not open a drawer.
|
|
71
73
|
|
|
72
|
-
- The bar is 52px tall, 20px in on the left
|
|
73
|
-
its slots.
|
|
74
|
+
- The bar is 52px tall, 20px in on the left (14px with a menu button over a
|
|
75
|
+
Sidebar) and 26px on the right, 16px between its slots.
|
|
74
76
|
|
|
75
77
|
## What it owns
|
|
76
78
|
|
package/src/TopBar.stories.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
import {
|
|
2
|
+
import { IconLayoutSidebarLeftCollapse } from '@tabler/icons-react'
|
|
3
3
|
import { useState, type ReactNode } from 'react'
|
|
4
4
|
import { IconButton } from './IconButton'
|
|
5
5
|
import { PersonTrigger } from './PersonTrigger'
|
|
@@ -34,9 +34,10 @@ export default meta
|
|
|
34
34
|
type Story = StoryObj<typeof meta>
|
|
35
35
|
|
|
36
36
|
const face = <PersonTrigger name="Ana Duarte" />
|
|
37
|
+
/** The fold AppShell draws there (Katerina, 31 October: the same button in every app). */
|
|
37
38
|
const menuButton = (
|
|
38
|
-
<IconButton tooltip="
|
|
39
|
-
<
|
|
39
|
+
<IconButton tooltip="Hide the sidebar" tooltipPlacement="bottom" aria-label="Hide the sidebar">
|
|
40
|
+
<IconLayoutSidebarLeftCollapse size={16} stroke={1.5} />
|
|
40
41
|
</IconButton>
|
|
41
42
|
)
|
|
42
43
|
|
package/src/TopBar.tsx
CHANGED
|
@@ -20,7 +20,8 @@ import { shortcutLabel } from './shortcuts'
|
|
|
20
20
|
* (Katerina, 28 September).
|
|
21
21
|
*
|
|
22
22
|
* Geometry both apps agreed on before extraction: 52px tall, `pl-5
|
|
23
|
-
* pr-[26px]`, right cluster `gap-[6px]
|
|
23
|
+
* pr-[26px]`, right cluster `gap-[6px]`; with a menu button over a
|
|
24
|
+
* Sidebar (solid, inset), `pl-3.5`, so its icon lines up with the rows'. The left region is two slots
|
|
24
25
|
* side by side — `menu` (the menu button, in an app whose navigation
|
|
25
26
|
* collapses) and `logo` (the mark or name beside it; Katerina,
|
|
26
27
|
* 2026-09-02). This component does not know who you are or what is being
|
|
@@ -40,7 +41,7 @@ import { shortcutLabel } from './shortcuts'
|
|
|
40
41
|
*/
|
|
41
42
|
export interface TopBarProps {
|
|
42
43
|
variant?: 'solid' | 'floating' | 'inset'
|
|
43
|
-
/** Far left: the menu button, in an app whose navigation
|
|
44
|
+
/** Far left: the menu button, in an app whose navigation folds. Inside an `AppShell`, the frame's own fold. */
|
|
44
45
|
menu?: ReactNode
|
|
45
46
|
/** Beside the menu button: the app's logo mark, or its name as text. */
|
|
46
47
|
logo?: ReactNode
|
|
@@ -83,10 +84,14 @@ export function TopBar({ variant = 'solid', menu, logo, search, onSearch, search
|
|
|
83
84
|
<Kbd>{shortcutLabel('Mod-K')}</Kbd>
|
|
84
85
|
</BaseButton>
|
|
85
86
|
))
|
|
87
|
+
/* The menu button's icon stands over the navigation's icons (Katerina, 31 October: the fold's left padding was too
|
|
88
|
+
much, out of line with the rows below). A Sidebar's icon is 18px in (its 10px and the row's 8px), the button's 4px
|
|
89
|
+
inside it, so the bar starts 14px in; a Rail centres its icons on 24px, which the bar's own 20px already meets. */
|
|
86
90
|
return (
|
|
87
91
|
<header
|
|
88
92
|
className={cn(
|
|
89
|
-
'flex h-[52px] items-center
|
|
93
|
+
'flex h-[52px] items-center pr-[26px]',
|
|
94
|
+
menu && !floating ? 'pl-3.5' : 'pl-5',
|
|
90
95
|
floating
|
|
91
96
|
? 'pointer-events-none absolute left-0 right-0 top-0 z-10'
|
|
92
97
|
: cn('shrink-0 gap-4', variant === 'solid' && 'border-b border-border-default bg-bg-surface'),
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
|
|
2
|
+
import * as Stories from './UrgentMark.stories'
|
|
3
|
+
|
|
4
|
+
<Meta of={Stories} />
|
|
5
|
+
|
|
6
|
+
# UrgentMark
|
|
7
|
+
|
|
8
|
+
Urgent and new: a small warning mark on its tint, in the unread dot's 24px slot.
|
|
9
|
+
|
|
10
|
+
<Canvas of={Stories.Urgent} />
|
|
11
|
+
|
|
12
|
+
## When
|
|
13
|
+
|
|
14
|
+
- In place of **UnreadDot** on something urgent and not read yet: a comment, a reply, a row of the navigation.
|
|
15
|
+
|
|
16
|
+
## When not
|
|
17
|
+
|
|
18
|
+
- New and not urgent → **UnreadDot**.
|
|
19
|
+
- A count of urgent things → **Chip**.
|
|
20
|
+
|
|
21
|
+
## How
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { UnreadDot, UrgentMark } from '@estiva-app/ui'
|
|
25
|
+
|
|
26
|
+
<>{isNew && (urgent ? <UrgentMark /> : <UnreadDot />)}</>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- It says nothing to a screen reader: say "urgent" in the row's own words.
|
|
30
|
+
|
|
31
|
+
## What it owns
|
|
32
|
+
|
|
33
|
+
Nothing. It only draws. Clicks and keys are yours.
|
|
34
|
+
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
<Controls />
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import { UnreadDot } from './UnreadDot'
|
|
3
|
+
import { UrgentMark } from './UrgentMark'
|
|
4
|
+
|
|
5
|
+
/** Urgent and new, in the unread dot's 24px slot. */
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Conversation/UrgentMark',
|
|
8
|
+
component: UrgentMark,
|
|
9
|
+
parameters: { layout: 'padded' },
|
|
10
|
+
} satisfies Meta<typeof UrgentMark>
|
|
11
|
+
|
|
12
|
+
export default meta
|
|
13
|
+
type Story = StoryObj<typeof meta>
|
|
14
|
+
|
|
15
|
+
/** The mark. */
|
|
16
|
+
export const Urgent: Story = {}
|
|
17
|
+
|
|
18
|
+
/** Beside the plain unread dot it stands in for. */
|
|
19
|
+
export const BesideTheDot: Story = {
|
|
20
|
+
name: 'Beside the dot',
|
|
21
|
+
render: () => (
|
|
22
|
+
<span className="flex items-center gap-2">
|
|
23
|
+
<UnreadDot />
|
|
24
|
+
<UrgentMark />
|
|
25
|
+
</span>
|
|
26
|
+
),
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IconAlertSquareRounded } from '@tabler/icons-react'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Urgent and new: a 12px warning mark on its tint, in the unread dot's 24px slot. A row of the navigation that is
|
|
5
|
+
* urgent and unread, and a comment or reply that is urgent and new, draw this one mark.
|
|
6
|
+
*/
|
|
7
|
+
export function UrgentMark() {
|
|
8
|
+
return (
|
|
9
|
+
<div className="flex h-6 w-6 shrink-0 items-center justify-center" data-urgent>
|
|
10
|
+
<div className="flex items-center rounded-full bg-warning-muted p-0.5 signal:shadow-glow-warning">
|
|
11
|
+
<IconAlertSquareRounded size={12} stroke={2.5} className="text-warning-default" />
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
}
|
package/src/commentBoxFrame.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import { Toolbar } from './Toolbar'
|
|
|
8
8
|
import { cn } from './cn'
|
|
9
9
|
import { richTextClassName } from './RichText'
|
|
10
10
|
import { ScrollArea } from './ScrollArea'
|
|
11
|
-
import { WRITING_BOX_CLASSES } from './looks'
|
|
11
|
+
import { BOX_HINT_CLASSES, WRITING_BOX_CLASSES, WRITING_RING_CLASSES } from './looks'
|
|
12
12
|
import { SelectionToolbar, type SelectionToolbarProps } from './SelectionToolbar'
|
|
13
13
|
import { isSuggestionActive } from './suggestionPopup'
|
|
14
14
|
|
|
@@ -102,14 +102,18 @@ export interface BoxFrameProps {
|
|
|
102
102
|
attachments?: ReactNode
|
|
103
103
|
/** The row under it all: the tools and Send, or the keys and Cancel/Save. */
|
|
104
104
|
footer: ReactNode
|
|
105
|
+
/** Signal's focus ring. Off for the edit box, whose edge only darkens on focus, as in Ship. Default on. */
|
|
106
|
+
ring?: boolean
|
|
105
107
|
/** On the box itself. */
|
|
106
108
|
className?: string
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
/** The one frame both boxes draw: the bordered box, its text in a `ScrollArea`, what is attached, the footer. */
|
|
110
|
-
export function BoxFrame({ editor, marked = false, selection, placeholder, empty = false, attachments, footer, className }: BoxFrameProps) {
|
|
112
|
+
export function BoxFrame({ editor, marked = false, selection, placeholder, empty = false, attachments, footer, ring = true, className }: BoxFrameProps) {
|
|
111
113
|
return (
|
|
112
|
-
|
|
114
|
+
// Focused, the edge darkens (the send box in Signal takes the accent and its glow instead). In Leaf, the edge every
|
|
115
|
+
// field takes, in the send box and the edit box alike (Katerina, 31 October); never the accent on Peek's edit box (1 November).
|
|
116
|
+
<div className={cn(WRITING_BOX_CLASSES, ring && WRITING_RING_CLASSES, 'focus-within:border-border-strong leaf:focus-within:border-border-focus transition-colors', className)}>
|
|
113
117
|
<div data-composer-editor data-marked={marked || undefined} className={cn('relative min-h-[20px] transition-all', marked && 'border-l-4 border-border-strong pl-2')}>
|
|
114
118
|
<ScrollArea className={COMPOSE_SCROLL_CLASSES.area} viewportClassName={COMPOSE_SCROLL_CLASSES.viewport} contentClassName={COMPOSE_SCROLL_CLASSES.content}>
|
|
115
119
|
<EditorContent editor={editor} />
|
|
@@ -207,7 +211,7 @@ export function SendBox({ editor, onSend, placeholder, tools, attachments, ready
|
|
|
207
211
|
<span />
|
|
208
212
|
)}
|
|
209
213
|
<div className="flex items-center gap-2.5">
|
|
210
|
-
<span className=
|
|
214
|
+
<span className={BOX_HINT_CLASSES}>Enter to send · Shift+Enter new line</span>
|
|
211
215
|
{/* Focus stays in the text: the press sends on its way down. A keyboard press is the click (`detail` 0), so a click never sends twice. */}
|
|
212
216
|
<IconButton
|
|
213
217
|
variant="primary"
|