@estiva-app/ui 0.30.0 → 0.32.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 (37) hide show
  1. package/README.md +12 -1
  2. package/dist/CommandPalette.d.ts.map +1 -1
  3. package/dist/DialogShell.d.ts.map +1 -1
  4. package/dist/eslint/index.d.ts +2 -0
  5. package/dist/eslint/index.d.ts.map +1 -1
  6. package/dist/eslint/index.js +1289 -961
  7. package/dist/eslint/index.js.map +4 -4
  8. package/dist/eslint/no-handmade-empty-state.d.ts +25 -0
  9. package/dist/eslint/no-handmade-empty-state.d.ts.map +1 -0
  10. package/dist/eslint/no-handmade-header.d.ts +17 -0
  11. package/dist/eslint/no-handmade-header.d.ts.map +1 -0
  12. package/dist/eslint/no-restyled-part.d.ts +20 -1
  13. package/dist/eslint/no-restyled-part.d.ts.map +1 -1
  14. package/dist/gates/app-checks.d.ts +1 -1
  15. package/dist/gates/app-checks.d.ts.map +1 -1
  16. package/dist/gates/index.js +4 -2
  17. package/dist/gates/index.js.map +2 -2
  18. package/dist/index.js +142 -123
  19. package/dist/index.js.map +4 -4
  20. package/package.json +1 -1
  21. package/registry.json +1 -1
  22. package/src/CommandPalette.tsx +1 -0
  23. package/src/ContainerHeader.mdx +3 -2
  24. package/src/DialogShell.tsx +22 -17
  25. package/src/EmptyState.mdx +5 -2
  26. package/src/FilePicker.stories.tsx +5 -1
  27. package/src/ReactionPicker.stories.tsx +2 -1
  28. package/src/eslint/index.test.ts +17 -9
  29. package/src/eslint/index.ts +12 -2
  30. package/src/eslint/no-handmade-empty-state.test.ts +151 -0
  31. package/src/eslint/no-handmade-empty-state.ts +344 -0
  32. package/src/eslint/no-handmade-header.test.ts +89 -0
  33. package/src/eslint/no-handmade-header.ts +153 -0
  34. package/src/eslint/no-restyled-part.ts +11 -0
  35. package/src/gates/app-checks.ts +5 -3
  36. package/src/gates/create-app.test.ts +1 -1
  37. package/src/gates/gates.test.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estiva-app/ui",
3
- "version": "0.30.0",
3
+ "version": "0.32.0",
4
4
  "description": "Estiva's design tokens (the contract) and a small set of primitives (a convenience) for every Estiva app.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/registry.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "kind": "package",
5
5
  "repo": "estiva-ui",
6
6
  "package": "@estiva-app/ui",
7
- "packageVersion": "0.30.0",
7
+ "packageVersion": "0.32.0",
8
8
  "exports": 87,
9
9
  "typeExports": 96,
10
10
  "files": null
