@estiva-app/ui 0.120.0 → 0.121.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estiva-app/ui",
3
- "version": "0.120.0",
3
+ "version": "0.121.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.120.0",
7
+ "packageVersion": "0.121.0",
8
8
  "exports": 256,
9
9
  "typeExports": 270,
10
10
  "files": null
@@ -8060,6 +8060,12 @@
8060
8060
  "takes": "text",
8061
8061
  "required": false,
8062
8062
  "note": "Remember each group open or closed in this browser, under this key and the group's id."
8063
+ },
8064
+ {
8065
+ "name": "spaced",
8066
+ "takes": "true/false",
8067
+ "required": false,
8068
+ "note": "8px between the items an app draws as `children`, none above the first: a tree whose items are each a place with rows under it — Peek's teams (Katerina, 17 November: \"a bit more spacing between the parent expandable items\")."
8063
8069
  }
8064
8070
  ],
8065
8071
  "variants": [],
@@ -10437,7 +10443,7 @@
10437
10443
  "kind": "component",
10438
10444
  "importPath": "@estiva-app/ui",
10439
10445
  "sourceFile": "src/SectionHeader.tsx",
10440
- "purpose": "The 32px row a section starts with: a SectionLabel, and actions that appear while the row is hovered or keyboard-focused, as IconButtons with tooltips — always, on a screen with no hover.",
10446
+ "purpose": "The 28px row a section starts with, a list row's height: a SectionLabel, and actions that appear while the row is hovered or keyboard-focused, as IconButtons with tooltips — always, on a screen with no hover.",
10441
10447
  "purposeFrom": "page",
