@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
package/src/LinkParts.tsx
CHANGED
|
@@ -62,8 +62,8 @@ export function kindNounOf(linked: Pick<Linked, 'kind' | 'noun'>): string | unde
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/** The 36px tile a link's kind sits in, as a file's type does in AttachmentCard; words a person wrote show their face. */
|
|
65
|
-
export function LinkTile({ kind, author }: { kind: LinkedKind; author?: { name: string; picture?: string } }) {
|
|
66
|
-
if (author) return <Avatar name={author.name} src={author.picture} size={36} />
|
|
65
|
+
export function LinkTile({ kind, author }: { kind: LinkedKind; author?: { name: string; picture?: string; bot?: boolean } }) {
|
|
66
|
+
if (author) return <Avatar name={author.name} src={author.picture} bot={author.bot} size={36} />
|
|
67
67
|
return (
|
|
68
68
|
<span className={TYPE_TILE_CLASSES}>
|
|
69
69
|
<LinkedIcon kind={kind} />
|
|
@@ -154,12 +154,14 @@ export interface LinkPickersProps {
|
|
|
154
154
|
ownerLabel?: string
|
|
155
155
|
/** Draws the values as words even where they could be changed: the hover preview. */
|
|
156
156
|
readOnly?: boolean
|
|
157
|
+
/** Why they cannot be changed right now (an archived file): the pickers stay, shut, saying it on hover. */
|
|
158
|
+
disabledReason?: string
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
/** The face for an owner option: nobody (value `''`, "Unassigned") is the silhouette, never a letter (Katerina, 30 Oct). */
|
|
160
|
-
function OwnerFace({ option }: { option: { value: string; label: string; picture?: string } | undefined }) {
|
|
162
|
+
function OwnerFace({ option }: { option: { value: string; label: string; picture?: string; bot?: boolean } | undefined }) {
|
|
161
163
|
const nobody = !option || option.value === ''
|
|
162
|
-
return <Avatar name={nobody ? undefined : option.label} src={nobody ? undefined : option.picture} size={16} />
|
|
164
|
+
return <Avatar name={nobody ? undefined : option.label} src={nobody ? undefined : option.picture} bot={!nobody && option.bot} size={16} />
|
|
163
165
|
}
|
|
164
166
|
|
|
165
167
|
/**
|
|
@@ -167,7 +169,7 @@ function OwnerFace({ option }: { option: { value: string; label: string; picture
|
|
|
167
169
|
* picker whose app passed no `onChange` reads as words in the same place: the
|
|
168
170
|
* reader may not change it. The hover preview is always words.
|
|
169
171
|
*/
|
|
170
|
-
export function LinkPickers({ status, owner, ownerLabel = 'Owner', readOnly = false }: LinkPickersProps) {
|
|
172
|
+
export function LinkPickers({ status, owner, ownerLabel = 'Owner', readOnly = false, disabledReason }: LinkPickersProps) {
|
|
171
173
|
const statusNow = chosenOf(status)
|
|
172
174
|
const ownerNow = chosenOf(owner)
|
|
173
175
|
const statusWords = status && (readOnly || !status.onChange)
|
|
@@ -190,6 +192,7 @@ export function LinkPickers({ status, owner, ownerLabel = 'Owner', readOnly = fa
|
|
|
190
192
|
value={status.value ?? ''}
|
|
191
193
|
onChange={(value) => status.onChange?.(value)}
|
|
192
194
|
ariaLabel="Status"
|
|
195
|
+
disabledReason={disabledReason}
|
|
193
196
|
options={status.options.map((option) => ({ value: option.value, label: option.label, leading: option.colour && <StatusIcon colour={option.colour} /> }))}
|
|
194
197
|
/>
|
|
195
198
|
))}
|
|
@@ -208,6 +211,7 @@ export function LinkPickers({ status, owner, ownerLabel = 'Owner', readOnly = fa
|
|
|
208
211
|
placeholder="Unassigned"
|
|
209
212
|
onChange={(value) => owner.onChange?.(value)}
|
|
210
213
|
ariaLabel={ownerLabel}
|
|
214
|
+
disabledReason={disabledReason}
|
|
211
215
|
options={owner.options.map((option) => ({ value: option.value, label: option.label, leading: <OwnerFace option={option} /> }))}
|
|
212
216
|
/>
|
|
213
217
|
))}
|
package/src/LinkRow.tsx
CHANGED
|
@@ -170,7 +170,7 @@ export function LinkRow({ link, preview = true }: LinkRowProps) {
|
|
|
170
170
|
{/* A ring already says how far along it is. */}
|
|
171
171
|
{linked.done ? <ProgressRing done={linked.done.done} total={linked.done.total} /> : status?.colour && <StatusMark status={{ label: status.label, colour: status.colour }} />}
|
|
172
172
|
{linked.conversation && <CommentCount conversation={linked.conversation} noun={linked.conversation.noun} />}
|
|
173
|
-
{owner && <Avatar name={owner.label} src={owner.picture} size={16} />}
|
|
173
|
+
{owner && <Avatar name={owner.label} src={owner.picture} bot={owner.bot} size={16} />}
|
|
174
174
|
{linked.members && <AvatarGroup members={linked.members} size={16} on="inset" />}
|
|
175
175
|
{linked.authors && <AvatarGroup members={linked.authors} size={16} on="inset" />}
|
|
176
176
|
</span>
|
package/src/ListColumn.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react'
|
|
|
2
2
|
import { cn } from './cn'
|
|
3
3
|
import { ContainerHeader } from './ContainerHeader'
|
|
4
4
|
import { ErrorBoundary } from './ErrorBoundary'
|
|
5
|
+
import { FOLDED_CLASSES, FOLD_MOTION_CLASSES, UNFOLDED_CLASSES } from './looks'
|
|
5
6
|
import { ScrollArea } from './ScrollArea'
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -25,7 +26,9 @@ import { ScrollArea } from './ScrollArea'
|
|
|
25
26
|
* in the middle of the room the list had, and the rest of the page keeps working.
|
|
26
27
|
*
|
|
27
28
|
* `collapsed` closes it with the rail, as Peek's did: it narrows to nothing
|
|
28
|
-
* and fades, in 300ms
|
|
29
|
+
* and fades, in 300ms, as `AppShell`'s fold does, and nothing in it can be
|
|
30
|
+
* reached. The fold that closes it is the frame's; whether it is closed is
|
|
31
|
+
* the app's to hand on.
|
|
29
32
|
*/
|
|
30
33
|
export interface ListColumnProps {
|
|
31
34
|
/** The column's name, in its header. A node for a title that is more than words. */
|
|
@@ -51,11 +54,14 @@ function Column({ title, chevron = false, titleMenu, actions, above, collapsed =
|
|
|
51
54
|
<div
|
|
52
55
|
className={cn(
|
|
53
56
|
// `shrink-0`: the column keeps its 290px beside a main area that grows.
|
|
54
|
-
'flex shrink-0 flex-col overflow-hidden border-r border-border-subtle transition-[width,opacity]
|
|
55
|
-
|
|
57
|
+
'flex shrink-0 flex-col overflow-hidden border-r border-border-subtle transition-[width,opacity,visibility]',
|
|
58
|
+
FOLD_MOTION_CLASSES,
|
|
59
|
+
collapsed ? cn('w-0 border-r-0', FOLDED_CLASSES) : cn('w-[290px]', UNFOLDED_CLASSES),
|
|
56
60
|
className,
|
|
57
61
|
)}
|
|
58
62
|
data-collapsed={collapsed || undefined}
|
|
63
|
+
// Closed, nothing in it can be reached: inert at once, hidden once it has faded, as AppShell's folded navigation.
|
|
64
|
+
inert={collapsed}
|
|
59
65
|
>
|
|
60
66
|
<ContainerHeader title={title} chevron={chevron} titleMenu={titleMenu} actions={actions} />
|
|
61
67
|
{above}
|
|
@@ -77,3 +77,14 @@ export const Long: Story = {
|
|
|
77
77
|
export const AddLayer: Story = {
|
|
78
78
|
args: { initialView: 'add' },
|
|
79
79
|
}
|
|
80
|
+
|
|
81
|
+
/** An agent among the members: its face is a robot (`bot`). */
|
|
82
|
+
export const WithAnAgent: Story = {
|
|
83
|
+
args: {
|
|
84
|
+
members: [
|
|
85
|
+
{ id: 'me', name: 'You', caption: 'Product designer' },
|
|
86
|
+
{ id: 'ana', name: 'Ana Duarte', caption: 'Assignee' },
|
|
87
|
+
{ id: 'agent', name: 'Agent (steered by Ana Duarte)', caption: 'Agent', bot: true },
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
}
|
package/src/MembersDialog.tsx
CHANGED
|
@@ -16,6 +16,8 @@ export interface MembersDialogMember {
|
|
|
16
16
|
name: string
|
|
17
17
|
/** A picture URL, resolved by the caller, as `Avatar` takes its `src`. */
|
|
18
18
|
picture?: string
|
|
19
|
+
/** An agent: its face is a robot, as Avatar's `bot`. */
|
|
20
|
+
bot?: boolean
|
|
19
21
|
/** The line under the name: a role, a relation ("Assignee"), or a state. */
|
|
20
22
|
caption?: string
|
|
21
23
|
}
|
|
@@ -23,6 +25,8 @@ export interface MembersDialogMember {
|
|
|
23
25
|
/** Somebody who can be added: a `ChipInput` option with a face. */
|
|
24
26
|
export interface MembersDialogCandidate extends ChipInputOption {
|
|
25
27
|
picture?: string
|
|
28
|
+
/** An agent: its face is a robot, as Avatar's `bot`. */
|
|
29
|
+
bot?: boolean
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
/** What the viewer's own row offers: in when they are out, out when they are in. */
|
|
@@ -132,8 +136,8 @@ export function MembersDialog({ members, count, self, candidates = [], onAdd, no
|
|
|
132
136
|
options={candidates}
|
|
133
137
|
placeholder="Search people..."
|
|
134
138
|
excludeIds={members.map((m) => m.id)}
|
|
135
|
-
chipLeading={(o) => <Avatar name={o.label} src={o.picture} size={16} />}
|
|
136
|
-
rowLeading={(o) => <Avatar name={o.label} src={o.picture} size={32} />}
|
|
139
|
+
chipLeading={(o) => <Avatar name={o.label} src={o.picture} bot={o.bot} size={16} />}
|
|
140
|
+
rowLeading={(o) => <Avatar name={o.label} src={o.picture} bot={o.bot} size={32} />}
|
|
137
141
|
autoFocus
|
|
138
142
|
/>
|
|
139
143
|
</Field>
|
|
@@ -182,7 +186,7 @@ export function MembersDialog({ members, count, self, candidates = [], onAdd, no
|
|
|
182
186
|
)}
|
|
183
187
|
{roster.map((member) => (
|
|
184
188
|
<div key={member.id} className="flex h-12 items-center gap-3 px-5">
|
|
185
|
-
<Avatar size={32} name={member.name} src={member.picture} />
|
|
189
|
+
<Avatar size={32} name={member.name} src={member.picture} bot={member.bot} />
|
|
186
190
|
<div className="flex min-w-0 flex-1 flex-col justify-center gap-[2px]">
|
|
187
191
|
<div className="truncate text-body-2 text-text-primary">{member.name}</div>
|
|
188
192
|
{member.caption && <div className="truncate text-caption text-text-secondary">{member.caption}</div>}
|
package/src/MetaText.mdx
ADDED
|
@@ -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' } }
|
package/src/MetaText.tsx
ADDED
|
@@ -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 {
|
|
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
|
+
}
|