@estiva-app/ui 0.90.2 → 0.91.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 (228) hide show
  1. package/dist/AttachedCard.d.ts +30 -0
  2. package/dist/AttachedCard.d.ts.map +1 -0
  3. package/dist/AttachmentCard.d.ts +14 -0
  4. package/dist/AttachmentCard.d.ts.map +1 -1
  5. package/dist/AvatarGroup.d.ts +7 -1
  6. package/dist/AvatarGroup.d.ts.map +1 -1
  7. package/dist/CommentBox.d.ts +1 -1
  8. package/dist/CommentBox.d.ts.map +1 -1
  9. package/dist/InlineText.d.ts +5 -2
  10. package/dist/InlineText.d.ts.map +1 -1
  11. package/dist/Link.d.ts +3 -2
  12. package/dist/Link.d.ts.map +1 -1
  13. package/dist/LinkCard.d.ts +3 -3
  14. package/dist/LinkCard.d.ts.map +1 -1
  15. package/dist/LinkChip.d.ts.map +1 -1
  16. package/dist/LinkParts.d.ts +17 -3
  17. package/dist/LinkParts.d.ts.map +1 -1
  18. package/dist/LinkPreview.d.ts.map +1 -1
  19. package/dist/LinkRow.d.ts +10 -5
  20. package/dist/LinkRow.d.ts.map +1 -1
  21. package/dist/PartCard.d.ts +7 -3
  22. package/dist/PartCard.d.ts.map +1 -1
  23. package/dist/Popover.d.ts +8 -1
  24. package/dist/Popover.d.ts.map +1 -1
  25. package/dist/ReactionRow.d.ts.map +1 -1
  26. package/dist/RichText.d.ts.map +1 -1
  27. package/dist/SuggestionMenu.d.ts +6 -2
  28. package/dist/SuggestionMenu.d.ts.map +1 -1
  29. package/dist/editor.js +19 -12
  30. package/dist/editor.js.map +3 -3
  31. package/dist/eslint/has-a-page-and-a-story.d.ts.map +1 -1
  32. package/dist/eslint/index.js +1093 -1076
  33. package/dist/eslint/index.js.map +4 -4
  34. package/dist/eslint/no-restyled-part.d.ts +9 -4
  35. package/dist/eslint/no-restyled-part.d.ts.map +1 -1
  36. package/dist/gates/{chunk-BS5JASHV.js → chunk-P2P6AHRY.js} +2 -2
  37. package/dist/gates/{chunk-BS5JASHV.js.map → chunk-P2P6AHRY.js.map} +2 -2
  38. package/dist/gates/cli.js +1 -1
  39. package/dist/gates/gate-config.d.ts +4 -1
  40. package/dist/gates/gate-config.d.ts.map +1 -1
  41. package/dist/gates/hook.d.ts.map +1 -1
  42. package/dist/gates/index.js +2 -2
  43. package/dist/gates/index.js.map +2 -2
  44. package/dist/index.d.ts +2 -2
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +275 -185
  47. package/dist/index.js.map +4 -4
  48. package/dist/linked.d.ts +7 -9
  49. package/dist/linked.d.ts.map +1 -1
  50. package/dist/linked.examples.d.ts.map +1 -1
  51. package/dist/linkedFrom.d.ts.map +1 -1
  52. package/dist/links.d.ts +2 -2
  53. package/dist/links.d.ts.map +1 -1
  54. package/dist/looks.d.ts +24 -0
  55. package/dist/looks.d.ts.map +1 -1
  56. package/dist/registry/{app-X2GI4WTU.js → app-IGBRDD4L.js} +3 -3
  57. package/dist/registry/{build-P6X3PTZP.js → build-MWN4UI23.js} +2 -2
  58. package/dist/registry/{chunk-P55P2QFD.js → chunk-4TWYUIOB.js} +1 -1
  59. package/dist/registry/chunk-4TWYUIOB.js.map +7 -0
  60. package/dist/registry/{chunk-V67F474L.js → chunk-NSHK76XT.js} +2 -2
  61. package/dist/registry/{chunk-4QWD3EBY.js → chunk-THI3SLW5.js} +1 -1
  62. package/dist/registry/{chunk-4QWD3EBY.js.map → chunk-THI3SLW5.js.map} +1 -1
  63. package/dist/registry/cli.js +3 -3
  64. package/dist/registry/find.d.ts +1 -1
  65. package/dist/registry/find.d.ts.map +1 -1
  66. package/dist/registry/index.js +3 -3
  67. package/package.json +1 -1
  68. package/registry.json +509 -455
  69. package/src/AppProvider.stories.tsx +1 -1
  70. package/src/AppShell.stories.tsx +1 -1
  71. package/src/AttachedCard.mdx +55 -0
  72. package/src/{CardUnder.stories.tsx → AttachedCard.stories.tsx} +10 -19
  73. package/src/{CardUnder.test.tsx → AttachedCard.test.tsx} +8 -8
  74. package/src/AttachedCard.tsx +43 -0
  75. package/src/AttachmentCard.stories.tsx +1 -1
  76. package/src/AttachmentCard.tsx +36 -14
  77. package/src/Avatar.stories.tsx +1 -1
  78. package/src/AvatarGroup.stories.tsx +1 -1
  79. package/src/AvatarGroup.tsx +8 -2
  80. package/src/Banner.stories.tsx +1 -1
  81. package/src/BlockHandle.stories.tsx +1 -1
  82. package/src/BlockNodes.stories.tsx +1 -1
  83. package/src/Breadcrumb.stories.tsx +1 -1
  84. package/src/Button.stories.tsx +1 -1
  85. package/src/Card.stories.tsx +1 -1
  86. package/src/Checkbox.stories.tsx +1 -1
  87. package/src/Chip.stories.tsx +1 -1
  88. package/src/ChipInput.stories.tsx +1 -1
  89. package/src/CodeBlockColours.stories.tsx +1 -1
  90. package/src/CollapsibleSection.stories.tsx +1 -1
  91. package/src/CommandPalette.stories.tsx +1 -1
  92. package/src/CommentBox.mdx +3 -3
  93. package/src/CommentBox.stories.tsx +39 -7
  94. package/src/CommentBox.tsx +27 -17
  95. package/src/CommentHighlights.stories.tsx +1 -1
  96. package/src/ComposerTriggers.stories.tsx +1 -1
  97. package/src/ConfirmDialog.stories.tsx +1 -1
  98. package/src/ContainerHeader.stories.tsx +1 -1
  99. package/src/DialogShell.stories.tsx +1 -1
  100. package/src/Divider.stories.tsx +1 -1
  101. package/src/DocumentEditor.stories.tsx +1 -1
  102. package/src/EditableText.stories.tsx +1 -1
  103. package/src/EditorBlockHandle.stories.tsx +1 -1
  104. package/src/EditorTableControls.stories.tsx +1 -1
  105. package/src/EmptyState.stories.tsx +1 -1
  106. package/src/EntryShell.mdx +1 -1
  107. package/src/EntryShell.stories.tsx +1 -1
  108. package/src/ErrorBoundary.stories.tsx +1 -1
  109. package/src/Field.stories.tsx +1 -1
  110. package/src/FieldLine.stories.tsx +1 -1
  111. package/src/FilePicker.stories.tsx +1 -1
  112. package/src/Form.stories.tsx +1 -1
  113. package/src/IconButton.stories.tsx +1 -1
  114. package/src/IdentityMenu.stories.tsx +1 -1
  115. package/src/InlineChip.stories.tsx +1 -1
  116. package/src/InlineText.mdx +1 -0
  117. package/src/InlineText.stories.tsx +6 -3
  118. package/src/InlineText.tsx +7 -2
  119. package/src/Kbd.stories.tsx +1 -1
  120. package/src/KindIcon.stories.tsx +1 -1
  121. package/src/Lightbox.stories.tsx +1 -1
  122. package/src/Link.mdx +3 -2
  123. package/src/Link.stories.tsx +1 -1
  124. package/src/Link.test.tsx +5 -3
  125. package/src/Link.tsx +5 -3
  126. package/src/LinkCard.mdx +5 -4
  127. package/src/LinkCard.stories.tsx +1 -1
  128. package/src/LinkCard.test.tsx +1 -1
  129. package/src/LinkCard.tsx +80 -57
  130. package/src/LinkChip.mdx +3 -3
  131. package/src/LinkChip.stories.tsx +1 -1
  132. package/src/LinkChip.test.tsx +1 -1
  133. package/src/LinkChip.tsx +16 -3
  134. package/src/LinkChips.stories.tsx +1 -1
  135. package/src/LinkParts.stories.tsx +1 -1
  136. package/src/LinkParts.tsx +40 -8
  137. package/src/LinkPlaces.stories.tsx +1 -1
  138. package/src/LinkPreview.mdx +1 -1
  139. package/src/LinkPreview.stories.tsx +1 -1
  140. package/src/LinkPreview.tsx +3 -1
  141. package/src/LinkRow.mdx +8 -6
  142. package/src/LinkRow.stories.tsx +3 -3
  143. package/src/LinkRow.test.tsx +3 -3
  144. package/src/LinkRow.tsx +71 -40
  145. package/src/ListColumn.stories.tsx +1 -1
  146. package/src/MembersDialog.stories.tsx +1 -1
  147. package/src/MembersPill.stories.tsx +1 -1
  148. package/src/Menu.stories.tsx +1 -1
  149. package/src/MenuItem.stories.tsx +1 -1
  150. package/src/NavItem.stories.tsx +1 -1
  151. package/src/NavTree.stories.tsx +1 -1
  152. package/src/Panel.stories.tsx +1 -1
  153. package/src/PartCard.mdx +4 -4
  154. package/src/PartCard.stories.tsx +11 -8
  155. package/src/PartCard.test.tsx +5 -3
  156. package/src/PartCard.tsx +33 -24
  157. package/src/PastedImages.stories.tsx +1 -1
  158. package/src/PastedMarkdown.stories.tsx +1 -1
  159. package/src/Person.stories.tsx +1 -1
  160. package/src/PersonTrigger.stories.tsx +1 -1
  161. package/src/Popover.stories.tsx +1 -1
  162. package/src/Popover.tsx +6 -2
  163. package/src/PreviewCard.stories.tsx +1 -1
  164. package/src/ProgressBar.stories.tsx +1 -1
  165. package/src/Property.stories.tsx +1 -1
  166. package/src/Rail.stories.tsx +1 -1
  167. package/src/RailItem.stories.tsx +1 -1
  168. package/src/Reaction.stories.tsx +1 -1
  169. package/src/ReactionPicker.stories.tsx +1 -1
  170. package/src/ReactionRow.stories.tsx +1 -1
  171. package/src/ReactionRow.tsx +3 -1
  172. package/src/ReferenceCards.mdx +3 -0
  173. package/src/ReferenceCards.stories.tsx +3 -1
  174. package/src/ReferenceMenu.mdx +1 -1
  175. package/src/ReferenceMenu.stories.tsx +1 -1
  176. package/src/RichText.stories.tsx +1 -1
  177. package/src/RichText.tsx +6 -2
  178. package/src/ScrollArea.stories.tsx +1 -1
  179. package/src/SearchInput.stories.tsx +1 -1
  180. package/src/SectionHeader.stories.tsx +1 -1
  181. package/src/SectionLabel.stories.tsx +1 -1
  182. package/src/Select.stories.tsx +1 -1
  183. package/src/SelectionToolbar.stories.tsx +1 -1
  184. package/src/ShowMore.stories.tsx +1 -1
  185. package/src/Sidebar.stories.tsx +1 -1
  186. package/src/Skeleton.stories.tsx +1 -1
  187. package/src/SuggestionMenu.mdx +4 -1
  188. package/src/SuggestionMenu.stories.tsx +14 -8
  189. package/src/SuggestionMenu.tsx +20 -3
  190. package/src/Tabs.stories.tsx +1 -1
  191. package/src/TextInput.stories.tsx +1 -1
  192. package/src/Textarea.stories.tsx +1 -1
  193. package/src/Toast.stories.tsx +1 -1
  194. package/src/Toolbar.stories.tsx +1 -1
  195. package/src/Tooltip.stories.tsx +1 -1
  196. package/src/TopBar.stories.tsx +1 -1
  197. package/src/UnreadDot.stories.tsx +1 -1
  198. package/src/eslint/has-a-page-and-a-story.test.ts +5 -0
  199. package/src/eslint/has-a-page-and-a-story.ts +11 -2
  200. package/src/eslint/no-restyled-part.test.ts +32 -8
  201. package/src/eslint/no-restyled-part.ts +50 -23
  202. package/src/gates/gate-config.ts +5 -2
  203. package/src/gates/gates.test.ts +20 -2
  204. package/src/gates/hook.ts +4 -3
  205. package/src/index.ts +2 -1
  206. package/src/linked.examples.ts +2 -3
  207. package/src/linked.ts +11 -1
  208. package/src/linkedFrom.ts +1 -0
  209. package/src/links.ts +3 -2
  210. package/src/looks.ts +29 -0
  211. package/src/registry/build.ts +1 -1
  212. package/src/registry/contract.test.ts +1 -1
  213. package/src/registry/find.ts +1 -1
  214. package/src/registry/registry.test.ts +12 -12
  215. package/src/suggestionPopup.tsx +1 -1
  216. package/stories/Choosing.mdx +2 -2
  217. package/stories/DesignTokens.mdx +1 -1
  218. package/stories/GettingStarted.mdx +2 -2
  219. package/stories/Introduction.mdx +23 -4
  220. package/stories/TokensPage.tsx +12 -7
  221. package/dist/CardUnder.d.ts +0 -31
  222. package/dist/CardUnder.d.ts.map +0 -1
  223. package/dist/registry/chunk-P55P2QFD.js.map +0 -7
  224. package/src/CardUnder.mdx +0 -54
  225. package/src/CardUnder.tsx +0 -49
  226. /package/dist/registry/{app-X2GI4WTU.js.map → app-IGBRDD4L.js.map} +0 -0
  227. /package/dist/registry/{build-P6X3PTZP.js.map → build-MWN4UI23.js.map} +0 -0
  228. /package/dist/registry/{chunk-V67F474L.js.map → chunk-NSHK76XT.js.map} +0 -0
