@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.
Files changed (173) hide show
  1. package/dist/AppShell.d.ts +25 -7
  2. package/dist/AppShell.d.ts.map +1 -1
  3. package/dist/ArchivedNotice.d.ts +28 -0
  4. package/dist/ArchivedNotice.d.ts.map +1 -0
  5. package/dist/Button.d.ts +4 -3
  6. package/dist/Button.d.ts.map +1 -1
  7. package/dist/Card.d.ts.map +1 -1
  8. package/dist/CommentBox.d.ts.map +1 -1
  9. package/dist/ConversationActions.d.ts +24 -0
  10. package/dist/ConversationActions.d.ts.map +1 -0
  11. package/dist/ConversationCard.d.ts +88 -0
  12. package/dist/ConversationCard.d.ts.map +1 -0
  13. package/dist/ConversationLayout.d.ts +50 -0
  14. package/dist/ConversationLayout.d.ts.map +1 -0
  15. package/dist/ConversationMenu.d.ts +24 -0
  16. package/dist/ConversationMenu.d.ts.map +1 -0
  17. package/dist/Divider.d.ts +23 -4
  18. package/dist/Divider.d.ts.map +1 -1
  19. package/dist/EditedMarker.d.ts +11 -0
  20. package/dist/EditedMarker.d.ts.map +1 -0
  21. package/dist/IconButton.d.ts +3 -3
  22. package/dist/IconButton.d.ts.map +1 -1
  23. package/dist/LinkParts.d.ts +3 -1
  24. package/dist/LinkParts.d.ts.map +1 -1
  25. package/dist/ListColumn.d.ts +3 -1
  26. package/dist/ListColumn.d.ts.map +1 -1
  27. package/dist/MetaText.d.ts +22 -0
  28. package/dist/MetaText.d.ts.map +1 -0
  29. package/dist/NavItem.d.ts.map +1 -1
  30. package/dist/PageHeader.d.ts +50 -0
  31. package/dist/PageHeader.d.ts.map +1 -0
  32. package/dist/Panel.d.ts +6 -0
  33. package/dist/Panel.d.ts.map +1 -1
  34. package/dist/PinnedComment.d.ts +17 -0
  35. package/dist/PinnedComment.d.ts.map +1 -0
  36. package/dist/QuotedLine.d.ts +16 -0
  37. package/dist/QuotedLine.d.ts.map +1 -0
  38. package/dist/ReactionHorizon.d.ts +14 -0
  39. package/dist/ReactionHorizon.d.ts.map +1 -0
  40. package/dist/RepliesRow.d.ts +26 -0
  41. package/dist/RepliesRow.d.ts.map +1 -0
  42. package/dist/ResolveDialog.d.ts +13 -0
  43. package/dist/ResolveDialog.d.ts.map +1 -0
  44. package/dist/Select.d.ts +1 -1
  45. package/dist/Select.d.ts.map +1 -1
  46. package/dist/Skeleton.d.ts +8 -4
  47. package/dist/Skeleton.d.ts.map +1 -1
  48. package/dist/Thread.d.ts +38 -0
  49. package/dist/Thread.d.ts.map +1 -0
  50. package/dist/TopBar.d.ts +3 -2
  51. package/dist/TopBar.d.ts.map +1 -1
  52. package/dist/UrgentMark.d.ts +6 -0
  53. package/dist/UrgentMark.d.ts.map +1 -0
  54. package/dist/commentBoxFrame.d.ts +3 -1
  55. package/dist/commentBoxFrame.d.ts.map +1 -1
  56. package/dist/conversation.examples.d.ts +52 -0
  57. package/dist/conversation.examples.d.ts.map +1 -0
  58. package/dist/editor.js +32 -24
  59. package/dist/editor.js.map +2 -2
  60. package/dist/eslint/index.js +2 -1
  61. package/dist/eslint/index.js.map +2 -2
  62. package/dist/eslint/no-native-title.d.ts +1 -1
  63. package/dist/eslint/no-native-title.d.ts.map +1 -1
  64. package/dist/eslint/no-restyled-part.d.ts.map +1 -1
  65. package/dist/index.d.ts +18 -2
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +1376 -433
  68. package/dist/index.js.map +4 -4
  69. package/dist/looks.d.ts +13 -1
  70. package/dist/looks.d.ts.map +1 -1
  71. package/dist/threadCard.d.ts +46 -0
  72. package/dist/threadCard.d.ts.map +1 -0
  73. package/package.json +1 -1
  74. package/registry.json +1873 -546
  75. package/src/AppShell.mdx +24 -10
  76. package/src/AppShell.stories.tsx +65 -31
  77. package/src/AppShell.test.tsx +92 -10
  78. package/src/AppShell.tsx +108 -18
  79. package/src/ArchivedNotice.mdx +46 -0
  80. package/src/ArchivedNotice.stories.tsx +52 -0
  81. package/src/ArchivedNotice.test.tsx +42 -0
  82. package/src/ArchivedNotice.tsx +71 -0
  83. package/src/Button.mdx +2 -2
  84. package/src/Button.tsx +8 -6
  85. package/src/Card.test.tsx +4 -4
  86. package/src/Card.tsx +6 -2
  87. package/src/CommentBox.test.tsx +2 -1
  88. package/src/CommentBox.tsx +14 -7
  89. package/src/ConfirmDialog.stories.tsx +12 -0
  90. package/src/ConversationActions.mdx +47 -0
  91. package/src/ConversationActions.stories.tsx +39 -0
  92. package/src/ConversationActions.tsx +96 -0
  93. package/src/ConversationCard.mdx +72 -0
  94. package/src/ConversationCard.states.test.tsx +330 -0
  95. package/src/ConversationCard.stories.tsx +135 -0
  96. package/src/ConversationCard.test.tsx +159 -0
  97. package/src/ConversationCard.tsx +522 -0
  98. package/src/ConversationLayout.mdx +61 -0
  99. package/src/ConversationLayout.stories.tsx +161 -0
  100. package/src/ConversationLayout.test.tsx +240 -0
  101. package/src/ConversationLayout.tsx +233 -0
  102. package/src/ConversationMenu.mdx +47 -0
  103. package/src/ConversationMenu.stories.tsx +42 -0
  104. package/src/ConversationMenu.test.tsx +47 -0
  105. package/src/ConversationMenu.tsx +57 -0
  106. package/src/Divider.mdx +36 -1
  107. package/src/Divider.stories.tsx +57 -0
  108. package/src/Divider.test.tsx +24 -1
  109. package/src/Divider.tsx +49 -9
  110. package/src/EditedMarker.mdx +36 -0
  111. package/src/EditedMarker.stories.tsx +24 -0
  112. package/src/EditedMarker.tsx +20 -0
  113. package/src/IconButton.mdx +2 -1
  114. package/src/IconButton.tsx +8 -5
  115. package/src/LinkParts.mdx +4 -0
  116. package/src/LinkParts.stories.tsx +10 -0
  117. package/src/LinkParts.tsx +5 -1
  118. package/src/ListColumn.tsx +9 -3
  119. package/src/MetaText.mdx +41 -0
  120. package/src/MetaText.stories.tsx +29 -0
  121. package/src/MetaText.tsx +38 -0
  122. package/src/NavItem.tsx +2 -11
  123. package/src/PageHeader.mdx +123 -0
  124. package/src/PageHeader.stories.tsx +174 -0
  125. package/src/PageHeader.test.tsx +99 -0
  126. package/src/PageHeader.tsx +105 -0
  127. package/src/Panel.mdx +12 -0
  128. package/src/Panel.stories.tsx +47 -5
  129. package/src/Panel.test.tsx +40 -0
  130. package/src/Panel.tsx +8 -2
  131. package/src/PinnedComment.mdx +40 -0
  132. package/src/PinnedComment.stories.tsx +21 -0
  133. package/src/PinnedComment.tsx +40 -0
  134. package/src/QuotedLine.mdx +44 -0
  135. package/src/QuotedLine.stories.tsx +30 -0
  136. package/src/QuotedLine.test.tsx +34 -0
  137. package/src/QuotedLine.tsx +33 -0
  138. package/src/ReactionHorizon.mdx +36 -0
  139. package/src/ReactionHorizon.stories.tsx +27 -0
  140. package/src/ReactionHorizon.tsx +27 -0
  141. package/src/RepliesRow.mdx +45 -0
  142. package/src/RepliesRow.stories.tsx +33 -0
  143. package/src/RepliesRow.test.tsx +47 -0
  144. package/src/RepliesRow.tsx +86 -0
  145. package/src/ReplyCard.mdx +50 -0
  146. package/src/ReplyCard.stories.tsx +68 -0
  147. package/src/ResolveDialog.mdx +44 -0
  148. package/src/ResolveDialog.stories.tsx +23 -0
  149. package/src/ResolveDialog.test.tsx +53 -0
  150. package/src/ResolveDialog.tsx +58 -0
  151. package/src/Select.tsx +12 -2
  152. package/src/Skeleton.stories.tsx +4 -1
  153. package/src/Skeleton.tsx +33 -4
  154. package/src/Thread.mdx +53 -0
  155. package/src/Thread.stories.tsx +167 -0
  156. package/src/Thread.test.tsx +83 -0
  157. package/src/Thread.tsx +113 -0
  158. package/src/TopBar.mdx +8 -6
  159. package/src/TopBar.stories.tsx +4 -3
  160. package/src/TopBar.tsx +8 -3
  161. package/src/UrgentMark.mdx +37 -0
  162. package/src/UrgentMark.stories.tsx +27 -0
  163. package/src/UrgentMark.tsx +15 -0
  164. package/src/commentBoxFrame.tsx +8 -4
  165. package/src/conversation.examples.tsx +135 -0
  166. package/src/eslint/no-native-title.ts +1 -1
  167. package/src/eslint/no-restyled-part.ts +1 -0
  168. package/src/index.ts +19 -2
  169. package/src/looks.ts +18 -2
  170. package/src/registry/registry.test.ts +7 -6
  171. package/src/threadCard.ts +84 -0
  172. package/stories/Choosing.mdx +21 -1
  173. package/tokens.css +14 -10