@@ -553,6 +553,7 @@ export function CommandPaletteForm({ chip, icon, submitLabel, onSubmit, submitWa
553
553
 
554
554
  return (
555
555
  <div ref={frameRef} tabIndex={-1} onKeyDown={onKeyDown} onFocus={measure} onBlur={measure} onInput={measure} className="flex min-h-0 flex-col outline-none">
556
+ {/* @estiva-escape: the palette's own input bar, the twin of its search row; the level chip stands where the field was */}
556
557
  <div className="flex h-12 shrink-0 items-center gap-3 border-b border-border-subtle px-5">
557
558
  {icon != null && <span className="flex shrink-0 items-center text-text-secondary">{icon}</span>}
558
559
  <LevelChip chip={chip} onBack={back} />
@@ -23,10 +23,11 @@ with a hairline under it.
23
23
  - One section inside a column → **SectionHeader**, the 32px row with a
24
24
  SectionLabel.
25
25
  - The top of the whole app → **TopBar**.
26
- - A dialog's title → **DialogShell** draws its own.
26
+ - A dialog's title → **DialogShell**, which draws this bar with the dialog's own 18px title.
27
27
 
28
28
  - A row you draw yourself at the top of a column — your own padding and a line
29
- under it → this part. Its numbers are every column's.
29
+ under it → this part. Its numbers are every column's. The lint refuses the
30
+ hand-made row (`estiva/no-handmade-header`).
30
31
  - A whole list column, header and scrolling list → **ListColumn**, which draws
31
32
  this bar at its top.
32
33
 
@@ -3,6 +3,7 @@ import { Dialog } from '@base-ui/react/dialog'
3
3
  import { AlertDialog } from '@base-ui/react/alert-dialog'
4
4
  import { IconX } from '@tabler/icons-react'
5
5
  import { cn } from './cn'
6
+ import { ContainerHeader } from './ContainerHeader'
6
7
  import { IconButton } from './IconButton'
7
8
  import { ScrollArea } from './ScrollArea'
8
9
 
@@ -113,14 +114,17 @@ export function DialogShell({ title, onClose, headerContent, footer, children, b
113
114
  className="bg-bg-elevated border border-border-subtle rounded-lg shadow-lg pointer-events-auto flex flex-col overflow-hidden outline-none"
114
115
  style={{ width }}
115
116
  >
116
- {/* Header */}
117
- <div className="h-12 flex items-center justify-between pl-5 pr-4 border-b border-border-subtle shrink-0">
118
- {headerContent ?? (
119
- <Parts.Title className="text-h4 text-text-primary" render={<span />}>
120
- {title}
121
- </Parts.Title>
122
- )}
123
- {/*
117
+ {/* Header: the package's one header bar, with the dialog's own title in it (UIG-22). */}
118
+ <ContainerHeader
119
+ title={
120
+ headerContent ?? (
121
+ <Parts.Title className="text-h4 text-text-primary" render={<span />}>
122
+ {title}
123
+ </Parts.Title>
124
+ )
125
+ }
126
+ actions={
127
+ /*
124
128
  The ✕ IS the `Close` part now, rather than a button that calls
125
129
  `onClose` beside one (stage 4, 2026-09-07). Stage 3 could not do
126
130
  this: an `IconButton` carrying a `tooltip` returned the tooltip
@@ -131,15 +135,16 @@ export function DialogShell({ title, onClose, headerContent, footer, children, b
131
135
  What it buys: the dialog closes through its own state machine,
132
136
  so the ✕, Escape and the outside press are one path with one
133
137
  reason attached, instead of one of the three going around.
134
- */}
135
- <Parts.Close
136
- render={
137
- <IconButton tooltip="Close" aria-label="Close">
138
- <IconX size={16} stroke={1.5} />
139
- </IconButton>
140
- }
141
- />
142
- </div>
138
+ */
139
+ <Parts.Close
140
+ render={
141
+ <IconButton tooltip="Close" aria-label="Close">
142
+ <IconX size={16} stroke={1.5} />
143
+ </IconButton>
144
+ }
145
+ />
146
+ }
147
+ />
143
148
 
144
149
  {/* Body. With a cap it scrolls in the package's bar: the cap goes
145
150
  on the viewport (ScrollArea's rule — on the region the viewport
@@ -83,7 +83,9 @@ padding by hand, and is left behind the day the box changes.
83
83
 
84
84
  The message is the caller's — a shared component has no words of its own
85
85
  for what is missing. A hand-written "Nothing here" paragraph or span in a
86
- section is the `section` manner, and becomes it.
86
+ section is the `section` manner, and becomes it. The lint refuses one
87
+ (`estiva/no-handmade-empty-state`): a line of words that shows in place of an
88
+ empty list, whatever it says.
87
89
 
88
90
  ## What it owns
89
91
 
@@ -91,7 +93,8 @@ It does these by itself. Write none of them around it.
91
93
 
92
94
  | It does | So you never write | Refused when written by hand |
93
95
  |---|---|---|
94
- | As a `page`, fills the room it is given and centres itself in it | centring, or padding around it | |
96
+ | As a `page`, fills the room it is given and centres itself in it | centring, or padding around it | a `page` inside a `ScrollArea`, where it cannot centre (`estiva/no-handmade-empty-state`) |
97
+ | Says a list is empty, in place of its rows | a paragraph or span of your own saying so | `estiva/no-handmade-empty-state` |
95
98
  | Draws its one action, an outlined Button, under the line when you pass `action` | a button of your own under the line | |
96
99
 
97
100
  ## Props
@@ -4,6 +4,7 @@ import { useRef, useState } from 'react'
4
4
  import { Button } from './Button'
5
5
  import { FilePicker } from './FilePicker'
6
6
  import { IconButton } from './IconButton'
7
+ import { EmptyState } from './EmptyState'
7
8
 
8
9
  const meta = {
9
10
  title: 'Inputs/FilePicker',
@@ -20,9 +21,12 @@ type Story = StoryObj<typeof meta>
20
21
 
21
22
  /** What was chosen, one line per pick, so choosing the same file twice shows twice. */
22
23
  function Picks({ picks }: { picks: string[] }) {
24
+ if (picks.length === 0) return <EmptyState scope="section" message="Nothing chosen yet." />
23
25
  return (
24
26
  <ul className="flex flex-col gap-1 text-body-2 text-text-secondary">
25
- {picks.length === 0 ? <li>Nothing chosen yet.</li> : picks.map((pick, i) => <li key={i}>{pick}</li>)}
27
+ {picks.map((pick, i) => (
28
+ <li key={i}>{pick}</li>
29
+ ))}
26
30
  </ul>
27
31
  )
28
32
  }
@@ -5,6 +5,7 @@ import { Popover } from './Popover'
5
5
  import { Reaction } from './Reaction'
6
6
  import { ReactionPicker, type ReactionOption } from './ReactionPicker'
7
7
  import { Toolbar, ToolbarButton } from './Toolbar'
8
+ import { EmptyState } from './EmptyState'
8
9
 
9
10
  /**
10
11
  * The reactions on offer, to choose one from. **A `Reaction` is the answer;
@@ -98,7 +99,7 @@ export const AndWhatItProduces: Story = {
98
99
  />
99
100
  <div className="flex flex-wrap items-center gap-1.5">
100
101
  {mine.length === 0 ? (
101
- <span className="text-caption text-text-muted">Nothing here yet.</span>
102
+ <EmptyState scope="section" message="Nothing here yet." />
102
103
  ) : (
103
104
  mine.map((emoji) => {
104
105
  const option = OPTIONS.find((o) => o.emoji === emoji)!
@@ -37,6 +37,8 @@ describe('the plugin object', () => {
37
37
  'no-raw-element',
38
38
  'no-rebuilt-behaviour',
39
39
  'no-restyled-part',
40
+ 'no-handmade-header',
41
+ 'no-handmade-empty-state',
40
42
  'raw-element-outside-a-wrapper',
41
43
  'no-hand-rolled-behaviour',
42
44
  'component-has-a-page',
@@ -56,17 +58,19 @@ describe('the plugin object', () => {
56
58
  it('gives an app only the app rules, as errors, under estiva/', () => {
57
59
  for (const config of [estiva.configs.recommended, estiva.configs.strict]) {
58
60
  expect(config.plugins?.[PLUGIN_KEY]).toBe(estiva)
59
- expect(config.rules).toEqual({ 'estiva/no-raw-element': 'error', 'estiva/no-rebuilt-behaviour': 'error', 'estiva/no-restyled-part': 'error' })
61
+ expect(config.rules).toEqual({ 'estiva/no-raw-element': 'error', 'estiva/no-rebuilt-behaviour': 'error', 'estiva/no-restyled-part': 'error', 'estiva/no-handmade-header': 'error', 'estiva/no-handmade-empty-state': 'error' })
60
62
  }
61
- expect(APP_RULE_IDS).toEqual(['estiva/no-raw-element', 'estiva/no-rebuilt-behaviour', 'estiva/no-restyled-part'])
63
+ expect(APP_RULE_IDS).toEqual(['estiva/no-raw-element', 'estiva/no-rebuilt-behaviour', 'estiva/no-restyled-part', 'estiva/no-handmade-header', 'estiva/no-handmade-empty-state'])
62
64
  })
63
65
 
64
66
  /**
65
- * `no-restyled-part` is the one rule in both sets (UIG-9): the package restyles
66
- * none of its own parts either (Katerina, 17 September). Every other inward
67
- * rule still reaches no app.
67
+ * `no-restyled-part` (UIG-9), `no-handmade-header` (UIG-22) and
68
+ * `no-handmade-empty-state` (UIG-23) are in both sets: the package restyles
69
+ * none of its own parts either (Katerina, 17 September), and draws no header
70
+ * bar or empty state by hand ("my review isn't enough", 23 September). Every
71
+ * other inward rule still reaches no app.
68
72
  */
69
- it('gives this package its own set, as errors, and only the shared rule reaches an app config', () => {
73
+ it('gives this package its own set, as errors, and only the shared rules reach an app config', () => {
70
74
  expect(estiva.configs.package.plugins?.[PLUGIN_KEY]).toBe(estiva)
71
75
  expect(estiva.configs.package.rules).toEqual({
72
76
  'estiva/raw-element-outside-a-wrapper': 'error',
@@ -74,9 +78,11 @@ describe('the plugin object', () => {
74
78
  'estiva/component-has-a-page': 'error',
75
79
  'estiva/component-has-a-story': 'error',
76
80
  'estiva/no-restyled-part': 'error',
81
+ 'estiva/no-handmade-header': 'error',
82
+ 'estiva/no-handmade-empty-state': 'error',
77
83
  })
78
84
  expect(PACKAGE_RULE_IDS).toEqual(Object.keys(estiva.configs.package.rules ?? {}))
79
- for (const id of PACKAGE_RULE_IDS.filter((id) => id !== 'estiva/no-restyled-part')) {
85
+ for (const id of PACKAGE_RULE_IDS.filter((id) => !['estiva/no-restyled-part', 'estiva/no-handmade-header', 'estiva/no-handmade-empty-state'].includes(id))) {
80
86
  expect(estiva.configs.recommended.rules?.[id]).toBeUndefined()
81
87
  expect(estiva.configs.strict.rules?.[id]).toBeUndefined()
82
88
  }
@@ -143,8 +149,8 @@ describe('countGates', () => {
143
149
  it('counts an error, and an escape only when the lint reports escapes', async () => {
144
150
  const code = component(' <div>\n <button>x</button>\n {/* @estiva-escape: a preview drawn from its own palette */}\n <button>y</button>\n </div>')
145
151
  const none = { errors: 0, warnings: 0, escapes: 0 }
146
- expect(countGates(await lint(code)).rules).toEqual({ 'estiva/no-raw-element': { errors: 1, warnings: 0, escapes: 0 }, 'estiva/no-rebuilt-behaviour': none, 'estiva/no-restyled-part': none })
147
- expect(countGates(await lint(code, [countMode])).rules).toEqual({ 'estiva/no-raw-element': { errors: 1, warnings: 0, escapes: 1 }, 'estiva/no-rebuilt-behaviour': none, 'estiva/no-restyled-part': none })
152
+ expect(countGates(await lint(code)).rules).toEqual({ 'estiva/no-raw-element': { errors: 1, warnings: 0, escapes: 0 }, 'estiva/no-rebuilt-behaviour': none, 'estiva/no-restyled-part': none, 'estiva/no-handmade-header': none, 'estiva/no-handmade-empty-state': none })
153
+ expect(countGates(await lint(code, [countMode])).rules).toEqual({ 'estiva/no-raw-element': { errors: 1, warnings: 0, escapes: 1 }, 'estiva/no-rebuilt-behaviour': none, 'estiva/no-restyled-part': none, 'estiva/no-handmade-header': none, 'estiva/no-handmade-empty-state': none })
148
154
  })
149
155
 
150
156
  it('lists a report an eslint-disable silenced, and counts it as neither an error nor an escape', async () => {
@@ -165,6 +171,8 @@ describe('countGates', () => {
165
171
  expect(countGates([])).toEqual({
166
172
  rules: { 'estiva/no-raw-element': { errors: 0, warnings: 0, escapes: 0 }, 'estiva/no-rebuilt-behaviour': { errors: 0, warnings: 0, escapes: 0 },
167
173
  'estiva/no-restyled-part': { errors: 0, warnings: 0, escapes: 0 },
174
+ 'estiva/no-handmade-header': { errors: 0, warnings: 0, escapes: 0 },
175
+ 'estiva/no-handmade-empty-state': { errors: 0, warnings: 0, escapes: 0 },
168
176
  },
169
177
  disabled: [],
170
178
  })
@@ -20,6 +20,8 @@ import { createRequire } from 'node:module'
20
20
  import type { ESLint, Linter } from 'eslint'
21
21
  import { componentHasAPage, componentHasAStory } from './has-a-page-and-a-story'
22
22
  import { noHandRolledBehaviour } from './no-hand-rolled-behaviour'
23
+ import { noHandmadeEmptyState } from './no-handmade-empty-state'
24
+ import { noHandmadeHeader } from './no-handmade-header'
23
25
  import { noRawElement } from './no-raw-element'
24
26
  import { noRebuiltBehaviour } from './no-rebuilt-behaviour'
25
27
  import { noRestyledPart } from './no-restyled-part'
@@ -44,6 +46,8 @@ const appRules = {
44
46
  'no-raw-element': noRawElement,
45
47
  'no-rebuilt-behaviour': noRebuiltBehaviour,
46
48
  'no-restyled-part': noRestyledPart,
49
+ 'no-handmade-header': noHandmadeHeader,
50
+ 'no-handmade-empty-state': noHandmadeEmptyState,
47
51
  }
48
52
 
49
53
  /**
@@ -58,8 +62,10 @@ const appRules = {
58
62
  * app's version, UIG-7), and an app has no `.mdx` pages at all. `index.test.ts` holds the
59
63
  * apps' list to exactly the app rules.
60
64
  *
61
- * One rule is in both sets: `no-restyled-part` (UIG-9). The package restyles
62
- * none of its own parts either (Katerina, 17 September).
65
+ * Three rules are in both sets: `no-restyled-part` (UIG-9), and the
66
+ * fingerprints `no-handmade-header` (UIG-22) and `no-handmade-empty-state`
67
+ * (UIG-23). The package restyles none of its own parts either (Katerina, 17
68
+ * September), and "my review isn't enough" (23 September).
63
69
  */
64
70
  const packageRules = {
65
71
  'raw-element-outside-a-wrapper': rawElementOutsideAWrapper,
@@ -67,6 +73,8 @@ const packageRules = {
67
73
  'component-has-a-page': componentHasAPage,
68
74
  'component-has-a-story': componentHasAStory,
69
75
  'no-restyled-part': noRestyledPart,
76
+ 'no-handmade-header': noHandmadeHeader,
77
+ 'no-handmade-empty-state': noHandmadeEmptyState,
70
78
  }
71
79
 
72
80
  const rules = { ...appRules, ...packageRules }
@@ -97,6 +105,8 @@ plugin.configs.recommended = {
97
105
  [`${PLUGIN_KEY}/no-raw-element`]: 'error',
98
106
  [`${PLUGIN_KEY}/no-rebuilt-behaviour`]: 'error',
99
107
  [`${PLUGIN_KEY}/no-restyled-part`]: 'error',
108
+ [`${PLUGIN_KEY}/no-handmade-header`]: 'error',
109
+ [`${PLUGIN_KEY}/no-handmade-empty-state`]: 'error',
100
110
  },
101
111
  }
102
112
  plugin.configs.strict = {
@@ -0,0 +1,151 @@
1
+ import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs'
2
+ import { tmpdir } from 'node:os'
3
+ import { dirname, join } from 'node:path'
4
+ import { RuleTester } from 'eslint'
5
+ import { parser } from 'typescript-eslint'
6
+ import { describe, it } from 'vitest'
7
+ import { noHandmadeEmptyState } from './no-handmade-empty-state'
8
+
9
+ RuleTester.describe = describe
10
+ RuleTester.it = it
11
+ RuleTester.itOnly = it.only
12
+
13
+ const tester = new RuleTester({
14
+ languageOptions: { parser, parserOptions: { ecmaFeatures: { jsx: true } } },
15
+ linterOptions: { reportUnusedDisableDirectives: 'off' },
16
+ })
17
+
18
+ /**
19
+ * The wrong-scope half follows the app's components into their files, so its
20
+ * cases live in a small app on disk, laid out the way Peek's Folders page was at
21
+ * `7f22e5e~1`: the page scrolls a view drawn in another file.
22
+ */
23
+ const root = mkdtempSync(join(tmpdir(), 'no-handmade-empty-state-'))
24
+ const write = (path: string, text: string) => {
25
+ mkdirSync(dirname(join(root, path)), { recursive: true })
26
+ writeFileSync(join(root, path), text)
27
+ }
28
+ write('app/package.json', '{ "name": "app" }')
29
+ write(
30
+ 'app/src/components/ui/EmptyState.tsx',
31
+ "import { EmptyState as UiEmptyState, type EmptyStateProps } from '@estiva-app/ui'\nexport function EmptyState({ message = 'Nothing', ...rest }: EmptyStateProps) {\n return <UiEmptyState message={message} {...rest} />\n}\n",
32
+ )
33
+ // The file conversation, as it arrived in the merge: two page states in a view another file scrolls.
34
+ write(
35
+ 'app/src/components/views/ForeignConversationView.tsx',
36
+ "import { EmptyState } from '@/components/ui/EmptyState'\nexport function ForeignConversationView({ state }: { state: string[] | 'failed' }) {\n if (state === 'failed') return <EmptyState message=\"This conversation could not be read.\" />\n if (state.length === 0) return <EmptyState message=\"Nothing said about this yet.\" />\n return <div>{state.map((c) => <p key={c}>{c}</p>)}</div>\n}\n",
37
+ )
38
+ // The folder view: its own states are sections; the rows it draws hold a page state two components down.
39
+ write(
40
+ 'app/src/components/views/FolderContentsView.tsx',
41
+ "import { EmptyState } from '@/components/ui/EmptyState'\nexport function FolderContentsView({ files }: { files: string[] }) {\n if (files.length === 0) return <EmptyState scope=\"section\" message=\"Nothing in this folder yet.\" />\n return <div>{files.map((f) => <FileRow key={f} file={f} />)}</div>\n}\nfunction FileRow({ file }: { file: string }) {\n return <div><p>{file}</p><ChildRows file={file} /></div>\n}\nfunction ChildRows({ file }: { file: string }) {\n const children: string[] = file ? [] : [file]\n if (children.length === 0) return <EmptyState message=\"Nothing in this yet.\" />\n return <>{children.map((c) => <FileRow key={c} file={c} />)}</>\n}\n",
42
+ )
43
+ // Ship's Activity: it hands its className on to a section EmptyState. It is the app's own, and is followed.
44
+ write(
45
+ 'app/src/components/Activity.tsx',
46
+ "import { EmptyState } from '@estiva-app/ui'\nexport function Activity({ items, className }: { items: string[]; className?: string }) {\n if (items.length === 0) return <EmptyState scope=\"section\" className={className} message=\"No related conversations yet.\" />\n return <ul>{items.map((i) => <li key={i}>{i}</li>)}</ul>\n}\n",
47
+ )
48
+
49
+ const app = join(root, 'app/src/pages/Probe.tsx')
50
+ const component = (body: string) => `export function Probe({ rows, report, answer, choosing }: { rows: string[]; report?: string; answer: false | { text: string; sources: string[] }; choosing: boolean }) {\n${body}\n}\n`
51
+ const jsx = (body: string) => component(` return (\n${body}\n )`)
52
+ const scrolled = (imports: string, body: string) =>
53
+ `import { ScrollArea, EmptyState } from '@estiva-app/ui'\n${imports}\nexport function Probe({ rows }: { rows: string[] }) {\n return (\n${body}\n )\n}\n`
54
+ const handmade = [{ messageId: 'handmade' }]
55
+
56
+ tester.run('no-handmade-empty-state', noHandmadeEmptyState, {
57
+ valid: [
58
+ // the part itself
59
+ { name: 'the part, in place of the list', code: jsx('<div>{rows.length === 0 ? <EmptyState scope="section" message="Nothing here" /> : rows.map((r) => <p key={r}>{r}</p>)}</div>') },
60
+
61
+ // UIG-1's two false alarms, which the ticket makes regression tests
62
+ {
63
+ name: '"Nothing is created until you submit it." — a hint beside a button (CommandLauncher.tsx:1498)',
64
+ code: jsx('<>\n<Button>Open the form</Button>\n<span className="text-[12px] text-text-secondary">Nothing is created until you submit it.</span>\n</>'),
65
+ },
66
+ {
67
+ name: '"…this folder has no folder state yet." — a status note, under a condition that asks nothing about a list (FolderContentsView.tsx:101)',
68
+ code: component(' const folder = { source: "channel" }\n return (\n<div>\n{folder.source === "channel" && (\n<p className="text-caption text-text-muted">From channel contents; this folder has no folder state yet.</p>\n)}\n{rows.map((r) => <p key={r}>{r}</p>)}\n</div>\n )'),
69
+ },
70
+
71
+ // the ticket's three ❓, ruled not empty states (GATES.md)
72
+ {
73
+ name: '"No comparison yet — it needs one relay fetch." — a debug line for a report not fetched yet (ReadStatePanel.tsx:65)',
74
+ code: component(' if (!report) return <p className="text-caption text-text-muted">No comparison yet — it needs one relay fetch.</p>\n return <p>{report}</p>'),
75
+ },
76
+ {
77
+ name: '"No answer came back." — a failure after a request; the other side is an answer, with its sources listed inside it (CommandLauncher.tsx:1514)',
78
+ code: jsx('<div>{answer === false ? (\n<p className="text-text-secondary">No answer came back. Edit the question and press Enter to try again.</p>\n) : (\n<>\n<p>{answer.text}</p>\n<ol>{answer.sources.map((s) => <li key={s}>{s}</li>)}</ol>\n</>\n)}</div>'),
79
+ },
80
+
81
+ // look-alikes
82
+ { name: 'the full side of the test: a count', code: jsx('<div>{rows.length > 0 && <span className="font-mono text-caption">{rows.length}</span>}</div>') },
83
+ { name: 'the full side of the test, with words', code: jsx('<div>{rows.length > 0 && <p className="text-caption">Recent</p>}{rows.map((r) => <p key={r}>{r}</p>)}</div>') },
84
+ { name: 'the full side of a ternary', code: jsx('<div>{rows.length ? <p>Pick one below.</p> : <Button>Add</Button>}</div>') },
85
+ {
86
+ name: 'a status line whose words are a choice (ReactionPicker.stories.tsx:76)',
87
+ code: component(' const chosen = rows[0]\n return <span className="text-caption text-text-secondary">{chosen ? `Chose ${chosen}` : "Nothing chosen yet."}</span>'),
88
+ },
89
+ { name: 'a paragraph, not a line', code: jsx(`<div>{rows.length === 0 ? <p>${'Nothing here, and a long explanation of why that is and what to do next about it. '.repeat(2)}</p> : rows.map((r) => <p key={r}>{r}</p>)}</div>`) },
90
+ { name: 'a line that is a value, not words: a message body', code: jsx('<div>{rows.length === 0 ? <p className="pl-8">{report}</p> : rows.map((r) => <p key={r}>{r}</p>)}</div>') },
91
+ { name: 'a box holding more than the line', code: jsx('<div>{rows.length === 0 ? <div className="px-3"><p>Nothing yet.</p><Button>Add one</Button></div> : rows.map((r) => <p key={r}>{r}</p>)}</div>') },
92
+ {
93
+ name: 'an escape with its reason',
94
+ code: jsx('<div>{rows.length === 0 ? (\n// @estiva-escape: a printed report keeps its own empty line, set in the print style\n<p>Nothing to print.</p>\n) : rows.map((r) => <p key={r}>{r}</p>)}</div>'),
95
+ },
96
+
97
+ // the right scope
98
+ { name: 'a page state for a whole column, outside any ScrollArea', filename: app, code: scrolled('', '<div className="flex h-full flex-col">{rows.length === 0 ? <EmptyState message="No topics yet." /> : <ScrollArea className="flex-1">{rows.map((r) => <p key={r}>{r}</p>)}</ScrollArea>}</div>') },
99
+ { name: 'a section state inside a ScrollArea', filename: app, code: scrolled('', '<ScrollArea className="flex-1">{rows.length === 0 ? <EmptyState scope="section" message="No issues yet." /> : null}</ScrollArea>') },
100
+ { name: 'a page state inside a ScrollArea whose content fills it', filename: app, code: scrolled('', '<ScrollArea className="flex-1" contentClassName="flex min-h-full flex-col">{rows.length === 0 && <EmptyState message="Nothing here yet." />}</ScrollArea>') },
101
+ { name: 'a scope that is decided at run time is not judged', filename: app, code: scrolled('', '<ScrollArea className="flex-1"><EmptyState scope={rows.length ? "section" : "page"} message="Nothing here yet." /></ScrollArea>') },
102
+ { name: "a component that hands its className to a section state (Ship's Activity), followed and fine", filename: app, code: scrolled("import { Activity } from '@/components/Activity'", '<ScrollArea className="flex-1" contentClassName="px-6"><section><Activity items={rows} /></section></ScrollArea>') },
103
+ ],
104
+ invalid: [
105
+ // the hand-made line, each way it stands in for a list
106
+ { name: 'the other side of a map (Ship Board.tsx:61 at 6693025)', code: jsx('<div className="flex flex-col gap-1.5">{rows.length === 0 ? <p className="px-1 py-2 text-caption text-text-muted">Nothing here</p> : rows.map((r) => <p key={r}>{r}</p>)}</div>'), errors: handmade },
107
+ { name: 'same shape, other class names and another tag (FilePicker.stories.tsx:25)', code: jsx('<ul className="flex flex-col gap-1 text-body-2">{rows.length === 0 ? <li>Nothing chosen yet.</li> : rows.map((r) => <li key={r}>{r}</li>)}</ul>'), errors: handmade },
108
+ { name: 'a map on the other side is enough, whatever the test', code: jsx('<div>{rows[0] === undefined ? <span className="text-caption">Nothing here yet.</span> : rows.map((r) => <p key={r}>{r}</p>)}</div>'), errors: handmade },
109
+ { name: 'under a test that the list is empty, in a box around it (CommandLauncher.tsx:1716 at d094006)', code: jsx('<div>{rows.length === 0 && (\n<div className="flex items-center h-12 px-3">\n<span className="text-[14px] text-text-secondary">Nothing for that here.</span>\n</div>\n)}</div>'), errors: handmade },
110
+ { name: 'returned when the list is empty', code: component(' if (rows.length === 0) return <p className="text-body-2">No tickets in this project yet.</p>\n return <ul>{rows.map((r) => <li key={r}>{r}</li>)}</ul>'), errors: handmade },
111
+ { name: "the empty side is the second: `rows.length ? … : …`", code: jsx('<div>{rows.length ? <Rows rows={rows} /> : <p>None yet.</p>}</div>'), errors: handmade },
112
+ { name: '`!rows.length`', code: jsx('<div>{!rows.length && <p>Nothing to show.</p>}</div>'), errors: handmade },
113
+ { name: 'optional chaining', code: jsx('<div>{rows?.length === 0 && <p>Nothing in it yet.</p>}</div>'), errors: handmade },
114
+ {
115
+ name: "words that do not say \"no\": Peek's dialogs (StartTopicDialog.tsx:106), and a name in the sentence",
116
+ code: jsx('<Dialog>{choosing && rows.length === 0 ? (\n<p className="text-body-2 text-text-secondary">There is nowhere in {report} to start one yet — make a folder first.</p>\n) : (\n<Form />\n)}</Dialog>'),
117
+ errors: handmade,
118
+ },
119
+ {
120
+ name: 'an escape with no reason is not an escape',
121
+ code: jsx('<div>{rows.length === 0 ? (\n// @estiva-escape\n<p>Nothing to print.</p>\n) : rows.map((r) => <p key={r}>{r}</p>)}</div>'),
122
+ errors: [{ messageId: 'escapeWithoutReason' }, ...handmade],
123
+ },
124
+
125
+ // the wrong scope
126
+ { name: 'a page state straight inside a ScrollArea', filename: app, code: scrolled('', '<ScrollArea className="min-h-0 flex-1">{rows.length === 0 && <EmptyState message="Nothing here yet." />}</ScrollArea>'), errors: [{ messageId: 'wrongScope' }] },
127
+ { name: 'scope="page" said out loud', filename: app, code: scrolled('', '<ScrollArea className="flex-1" contentClassName="flex flex-col gap-3 p-4"><EmptyState scope="page" message="Nothing here yet." /></ScrollArea>'), errors: [{ messageId: 'wrongScope' }] },
128
+ { name: "through the app's wrapper, one box down", filename: app, code: "import { ScrollArea } from '@estiva-app/ui'\nimport { EmptyState } from '@/components/ui/EmptyState'\nexport function Probe() {\n return <ScrollArea className=\"flex-1\"><div className=\"p-4\"><EmptyState message=\"Nothing said about this yet.\" /></div></ScrollArea>\n}\n", errors: [{ messageId: 'wrongScope' }] },
129
+ {
130
+ name: 'the file conversation at 7f22e5e~1: a view drawn in another file, scrolled here — both its states',
131
+ filename: app,
132
+ code: scrolled("import { ForeignConversationView } from '@/components/views/ForeignConversationView'", '<ScrollArea className="min-h-0 flex-1">\n<ForeignConversationView state={rows} />\n</ScrollArea>'),
133
+ errors: [
134
+ { messageId: 'wrongScopeVia', data: { component: 'ForeignConversationView', where: 'ForeignConversationView.tsx:3' } },
135
+ { messageId: 'wrongScopeVia', data: { component: 'ForeignConversationView', where: 'ForeignConversationView.tsx:4' } },
136
+ ],
137
+ },
138
+ {
139
+ name: 'the nested children at 7f22e5e~1: a page state under one row of a list, two components down in another file',
140
+ filename: app,
141
+ code: scrolled("import { FolderContentsView } from '@/components/views/FolderContentsView'", '<ScrollArea className="min-h-0 flex-1">\n<FolderContentsView files={rows} />\n</ScrollArea>'),
142
+ errors: [{ messageId: 'wrongScopeVia', data: { component: 'FolderContentsView', where: 'FolderContentsView.tsx:11' } }],
143
+ },
144
+ {
145
+ name: 'a component in the same file',
146
+ filename: app,
147
+ code: "import { ScrollArea, EmptyState } from '@estiva-app/ui'\nfunction Replies({ rows }: { rows: string[] }) {\n if (rows.length === 0) return <EmptyState message=\"No replies yet.\" />\n return <>{rows.map((r) => <p key={r}>{r}</p>)}</>\n}\nexport function Probe({ rows }: { rows: string[] }) {\n return <ScrollArea className=\"flex-1\"><Replies rows={rows} /></ScrollArea>\n}\n",
148
+ errors: [{ messageId: 'wrongScopeVia', data: { component: 'Replies', where: 'line 3' } }],
149
+ },
150
+ ],
151
+ })