@estiva-app/ui 0.90.1 → 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 (235) 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/InlineChip.d.ts +22 -13
  10. package/dist/InlineChip.d.ts.map +1 -1
  11. package/dist/InlineText.d.ts +5 -2
  12. package/dist/InlineText.d.ts.map +1 -1
  13. package/dist/Link.d.ts +3 -2
  14. package/dist/Link.d.ts.map +1 -1
  15. package/dist/LinkCard.d.ts +3 -3
  16. package/dist/LinkCard.d.ts.map +1 -1
  17. package/dist/LinkChip.d.ts.map +1 -1
  18. package/dist/LinkParts.d.ts +17 -3
  19. package/dist/LinkParts.d.ts.map +1 -1
  20. package/dist/LinkPreview.d.ts.map +1 -1
  21. package/dist/LinkRow.d.ts +10 -5
  22. package/dist/LinkRow.d.ts.map +1 -1
  23. package/dist/PartCard.d.ts +7 -3
  24. package/dist/PartCard.d.ts.map +1 -1
  25. package/dist/Popover.d.ts +8 -1
  26. package/dist/Popover.d.ts.map +1 -1
  27. package/dist/ReactionRow.d.ts.map +1 -1
  28. package/dist/RichText.d.ts.map +1 -1
  29. package/dist/SuggestionMenu.d.ts +6 -2
  30. package/dist/SuggestionMenu.d.ts.map +1 -1
  31. package/dist/editor.js +19 -12
  32. package/dist/editor.js.map +3 -3
  33. package/dist/eslint/has-a-page-and-a-story.d.ts.map +1 -1
  34. package/dist/eslint/index.js +1093 -1076
  35. package/dist/eslint/index.js.map +4 -4
  36. package/dist/eslint/no-restyled-part.d.ts +9 -4
  37. package/dist/eslint/no-restyled-part.d.ts.map +1 -1
  38. package/dist/gates/{chunk-BS5JASHV.js → chunk-P2P6AHRY.js} +2 -2
  39. package/dist/gates/{chunk-BS5JASHV.js.map → chunk-P2P6AHRY.js.map} +2 -2
  40. package/dist/gates/cli.js +1 -1
  41. package/dist/gates/gate-config.d.ts +4 -1
  42. package/dist/gates/gate-config.d.ts.map +1 -1
  43. package/dist/gates/hook.d.ts.map +1 -1
  44. package/dist/gates/index.js +2 -2
  45. package/dist/gates/index.js.map +2 -2
  46. package/dist/index.d.ts +2 -2
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +283 -192
  49. package/dist/index.js.map +4 -4
  50. package/dist/linked.d.ts +7 -9
  51. package/dist/linked.d.ts.map +1 -1
  52. package/dist/linked.examples.d.ts.map +1 -1
  53. package/dist/linkedFrom.d.ts.map +1 -1
  54. package/dist/links.d.ts +2 -2
  55. package/dist/links.d.ts.map +1 -1
  56. package/dist/looks.d.ts +24 -0
  57. package/dist/looks.d.ts.map +1 -1
  58. package/dist/registry/{app-X2GI4WTU.js → app-IGBRDD4L.js} +3 -3
  59. package/dist/registry/{build-P6X3PTZP.js → build-MWN4UI23.js} +2 -2
  60. package/dist/registry/{chunk-P55P2QFD.js → chunk-4TWYUIOB.js} +1 -1
  61. package/dist/registry/chunk-4TWYUIOB.js.map +7 -0
  62. package/dist/registry/{chunk-V67F474L.js → chunk-NSHK76XT.js} +2 -2
  63. package/dist/registry/{chunk-4QWD3EBY.js → chunk-THI3SLW5.js} +1 -1
  64. package/dist/registry/{chunk-4QWD3EBY.js.map → chunk-THI3SLW5.js.map} +1 -1
  65. package/dist/registry/cli.js +3 -3
  66. package/dist/registry/find.d.ts +1 -1
  67. package/dist/registry/find.d.ts.map +1 -1
  68. package/dist/registry/index.js +3 -3
  69. package/package.json +1 -1
  70. package/registry.json +511 -457
  71. package/src/AppProvider.stories.tsx +1 -1
  72. package/src/AppShell.stories.tsx +1 -1
  73. package/src/AttachedCard.mdx +55 -0
  74. package/src/{CardUnder.stories.tsx → AttachedCard.stories.tsx} +10 -19
  75. package/src/{CardUnder.test.tsx → AttachedCard.test.tsx} +8 -8
  76. package/src/AttachedCard.tsx +43 -0
  77. package/src/AttachmentCard.stories.tsx +1 -1
  78. package/src/AttachmentCard.tsx +36 -14
  79. package/src/Avatar.stories.tsx +1 -1
  80. package/src/AvatarGroup.stories.tsx +1 -1
  81. package/src/AvatarGroup.tsx +8 -2
  82. package/src/Banner.stories.tsx +1 -1
  83. package/src/BlockHandle.stories.tsx +1 -1
  84. package/src/BlockNodes.stories.tsx +1 -1
  85. package/src/Breadcrumb.stories.tsx +1 -1
  86. package/src/Button.stories.tsx +1 -1
  87. package/src/Card.stories.tsx +1 -1
  88. package/src/Checkbox.stories.tsx +1 -1
  89. package/src/Chip.stories.tsx +1 -1
  90. package/src/ChipInput.stories.tsx +1 -1
  91. package/src/CodeBlockColours.stories.tsx +1 -1
  92. package/src/CollapsibleSection.stories.tsx +1 -1
  93. package/src/CommandPalette.stories.tsx +1 -1
  94. package/src/CommentBox.mdx +3 -3
  95. package/src/CommentBox.stories.tsx +39 -7
  96. package/src/CommentBox.tsx +27 -17
  97. package/src/CommentHighlights.stories.tsx +1 -1
  98. package/src/ComposerTriggers.stories.tsx +1 -1
  99. package/src/ConfirmDialog.stories.tsx +1 -1
  100. package/src/ContainerHeader.stories.tsx +1 -1
  101. package/src/DialogShell.stories.tsx +1 -1
  102. package/src/Divider.stories.tsx +1 -1
  103. package/src/DocumentEditor.stories.tsx +1 -1
  104. package/src/EditableText.stories.tsx +1 -1
  105. package/src/EditorBlockHandle.stories.tsx +1 -1
  106. package/src/EditorTableControls.stories.tsx +1 -1
  107. package/src/EmptyState.stories.tsx +1 -1
  108. package/src/EntryShell.mdx +1 -1
  109. package/src/EntryShell.stories.tsx +1 -1
  110. package/src/ErrorBoundary.stories.tsx +1 -1
  111. package/src/Field.stories.tsx +1 -1
  112. package/src/FieldLine.stories.tsx +1 -1
  113. package/src/FilePicker.stories.tsx +1 -1
  114. package/src/Form.stories.tsx +1 -1
  115. package/src/IconButton.stories.tsx +1 -1
  116. package/src/IdentityMenu.stories.tsx +1 -1
  117. package/src/InlineChip.mdx +4 -2
  118. package/src/InlineChip.stories.tsx +1 -1
  119. package/src/InlineChip.test.tsx +3 -2
  120. package/src/InlineChip.tsx +24 -14
  121. package/src/InlineText.mdx +1 -0
  122. package/src/InlineText.stories.tsx +6 -3
  123. package/src/InlineText.tsx +7 -2
  124. package/src/Kbd.stories.tsx +1 -1
  125. package/src/KindIcon.stories.tsx +1 -1
  126. package/src/Lightbox.stories.tsx +1 -1
  127. package/src/Link.mdx +3 -2
  128. package/src/Link.stories.tsx +1 -1
  129. package/src/Link.test.tsx +5 -3
  130. package/src/Link.tsx +5 -3
  131. package/src/LinkCard.mdx +5 -4
  132. package/src/LinkCard.stories.tsx +1 -1
  133. package/src/LinkCard.test.tsx +1 -1
  134. package/src/LinkCard.tsx +80 -57
  135. package/src/LinkChip.mdx +3 -3
  136. package/src/LinkChip.stories.tsx +1 -1
  137. package/src/LinkChip.test.tsx +1 -1
  138. package/src/LinkChip.tsx +16 -3
  139. package/src/LinkChips.stories.tsx +1 -1
  140. package/src/LinkParts.stories.tsx +1 -1
  141. package/src/LinkParts.tsx +40 -8
  142. package/src/LinkPlaces.stories.tsx +1 -1
  143. package/src/LinkPreview.mdx +1 -1
  144. package/src/LinkPreview.stories.tsx +1 -1
  145. package/src/LinkPreview.tsx +3 -1
  146. package/src/LinkRow.mdx +8 -6
  147. package/src/LinkRow.stories.tsx +3 -3
  148. package/src/LinkRow.test.tsx +3 -3
  149. package/src/LinkRow.tsx +71 -40
  150. package/src/ListColumn.stories.tsx +1 -1
  151. package/src/MembersDialog.stories.tsx +1 -1
  152. package/src/MembersPill.stories.tsx +1 -1
  153. package/src/Menu.stories.tsx +1 -1
  154. package/src/MenuItem.stories.tsx +1 -1
  155. package/src/NavItem.stories.tsx +1 -1
  156. package/src/NavTree.stories.tsx +1 -1
  157. package/src/Panel.stories.tsx +1 -1
  158. package/src/PartCard.mdx +4 -4
  159. package/src/PartCard.stories.tsx +11 -8
  160. package/src/PartCard.test.tsx +5 -3
  161. package/src/PartCard.tsx +33 -24
  162. package/src/PastedImages.stories.tsx +1 -1
  163. package/src/PastedMarkdown.stories.tsx +1 -1
  164. package/src/Person.stories.tsx +1 -1
  165. package/src/PersonTrigger.stories.tsx +1 -1
  166. package/src/Popover.stories.tsx +1 -1
  167. package/src/Popover.tsx +6 -2
  168. package/src/PreviewCard.stories.tsx +1 -1
  169. package/src/ProgressBar.stories.tsx +1 -1
  170. package/src/Property.stories.tsx +1 -1
  171. package/src/Rail.stories.tsx +1 -1
  172. package/src/RailItem.stories.tsx +1 -1
  173. package/src/Reaction.stories.tsx +1 -1
  174. package/src/ReactionPicker.stories.tsx +1 -1
  175. package/src/ReactionRow.stories.tsx +1 -1
  176. package/src/ReactionRow.tsx +3 -1
  177. package/src/ReferenceCards.mdx +3 -0
  178. package/src/ReferenceCards.stories.tsx +3 -1
  179. package/src/ReferenceMenu.mdx +1 -1
  180. package/src/ReferenceMenu.stories.tsx +1 -1
  181. package/src/RichText.stories.tsx +1 -1
  182. package/src/RichText.tsx +6 -2
  183. package/src/ScrollArea.stories.tsx +1 -1
  184. package/src/SearchInput.stories.tsx +1 -1
  185. package/src/SectionHeader.stories.tsx +1 -1
  186. package/src/SectionLabel.stories.tsx +1 -1
  187. package/src/Select.stories.tsx +1 -1
  188. package/src/SelectionToolbar.stories.tsx +1 -1
  189. package/src/ShowMore.stories.tsx +1 -1
  190. package/src/Sidebar.stories.tsx +1 -1
  191. package/src/Skeleton.stories.tsx +1 -1
  192. package/src/SuggestionMenu.mdx +4 -1
  193. package/src/SuggestionMenu.stories.tsx +14 -8
  194. package/src/SuggestionMenu.tsx +20 -3
  195. package/src/Tabs.stories.tsx +1 -1
  196. package/src/TextInput.stories.tsx +1 -1
  197. package/src/Textarea.stories.tsx +1 -1
  198. package/src/Toast.stories.tsx +1 -1
  199. package/src/Toolbar.stories.tsx +1 -1
  200. package/src/Tooltip.stories.tsx +1 -1
  201. package/src/Tooltip.test.tsx +5 -4
  202. package/src/Tooltip.tsx +1 -1
  203. package/src/TopBar.stories.tsx +1 -1
  204. package/src/UnreadDot.stories.tsx +1 -1
  205. package/src/eslint/has-a-page-and-a-story.test.ts +5 -0
  206. package/src/eslint/has-a-page-and-a-story.ts +11 -2
  207. package/src/eslint/no-restyled-part.test.ts +32 -8
  208. package/src/eslint/no-restyled-part.ts +50 -23
  209. package/src/gates/gate-config.ts +5 -2
  210. package/src/gates/gates.test.ts +20 -2
  211. package/src/gates/hook.ts +4 -3
  212. package/src/index.ts +2 -1
  213. package/src/linked.examples.ts +2 -3
  214. package/src/linked.ts +11 -1
  215. package/src/linkedFrom.ts +1 -0
  216. package/src/links.ts +3 -2
  217. package/src/looks.ts +29 -0
  218. package/src/registry/build.ts +1 -1
  219. package/src/registry/contract.test.ts +1 -1
  220. package/src/registry/find.ts +1 -1
  221. package/src/registry/registry.test.ts +12 -12
  222. package/src/suggestionPopup.tsx +1 -1
  223. package/stories/Choosing.mdx +2 -2
  224. package/stories/DesignTokens.mdx +1 -1
  225. package/stories/GettingStarted.mdx +2 -2
  226. package/stories/Introduction.mdx +23 -4
  227. package/stories/TokensPage.tsx +12 -7
  228. package/dist/CardUnder.d.ts +0 -31
  229. package/dist/CardUnder.d.ts.map +0 -1
  230. package/dist/registry/chunk-P55P2QFD.js.map +0 -7
  231. package/src/CardUnder.mdx +0 -54
  232. package/src/CardUnder.tsx +0 -49
  233. /package/dist/registry/{app-X2GI4WTU.js.map → app-IGBRDD4L.js.map} +0 -0
  234. /package/dist/registry/{build-P6X3PTZP.js.map → build-MWN4UI23.js.map} +0 -0
  235. /package/dist/registry/{chunk-V67F474L.js.map → chunk-NSHK76XT.js.map} +0 -0