@@ -12,7 +12,7 @@ const ANA = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" vie
12
12
  const pictureFor = (name: string) => (name === 'Ana Duarte' ? ANA : undefined)
13
13
 
14
14
  const meta = {
15
- title: 'Frame/AppProvider',
15
+ title: 'App frame/AppProvider',
16
16
  component: AppProvider,
17
17
  args: { children: null },
18
18
  argTypes: { children: { control: false }, pictureFor: { control: false }, navigate: { control: false } },
@@ -13,7 +13,7 @@ import { RailItem } from './RailItem'
13
13
  import { Sidebar } from './Sidebar'
14
14
 
15
15
  const meta = {
16
- title: 'Frame/AppShell',
16
+ title: 'App frame/AppShell',
17
17
  component: AppShell,
18
18
  parameters: {
19
19
  layout: 'fullscreen',
@@ -0,0 +1,55 @@
1
+ import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks'
2
+ import * as AttachedCardStories from './AttachedCard.stories'
3
+
4
+ <Meta of={AttachedCardStories} />
5
+
6
+ # AttachedCard
7
+
8
+ The one card attached to a piece of text, and the ✕ that removes it.
9
+
10
+ <Canvas of={AttachedCardStories.WithRemove} />
11
+
12
+ ## When
13
+
14
+ - **while writing** — `CommentBox` places it inside the box, with the files, on their fill, its values as words. Write nothing for that.
15
+ - **after sending** — under the text, its values as pickers.
16
+ - **no ✕** — no `onRemove`: to anyone but who wrote it.
17
+
18
+ The ✕ is a file's: round, on the card's corner, shown when the pointer is over the card or the ✕ has focus, and always on a screen that cannot hover, so a tap reaches it.
19
+
20
+ ## When not
21
+
22
+ - A file → **AttachmentCard**.
23
+ - A link alone on its line, with no card chosen → **LinkRow**.
24
+ - A part of something longer: it has no ✕ → **PartCard**.
25
+
26
+ ## How
27
+
28
+ ```tsx
29
+ import { AttachedCard } from '@estiva-app/ui'
30
+
31
+ <AttachedCard link={link} onRemove={isAuthor ? removeCard : undefined} />
32
+ ```
33
+
34
+ - **Which link gets the card is the app's**, by the rule every app reads by (`defaultCardOf` in `@estiva-app/protocol`). This draws the one it is given.
35
+ - `onRemove` is the app's: before sending it drops the card from what will be sent; after, it sends the edit that removes it.
36
+ - It is at most 480px wide.
37
+ - **An app that draws its sent cards itself** passes its card as `children` instead of `link`, so the card in a box and under a sent message are the same: `<AttachedCard onRemove={remove}>{appCard}</AttachedCard>`. `CommentBox` draws its card this way.
38
+
39
+ ## What it owns
40
+
41
+ | It does | So you never write |
42
+ |---|---|
43
+ | Places the ✕ on the card's corner, as a file's | a remove button of your own |
44
+ | Reveals the ✕ on hover and focus, and always shows it on touch | a hover or touch check |
45
+
46
+ ## Keys
47
+
48
+ | Key | Does |
49
+ |---|---|
50
+ | Tab | Reaches the ✕, and shows it |
51
+ | Enter, Space | Removes the card |
52
+
53
+ ## Props
54
+
55
+ <Controls of={AttachedCardStories.NoRemove} />
@@ -1,34 +1,25 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite'
2
2
  import { useState } from 'react'
3
+ import { AttachedCard } from './AttachedCard'
3
4
  import { Button } from './Button'
4
- import { CardUnder } from './CardUnder'
5
5
  import { ITEM, LOADING, ready, SAID, UNAVAILABLE } from './linked.examples'
6
6
 
7
7
  const meta = {
8
- title: 'Components/CardUnder',
9
- component: CardUnder,
8
+ title: 'Links & references/AttachedCard',
9
+ component: AttachedCard,
10
10
  parameters: { layout: 'padded' },
11
11
  args: { link: ready(ITEM) },
12
- } satisfies Meta<typeof CardUnder>
12
+ } satisfies Meta<typeof AttachedCard>
13
13
 
14
14
  export default meta
15
15
  type Story = StoryObj<typeof meta>
16
16
 
17
- /** Under a box being written in: the ✕ always shows. Press it to remove the card. */
18
- export const WhileWriting: Story = {
17
+ /** To who wrote it: the round ✕ shows when you point at the card, as a file's does, and always on a screen that cannot hover. Press it to remove the card. */
18
+ export const WithRemove: Story = {
19
19
  render: (args) => {
20
20
  const [removed, setRemoved] = useState(false)
21
21
  if (removed) return <Button onClick={() => setRemoved(false)}>Put it back</Button>
22
- return <CardUnder {...args} onRemove={() => setRemoved(true)} />
23
- },
24
- }
25
-
26
- /** Under text already sent: the ✕ shows on hover or focus, and always on a screen that cannot hover. */
27
- export const AfterSending: Story = {
28
- render: (args) => {
29
- const [removed, setRemoved] = useState(false)
30
- if (removed) return <Button onClick={() => setRemoved(false)}>Put it back</Button>
31
- return <CardUnder {...args} revealOnHover onRemove={() => setRemoved(true)} />
22
+ return <AttachedCard {...args} onRemove={() => setRemoved(true)} />
32
23
  },
33
24
  }
34
25
 
@@ -36,10 +27,10 @@ export const AfterSending: Story = {
36
27
  export const NoRemove: Story = {}
37
28
 
38
29
  /** Words a person wrote, as the card. */
39
- export const WordsAPersonWrote: Story = { args: { link: ready(SAID) }, render: (args) => <CardUnder {...args} onRemove={() => {}} /> }
30
+ export const WordsAPersonWrote: Story = { args: { link: ready(SAID) }, render: (args) => <AttachedCard {...args} onRemove={() => {}} /> }
40
31
 
41
32
  /** Still being looked up: at the card's height, with its ✕. */
42
- export const Loading: Story = { args: { link: LOADING }, render: (args) => <CardUnder {...args} onRemove={() => {}} /> }
33
+ export const Loading: Story = { args: { link: LOADING }, render: (args) => <AttachedCard {...args} onRemove={() => {}} /> }
43
34
 
44
35
  /** Deleted, or not this reader's to see. */
45
- export const NotAvailable: Story = { args: { link: UNAVAILABLE }, render: (args) => <CardUnder {...args} onRemove={() => {}} /> }
36
+ export const NotAvailable: Story = { args: { link: UNAVAILABLE }, render: (args) => <AttachedCard {...args} onRemove={() => {}} /> }
@@ -1,31 +1,31 @@
1
1
  // @vitest-environment jsdom
2
- /** What the CardUnder page claims, pinned: the ✕ removes the card, by pointer and by keyboard, and only where it is given. */
2
+ /** What the AttachedCard page claims, pinned: the ✕ removes the card, by pointer and by keyboard, and only where it is given. */
3
3
  import { cleanup, render, screen } from '@testing-library/react'
4
4
  import userEvent from '@testing-library/user-event'
5
5
  import { afterEach, describe, expect, it, vi } from 'vitest'
6
- import { CardUnder } from './CardUnder'
6
+ import { AttachedCard } from './AttachedCard'
7
7
  import { ITEM, ready } from './linked.examples'
8
8
 
9
9
  afterEach(cleanup)
10
10
 
11
- describe('CardUnder', () => {
11
+ describe('AttachedCard', () => {
12
12
  it('draws the card it is given', () => {
13
- render(<CardUnder link={ready(ITEM)} />)
13
+ render(<AttachedCard link={ready(ITEM)} />)
14
14
  expect(screen.getByRole('link', { name: ITEM.title })).toBeTruthy()
15
15
  })
16
16
 
17
17
  it('removes the card when the ✕ is pressed', async () => {
18
18
  const user = userEvent.setup()
19
19
  const onRemove = vi.fn()
20
- render(<CardUnder link={ready(ITEM)} onRemove={onRemove} />)
20
+ render(<AttachedCard link={ready(ITEM)} onRemove={onRemove} />)
21
21
  await user.click(screen.getByRole('button', { name: 'Remove card' }))
22
22
  expect(onRemove).toHaveBeenCalledTimes(1)
23
23
  })
24
24
 
25
- it('reaches the ✕ from the keyboard once sent, and removes the card with Enter', async () => {
25
+ it('reaches the ✕ from the keyboard, and removes the card with Enter', async () => {
26
26
  const user = userEvent.setup()
27
27
  const onRemove = vi.fn()
28
- render(<CardUnder link={ready({ ...ITEM, conversation: undefined, status: undefined, owner: undefined })} onRemove={onRemove} revealOnHover />)
28
+ render(<AttachedCard link={ready({ ...ITEM, conversation: undefined, status: undefined, owner: undefined })} onRemove={onRemove} />)
29
29
  await user.tab()
30
30
  await user.tab()
31
31
  expect(document.activeElement).toBe(screen.getByRole('button', { name: 'Remove card' }))
@@ -34,7 +34,7 @@ describe('CardUnder', () => {
34
34
  })
35
35
 
36
36
  it('has no ✕ for anyone but who wrote it', () => {
37
- render(<CardUnder link={ready(ITEM)} />)
37
+ render(<AttachedCard link={ready(ITEM)} />)
38
38
  expect(screen.queryByRole('button', { name: 'Remove card' })).toBeNull()
39
39
  })
40
40
  })
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The one card attached to a piece of text, and the ✕ that removes it (why:
3
+ * https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md).
4
+ *
5
+ * Its ✕ is a file's (Katerina, 29 Oct): the round one on the card's corner, from
6
+ * `AttachmentCard`, shown when the pointer is over the card or the ✕ has focus.
7
+ * On a screen that cannot hover it always shows, so a tap reaches it (Miky, 16
8
+ * Oct, kickoff). Inside a box being written in, `CommentBox` places it with the
9
+ * files, and the card there reads as words on the files' fill (`inTheBox`).
10
+ */
11
+ import { useContext, type ReactNode } from 'react'
12
+ import { RemoveBadge } from './AttachmentCard'
13
+ import { LinkCard } from './LinkCard'
14
+ import { cn } from './cn'
15
+ import { inTheBox, type LinkState } from './linked'
16
+
17
+ interface AttachedCardBase {
18
+ /** Draws the ✕. Without it the card shows with none, as it does to anyone but the author. */
19
+ onRemove?: () => void
20
+ }
21
+
22
+ /**
23
+ * The card is a `LinkCard` of `link`, or the app's own card as `children`: an
24
+ * app that draws a sent card itself draws the one in its box the same way.
25
+ */
26
+ export type AttachedCardProps = AttachedCardBase & ({ link: LinkState; children?: never } | { link?: never; children: ReactNode })
27
+
28
+ export function AttachedCard({ link, children, onRemove }: AttachedCardProps) {
29
+ const boxed = useContext(inTheBox)
30
+ return (
31
+ // At most 480px under a message or in a document, so it never runs the column's whole width; in a box it fills the box (Katerina, 29 Oct).
32
+ <div className={cn('group/card relative', !boxed && 'max-w-[480px]')}>
33
+ {link ? <LinkCard link={link} /> : children}
34
+ {onRemove && (
35
+ <RemoveBadge
36
+ label="Remove card"
37
+ onRemove={onRemove}
38
+ className="opacity-0 group-hover/card:opacity-100 group-focus-within/card:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100"
39
+ />
40
+ )}
41
+ </div>
42
+ )
43
+ }
@@ -18,7 +18,7 @@ const SHOT = svg(
18
18
  const noop = () => {}
19
19
 
20
20
  const meta = {
21
- title: 'Components/AttachmentCard',
21
+ title: 'Links & references/AttachmentCard',
22
22
  component: AttachmentCard,
23
23
  parameters: { layout: 'padded' },
24
24
  args: { name: 'Q3-billing-summary.pdf', size: 2_412_000, href: 'https://example.com/f', onDownload: noop },
@@ -23,6 +23,7 @@ import { Lightbox } from './Lightbox'
23
23
  import { Link } from './Link'
24
24
  import { WithTooltip, type WithTooltipProps } from './Tooltip'
25
25
  import { cn } from './cn'
26
+ import { TYPE_TILE_CLASSES } from './looks'
26
27
 
27
28
  /**
28
29
  * Something attached — a document or an image — drawn as a card.
@@ -88,7 +89,8 @@ const formatBytes = (bytes: number) => {
88
89
  /** `'PDF'`, `'ZIP'`, `'DOCX'`, `'FILE'`. */
89
90
  const typeLabelOf = (name: string) => extensionOf(name).toUpperCase() || 'FILE'
90
91
 
91
- const TILE_CLASSES = 'size-9 rounded-md bg-bg-active flex items-center justify-center shrink-0 text-text-secondary'
92
+ /** A file's type tile: the one a link's kind sits in too. */
93
+ const TILE_CLASSES = TYPE_TILE_CLASSES
92
94
  // @estiva-escape(no-copied-look): A6 (Katerina, 24 September: record only): a 12px medium name, the text style InputChip's label also uses, not a copy of a part
93
95
  const NAME_CLASSES = 'text-caption font-medium text-text-primary truncate'
94
96
  const NOTE_CLASSES = 'text-small tracking-wide leading-tight truncate'
@@ -142,6 +144,34 @@ function Truncating({ text, hint, className, wrapperClassName, placement }: { te
142
144
  )
143
145
  }
144
146
 
147
+ /**
148
+ * The round ✕ on the corner of something attached: a file waiting to be sent,
149
+ * and an AttachedCard (Katerina, 29 Oct: "we have an x icon used for
150
+ * attachments so we could reuse that one"). Its parent is `relative`;
151
+ * `className` says when it shows.
152
+ *
153
+ * On Base UI's Button, as InputChip's ✕ is (Katerina, 2026-09-14): IconButton is
154
+ * a 24px square that fills on hover, and this is Peek's 20px round badge.
155
+ */
156
+ export function RemoveBadge({ label, onRemove, className }: { label: string; onRemove: () => void; className?: string }) {
157
+ return (
158
+ <BaseButton
159
+ type="button"
160
+ aria-label={label}
161
+ className={cn(
162
+ 'absolute -top-1.5 -right-1.5 size-5 rounded-full bg-bg-elevated border border-border-strong flex items-center justify-center text-text-secondary hover:text-text-primary transition-opacity',
163
+ className,
164
+ )}
165
+ onClick={(event) => {
166
+ event.stopPropagation()
167
+ onRemove()
168
+ }}
169
+ >
170
+ <IconX size={11} stroke={1.75} />
171
+ </BaseButton>
172
+ )
173
+ }
174
+
145
175
  export interface AttachmentCardProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
146
176
  /** The name it was attached under, extension included: it decides the icon and the type label. */
147
177
  name: string
@@ -387,22 +417,14 @@ export function AttachmentCard({
387
417
  className={cn(NOTE_CLASSES, failed ? 'text-error-default' : warning ? 'text-warning-default' : 'text-text-secondary')}
388
418
  />
389
419
  </div>
390
- {/* On Base UI's Button, as InputChip's ✕ is (Katerina, 2026-09-14): IconButton is a 24px square
391
- that fills on hover, and this is Peek's 20px round badge on the card's corner. */}
392
420
  {onRemove && (
393
- <BaseButton
394
- type="button"
395
- aria-label={`Remove ${name}`}
421
+ <RemoveBadge
422
+ label={`Remove ${name}`}
423
+ onRemove={onRemove}
396
424
  // Shows with the card's hover and with keyboard focus, as Download does: hover-only left it invisible to
397
425
  // the keyboard that had reached it (UIG-14, C4, Katerina 19 September).
398
- className="absolute -top-1.5 -right-1.5 size-5 rounded-full bg-bg-elevated border border-border-strong flex items-center justify-center text-text-secondary hover:text-text-primary opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100 transition-opacity"
399
- onClick={(event) => {
400
- event.stopPropagation()
401
- onRemove()
402
- }}
403
- >
404
- <IconX size={11} stroke={1.75} />
405
- </BaseButton>
426
+ className="opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 focus-visible:opacity-100"
427
+ />
406
428
  )}
407
429
  </Card>
408
430
  )
@@ -3,7 +3,7 @@ import { Avatar } from './Avatar'
3
3
 
4
4
  /** A picture, or initials on the person's own colour, or a silhouette. Nothing here comes from an app. */
5
5
  const meta = {
6
- title: 'Primitives/Avatar',
6
+ title: 'People/Avatar',
7
7
  component: Avatar,
8
8
  args: { name: 'Ana Duarte', size: 36 },
9
9
  } satisfies Meta<typeof Avatar>
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite'
2
2
  import { AvatarGroup } from './AvatarGroup'
3
3
 
4
4
  const meta = {
5
- title: 'Primitives/AvatarGroup',
5
+ title: 'People/AvatarGroup',
6
6
  component: AvatarGroup,
7
7
  args: {
8
8
  members: [{ name: 'Ana Duarte' }, { name: 'Ravi Mehta' }, { name: 'Marta Silva' }],
@@ -30,9 +30,15 @@ export interface AvatarGroupProps {
30
30
  * for two months for want of this one number, and drifted while it did.
31
31
  */
32
32
  size?: number
33
+ /**
34
+ * What the stack sits on, so each face's ring is that colour and reads as a gap. Default `surface`. On a card
35
+ * (`inset`, or `elevated` in a box) the surface-coloured ring drew a dark outline round every face (proposal,
36
+ * Katerina 29 Oct).
37
+ */
38
+ on?: 'surface' | 'inset' | 'elevated'
33
39
  }
34
40
 
35
- export function AvatarGroup({ members, size = 24 }: AvatarGroupProps) {
41
+ export function AvatarGroup({ members, size = 24, on = 'surface' }: AvatarGroupProps) {
36
42
  const visible = members.slice(0, 3)
37
43
  /*
38
44
  A third of the face, so a stack reads the same at any size — which is
@@ -56,7 +62,7 @@ export function AvatarGroup({ members, size = 24 }: AvatarGroupProps) {
56
62
  key={i}
57
63
  className="relative flex rounded-sm"
58
64
  /* eslint-disable-next-line no-restricted-syntax -- @estiva-escape: the ring's width is the `ring` prop, so it cannot be a class; its colour is the surface token */
59
- style={{ marginRight: -overlap, boxShadow: `0 0 0 ${ring}px var(--bg-surface)` }}
65
+ style={{ marginRight: -overlap, boxShadow: `0 0 0 ${ring}px var(--bg-${on})` }}
60
66
  >
61
67
  {/* Each face says whose it is: a stack stands on its own, with no
62
68
  name beside it to borrow. It read as its initials before —
@@ -3,7 +3,7 @@ import { IconPencilMinus, IconUserPlus } from '@tabler/icons-react'
3
3
  import { Banner } from './Banner'
4
4
 
5
5
  const meta = {
6
- title: 'Feedback/Banner',
6
+ title: 'Status & feedback/Banner',
7
7
  component: Banner,
8
8
  parameters: {
9
9
  layout: 'fullscreen',
@@ -10,7 +10,7 @@ import { RichText, type RichTextBlock } from './RichText'
10
10
  * and the editing rows.
11
11
  */
12
12
  const meta = {
13
- title: 'Primitives/BlockHandle',
13
+ title: 'Writing/BlockHandle',
14
14
  // The handle sits 28px left of the content, in the page's margin.
15
15
  parameters: { layout: 'padded' },
16
16
  } satisfies Meta
@@ -12,7 +12,7 @@ import { AttachmentNode, BlockId, Callout, Checklist, ReferenceNode, UnknownBloc
12
12
  * draws the reference and the file with its own views.
13
13
  */
14
14
  const meta = {
15
- title: 'Primitives/BlockNodes',
15
+ title: 'Writing/BlockNodes',
16
16
  parameters: { layout: 'padded' },
17
17
  } satisfies Meta
18
18
 
@@ -4,7 +4,7 @@ import { Breadcrumb } from './Breadcrumb'
4
4
 
5
5
  /** A trail of places, ending where you are — or on a mono ref. */
6
6
  const meta = {
7
- title: 'Navigation/Breadcrumb',
7
+ title: 'Page structure/Breadcrumb',
8
8
  component: Breadcrumb,
9
9
  // axe color-contrast is off here until PLAN.md stage 0.10 is ruled:
10
10
  // the current item is muted text, 3.94:1 on --bg-base in signal (AA 4.5:1).
@@ -3,7 +3,7 @@ import { IconPlus } from '@tabler/icons-react'
3
3
  import { Button } from './Button'
4
4
 
5
5
  const meta = {
6
- title: 'Primitives/Button',
6
+ title: 'Buttons & links/Button',
7
7
  component: Button,
8
8
  args: { children: 'Button', variant: 'muted', size: 'default', disabled: false },
9
9
  argTypes: {
@@ -9,7 +9,7 @@ const Body = ({ title = 'Item one', line = 'A line about the item.' }: { title?:
9
9
  )
10
10
 
11
11
  const meta = {
12
- title: 'Primitives/Card',
12
+ title: 'Page structure/Card',
13
13
  component: Card,
14
14
  args: { fill: 'surface', className: 'w-[280px] p-3', children: <Body /> },
15
15
  argTypes: {
@@ -5,7 +5,7 @@ import { IconSquareRounded } from '@tabler/icons-react'
5
5
  import { Checkbox } from './Checkbox'
6
6
 
7
7
  const meta = {
8
- title: 'Inputs/Checkbox',
8
+ title: 'Forms & fields/Checkbox',
9
9
  component: Checkbox,
10
10
  // `onChange` makes it the control; without one it is the picture of a
11
11
  // state (the "inside a row" story), and these stories are about the control.
@@ -3,7 +3,7 @@ import { IconArrowUp, IconMessage2 } from '@tabler/icons-react'
3
3
  import { Chip } from './Chip'
4
4
 
5
5
  const meta = {
6
- title: 'Primitives/Chip',
6
+ title: 'Status & feedback/Chip',
7
7
  component: Chip,
8
8
  // axe color-contrast is off here until PLAN.md stage 0.10 is ruled:
9
9
  // in ship the brand chip reads 2.70:1 and the info chip 3.99:1 on their washes
@@ -27,7 +27,7 @@ const personLeading = {
27
27
  }
28
28
 
29
29
  const meta = {
30
- title: 'Inputs/ChipInput',
30
+ title: 'Forms & fields/ChipInput',
31
31
  component: ChipInput,
32
32
  parameters: {
33
33
  // The suggestion list portals to document.body at fixed coordinates —
@@ -10,7 +10,7 @@ import { richTextClassName } from './RichText'
10
10
  * colours RichText reads it in. Change the theme to see each set.
11
11
  */
12
12
  const meta = {
13
- title: 'Primitives/CodeBlockColours',
13
+ title: 'Writing/CodeBlockColours',
14
14
  parameters: { layout: 'padded' },
15
15
  } satisfies Meta
16
16
 
@@ -7,7 +7,7 @@ import { NavItem } from './NavItem'
7
7
 
8
8
  /** A section that opens and closes: the header's title is the toggle, and the rows slide. */
9
9
  const meta = {
10
- title: 'Navigation/CollapsibleSection',
10
+ title: 'Page structure/CollapsibleSection',
11
11
  component: CollapsibleSection,
12
12
  decorators: [(Story) => <div className="w-[280px]"><Story /></div>],
13
13
  args: { title: 'Section', contentClassName: 'gap-0.5', children: null },
@@ -28,7 +28,7 @@ import { Textarea } from './Textarea'
28
28
  * Nothing here is fetched: what "arrives later" is a timer.
29
29
  */
30
30
  const meta = {
31
- title: 'Overlays/CommandPalette',
31
+ title: 'Menus & windows/CommandPalette',
32
32
  component: CommandPalette,
33
33
  parameters: {
34
34
  layout: 'fullscreen',
@@ -15,7 +15,7 @@ The one box every app writes a comment, a reply and a line of a conversation in:
15
15
  - `showsAtOnce` when the app shows a send before the relay answers: the box empties at once, and a refusal puts the words back. Without it the box holds the words, shut, until the answer.
16
16
  - `edit` to change something already sent: the same box with Cancel and Save, its keys on the left, and the same selection strip over selected words. Its files can be taken off, and with `upload` and `edit.writesFiles` (the app's save writes them) more added. An app that closes the box as Save is pressed and reopens it on a refusal passes `edit.refused`, which is said under the box as it opens.
17
17
  - `upload` to offer files: the paperclip, `/` → Upload, a pasted picture and a dropped file. The edit box has no paperclip, since it shows only its keys; the other three work there too.
18
- - `under` to show, while something is written, the one card it will be sent with (✕ takes it off) and the live part of each block link, drawn as the app draws them under a sent message. An edit box shows the card and no part.
18
+ - `under` to show, while something is written, the one card it will be sent with and the live part of each block link. They sit inside the box with the files, on the files' fill; the card's ✕ is a file's, on hover, and its values read as words until it is sent. An edit box shows the card and no part.
19
19
  - `closed` where nothing can be written (archived, signed out): a line saying why, in the box's place. No greyed box.
20
20
  - `marked` when the app has its own reason for the bar down the text, besides an urgent mention, which always draws it.
21
21
  - `onEditor` when something outside the box writes into it: the app keeps the editor it is handed and inserts into the box last used.
@@ -28,7 +28,7 @@ The one box every app writes a comment, a reply and a line of a conversation in:
28
28
 
29
29
  <Canvas of={CommentBoxStories.LongDraft} />
30
30
 
31
- <Canvas of={CommentBoxStories.CardUnderTheBox} />
31
+ <Canvas of={CommentBoxStories.WithACard} />
32
32
 
33
33
  ## When not
34
34
 
@@ -84,7 +84,7 @@ It does these by itself. Write none of them around it.
84
84
  | A refusal: the words back, and a line under the box | a toast, or putting text back |
85
85
  | The draft, written as you type and forgotten once sent | an update listener |
86
86
  | Files: picking, pasting, dropping, uploading, failing; Send waits for an upload and holds on a failed file until its ✕ removes it | a file list |
87
- | The card under the box, its ✕, and a ✕ forgotten once the link is taken out; a refused send puts back what ✕ took off | a card state |
87
+ | The card in the box, its ✕, and a ✕ forgotten once the link is taken out; a refused send puts back what ✕ took off | a card state |
88
88
  | A URL pasted over words links them when a message can carry them as a link (one line of plain words, no bracket, no chip, no `)` in the URL); otherwise the URL goes in after the words. The caret goes after the link, so the next Enter sends. Typing after linked words is not linked | a paste handler |
89
89
  | A long draft stops at half the window and scrolls inside the box, in the send box and the edit box | a height or a scroll container |
90
90
  | The bar down the text while an urgent mention is in the box | an urgent check |
@@ -12,6 +12,7 @@ import { Kbd } from './Kbd'
12
12
  import { LinkCard } from './LinkCard'
13
13
  import { ITEM, ready } from './linked.examples'
14
14
  import { PartCard } from './PartCard'
15
+ import { RichText } from './RichText'
15
16
 
16
17
  /**
17
18
  * The one box every app writes in. Every story is live: write, open a list,
@@ -19,7 +20,7 @@ import { PartCard } from './PartCard'
19
20
  * refusal. Pick the theme in the toolbar.
20
21
  */
21
22
  const meta = {
22
- title: 'Primitives/CommentBox',
23
+ title: 'Writing/CommentBox',
23
24
  component: CommentBox,
24
25
  parameters: { layout: 'padded' },
25
26
  decorators: [
@@ -217,7 +218,7 @@ const ITEM_URL = 'https://app.example/item/one'
217
218
  const PART_URL = 'https://app.example/page/two#block'
218
219
 
219
220
  /**
220
- * What the app reads under the box: one item named gets its card; a link to
221
+ * What the app reads for the box: one item named gets its card; a link to
221
222
  * a block of something is its live part, and then no card.
222
223
  */
223
224
  const under: BoxUnder = {
@@ -233,7 +234,8 @@ const under: BoxUnder = {
233
234
  key: 'item-two',
234
235
  view: (
235
236
  <PartCard state="ready" kind="issue" heading="Item two" partKey="ABC-3" href="#part">
236
- <p className="text-body-2 text-text-secondary">The block, as it is now. It changes when the text it came from changes.</p>
237
+ {/* As the apps draw a part's blocks: RichText in its small size. */}
238
+ <RichText blocks={[{ type: 'paragraph', inline: [{ text: 'The block, as it is now. It changes when the text it came from changes.', marks: [] }] }]} size="small" />
237
239
  </PartCard>
238
240
  ),
239
241
  },
@@ -244,11 +246,41 @@ const under: BoxUnder = {
244
246
  },
245
247
  }
246
248
 
247
- /** One item named: its card under the box, with ✕ to take it off. Take the link out and put it back and the card comes back. */
248
- export const CardUnderTheBox: Story = { render: () => <Live under={under} />, play: typeInto(`As in ${ITEM_URL} `) }
249
+ /** One item named: its card in the box, under the text; point at it for the ✕ that takes it off. Take the link out and put it back and the card comes back. */
250
+ export const WithACard: Story = { render: () => <Live under={under} />, play: typeInto(`As in ${ITEM_URL} `) }
249
251
 
250
- /** A link to a block: its live part under the box, and no card. */
251
- export const PartUnderTheBox: Story = { render: () => <Live under={under} />, play: typeInto(`As in ${ITEM_URL} and ${PART_URL} `) }
252
+ /** A file and a card: both in the box, on the same fill, with the same ✕ on hover. */
253
+ export const WithAFileAndACard: Story = {
254
+ render: () => <Live under={under} />,
255
+ play: async (ctx) => {
256
+ await pickAFile(ctx)
257
+ await typeInto(`As in ${ITEM_URL} `)(ctx)
258
+ },
259
+ }
260
+
261
+ /** A link in the box, on words: drawn as a link, the link icon before its words (it read as plain words before). */
262
+ export const WithALink: Story = {
263
+ render: () => (
264
+ <Live
265
+ start={{
266
+ type: 'doc',
267
+ content: [
268
+ {
269
+ type: 'paragraph',
270
+ content: [
271
+ { type: 'text', text: 'The plan is in ' },
272
+ { type: 'text', text: 'the guide', marks: [{ type: 'link', attrs: { href: 'https://example.com/guide' } }] },
273
+ { type: 'text', text: ' for now.' },
274
+ ],
275
+ },
276
+ ],
277
+ }}
278
+ />
279
+ ),
280
+ }
281
+
282
+ /** A link to a block: its live part in the box, and no card. */
283
+ export const WithAPart: Story = { render: () => <Live under={under} />, play: typeInto(`As in ${ITEM_URL} and ${PART_URL} `) }
252
284
 
253
285
  /** Editing: a link the edit adds shows the card Save will add. A part never shows here, since an edit carries none. */
254
286
  export const EditingWithACard: Story = {