@@ -0,0 +1,41 @@
1
+ import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
2
+ import * as Stories from './MetaText.stories'
3
+
4
+ <Meta of={Stories} />
5
+
6
+ # MetaText
7
+
8
+ The small figure beside a name: a time, a resolve line's time, a count. In Signal the mono micro-type with even digits.
9
+
10
+ <Canvas of={Stories.Time} />
11
+
12
+ ## When
13
+
14
+ - A time beside a name.
15
+ - `tone="secondary"` and `tone="success"` for counts of open and resolved.
16
+ - `size="chip"` beside a small name.
17
+
18
+ <Canvas of={Stories.Counts} />
19
+
20
+ ## When not
21
+
22
+ - Words a person reads as a sentence → plain text in the caption size.
23
+ - A status → **Chip**.
24
+
25
+ ## How
26
+
27
+ ```tsx
28
+ import { MetaText } from '@estiva-app/ui'
29
+
30
+ <MetaText>11:08 AM</MetaText>
31
+ ```
32
+
33
+ - It never wraps.
34
+
35
+ ## What it owns
36
+
37
+ Nothing. It only draws. Clicks and keys are yours.
38
+
39
+ ## Props
40
+
41
+ <Controls />
@@ -0,0 +1,29 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
+ import { MetaText } from './MetaText'
3
+
4
+ /** The small figure beside a name. In Signal the mono micro-type; in the other themes the caption. */
5
+ const meta = {
6
+ title: 'Conversation/MetaText',
7
+ component: MetaText,
8
+ parameters: { layout: 'padded' },
9
+ args: { children: '11:08 AM' },
10
+ } satisfies Meta<typeof MetaText>
11
+
12
+ export default meta
13
+ type Story = StoryObj<typeof meta>
14
+
15
+ /** A time. */
16
+ export const Time: Story = {}
17
+
18
+ /** Counts, of open and of resolved. */
19
+ export const Counts: Story = {
20
+ render: () => (
21
+ <span className="flex items-center gap-2">
22
+ <MetaText tone="secondary">6 open</MetaText>
23
+ <MetaText tone="success">2 resolved</MetaText>
24
+ </span>
25
+ ),
26
+ }
27
+
28
+ /** The smaller size, beside a small name. */
29
+ export const Small: Story = { args: { size: 'chip' } }
@@ -0,0 +1,38 @@
1
+ import type { ReactNode } from 'react'
2
+ import { cn } from './cn'
3
+ import { TIME_CLASSES } from './looks'
4
+
5
+ const TONE_CLASSES = {
6
+ muted: 'text-text-muted',
7
+ secondary: 'text-text-secondary',
8
+ success: 'text-success-default',
9
+ } as const
10
+
11
+ export interface MetaTextProps {
12
+ children: ReactNode
13
+ /** `muted` for a time; `secondary` and `success` for counts of open and resolved. */
14
+ tone?: keyof typeof TONE_CLASSES
15
+ /** `chip` beside a small name, as in a thread's resolve line. */
16
+ size?: 'caption' | 'chip'
17
+ /** Placement only: `shrink-0`, `contents`. */
18
+ className?: string
19
+ }
20
+
21
+ /**
22
+ * The small figure beside a name: a comment's time, a resolve line's time, a count. One line; in Signal the mono
23
+ * micro-type with even digits. Peek's, moved with the conversation (Katerina, 31 October: Peek's way in every app).
24
+ */
25
+ export function MetaText({ children, tone = 'muted', size = 'caption', className }: MetaTextProps) {
26
+ return (
27
+ <span
28
+ className={cn(
29
+ size === 'chip' ? 'text-chip font-normal' : 'text-caption',
30
+ TONE_CLASSES[tone],
31
+ TIME_CLASSES,
32
+ className,
33
+ )}
34
+ >
35
+ {children}
36
+ </span>
37
+ )
38
+ }
package/src/NavItem.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import { useId, useState, type ComponentPropsWithoutRef, type ReactNode } from 'react'
2
2
  import { Collapsible } from '@base-ui/react/collapsible'
