@estiva-app/ui 0.106.0 → 0.108.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/ConversationCard.d.ts +5 -0
- package/dist/ConversationCard.d.ts.map +1 -1
- package/dist/FollowSwitch.d.ts +42 -0
- package/dist/FollowSwitch.d.ts.map +1 -0
- package/dist/MembersDialog.d.ts +25 -0
- package/dist/MembersDialog.d.ts.map +1 -1
- package/dist/MembersPill.d.ts +3 -1
- package/dist/MembersPill.d.ts.map +1 -1
- package/dist/PinnedComment.d.ts +7 -1
- package/dist/PinnedComment.d.ts.map +1 -1
- package/dist/WhoFollowsDialog.d.ts +27 -0
- package/dist/WhoFollowsDialog.d.ts.map +1 -0
- package/dist/eslint/index.js +1 -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/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1101 -959
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/registry.json +281 -3
- package/src/ConversationCard.mdx +1 -0
- package/src/ConversationCard.stories.tsx +3 -0
- package/src/ConversationCard.test.tsx +22 -0
- package/src/ConversationCard.tsx +10 -2
- package/src/FollowSwitch.mdx +64 -0
- package/src/FollowSwitch.stories.tsx +54 -0
- package/src/FollowSwitch.test.tsx +139 -0
- package/src/FollowSwitch.tsx +127 -0
- package/src/MembersDialog.tsx +115 -62
- package/src/MembersPill.tsx +4 -2
- package/src/PinnedComment.tsx +11 -3
- package/src/Thread.stories.tsx +14 -1
- package/src/Thread.tsx +1 -1
- package/src/WhoFollowsDialog.mdx +65 -0
- package/src/WhoFollowsDialog.stories.tsx +40 -0
- package/src/WhoFollowsDialog.tsx +74 -0
- package/src/eslint/no-native-title.ts +1 -1
- package/src/index.ts +3 -1
- package/src/registry/registry.test.ts +6 -6
- package/stories/Choosing.mdx +2 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import { WhoFollowsDialog } from './WhoFollowsDialog'
|
|
3
|
+
|
|
4
|
+
const people = [
|
|
5
|
+
{ id: 'ana', label: 'Ana Duarte' },
|
|
6
|
+
{ id: 'ravi', label: 'Ravi Mehta' },
|
|
7
|
+
{ id: 'marta', label: 'Marta Silva' },
|
|
8
|
+
{ id: 'jonas', label: 'Jonas Weber' },
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'People/WhoFollowsDialog',
|
|
13
|
+
component: WhoFollowsDialog,
|
|
14
|
+
args: {
|
|
15
|
+
title: 'Item one',
|
|
16
|
+
all: [{ id: 'ana', name: 'Ana Duarte', caption: 'Chose it' }],
|
|
17
|
+
important: [
|
|
18
|
+
{ id: 'me', name: 'You', caption: 'In Group one' },
|
|
19
|
+
{ id: 'ravi', name: 'Ravi Mehta', caption: 'Added by Ana Duarte' },
|
|
20
|
+
],
|
|
21
|
+
candidates: people,
|
|
22
|
+
onAdd: () => {},
|
|
23
|
+
onClose: () => {},
|
|
24
|
+
},
|
|
25
|
+
} satisfies Meta<typeof WhoFollowsDialog>
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof meta>
|
|
29
|
+
|
|
30
|
+
/** All, then Important, each counted, and "Add someone" on top. */
|
|
31
|
+
export const Default: Story = {}
|
|
32
|
+
|
|
33
|
+
/** Nobody at All yet. */
|
|
34
|
+
export const NobodyAtAll: Story = { args: { all: [] } }
|
|
35
|
+
|
|
36
|
+
/** No `onAdd`: the list alone, with nobody to add from here. */
|
|
37
|
+
export const ListOnly: Story = { args: { onAdd: undefined } }
|
|
38
|
+
|
|
39
|
+
/** Opened from a menu's "Add someone…": straight on the add layer, whose back arrow returns to the list. */
|
|
40
|
+
export const Adding: Story = { args: { initialView: 'add' } }
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { DialogShell } from './DialogShell'
|
|
3
|
+
import { EmptyState } from './EmptyState'
|
|
4
|
+
import { AddPeopleLayer, AddRow, RosterRow, type MembersDialogCandidate, type MembersDialogMember } from './MembersDialog'
|
|
5
|
+
import { SectionLabel } from './SectionLabel'
|
|
6
|
+
|
|
7
|
+
export interface WhoFollowsDialogProps {
|
|
8
|
+
/** The place's name: the title reads "Who follows <title>". */
|
|
9
|
+
title: string
|
|
10
|
+
/** Who follows it at All, in the order to draw them. A row is a `MembersDialogMember`; its caption says how they are in it. */
|
|
11
|
+
all: MembersDialogMember[]
|
|
12
|
+
/** Who follows it at Important. */
|
|
13
|
+
important: MembersDialogMember[]
|
|
14
|
+
/** Who "Add someone" may offer. Everyone listed is left out by id; leave the viewer out yourself — they join with the switch, not by adding themselves. */
|
|
15
|
+
candidates?: MembersDialogCandidate[]
|
|
16
|
+
/**
|
|
17
|
+
* Adds the people chosen. With it, the "Add someone" row shows and opens the
|
|
18
|
+
* same add layer as `MembersDialog`'s. Return `false` to stay on it.
|
|
19
|
+
*/
|
|
20
|
+
onAdd?: (chosen: MembersDialogCandidate[]) => void | boolean | Promise<void | boolean>
|
|
21
|
+
/** `add` opens straight on the add layer, as a menu's "Add someone…" does. */
|
|
22
|
+
initialView?: 'list' | 'add'
|
|
23
|
+
onClose: () => void
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Who follows a place, in two groups, All then Important, each with its count
|
|
28
|
+
* and "Nobody" when empty; and "Add someone" on top, which opens the add layer
|
|
29
|
+
* `MembersDialog` uses. Nobody's level is changed here: each person changes
|
|
30
|
+
* their own on the place's `FollowSwitch`.
|
|
31
|
+
*/
|
|
32
|
+
export function WhoFollowsDialog({ title, all, important, candidates = [], onAdd, initialView = 'list', onClose }: WhoFollowsDialogProps) {
|
|
33
|
+
const [view, setView] = useState<'list' | 'add'>(onAdd ? initialView : 'list')
|
|
34
|
+
const heading = `Who follows ${title}`
|
|
35
|
+
|
|
36
|
+
if (view === 'add' && onAdd) {
|
|
37
|
+
return (
|
|
38
|
+
<AddPeopleLayer
|
|
39
|
+
title="Add someone"
|
|
40
|
+
backLabel="Back to who follows"
|
|
41
|
+
candidates={candidates}
|
|
42
|
+
excludeIds={[...all, ...important].map((m) => m.id)}
|
|
43
|
+
onAdd={onAdd}
|
|
44
|
+
onBack={() => setView('list')}
|
|
45
|
+
onClose={onClose}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const group = (label: string, rows: MembersDialogMember[]) => (
|
|
51
|
+
<div className="flex flex-col pt-2">
|
|
52
|
+
<SectionLabel tone="muted" className="px-5">{`${label} · ${rows.length}`}</SectionLabel>
|
|
53
|
+
{rows.length === 0 ? (
|
|
54
|
+
<div className="px-5">
|
|
55
|
+
<EmptyState scope="rows" message="Nobody" />
|
|
56
|
+
</div>
|
|
57
|
+
) : (
|
|
58
|
+
rows.map((m) => <RosterRow key={m.id} member={m} />)
|
|
59
|
+
)}
|
|
60
|
+
</div>
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<DialogShell title={heading} onClose={onClose} bodyMaxHeight="max-h-[400px]" bodyClassName="p-0 py-2">
|
|
65
|
+
{onAdd && (
|
|
66
|
+
<div className="flex flex-col px-2">
|
|
67
|
+
<AddRow label="Add someone" onClick={() => setView('add')} />
|
|
68
|
+
</div>
|
|
69
|
+
)}
|
|
70
|
+
{group('All', all)}
|
|
71
|
+
{group('Important', important)}
|
|
72
|
+
</DialogShell>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
@@ -8,7 +8,7 @@ import { bindingOfTag, partsOfFile, type Node, type Parser, type PartBinding } f
|
|
|
8
8
|
* the browser shows it as its tooltip. `no-native-title.test.ts` holds this
|
|
9
9
|
* list to the catalogue: a part that gains a `title` of its own joins it.
|
|
10
10
|
*/
|
|
11
|
-
export const PARTS_WITH_A_TITLE = ['ArchiveDialog', 'CollapsibleSection', 'ConfirmDialog', 'ContainerHeader', 'ConversationLayout', 'DialogShell', 'FormDialog', 'ListColumn', 'MoveDialog', 'NavTree', 'NavTreeSection', 'PageHeader', 'Panel', 'SectionHeader', 'Thread'] as const
|
|
11
|
+
export const PARTS_WITH_A_TITLE = ['ArchiveDialog', 'CollapsibleSection', 'ConfirmDialog', 'ContainerHeader', 'ConversationLayout', 'DialogShell', 'FormDialog', 'ListColumn', 'MoveDialog', 'NavTree', 'NavTreeSection', 'PageHeader', 'Panel', 'SectionHeader', 'Thread', 'WhoFollowsDialog'] as const
|
|
12
12
|
|
|
13
13
|
const child = (node: Node, key: string) => node[key] as Node | null | undefined
|
|
14
14
|
const nameOf = (node: Node | null | undefined): string | undefined =>
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,8 @@ export { Avatar, hueFor, initialsFor, type AvatarProps } from './Avatar'
|
|
|
16
16
|
export { AvatarGroup, type AvatarGroupMember, type AvatarGroupProps } from './AvatarGroup'
|
|
17
17
|
export { MembersPill, type MembersPillProps } from './MembersPill'
|
|
18
18
|
export { MoveDialog, type MoveCheck, type MoveChoice, type MoveDialogProps, type MoveFolder, type MovePlace } from './MoveDialog'
|
|
19
|
+
export { FollowSwitch, LevelIcon, type FollowChoice, type FollowLevel, type FollowSwitchProps, type LevelIconProps } from './FollowSwitch'
|
|
20
|
+
export { WhoFollowsDialog, type WhoFollowsDialogProps } from './WhoFollowsDialog'
|
|
19
21
|
export { MembersDialog, type MembersDialogCandidate, type MembersDialogMember, type MembersDialogProps, type MembersDialogSelfAction } from './MembersDialog'
|
|
20
22
|
export { Banner, type BannerProps, type BannerTone } from './Banner'
|
|
21
23
|
export { BlockHandle, blockAtY, type BlockHandleProps, type BlockHandleEditing, type HandleBlock } from './BlockHandle'
|
|
@@ -151,7 +153,7 @@ export { QuotedLine, type QuotedLineProps } from './QuotedLine'
|
|
|
151
153
|
export { ReactionHorizon, type ReactionHorizonProps } from './ReactionHorizon'
|
|
152
154
|
export { RepliesRow, type RepliesRowProps } from './RepliesRow'
|
|
153
155
|
export { ResolveDialog, type ResolveDialogProps } from './ResolveDialog'
|
|
154
|
-
export { PinnedComment, type PinnedCommentProps } from './PinnedComment'
|
|
156
|
+
export { PinnedComment, goneWords, GONE_CLOSED, type PinnedCommentProps } from './PinnedComment'
|
|
155
157
|
export { ArchiveDialog, type ArchiveDialogProps } from './ArchiveDialog'
|
|
156
158
|
export { ArchivedNotice, type ArchivedNoticeProps } from './ArchivedNotice'
|
|
157
159
|
export { DeletedNotice, type DeletedNoticeProps } from './DeletedNotice'
|
|
@@ -48,20 +48,20 @@ describe('the registry builds', () => {
|
|
|
48
48
|
expect(registry.entries.map((one) => one.name).sort()).toEqual(values.map((one) => one.name).sort())
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
it('counts
|
|
51
|
+
it('counts 250 names over 127 files: 165 components, 78 helpers and 7 hooks (FollowSwitch, LevelIcon and WhoFollowsDialog, how you follow a place and who follows it (TEA-6), on 6 November; goneWords and GONE_CLOSED, what stands in a gone comment’s place and under its thread in every app (ONE-9), on 6 November; DeletedNotice and NoAccessNotice, the cards on a deleted file and on one you cannot open (ALO-4), on 3 November; useFormBusy, whether a Form around it is sending, read by the editor’s DocumentField from the main entry, in the review of 2 November; useLeftAt, sendsInLayout, useSeenOnScreen, showInConversation and showInConversationWhenDrawn, where a conversation scrolls, what was seen and a link landing on a comment, moved from Peek for every app, on 2 November; useRememberedOpen, the fold a section remembers, read by the app, and NAV_TREE_PENDING_MS and isPlainClick, Peek’s Folder timer and plain-click check, moved in, on 2 November; FormDialog, MoveDialog and ArchiveDialog, the dialogs Peek wired by hand, on 2 November; ConversationPlace, the line saying where a comment was said, and DocumentField, a rich-text field of a form, moved from Peek, on 2 November; ArchivedNotice, the card on an archived file, from Peek, Ship and Leaf, on 31 October; caretOnOpen, the box at a thread’s foot taking the caret when a ConversationLayout opens it, without scrolling, on 31 October; the conversation from Peek for every app, with PageHeader and PinnedComment, on 31 October, and ResolutionNote and ResolutionHistory gone with the resolved looks not picked, on 1 November; useSidebarFold, a folded sidebar kept folded in every app, on 31 October; cardShapeMemory, a card’s last shape on this device, lifted from Peek and Ship for Leaf, and ReferenceCards and useReferenceCards gone with their deprecated page, in the widget review, on 30 October; inTheBox, a card or part in a box being written in, on the files’ fill and in words, on 29 October; archivedLine, the line on an archived file in every app (PEEKM-2), on 23 October; keepCommentBoxWarm, a box built ahead, exported as 0.84.0 promised (PEEKM-1), on 21 October;linkedFrom and linkStateFrom, one card for a file in every app (5ebf2756), on 21 October; ComposeBox, ComposeKeys and COMPOSE_EDITOR_CLASSES gone into CommentBox’s own frame (one box), on 21 October; LinkPlaces with linkPlaceAt and staysChip, a link in a document drawn where it sits (WBD-4), on 20 October; DocumentEditor, one document editor for every app, and PersonReference, `@` in a document (WBD-3), on 20 October; toggleTableHeaderRow, a table’s header row on and off (LEAF-12), on 19 October;EntryShell, the screen while nobody is signed in, moved from Peek (AUT-3), on 17 October; CommentBox with commentBoxRows, and ReactionRow with AddReactionButton and whoReacted, the shared comment box and reaction row (COMM-2), on 17 October; the link widgets — LinkChip, LinkRow, LinkCard, CardUnder, PartCard, LinkPreview and their parts, with useCanHover, chosenOf, loadingShapeOf and unavailableMemory — from the Widgets 2 prototype, on 16 October; InlineText, a title or the line under it edited where it stands (SUM-4), on 16 October; ComposeBox with ComposeKeys and its classes, CommentHighlights with its five helpers, and keepSelection and releaseSelection, from the Leaf prototype (LEAF-4), on 16 October;NavTree, NavTreeSection, the composer triggers and UnreadDot joined on 2 October; BlockHandle and EditorBlockHandle (RIC-18) on 2 October, moveBlock and blockDropCursor, the drop in the gutter, on 5 October, MembersPill and MembersDialog, moved from Peek (SHI-31), on 6 October, ShowMore on 7 October, AppProvider on 8 October, and KindIcon, thingKindOf and PastedImages with its two helpers, moved from Peek, on 8 October; CodeBlockColours, the coloured code block of the editor, on 9 October; Checklist, Callout, isChecklistTick and calloutLook (RIC-19) on 13 October; EditorTableControls and its four actions (RIC-21) on 13 October; ReferenceCards, useReferenceCards and its three helpers, the card a chip in a document asks for, on 14 October; LinkChips and its two helpers, a URL in a document read as its chip, on 14 October; ReferenceMenu, ReferenceMenuView and three helpers, the menu of a chip while writing, on 14 October; PastedMarkdown, markdown pasted as the blocks it spells (LEAF-10), on 15 October; turnIntoRows, turnListInto and turnQuoteInto, the block menu’s Turn into for a list and a quote (LEAF-11), on 15 October)', () => {
|
|
52
52
|
// The reconciliation GATES.md §24 explains. If this changes, that changes.
|
|
53
53
|
// The `EDITOR_EXTENSIONS` count as components by their names; they are
|
|
54
54
|
// editor extensions, documented on SelectionToolbar's, BlockNodes' and
|
|
55
55
|
// ComposerTriggers' pages.
|
|
56
56
|
const kinds = registry.entries.reduce<Record<string, number>>((all, one) => ({ ...all, [one.kind]: (all[one.kind] ?? 0) + 1 }), {})
|
|
57
|
-
expect(kinds).toEqual({ component:
|
|
58
|
-
expect(new Set(registry.entries.map((one) => one.sourceFile)).size).toBe(
|
|
57
|
+
expect(kinds).toEqual({ component: 165, helper: 78, hook: 7 })
|
|
58
|
+
expect(new Set(registry.entries.map((one) => one.sourceFile)).size).toBe(127)
|
|
59
59
|
})
|
|
60
60
|
|
|
61
61
|
it('gives every entry a purpose, from its own page or from the comment above it', () => {
|
|
62
62
|
expect(registry.entries.filter((one) => one.purpose.trim() === '')).toEqual([])
|
|
63
|
-
expect(registry.entries.filter((one) => one.purposeFrom === 'page').length).toBe(
|
|
64
|
-
expect(registry.entries.filter((one) => one.purposeFrom === 'comment').length).toBe(
|
|
63
|
+
expect(registry.entries.filter((one) => one.purposeFrom === 'page').length).toBe(114)
|
|
64
|
+
expect(registry.entries.filter((one) => one.purposeFrom === 'comment').length).toBe(136)
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
it('takes a name with a page of its own from the page, and a name without one from the code', () => {
|
|
@@ -325,7 +325,7 @@ describe('the ids point at something', () => {
|
|
|
325
325
|
describe('a second parser agrees', async () => {
|
|
326
326
|
const docgen = await import('react-docgen').catch(() => null)
|
|
327
327
|
|
|
328
|
-
it.skipIf(!docgen)('finds the same props on all
|
|
328
|
+
it.skipIf(!docgen)('finds the same props on all 88 components', async () => {
|
|
329
329
|
if (!docgen) return
|
|
330
330
|
const resolver = new docgen.builtinResolvers.FindExportedDefinitionsResolver({ limit: 0 })
|
|
331
331
|
const byName = new Map(registry.entries.map((one) => [one.name, one]))
|
package/stories/Choosing.mdx
CHANGED
|
@@ -54,6 +54,8 @@ fork freely, owe nothing back, mention it on the package's ticket.
|
|
|
54
54
|
| Several faces, overlapping | **AvatarGroup** |
|
|
55
55
|
| Who is in it, at a glance, opening the list | **MembersPill** |
|
|
56
56
|
| Who is in it, with Join, Leave and adding people | **MembersDialog** |
|
|
57
|
+
| How you follow a place — Not following, Important or All — before its title | **FollowSwitch**; the icon alone, in a list, is **LevelIcon** |
|
|
58
|
+
| Who follows a place, at which level, and adding someone | **WhoFollowsDialog**, opened from a **MembersPill** |
|
|
57
59
|
| Face and name in a row | **Person** |
|
|
58
60
|
| The face that opens a menu | **PersonTrigger** |
|
|
59
61
|
| Who you are, where you are, sign out | **IdentityMenu** — the account menu, ready-made |
|