10442
10448
  "props": [
10443
10449
  {
@@ -11206,7 +11212,7 @@
11206
11212
  "kind": "component",
11207
11213
  "importPath": "@estiva-app/ui",
11208
11214
  "sourceFile": "src/Skeleton.tsx",
11209
- "purpose": "A 32px row: a 16px square and a bar, like a row with a face and a name.",
11215
+ "purpose": "A 28px row, a list row's height: a 16px square and a bar, like a row with a face and a name.",
11210
11216
  "purposeFrom": "comment",
11211
11217
  "props": [
11212
11218
  {
@@ -46,13 +46,16 @@ toggle, and the rows under it, sliding shut and open.
46
46
  revealed while the row is hovered or keyboard-focused.
47
47
  - `look="row"` when the section is a row among rows — a folder in a
48
48
  sidebar, under a quiet label: the title at a row's weight, and its rows
49
- indented under it, past the chevron.
49
+ indented under it, past the chevron, the tree's line beside them, 1px
50
+ down from the chevron's middle (Katerina, 17 November), as a **NavItem**'s
51
+ rows have it.
50
52
 
51
53
  <Canvas of={CollapsibleSectionStories.AsARow} />
52
54
 
53
55
  - `indent` with the standard heading: its rows start under its title, past
54
- the chevron — a group in a sidebar whose rows read as inside it. **NavTree**
55
- draws its groups this way.
56
+ the chevron, the tree's line beside them — a group in a sidebar whose rows
57
+ read as inside it. **NavTree** draws its groups this way. The standard
58
+ heading without `indent` has no line: its rows are level with its title.
56
59
 
57
60
  <Canvas of={CollapsibleSectionStories.Indented} />
58
61
 
@@ -93,6 +93,28 @@ describe('CollapsibleSection', () => {
93
93
  })
94
94
 
95
95
  /** Opened before its rows are in (0.65.1, OPT-11): the title says open, the panel waits. */
96
+ // The tree's line, as a row's (Katerina, 17 November).
97
+ describe('CollapsibleSection, its rows', () => {
98
+ it('a row-look fold draws the tree’s line beside its rows, 24px in', () => {
99
+ render(
100
+ <CollapsibleSection look="row" title="Files">
101
+ <a href="#one">One</a>
102
+ </CollapsibleSection>,
103
+ )
104
+ const classes = screen.getByRole('link', { name: 'One' }).parentElement!.className.split(' ')
105
+ expect(classes).toEqual(expect.arrayContaining(['border-l', 'border-border-default', 'ml-[15px]', 'pl-2']))
106
+ })
107
+
108
+ it('a heading draws no line: its rows are level with its title', () => {
109
+ render(
110
+ <CollapsibleSection title="Starred">
111
+ <a href="#one">One</a>
112
+ </CollapsibleSection>,
113
+ )
114
+ expect(screen.getByRole('link', { name: 'One' }).parentElement!.className.split(' ')).not.toContain('border-l')
115
+ })
116
+ })
117
+
96
118
  describe('CollapsibleSection, pending', () => {
97
119
  it('the title says open and busy while the rows stay shut, then they open', () => {
98
120
  const { rerender } = render(<CollapsibleSection title="Section" open pending>{rows}</CollapsibleSection>)
@@ -191,7 +191,8 @@ export function CollapsibleSection({ title, defaultOpen = true, open: openProp,
191
191
  >
192
192
  {/* A row's rows start under its title: the 16px chevron and its 8px gap
193
193
  (pl-6). An indented heading's: the same — its arrow is a row's now (5 October). */}
194
- <div className={cn('flex flex-col pt-0.5', (look === 'row' || indent) && 'pl-6', contentClassName)}>{children}</div>
194
+ {/* The tree's line, as NavItem's (Katerina, 17 November): under the arrow's middle, the rows 24px in as before. */}
195
+ <div className={cn('flex flex-col', look === 'row' || indent ? 'ml-[15px] mt-0.5 border-l border-border-default pl-2' : 'pt-0.5', contentClassName)}>{children}</div>
195
196
  </Collapsible.Panel>
196
197
  </Collapsible.Root>
197
198
  )
package/src/NavItem.mdx CHANGED
@@ -142,7 +142,7 @@ import { NavItem } from '@estiva-app/ui'
142
142
  place for that row; another site's address, a `target` and a `download` stay
143
143
  the browser's.
144
144
 
145
- - A row is 32px tall, 8px in on each side, 8px between the icon and the label,
145
+ - A row is 28px tall (32px until 17 November), 8px in on each side, 8px between the icon and the label,
146
146
  the label 14px regular (medium when unread), 8px corners as a **MenuItem**'s.
147
147
 
148
148
  ## What it owns
@@ -152,7 +152,7 @@ It does these by itself. Write none of them around it.
152
152
  | It does | So you never write | Refused when written by hand |
153
153
  |---|---|---|
154
154
  | Marks the current place for assistive technology when `active` | `aria-current` | |
155
- | Keeps its 32px in a scrolling column | `shrink-0` | |
155
+ | Keeps its 28px in a scrolling column | `shrink-0` | |
156
156
  | Shows a ⋮ over the count while pointed at, focused or open, and keeps the row's hover look under it | a positioned `IconButton` + `Menu` over the row, `group-hover` reveals | |
157
157
  | Turns its icon into the arrow that folds `children` while pointed at or focused, and slides them | a positioned `IconButton` over the icon, open state, `group-hover` reveals, an indented box | |
158
158
  | Tells assistive technology whether its rows are open | `aria-expanded`, `aria-controls` | |
@@ -85,6 +85,14 @@ describe('NavItem with rows under it', () => {
85
85
  </NavItem>
86
86
  )
87
87
 
88
+ // "Show some vertical line for the tree", "a little stronger just a bit"; the indent kept (Katerina, 17 November).
89
+ it('draws the tree’s line beside its rows: 1px, a step above the quietest border, under the middle of its icon, the rows 24px in', () => {
90
+ render(tree())
91
+ const rows = screen.getByText('Item two').closest('a')!.parentElement!.closest('div[class*="border-l"]')!
92
+ const classes = rows.className.split(' ')
93
+ expect(classes).toEqual(expect.arrayContaining(['border-l', 'border-border-default', 'ml-[15px]', 'pl-2']))
94
+ })
95
+
88
96
  it('starts open: the arrow says so and names what it folds, and the rows are there', () => {
89
97
  render(tree())
90
98
  const button = arrow(/Hide what is under Item one/)
@@ -288,7 +296,8 @@ describe('NavItem with a tooltip', () => {
288
296
  render(<NavItem href="#" label="Item one" tooltip="A sentence about item one." />)
289
297
  const link = screen.getByRole('link', { name: 'Item one' })
290
298
  expect(link.contains(screen.getByText('Item one'))).toBe(true)
291
- expect(link.className.split(' ')).toContain('h-8')
299
+ // 28px (Katerina, 17 November); 32px until then.
300
+ expect(link.className.split(' ')).toContain('h-7')
292
301
  expect(screen.getByText('Item one').className.split(' ')).toContain('truncate')
293
302
  })
294
303
 
package/src/NavItem.tsx CHANGED
@@ -177,10 +177,11 @@ export function NavItem({
177
177
  href={href}
178
178
  aria-current={active ? 'page' : undefined}
179
179
  className={cn(
180
- // shrink-0: the row keeps its 32px inside an overflowing flex column
180
+ // shrink-0: the row keeps its 28px inside an overflowing flex column
181
181
  // — without it the list compresses instead of scrolling (the missing-
182
182
  // shrink-0 family; Katerina, 2026-09-02).
183
- 'flex h-8 min-w-0 shrink-0 items-center gap-2 px-2 text-body-2',
183
+ // 28px (Katerina, 17 November: "what if we make the height of the items 28px"); 32px until then.
184
+ 'flex h-7 min-w-0 shrink-0 items-center gap-2 px-2 text-body-2',
184
185
  SIDEBAR_ROW_CLASSES,
185
186
  active ? 'bg-bg-nav-active text-text-primary' : cn(unread ? 'text-text-primary' : SIDEBAR_ROW_TEXT_CLASSES, 'hover:bg-bg-hover'),
186
187
  // With a menu the ⋮ sits beside the link, so the row keeps its hover
@@ -330,8 +331,12 @@ export function NavItem({
330
331
  hiddenUntilFound
331
332
  className={COLLAPSIBLE_PANEL_CLASSES}
332
333
  >
333
- {/* `pl-6`: past the 16px icon and its 8px gap, so the rows' icons start under this row's label. */}
334
- <div className="flex flex-col gap-0.5 pt-0.5 pl-6">{children}</div>
334
+ {/*
335
+ The tree's line (Katerina, 17 November: "show some vertical line for the tree", "a little stronger just a
336
+ bit"): 1px down from the middle of this row's icon (8px in, 16px wide), and the rows past it 24px in, as
337
+ before, their icons under this row's label (the indent she kept: "i dont like the indentation change").
338
+ */}
339
+ <div className="ml-[15px] mt-0.5 flex flex-col gap-0.5 border-l border-border-default pl-2">{children}</div>
335
340
  </Collapsible.Panel>
336
341
  </Collapsible.Root>
337
342
  )
package/src/NavTree.mdx CHANGED
@@ -81,6 +81,16 @@ rows to any depth.
81
81
  - A group folds with a row's arrow, 16px — every folding heading does — so a
82
82
  group and the rows under it fold with the same arrow; its title starts 8px
83
83
  after it, as a row's label.
84
+ - Rows under a row, or under a group, have the tree's line beside them: 1px,
85
+ a step above the quietest border, down from the middle of the icon or the
86
+ arrow above them; the rows stay 24px in (Katerina, 17 November).
87
+ - `spaced` puts 8px between the items the app draws as `children`, none
88
+ above the first: a tree whose items are each a place with rows under it,
89
+ as Peek's teams are ("a bit more spacing between the parent expandable
90
+ items", Katerina, 17 November). Groups from `groups` keep their 4px.
91
+
92
+ <Canvas of={NavTreeStories.Spaced} />
93
+
84
94
  - A group's `icon` sits before its title — a folder's — and the arrow takes
85
95
  its place under the pointer, as a row's icon turns into its arrow. Its rows
86
96
  then start under the title, past the icon.
@@ -4,6 +4,7 @@ import { useEffect, useState, type ReactNode } from 'react'
4
4
  import { IconArrowUpRight, IconFolder, IconPlus } from '@tabler/icons-react'
5
5
  import { Button } from './Button'
6
6
  import { Chip } from './Chip'
7
+ import { CollapsibleSection } from './CollapsibleSection'
7
8
  import { UnreadDot } from './UnreadDot'
8
9
  import { MenuItem, MenuSeparator } from './Menu'
9
10
  import { NavItem } from './NavItem'
@@ -201,6 +202,38 @@ export const AppDrawnGroups: Story = {
201
202
  },
202
203
  }
203
204
 
205
+ /**
206
+ * `spaced`: 8px between the items the app draws, none above the first — a tree whose items are each a place with rows
207
+ * under it, as Peek's teams are (Katerina, 17 November). The tree's line runs beside each one's rows.
208
+ */
209
+ export const Spaced: Story = {
210
+ args: { groups: undefined },
211
+ render: function Render() {
212
+ return (
213
+ <div className="flex h-screen bg-bg-base">
214
+ <Sidebar>
215
+ <NavTree spaced>
216
+ <NavItem href="#" label="Team one" icon={placeholder}>
217
+ <NavItem href="#" label="Item one" icon={placeholder} />
218
+ <NavItem href="#" label="Item two" icon={placeholder} active />
219
+ <CollapsibleSection look="row" title="A fold" icon={placeholder} defaultOpen>
220
+ <NavItem href="#" label="Item three" icon={placeholder} />
221
+ </CollapsibleSection>
222
+ </NavItem>
223
+ <NavItem href="#" label="Team two" icon={placeholder}>
224
+ <NavItem href="#" label="Item four" icon={placeholder} />
225
+ </NavItem>
226
+ <CollapsibleSection look="row" title="The rest" count={2} defaultOpen={false}>
227
+ <NavItem href="#" label="Team three" icon={placeholder} />
228
+ <NavItem href="#" label="Team four" icon={placeholder} />
229
+ </CollapsibleSection>
230
+ </NavTree>
231
+ </Sidebar>
232
+ </div>
233
+ )
234
+ },
235
+ }
236
+
204
237
  /** A group the app draws, its rows read when it opens: pending while the read is out, and once it has taken `NAV_TREE_PENDING_MS` the skeleton. */
205
238
  function ReadOnOpen({ title, ms }: { title: string; ms: number }) {
206
239
  const [open, setOpen] = useState(false)
@@ -9,6 +9,7 @@ import { act, cleanup, render, screen } from '@testing-library/react'
9
9
  import userEvent from '@testing-library/user-event'
10
10
  import { MenuItem } from './Menu'
11
11
  import { NAV_TREE_PENDING_MS, NavTree, NavTreeSection, type NavTreeGroup } from './NavTree'
12
+ import { NavItem } from './NavItem'
12
13
 
13
14
  afterEach(cleanup)
14
15
 
@@ -179,6 +180,31 @@ describe('NavTree spaces its groups', () => {
179
180
  })
180
181
  })
181
182
 
183
+ // "A bit more spacing between the parent expandable items" (Katerina, 17 November): Peek's teams.
184
+ describe('NavTree spaced', () => {
185
+ it('puts 8px above each item the app draws but the first', () => {
186
+ const { container } = render(
187
+ <NavTree spaced>
188
+ <NavItem href="#one" label="One" />
189
+ <NavItem href="#two" label="Two" />
190
+ </NavTree>,
191
+ )
192
+ const box = screen.getByRole('link', { name: 'One' }).closest('div[class*="mt-2"]')
193
+ expect(box?.className.split(' ')).toEqual(expect.arrayContaining(['contents', '[&>*+*]:mt-2']))
194
+ expect(container.querySelectorAll('[class*="[&>*+*]:mt-2"]')).toHaveLength(1)
195
+ })
196
+
197
+ it('without it, nothing is put between them, as before', () => {
198
+ const { container } = render(
199
+ <NavTree>
200
+ <NavItem href="#one" label="One" />
201
+ <NavItem href="#two" label="Two" />
202
+ </NavTree>,
203
+ )
204
+ expect(container.querySelector('[class*="[&>*+*]:mt-2"]')).toBeNull()
205
+ })
206
+ })
207
+
182
208
  describe('NavTree with no groups and no words', () => {
183
209
  it('draws no line at all', () => {
184
210
  const { container } = render(<NavTree groups={[]} />)
package/src/NavTree.tsx CHANGED
@@ -118,6 +118,12 @@ export interface NavTreeProps {
118
118
  emptyMessage?: string
119
119
  /** Remember each group open or closed in this browser, under this key and the group's id. The app prefixes it. */
120
120
  storageKey?: string
121
+ /**
122
+ * 8px between the items an app draws as `children`, none above the first: a tree whose items are each a place with
123
+ * rows under it — Peek's teams (Katerina, 17 November: "a bit more spacing between the parent expandable items").
124
+ * Groups drawn from `groups` keep their own 4px.
125
+ */
126
+ spaced?: boolean
121
127
  }
122
128
 
123
129
  /** How long the pointer rests on a group before `onIntent` (Peek's FolderTree, 150ms). */
@@ -364,7 +370,7 @@ export function NavTreeSection({ id, title, message, loading = false, pending =
364
370
  * and the column scrolls to it. Groups the app draws itself take `openFor`
365
371
  * for that; the scroll is the tree's either way.
366
372
  */
367
- export function NavTree({ title, titleActions, groups, children, selected, selectedParent, selectedGroup, onSelect, emptyMessage = '', storageKey }: NavTreeProps) {
373
+ export function NavTree({ title, titleActions, groups, children, selected, selectedParent, selectedGroup, onSelect, emptyMessage = '', storageKey, spaced = false }: NavTreeProps) {
368
374
  const opening = groups ? openingFor(groups, selected, selectedParent) : null
369
375
  /*
370
376
  Once per current row, when it is drawn and shown, however late: a row a part inside the tree draws itself (a fold
@@ -391,7 +397,8 @@ export function NavTree({ title, titleActions, groups, children, selected, selec
391
397
  <groupLinked.Provider value={selectedGroup}>
392
398
  {title && <SectionHeader title={title} look="quiet" showActions="always" actions={titleActions} className="mt-4 shrink-0" />}
393
399
  {groups === undefined ? (
394
- children
400
+ // `contents` again: the items stay the column's own; the margin is on each one that follows another.
401
+ spaced ? <div className="contents [&>*+*]:mt-2">{children}</div> : children
395
402
  ) : groups === null ? (
396
403
  <SkeletonList rows={5} />
397
404
  ) : groups.length === 0 ? (
@@ -5,7 +5,7 @@ import * as SectionHeaderStories from './SectionHeader.stories'
5
5
 
6
6
  # SectionHeader
7
7
 
8
- The 32px row a section starts with: a SectionLabel, and actions that
8
+ The 28px row a section starts with, a list row's height: a SectionLabel, and actions that
9
9
  appear while the row is hovered or keyboard-focused, as IconButtons with
10
10
  tooltips — always, on a screen with no hover. It is also the
11
11
  header of a **CollapsibleSection**, which draws the chevron and makes the
@@ -83,7 +83,7 @@ import { IconPlus } from '@tabler/icons-react'
83
83
  actions are always shown (`showActions="always"`), where the buttons light up
84
84
  on their own. The default, `fill`, lights a row that toggles or has actions.
85
85
 
86
- - The row is 32px tall, 8px in on each side, 4px between the title and the
86
+ - The row is 28px tall (32px until 17 November), 8px in on each side, 4px between the title and the
87
87
  actions, with 8px corners.
88
88
 
89
89
  ## What it owns
@@ -94,7 +94,7 @@ It does these by itself. Write none of them around it.
94
94
  |---|---|---|
95
95
  | With `chevron`, its title is a button that calls `onToggle` on a click, Enter or Space, and says whether it is open | a button of your own, or `aria-expanded` | |
96
96
  | Shows its actions while the keyboard is in the row — on the title or on one of them — and always on a screen with no hover | a focus style of your own | |
97
- | Keeps its 32px in a scrolling column | `shrink-0` | |
97
+ | Keeps its 28px in a scrolling column | `shrink-0` | |
98
98
  | Keeps a long title on one line, cut short with "…", in every look | `truncate` around the title | |
99
99
 
100
100
  ## Keys
@@ -205,7 +205,8 @@ export function SectionHeader({ title, chevron = false, icon, isExpanded = true,
205
205
  <div
206
206
  className={cn(
207
207
  // `relative`: a dot in the last button's place is placed against the row.
208
- 'group relative flex h-[32px] shrink-0 items-center gap-1 px-2',
208
+ // 28px, a row's height (Katerina, 17 November); 32px until then.
209
+ 'group relative flex h-[28px] shrink-0 items-center gap-1 px-2',
209
210
  !row && 'transition-colors',
210
211
  // A row is NavItem's shape and colour: 6px corners, secondary words that brighten on hover.
211
212
  row ? cn(SIDEBAR_ROW_CLASSES, SIDEBAR_ROW_TEXT_CLASSES) : 'rounded-lg',
package/src/Skeleton.mdx CHANGED
@@ -6,7 +6,7 @@ import * as SkeletonStories from './Skeleton.stories'
6
6
  # Skeleton
7
7
 
8
8
  The loading placeholder, in generic parts: **SkeletonBar** (the pulsing
9
- block), **SkeletonRow** (a 32px row — a 16px square and a bar, like a row
9
+ block), **SkeletonRow** (a 28px row, a list row's height — a 16px square and a bar, like a row
10
10
  with a face and a name), and **SkeletonList** (rows of varied widths, so
11
11
  the placeholder does not read as a pattern).
12
12
 
@@ -44,4 +44,4 @@ It does these by itself. Write none of them around it.
44
44
 
45
45
  | It does | So you never write | Refused when written by hand |
46
46
  |---|---|---|
47
- | Keeps each row's 32px in a scrolling column | `shrink-0` | |
47
+ | Keeps each row's 28px in a scrolling column | `shrink-0` | |
package/src/Skeleton.tsx CHANGED
@@ -22,10 +22,10 @@ export function SkeletonBar({ className, style, on = 'surface', shape = 'bar' }:
22
22
 
23
23
  const ROW_BAR_WIDTHS = [150, 100, 170, 120, 90, 140, 110, 160]
24
24
 
25
- /** A 32px row: a 16px square and a bar, like a row with a face and a name. */
25
+ /** A 28px row, a list row's height: a 16px square and a bar, like a row with a face and a name. */
26
26
  export function SkeletonRow({ barWidth = 130 }: { barWidth?: number }) {
27
27
  return (
28
- <div className="flex shrink-0 items-center gap-2 px-2 h-[32px] rounded-lg">
28
+ <div className="flex shrink-0 items-center gap-2 px-2 h-[28px] rounded-lg">
29
29
  <SkeletonBar className="w-4 h-4 shrink-0" />
30
30
  <SkeletonBar className="h-3.5" style={{ width: barWidth }} />
31
31
  </div>
@@ -28,7 +28,7 @@ const classes = (el: Element | null) => (el?.getAttribute('class') ?? '').split(
28
28
  describe('a part with a set height keeps it in a scrolling column', () => {
29
29
  it('SectionHeader: shrink-0', () => {
30
30
  const { container } = render(<SectionHeader title="Group" />)
31
- expect(classes(container.querySelector('[class*="h-[32px]"]'))).toContain('shrink-0')
31
+ expect(classes(container.querySelector('[class*="h-[28px]"]'))).toContain('shrink-0')
32
32
  })
33
33
 
34
34
  it('SkeletonRow: shrink-0', () => {
@@ -36,6 +36,13 @@ describe('a part with a set height keeps it in a scrolling column', () => {
36
36
  expect(classes(container.firstElementChild)).toContain('shrink-0')
37
37
  })
38
38
 
39
+ // 28px, a list row's height, for the three that stand in one list (Katerina, 17 November): 32px until then.
40
+ it('a row, a heading and a loading row are each 28px', () => {
41
+ const row = render(<SectionHeader title="Group" />).container
42
+ expect(classes(row.firstElementChild)).toContain('h-[28px]')
43
+ expect(classes(render(<SkeletonRow />).container.firstElementChild)).toContain('h-[28px]')
44
+ })
45
+
39
46
  it('RailItem: a set 48px, and shrink-0', () => {
40
47
  render(<RailItem href="#" label="Item" icon={<span />} />)
41
48
  const tile = classes(screen.getByRole('link'))