3
- import { IconAlertSquareRounded, IconChevronRight, IconDotsVertical } from '@tabler/icons-react'
3
+ import { IconChevronRight, IconDotsVertical } from '@tabler/icons-react'
4
+ import { UrgentMark } from './UrgentMark'
4
5
  import { useInAppClick } from './AppProvider'
5
6
  import { cn } from './cn'
6
7
  import { useOpenFor } from './CollapsibleSection'
@@ -296,13 +297,3 @@ export function NavItem({
296
297
  )
297
298
  }
298
299
 
299
- /** Urgent and unread: a 12px warning mark on its tint, in the dot's 24px slot. */
300
- function UrgentMark() {
301
- return (
302
- <div className="flex h-6 w-6 shrink-0 items-center justify-center" data-urgent>
303
- <div className="flex items-center rounded-full bg-warning-muted p-0.5 signal:shadow-glow-warning">
304
- <IconAlertSquareRounded size={12} stroke={2.5} className="text-warning-default" />
305
- </div>
306
- </div>
307
- )
308
- }
@@ -0,0 +1,123 @@
1
+ import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
2
+ import * as PageHeaderStories from './PageHeader.stories'
3
+
4
+ <Meta of={PageHeaderStories} />
5
+
6
+ # PageHeader
7
+
8
+ The bar at the top of a page: what the page is, and what acts on all of it, each in its own place.
9
+
10
+ <Canvas of={PageHeaderStories.Everything} />
11
+
12
+ It is ContainerHeader's bar — 48px, a hairline under it, 16px in at each
13
+ end — with a place for each thing a page's bar holds. At the left, 8px
14
+ apart: an icon or a face, a lock, the title, something right after it. At the
15
+ right, 12px apart: quiet counts, when it last changed, the members, then the
16
+ page's buttons, 4px apart.
17
+
18
+ ## When
19
+
20
+ - **The top of any page**: a page of one thing, opened from a list, with its
21
+ name and the buttons that act on the whole of it.
22
+ - `leading`: what kind of page it is, or its state, as a 16px icon; a face
23
+ for a page that is one person's.
24
+
25
+ <Canvas of={PageHeaderStories.WithAFace} />
26
+
27
+ - `private`: a lock before the title, when only its members can open it.
28
+ - `after`: something that belongs to the title, right after it — a small
29
+ `Button` that opens it elsewhere, a `Chip`.
30
+
31
+ <Canvas of={PageHeaderStories.AfterTheTitle} />
32
+
33
+ - `meta`: quiet counts at the right, a dot between them; `done: true`
34
+ for words about what is finished.
35
+
36
+ <Canvas of={PageHeaderStories.Counts} />
37
+
38
+ - `time`: when it last changed, in words, 12px italic; the exact time is in
39
+ a tooltip.
40
+
41
+ <Canvas of={PageHeaderStories.EditedTime} />
42
+
43
+ - `members`: who is in it — a **MembersPill**.
44
+ - `actions`: the page's own buttons — a **Toolbar** of `ToolbarButton`s,
45
+ `surface={false}`. A button that shows and hides the right column is
46
+ one of them, its icon filled while the column is open.
47
+
48
+ <Canvas of={PageHeaderStories.ColumnToggle} />
49
+
50
+ - A **Breadcrumb** in the title's place, for a page reached down a trail.
51
+
52
+ <Canvas of={PageHeaderStories.Breadcrumb} />
53
+
54
+ ## When not
55
+
56
+ - The bar of a side column — details, a thread → **Panel**, which draws its
57
+ own bar from `title` and `actions`.
58
+ - The bar of a list beside the page → **ListColumn**.
59
+ - The bar across the whole frame, with the logo and the search field →
60
+ **TopBar**.
61
+ - A heading for one part of the page → **SectionHeader**.
62
+
63
+ ## How
64
+
65
+ ```tsx
66
+ import { MembersPill, PageHeader, Toolbar, ToolbarButton } from '@estiva-app/ui'
67
+
68
+ <PageHeader
69
+ leading={<IconSquareRounded size={16} stroke={1.5} />}
70
+ title="Item one"
71
+ meta={['6 open', { label: '2 done', done: true }]}
72
+ time={{ label: 'Edited 2 minutes ago', exact: '31 October 2026, 14:02' }}
73
+ members={<MembersPill members={members} onClick={openMembers} />}
74
+ actions={
75
+ <Toolbar aria-label="Page actions" surface={false}>
76
+ <ToolbarButton tooltip="More" aria-label="More">
77
+ <IconDotsVertical size={16} stroke={1.5} />
78
+ </ToolbarButton>
79
+ </Toolbar>
80
+ }
81
+ />
82
+ ```
83
+
84
+ - **It is the bar, and nothing under it.** The page under it is yours: a
85
+ `ScrollArea` that takes the rest of the column (`min-h-0 flex-1`), or a
86
+ **Panel** that takes it in `header`, in place of its own bar.
87
+ - A string `title` is one line and is cut short with an ellipsis when the
88
+ room runs out; everything at the right keeps its size. A node — a
89
+ `Breadcrumb`, an `InlineText` — is drawn as given, and cuts itself short.
90
+
91
+ <Canvas of={PageHeaderStories.LongTitle} />
92
+
93
+ - `leading` is 16px. A bare icon takes the secondary text colour; a face is
94
+ an `Avatar` at `size={16}`.
95
+ - **The tooltips are under the pointer only.** The lock is named "Private"
96
+ to assistive technology as well; the exact time is not, and Tab does not
97
+ stop on the words. That is a known gap.
98
+ - The quiet things keep 12px clear of the buttons by themselves: write no
99
+ padding between them.
100
+
101
+ ## What it owns
102
+
103
+ It does these by itself. Write none of them around it.
104
+
105
+ | It does | So you never write | Refused when written by hand |
106
+ |---|---|---|
107
+ | Draws ContainerHeader's bar: 48px, the hairline under it, 16px in at each end | a header row of your own | ContainerHeader used on its own in an app |
108
+ | Keeps the counts, the time and the members 12px apart, and 12px clear of the buttons | `gap-3`, `pr-2` of your own around them | |
109
+ | Cuts a long string title short and keeps everything else whole | `truncate`, `min-w-0`, `shrink-0` | |
110
+ | Draws the counts in `MetaText`, a dot between them | a dot or a count style of your own | |
111
+ | Draws the time 12px italic, with the exact time in a tooltip | `text-caption italic` and a `WithTooltip` of your own | |
112
+ | Names the lock "Private", in a tooltip and to assistive technology | an `aria-label` and a tooltip on an icon | |
113
+
114
+ ## Keys
115
+
116
+ | Key | What it does |
117
+ |---|---|
118
+ | Tab | Moves through the bar in reading order: what is after the title, the members, then the buttons |
119
+ | Arrow keys | Move along the `Toolbar` of buttons, which is one Tab stop — the Toolbar's own keys |
120
+
121
+ ## Props
122
+
123
+ <Controls of={PageHeaderStories.Title} />
@@ -0,0 +1,174 @@
1
+ import { useState } from 'react'
2
+ import type { Decorator, Meta, StoryObj } from '@storybook/react-vite'
3
+ import { IconBox, IconDotsVertical, IconLayoutSidebarRight, IconLayoutSidebarRightFilled, IconSquareRounded } from '@tabler/icons-react'
4
+ import { Avatar } from './Avatar'
5
+ import { Breadcrumb as Trail } from './Breadcrumb'
6
+ import { Button } from './Button'
7
+ import { MembersPill } from './MembersPill'
8
+ import { Menu, MenuItem } from './Menu'
9
+ import { PageHeader } from './PageHeader'
10
+ import { ScrollArea } from './ScrollArea'
11
+ import { Toolbar, ToolbarButton } from './Toolbar'
12
+
13
+ /**
14
+ * The page under the bar: a stand-in body that scrolls, so the bar is seen
15
+ * against content and its hairline against the page.
16
+ */
17
+ const onAPage: Decorator = (Story) => (
18
+ <div className="flex h-screen w-full flex-col bg-bg-surface">
19
+ {Story()}
20
+ <ScrollArea className="min-h-0 flex-1" contentClassName="flex flex-col gap-3 px-4 pt-3 pb-4">
21
+ {Array.from({ length: 3 }, (_, i) => (
22
+ <p key={i} className="max-w-2xl text-body-2 text-text-secondary">
23
+ Paragraph {i + 1}. The page under the bar: what it holds, written out in full the way a real one is, so the bar is seen
24
+ against what it heads.
25
+ </p>
26
+ ))}
27
+ </ScrollArea>
28
+ </div>
29
+ )
30
+
31
+ const meta = {
32
+ title: 'Page structure/PageHeader',
33
+ component: PageHeader,
34
+ // On the page each canvas is its own frame, the bar and a few lines of the page under it; the story alone is full height.
35
+ parameters: { layout: 'fullscreen', docs: { story: { inline: false, height: '200px' } } },
36
+ args: { title: 'Item one' },
37
+ argTypes: {
38
+ leading: { control: false },
39
+ after: { control: false },
40
+ members: { control: false },
41
+ actions: { control: false },
42
+ },
43
+ decorators: [onAPage],
44
+ } satisfies Meta<typeof PageHeader>
45
+
46
+ export default meta
47
+ type Story = StoryObj<typeof meta>
48
+
49
+ const icon = <IconSquareRounded size={16} stroke={1.5} />
50
+ const members = <MembersPill members={[{ name: 'Ana Duarte' }, { name: 'Ravi Mehta' }, { name: 'Marta Silva' }]} count={4} onClick={() => {}} />
51
+ const more = (
52
+ <Menu
53
+ align="right"
54
+ trigger={
55
+ <ToolbarButton tooltip="More" aria-label="More">
56
+ <IconDotsVertical size={16} stroke={1.5} />
57
+ </ToolbarButton>
58
+ }
59
+ >
60
+ <MenuItem label="Item one" />
61
+ <MenuItem label="Item two" />
62
+ </Menu>
63
+ )
64
+ const actions = (
65
+ <Toolbar aria-label="Page actions" surface={false}>
66
+ <ToolbarButton tooltip="Action" aria-label="Action">
67
+ <IconSquareRounded size={16} stroke={1.5} />
68
+ </ToolbarButton>
69
+ {more}
70
+ </Toolbar>
71
+ )
72
+
73
+ /** The title alone: one line in body-2-strong. */
74
+ export const Title: Story = {}
75
+
76
+ /** An icon before the title, 16px, 8px from it: what kind of page this is, or its state. */
77
+ export const WithAnIcon: Story = { args: { leading: icon } }
78
+
79
+ /** A face before the title: a page that is one person's. */
80
+ export const WithAFace: Story = { args: { title: 'Ana Duarte', leading: <Avatar size={16} name="Ana Duarte" /> } }
81
+
82
+ /** A lock before the title: only its members can open it. Point at the lock for its name. */
83
+ export const Private: Story = { args: { private: true } }
84
+
85
+ /** Something right after the title, never cut short: a small button. */
86
+ export const AfterTheTitle: Story = {
87
+ args: {
88
+ after: (
89
+ <Button size="small" href="https://example.com" external leadingIcon={<IconSquareRounded size={14} stroke={1.5} />}>
90
+ Open
91
+ </Button>
92
+ ),
93
+ },
94
+ }
95
+
96
+ /** Quiet counts at the right, a dot between them; words about what is finished in the success colour. */
97
+ export const Counts: Story = { args: { leading: icon, meta: ['6 open', { label: '2 done', done: true }] } }
98
+
99
+ /** When it last changed, 12px italic. Point at it for the exact time. */
100
+ export const EditedTime: Story = { args: { time: { label: 'Edited 2 minutes ago', exact: '31 October 2026, 14:02' } } }
101
+
102
+ /** Who is in it: the members pill, which opens the list. */
103
+ export const Members: Story = { args: { members } }
104
+
105
+ /** The page's buttons at the right edge: a toolbar, 4px apart, the last one a menu. */
106
+ export const Actions: Story = { args: { actions } }
107
+
108
+ function WithAToggle() {
109
+ const [open, setOpen] = useState(true)
110
+ return (
111
+ <PageHeader
112
+ title="Item one"
113
+ members={members}
114
+ actions={
115
+ <Toolbar aria-label="Page actions" surface={false}>
116
+ <ToolbarButton tooltip={open ? 'Hide column' : 'Show column'} aria-label={open ? 'Hide column' : 'Show column'} onClick={() => setOpen(!open)}>
117
+ {open ? <IconLayoutSidebarRightFilled size={16} stroke={1.5} /> : <IconLayoutSidebarRight size={16} stroke={1.5} />}
118
+ </ToolbarButton>
119
+ {more}
120
+ </Toolbar>
121
+ }
122
+ />
123
+ )
124
+ }
125
+
126
+ /** A button that shows and hides the right column: its icon filled while the column is open. Press it. */
127
+ export const ColumnToggle: Story = {
128
+ render: () => <WithAToggle />,
129
+ }
130
+
131
+ /** A trail in the title's place: where this page sits, the last crumb where you are. */
132
+ export const Breadcrumb: Story = {
133
+ args: {
134
+ title: (
135
+ <Trail
136
+ items={[
137
+ { label: 'Items', href: '#' },
138
+ { label: 'Group one', icon: <IconBox size={16} stroke={1.5} />, href: '#' },
139
+ { label: 'ITM-12', mono: true },
140
+ ]}
141
+ />
142
+ ),
143
+ members,
144
+ },
145
+ }
146
+
147
+ /** A title longer than its room: it is cut short with an ellipsis, and nothing at the right moves. */
148
+ export const LongTitle: Story = {
149
+ decorators: [(Story) => <div className="flex w-full max-w-xl flex-col">{Story()}</div>],
150
+ args: {
151
+ leading: icon,
152
+ title: 'Item one, with a name long enough to run out of room well before the buttons at the right',
153
+ meta: ['6 open', { label: '2 done', done: true }],
154
+ members,
155
+ actions,
156
+ },
157
+ }
158
+
159
+ /** Everything at once, in its order: icon, lock, title, button; counts, time, members, buttons. */
160
+ export const Everything: Story = {
161
+ args: {
162
+ leading: icon,
163
+ private: true,
164
+ after: (
165
+ <Button size="small" href="https://example.com" external leadingIcon={<IconSquareRounded size={14} stroke={1.5} />}>
166
+ Open
167
+ </Button>
168
+ ),
169
+ meta: ['6 open', { label: '2 done', done: true }],
170
+ time: { label: 'Edited 2 minutes ago', exact: '31 October 2026, 14:02' },
171
+ members,
172
+ actions,
173
+ },
174
+ }
@@ -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.