@@ -14,7 +14,7 @@ import { richTextClassName } from './RichText'
14
14
  * row and card are the app's.
15
15
  */
16
16
  const meta = {
17
- title: 'Primitives/ReferenceMenu',
17
+ title: 'Writing/ReferenceMenu',
18
18
  parameters: { layout: 'padded' },
19
19
  } satisfies Meta
20
20
 
@@ -29,7 +29,7 @@ const EVERY_BLOCK: RichTextBlock[] = [
29
29
  ]
30
30
 
31
31
  const meta = {
32
- title: 'Components/RichText',
32
+ title: 'Writing/RichText',
33
33
  component: RichText,
34
34
  args: { blocks: EVERY_BLOCK, size: 'default' },
35
35
  argTypes: { size: { control: 'inline-radio', options: ['default', 'small'] } },
package/src/RichText.tsx CHANGED
@@ -171,7 +171,9 @@ function textWithLinks(text: string, renderText: (text: string) => ReactNode): R
171
171
  if (written) {
172
172
  return (
173
173
  <span key={i} className="break-words">
174
- <Link href={written[2]} external onClick={keepToLink}>{written[1]}</Link>
174
+ <Link href={written[2]} external onClick={keepToLink}>
175
+ {written[1]}
176
+ </Link>
175
177
  </span>
176
178
  )
177
179
  }
@@ -180,7 +182,9 @@ function textWithLinks(text: string, renderText: (text: string) => ReactNode): R
180
182
  return (
181
183
  // An address has no spaces to wrap at, so it may break anywhere.
182
184
  <span key={i} className="break-all">
183
- <Link href={bare[1]} external onClick={keepToLink}>{bare[1]}</Link>
185
+ <Link href={bare[1]} external onClick={keepToLink}>
186
+ {bare[1]}
187
+ </Link>
184
188
  {bare[2]}
185
189
  </span>
186
190
  )
@@ -4,7 +4,7 @@ import { ScrollArea } from './ScrollArea'
4
4
 
5
5
  /** A region that scrolls without taking width for its scrollbar. */
6
6
  const meta = {
7
- title: 'Layout/ScrollArea',
7
+ title: 'Page structure/ScrollArea',
8
8
  component: ScrollArea,
9
9
  parameters: { controls: { disable: true } },
10
10
  args: { children: null },
@@ -3,7 +3,7 @@ import { SearchInput } from './SearchInput'
3
3
 
4
4
  /** An inset field whose border strengthens on focus; under Signal the shortcut becomes the mono kbd chip. */
5
5
  const meta = {
6
- title: 'Inputs/SearchInput',
6
+ title: 'Forms & fields/SearchInput',
7
7
  component: SearchInput,
8
8
  decorators: [(Story) => <div className="w-[290px]"><Story /></div>],
9
9
  } satisfies Meta<typeof SearchInput>
@@ -6,7 +6,7 @@ import { SectionHeader } from './SectionHeader'
6
6
 
7
7
  /** The 32px row a section starts with. Hover it: the row fills, and its actions appear. A section that folds is CollapsibleSection, whose header this is. */
8
8
  const meta = {
9
- title: 'Navigation/SectionHeader',
9
+ title: 'Page structure/SectionHeader',
10
10
  component: SectionHeader,
11
11
  decorators: [(Story) => <div className="w-[280px]"><Story /></div>],
12
12
  args: { title: 'Section', showActions: 'hover' },
@@ -4,7 +4,7 @@ import { SectionLabel } from './SectionLabel'
4
4
 
5
5
  /** Every section title renders through this span — a style change is one edit. Under Signal it becomes the mono uppercase micro-label. */
6
6
  const meta = {
7
- title: 'Primitives/SectionLabel',
7
+ title: 'Page structure/SectionLabel',
8
8
  component: SectionLabel,
9
9
  args: { children: 'Starred' },
10
10
  } satisfies Meta<typeof SectionLabel>
@@ -17,7 +17,7 @@ import { TextInput } from './TextInput'
17
17
  * you stop using one.
18
18
  */
19
19
  const meta = {
20
- title: 'Inputs/Select',
20
+ title: 'Forms & fields/Select',
21
21
  component: Select,
22
22
  parameters: { layout: 'padded' },
23
23
  decorators: [(Story) => <div className="w-[360px]"><Story /></div>],
@@ -9,7 +9,7 @@ import { KeptSelection, SelectionToolbar, type MarkId } from './SelectionToolbar
9
9
  * text you have already selected. It follows the selection by itself.
10
10
  */
11
11
  const meta = {
12
- title: 'Primitives/SelectionToolbar',
12
+ title: 'Writing/SelectionToolbar',
13
13
  component: SelectionToolbar,
14
14
  parameters: { layout: 'padded' },
15
15
  } satisfies Meta
@@ -11,7 +11,7 @@ const LONG = Array.from(
11
11
 
12
12
  /** Long content cut behind a fade, with "Show more" under it. Short content is drawn whole. */
13
13
  const meta = {
14
- title: 'Layout/ShowMore',
14
+ title: 'Page structure/ShowMore',
15
15
  component: ShowMore,
16
16
  decorators: [(Story) => <div className="w-[320px]"><Story /></div>],
17
17
  args: { children: <p className="text-caption text-text-secondary">{LONG}</p> },
@@ -8,7 +8,7 @@ import { Sidebar } from './Sidebar'
8
8
  const placeholder = <IconSquareRounded size={16} stroke={1.5} />
9
9
 
10
10
  const meta = {
11
- title: 'Frame/Sidebar',
11
+ title: 'App frame/Sidebar',
12
12
  component: Sidebar,
13
13
  parameters: { layout: 'fullscreen' },
14
14
  args: { children: null },
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite'
2
2
  import { SkeletonBar, SkeletonList, SkeletonRow } from './Skeleton'
3
3
 
4
4
  const meta = {
5
- title: 'Feedback/Skeleton',
5
+ title: 'Status & feedback/Skeleton',
6
6
  component: SkeletonList,
7
7
  } satisfies Meta<typeof SkeletonList>
8
8
 
@@ -72,6 +72,9 @@ Suggestion<Command>({
72
72
  Escape: the first press closes the list, the second is somebody's own.
73
73
  - **Outside an editor**, draw `SuggestionMenu` itself with a `rect` to hang from,
74
74
  and call `handle.current.onKeyDown(event)` from wherever the keys arrive.
75
+ Give `rect` as a function that says where the caret is now, as Tiptap's
76
+ `clientRect` does, and the list follows the caret when the page scrolls; a
77
+ rect alone is where the caret was, and the list stays there.
75
78
 
76
79
  <Canvas of={SuggestionMenuStories.InAnEditor} />
77
80
 
@@ -83,7 +86,7 @@ It does these by itself. Write none of them around it.
83
86
  |---|---|---|
84
87
  | Moves through its items with the arrow keys, and wraps at the ends | an arrow-key handler | ✓ |
85
88
  | Says what it is to assistive technology: a listbox of options, and the editor pointing at the active one | `role="listbox"`, `role="option"`, `aria-activedescendant` | ✓ |
86
- | Hangs from the caret: above it, below when there is no room, never off the window | position arithmetic | |
89
+ | Hangs from the caret: above it, below when there is no room, never off the window, and follows it when the page scrolls | position arithmetic, a scroll listener | |
87
90
  | Scrolls the highlighted row into view, and back to the first row when the list changes | `scrollIntoView` | |
88
91
  | Chooses on a press without taking focus from the text | `preventDefault` on each row | |
89
92
 
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite'
2
2
  import { IconSquareRounded } from '@tabler/icons-react'
3
- import { useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react'
3
+ import { useCallback, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react'
4
4
  import { Extension } from '@tiptap/core'
5
5
  import { EditorContent, useEditor } from '@tiptap/react'
6
6
  import StarterKit from '@tiptap/starter-kit'
@@ -15,9 +15,14 @@ import { suggestionPopup } from './suggestionPopup'
15
15
  * Focus stays in the text: the editor hands its ↑, ↓ and Enter to the list.
16
16
  */
17
17
  const meta = {
18
- title: 'Primitives/SuggestionMenu',
18
+ title: 'Writing/SuggestionMenu',
19
19
  component: SuggestionMenu,
20
- parameters: { layout: 'padded' },
20
+ parameters: {
21
+ layout: 'padded',
22
+ // Each example in a frame of its own on the Docs page, so its list stays in its box. Drawn on the page itself, a
23
+ // list near the top of the window flipped below its caret as the page scrolled, over the words (Katerina, 29 Oct).
24
+ docs: { story: { inline: false, height: '560px' } },
25
+ },
21
26
  } satisfies Meta
22
27
 
23
28
  export default meta
@@ -46,13 +51,14 @@ const commandRow = (c: Command): SuggestionMenuRow => ({ label: c.label, shortcu
46
51
 
47
52
  /**
48
53
  * A line of text with the caret's place marked, and the list hung from it —
49
- * the way the editor hangs it. The list is drawn from a rect, so the story
50
- * measures a stand-in for the caret once it is on screen.
54
+ * the way the editor hangs it: from where a stand-in for the caret is now,
55
+ * asked again each time the list is placed, as Tiptap's `clientRect` is.
51
56
  */
52
57
  function AtACaret<T>({ children, ...props }: { children?: ReactNode } & Omit<Parameters<typeof SuggestionMenu<T>>[0], 'rect'>) {
53
58
  const caret = useRef<HTMLSpanElement>(null)
54
- const [rect, setRect] = useState<DOMRect | null>(null)
55
- useLayoutEffect(() => setRect(caret.current?.getBoundingClientRect() ?? null), [])
59
+ const [drawn, setDrawn] = useState(false)
60
+ useLayoutEffect(() => setDrawn(true), [])
61
+ const where = useCallback(() => caret.current?.getBoundingClientRect() ?? null, [])
56
62
  return (
57
63
  <div className="flex h-[520px] items-end pb-6 text-body-2 text-text-primary">
58
64
  <p>
@@ -60,7 +66,7 @@ function AtACaret<T>({ children, ...props }: { children?: ReactNode } & Omit<Par
60
66
  <span ref={caret}>/</span>
61
67
  {children}
62
68
  </p>
63
- <SuggestionMenu<T> {...props} rect={rect} />
69
+ <SuggestionMenu<T> {...props} rect={drawn ? where : null} />
64
70
  </div>
65
71
  )
66
72
  }
@@ -60,8 +60,12 @@ export interface SuggestionMenuHandle {
60
60
  }
61
61
 
62
62
  export interface SuggestionMenuProps<T> {
63
- /** The caret's rect, from the editor. `null` closes the box. */
64
- rect: DOMRect | null
63
+ /**
64
+ * Where the caret is, from the editor: Tiptap's `clientRect`, asked again each
65
+ * time the box is placed, so it follows the caret as the page scrolls. A rect
66
+ * is where the caret was, and stays there. `null` closes the box.
67
+ */
68
+ rect: (() => DOMRect | null) | DOMRect | null
65
69
  /** The editor's own element — told which row is active. Absent in a story. */
66
70
  editorElement?: HTMLElement | null
67
71
  /** Names the list — "Commands", "People". */
@@ -80,6 +84,19 @@ export interface SuggestionMenuProps<T> {
80
84
  }
81
85
 
82
86
  export function SuggestionMenu<T>({ rect, editorElement, ariaLabel, width, maxHeight, sections, itemKey, row, onSelect, handle }: SuggestionMenuProps<T>) {
87
+ // The caret where it is now, and the editor it sits in, whose scrolling moves it. Given only the rect it had as the
88
+ // list opened, the list stayed on the screen while the text scrolled away under it (Katerina, 29 Oct).
89
+ const last = useRef<DOMRect | null>(null)
90
+ const anchor = useMemo(() => {
91
+ if (typeof rect !== 'function') return rect
92
+ return {
93
+ getBoundingClientRect: () => {
94
+ last.current = rect() ?? last.current
95
+ return last.current ?? new DOMRect()
96
+ },
97
+ contextElement: editorElement ?? undefined,
98
+ }
99
+ }, [rect, editorElement])
83
100
  const shown = useMemo(() => sections.filter((section) => section.items.length > 0), [sections])
84
101
  const items = useMemo(() => shown.flatMap((section) => section.items), [shown])
85
102
  const keys = items.map(itemKey).join('\n')
@@ -190,7 +207,7 @@ export function SuggestionMenu<T>({ rect, editorElement, ariaLabel, width, maxHe
190
207
 
191
208
  return (
192
209
  // finalFocus={false}: focus never left the text, and a list that closes because focus moved elsewhere must not pull it back (71a4577b).
193
- <Popover anchor={rect} open={rect !== null} side="top" align="left" className={width} maxHeight={maxHeight} ariaLabel={ariaLabel} finalFocus={false}>
210
+ <Popover anchor={anchor} open={rect !== null} side="top" align="left" className={width} maxHeight={maxHeight} ariaLabel={ariaLabel} finalFocus={false}>
194
211
  {/* The list the editor drives from its caret: a listbox, because Base UI's lists need a text field of their own.
195
212
  `gap-0.5`: 2px between rows, as a menu's — a section with a heading
196
213
  had them from `MenuSection`, and rows without one touched. */}
@@ -5,7 +5,7 @@ import { Tabs, type TabDef } from './Tabs'
5
5
 
6
6
  /** A row of tabs; the selected one is a neutral fill, never the accent tint. */
7
7
  const meta = {
8
- title: 'Navigation/Tabs',
8
+ title: 'Page structure/Tabs',
9
9
  component: Tabs,
10
10
  } satisfies Meta<typeof Tabs>
11
11
 
@@ -4,7 +4,7 @@ import { Select } from './Select'
4
4
  import { TextInput } from './TextInput'
5
5
 
6
6
  const meta = {
7
- title: 'Inputs/TextInput',
7
+ title: 'Forms & fields/TextInput',
8
8
  component: TextInput,
9
9
  parameters: { layout: 'padded' },
10
10
  args: { placeholder: 'What is this about?' },
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite'
2
2
  import { Textarea } from './Textarea'
3
3
 
4
4
  const meta = {
5
- title: 'Inputs/Textarea',
5
+ title: 'Forms & fields/Textarea',
6
6
  component: Textarea,
7
7
  parameters: { layout: 'padded' },
8
8
  args: { placeholder: 'Summarise the outcome or decision…', className: 'h-[109px]' },
@@ -4,7 +4,7 @@ import { Toast, ToastProvider, useToast } from './Toast'
4
4
 
5
5
  /** The pill that confirms something happened. Positioning and auto-dismiss live in ToastProvider. */
6
6
  const meta = {
7
- title: 'Feedback/Toast',
7
+ title: 'Status & feedback/Toast',
8
8
  component: Toast,
9
9
  args: {
10
10
  label: 'Changes saved',
@@ -14,7 +14,7 @@ import { Toolbar, ToolbarButton, ToolbarInput, ToolbarLink, ToolbarSeparator } f
14
14
  * it without the caller drawing anything.
15
15
  */
16
16
  const meta = {
17
- title: 'Primitives/Toolbar',
17
+ title: 'Buttons & links/Toolbar',
18
18
  component: Toolbar,
19
19
  args: { 'aria-label': 'Formatting', children: null },
20
20
  argTypes: { children: { control: false } },
@@ -6,7 +6,7 @@ import { Tooltip, WithTooltip } from './Tooltip'
6
6
  import { Toolbar, ToolbarButton } from './Toolbar'
7
7
 
8
8
  const meta = {
9
- title: 'Primitives/Tooltip',
9
+ title: 'Menus & windows/Tooltip',
10
10
  component: Tooltip,
11
11
  args: { label: 'Add to starred' },
12
12
  } satisfies Meta<typeof Tooltip>
@@ -78,9 +78,10 @@ describe('WithTooltip', () => {
78
78
  expect(errors).toEqual([])
79
79
  })
80
80
 
81
- // F1: without `align-top` a chip in the wrapper drops 0.2px and its line grows
82
- // from 19.6 to 20px; the apps may not add the class to the part, so it carries it.
83
- it('inline: the wrapper sits at the top of the line by itself', () => {
81
+ // F1 pinned the wrapper to the line's top, as the chip was then. Since PEE-72 the
82
+ // chip sits on the sentence's baseline, and `align-top` put a chip in this wrapper
83
+ // 1px high in a 21px line; the apps may not add the class to the part, so it carries it.
84
+ it('inline: the wrapper sits on the line’s baseline by itself', () => {
84
85
  render(
85
86
  <p>
86
87
  <WithTooltip inline label="Item one">
@@ -88,7 +89,7 @@ describe('WithTooltip', () => {
88
89
  </WithTooltip>
89
90
  </p>,
90
91
  )
91
- expect(screen.getByText('Item one').parentElement?.className.split(' ')).toContain('align-top')
92
+ expect(screen.getByText('Item one').parentElement?.className.split(' ')).toContain('align-baseline')
92
93
  })
93
94
 
94
95
  it('a block wrapper is not moved', () => {
package/src/Tooltip.tsx CHANGED
@@ -172,7 +172,7 @@ export function WithTooltip({ label, shortcut, placement = 'top', wrapperClassNa
172
172
  can carry the handlers for all of them. A control that IS the trigger
173
173
  (Button, IconButton) composes the part onto itself instead, which is
174
174
  what lets a `Dialog.Close` or a `Menu.Trigger` be one of those. */}
175
- <BaseTooltip.Trigger delay={OPEN_DELAY} render={<Wrapper className={cn('inline-flex shrink-0', inline && 'align-top', wrapperClassName)} />}>
175
+ <BaseTooltip.Trigger delay={OPEN_DELAY} render={<Wrapper className={cn('inline-flex shrink-0', inline && 'align-baseline', wrapperClassName)} />}>
176
176
  {children}
177
177
  </BaseTooltip.Trigger>
178
178
  <TooltipSurface label={label} shortcut={shortcut} placement={placement} />
@@ -11,7 +11,7 @@ import { TopBar } from './TopBar'
11
11
  * over it — no border, no background, clicks passing through.
12
12
  */
13
13
  const meta = {
14
- title: 'Frame/TopBar',
14
+ title: 'App frame/TopBar',
15
15
  component: TopBar,
16
16
  parameters: {
17
17
  layout: 'fullscreen',
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-vite'
2
2
  import { UnreadDot } from './UnreadDot'
3
3
 
4
4
  const meta = {
5
- title: 'Primitives/UnreadDot',
5
+ title: 'Status & feedback/UnreadDot',
6
6
  component: UnreadDot,
7
7
  } satisfies Meta<typeof UnreadDot>
8
8
 
@@ -16,6 +16,8 @@ const tester = new RuleTester({
16
16
 
17
17
  /** Real files of this package, so the rules are tested against what they read. */
18
18
  const src = (name: string) => fileURLToPath(new URL(`../${name}`, import.meta.url))
19
+ /** The package's root `stories/`: Storybook's pages and a prototype's helpers, which the gate reads too. */
20
+ const stories = (name: string) => fileURLToPath(new URL(`../../stories/${name}`, import.meta.url))
19
21
  const code = 'export function Probe() {\n return null\n}\n'
20
22
  const escaped = '// @estiva-escape(component-has-a-page, component-has-a-story): a probe file that documents itself in its own page\nexport function Probe() {\n return null\n}\n'
21
23
 
@@ -39,6 +41,8 @@ tester.run('component-has-a-page', componentHasAPage, {
39
41
  { name: 'a test file', code, filename: src('Button.test.tsx') },
40
42
  { name: 'a file that is not a component file at all', code, filename: src('index.ts') },
41
43
  { name: 'a component with its reason at the top', code: escaped, filename: src('NoPageProbe.tsx') },
44
+ { name: "a helper in the root stories/, which is not a part (the One conversation prototype's Conversation.tsx)", code, filename: stories('one-conversation/Conversation.tsx') },
45
+ { name: 'a page of the root stories/ drawn in a .tsx', code, filename: stories('TokensPage.tsx') },
42
46
  ],
43
47
  invalid: [
44
48
  { name: 'a component with no page', code, filename: src('NoPageProbe.tsx'), errors: [{ messageId: 'missing' }] },
@@ -50,6 +54,7 @@ tester.run('component-has-a-story', componentHasAStory, {
50
54
  { name: 'a component with its story beside it', code, filename: src('Button.tsx') },
51
55
  { name: 'a story file, which is not itself a component', code, filename: src('Button.stories.tsx') },
52
56
  { name: 'a component with its reason at the top', code: escaped, filename: src('NoStoryProbe.tsx') },
57
+ { name: "a helper in the root stories/, which is not a part (the One conversation prototype's Places.tsx)", code, filename: stories('one-conversation/Places.tsx') },
53
58
  ],
54
59
  invalid: [
55
60
  { name: 'a component with no story', code, filename: src('NoStoryProbe.tsx'), errors: [{ messageId: 'missing' }] },
@@ -1,6 +1,8 @@
1
1
  import { existsSync } from 'node:fs'
2
+ import { relative, sep } from 'node:path'
2
3
  import type { Rule } from 'eslint'
3
4
  import { ESCAPE_MESSAGES, isEscaped } from './escape'
5
+ import { packageDirOf } from './no-restyled-part'
4
6
 
5
7
  /**
6
8
  * A component of the package with no page, and one with no story (UIG-5, P2 and
@@ -21,6 +23,11 @@ import { ESCAPE_MESSAGES, isEscaped } from './escape'
21
23
  * page and its story, never the other way round, so a page without a component
22
24
  * is not this rule's business.
23
25
  *
26
+ * Only the package's `src/` holds its components. The gate reads `stories/` too
27
+ * (a prototype there is what a build is checked against), but what lives there
28
+ * is Storybook's own pages and the helpers its stories draw with, not parts,
29
+ * so neither rule asks them for a page.
30
+ *
24
31
  * A file that stays without one says why at its top: `// @estiva-escape: <why>`.
25
32
  */
26
33
  interface ProgramNode {
@@ -29,9 +36,11 @@ interface ProgramNode {
29
36
  range: [number, number]
30
37
  }
31
38
 
32
- /** A component file: a `.tsx` in the package's source that is not a story or a test. */
39
+ /** A component file: a `.tsx` in the package's `src/` that is not a story or a test. */
33
40
  function componentFile(filename: string): boolean {
34
- return filename.endsWith('.tsx') && !/\.(stories|test)\.tsx$/.test(filename)
41
+ if (!filename.endsWith('.tsx') || /\.(stories|test)\.tsx$/.test(filename)) return false
42
+ const dir = packageDirOf(filename)
43
+ return !dir || relative(dir, filename).split(sep).join('/').startsWith('src/')
35
44
  }
36
45
 
37
46
  function sibling(filename: string, extension: string): string {
@@ -39,13 +39,18 @@ write(
39
39
  "import { Card, cn } from '@estiva-app/ui'\nexport function ConversationCard({ className, title }: { className?: string; title: string }) {\n return <Card className={cn('relative', className)}>{title}</Card>\n}\n",
40
40
  )
41
41
  write('app/src/components/Button.tsx', 'export function Button() {\n return null\n}\n')
42
- write('pkg/package.json', '{ "name": "@estiva-app/ui" }')
42
+ write('pkg/package.json', '{ "name": "@estiva-app/ui", "exports": { ".": { "default": "./dist/index.js" }, "./editor": { "default": "./dist/editor.js" }, "./tokens.css": "./tokens.css" } }')
43
43
  write('pkg/src/index.ts', "export { Link, type LinkProps } from './Link'\nexport { Card } from './Card'\nexport { cn } from './cn'\n")
44
44
  write('pkg/src/Link.tsx', 'export function Link() {\n return null\n}\n')
45
45
  write('pkg/src/cn.ts', 'export const cn = (...a: string[]) => a.join(" ")\n')
46
+ // The second entry, `@estiva-app/ui/editor`, where CommentBox lives.
47
+ write('pkg/src/editor.ts', "export { CommentBox, type CommentBoxProps } from './CommentBox'\n")
48
+ write('pkg/src/CommentBox.tsx', 'export function CommentBox() {\n return null\n}\n')
46
49
 
47
50
  const app = join(root, 'app/src/Probe.tsx')
48
51
  const pkg = join(root, 'pkg/src/Card.tsx')
52
+ /** A prototype's helper in the package's root `stories/`, which the gate reads since 28 October. */
53
+ const pkgStory = join(root, 'pkg/stories/one-conversation/Conversation.tsx')
49
54
  const ui = (imports: string, body: string) => `import { ${imports} } from '@estiva-app/ui'\nexport function Probe() {\n return (\n${body}\n )\n}\n`
50
55
  const local = (imports: string, from: string, body: string) => `import { ${imports} } from '${from}'\nexport function Probe() {\n return (\n${body}\n )\n}\n`
51
56
  const USE_VARIANT_OR_SIZE = ' Use its `variant` or `size`.'
@@ -235,6 +240,20 @@ tester.run('no-restyled-part', noRestyledPart, {
235
240
  code: local('Link', './Link', ' <Link href="/x" className="rounded-lg border">x</Link>'),
236
241
  errors: [{ message: restyled('`rounded-lg` `border`', '`Link`', ' Use its `variant`, `truncate` or `cover`.') }],
237
242
  },
243
+ {
244
+ name: 'in an app: a part from the editor entry, restyled',
245
+ filename: app,
246
+ code: "import { CommentBox } from '@estiva-app/ui/editor'\nexport function Probe() {\n return <CommentBox className=\"border-l-4 pl-2\" />\n}\n",
247
+ errors: [{ message: restyled('`border-l-4`', '`CommentBox`', noProp('CommentBox')) }],
248
+ },
249
+ {
250
+ // The One conversation prototype (estiva-ui concept/one-conversation 8641081, Conversation.tsx:199),
251
+ // which passed because only src/index.ts was read for the package's parts.
252
+ name: "inside the package: the editor entry's CommentBox restyled from a prototype in stories/, behind a condition",
253
+ filename: pkgStory,
254
+ code: "import { CommentBox } from '../../src/CommentBox'\nimport { cn } from '../../src/cn'\nexport function Probe({ on }: { on: boolean }) {\n return <CommentBox className={cn(on && '[&_[data-composer-editor]]:border-l-4 [&_[data-composer-editor]]:border-success-default [&_[data-composer-editor]]:pl-2')} />\n}\n",
255
+ errors: [{ message: restyled('`[&_[data-composer-editor]]:border-l-4` `[&_[data-composer-editor]]:border-success-default` `[&_[data-composer-editor]]:pl-2`', '`CommentBox`', noProp('CommentBox')) }],
256
+ },
238
257
  {
239
258
  name: 'inside the package: a part used in the file that declares it',
240
259
  filename: pkg,
@@ -244,25 +263,30 @@ tester.run('no-restyled-part', noRestyledPart, {
244
263
  ],
245
264
  })
246
265
 
247
- /** Every part the package exports, from its own index.ts. */
266
+ /** Every part an entry of the package exports, from its own source: `index.ts`, and `editor.ts` for `@estiva-app/ui/editor`. */
248
267
  const SRC = new URL('..', import.meta.url)
249
- const indexSource = readFileSync(new URL('index.ts', SRC), 'utf8')
250
- const PARTS = [...indexSource.matchAll(/export \{([^}]*)\} from '\.\/[^']+'/g)]
251
- .flatMap((m) => m[1].split(','))
252
- .map((name) => name.trim())
253
- .filter((name) => /^[A-Z][a-z]/.test(name))
268
+ const partsOf = (entry: string) =>
269
+ [...readFileSync(new URL(entry, SRC), 'utf8').matchAll(/export \{([^}]*)\} from '\.\/[^']+'/g)]
270
+ .flatMap((m) => m[1].split(','))
271
+ .map((name) => name.trim())
272
+ .filter((name) => /^[A-Z][a-z]/.test(name))
273
+ const MAIN_PARTS = partsOf('index.ts')
274
+ const EDITOR_PARTS = partsOf('editor.ts').filter((name) => !MAIN_PARTS.includes(name))
275
+ const PARTS = [...MAIN_PARTS, ...EDITOR_PARTS]
276
+ const entryOf = (part: string) => (EDITOR_PARTS.includes(part) ? '@estiva-app/ui/editor' : '@estiva-app/ui')
254
277
 
255
278
  describe('every part of the package is covered, by where it comes from', () => {
256
279
  it('finds the parts', () => {
257
280
  expect(PARTS.length).toBeGreaterThan(70)
258
281
  expect(PARTS).toContain('EnterHint')
282
+ expect(EDITOR_PARTS).toContain('CommentBox')
259
283
  })
260
284
  tester.run('no-restyled-part, one case per exported part', noRestyledPart, {
261
285
  valid: [],
262
286
  invalid: PARTS.map((part) => ({
263
287
  name: `${part}, restyled`,
264
288
  filename: app,
265
- code: ui(part, ` <${part} className="bg-bg-surface" />`),
289
+ code: `import { ${part} } from '${entryOf(part)}'\nexport function Probe() {\n return (\n <${part} className="bg-bg-surface" />\n )\n}\n`,
266
290
  errors: [{ message: restyled('`bg-bg-surface`', `\`${part}\``, PART_LOOK_PROPS[part] ? ` Use its ${PART_LOOK_PROPS[part].length === 1 ? `\`${PART_LOOK_PROPS[part][0]}\`` : `${PART_LOOK_PROPS[part].slice(0, -1).map((p) => `\`${p}\``).join(', ')} or \`${PART_LOOK_PROPS[part].at(-1)}\``}.` : noProp(part)) }],
267
291
  })),
268
292
  })