@kolkrabbi/kol-component 0.352.0 → 0.354.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": "@kolkrabbi/kol-component",
3
- "version": "0.352.0",
3
+ "version": "0.354.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,9 +32,9 @@
32
32
  "embla-carousel-react": "^8.6.0",
33
33
  "pdfjs-dist": "^6.3.289",
34
34
  "react-syntax-highlighter": "^16.1.1",
35
- "@kolkrabbi/kol-growth": "^0.5.0",
35
+ "@kolkrabbi/kol-search": "^0.3.0",
36
36
  "@kolkrabbi/kol-markdown": "^0.2.0",
37
- "@kolkrabbi/kol-search": "^0.3.0"
37
+ "@kolkrabbi/kol-growth": "^0.5.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@kolkrabbi/kol-icons": ">=0.61.1",
@@ -1,11 +1,16 @@
1
+ import { Icon } from '@kolkrabbi/kol-icons'
2
+
1
3
  /**
2
4
  * Label — minimal form label. Inherits typography from parent (consumer
3
5
  * supplies `kol-helper-N` or similar via className when needed). Defaults
4
6
  * to `text-fg-48` for the muted-control look.
7
+ *
8
+ * @param {string} icon a kol-icons name, drawn before the text at the label's own size (1em) — never a text glyph
5
9
  */
6
- export default function Label({ children, htmlFor, className = '' }) {
10
+ export default function Label({ children, htmlFor, icon, className = '' }) {
7
11
  return (
8
- <label htmlFor={htmlFor} className={`text-fg-48 ${className}`}>
12
+ <label htmlFor={htmlFor} className={`text-fg-48 ${icon ? 'inline-flex items-center gap-1 ' : ''}${className}`}>
13
+ {icon && <Icon name={icon} size="1em" />}
9
14
  {children}
10
15
  </label>
11
16
  )
@@ -4,6 +4,7 @@ import KindPreview, { KIND_GLYPH } from '../molecules/KindPreview.jsx'
4
4
  import FileIcon from '../atoms/FileIcon.jsx'
5
5
  import RowMenuButton from '../molecules/RowMenuButton.jsx'
6
6
  import OptionRow from '../molecules/OptionRow.jsx'
7
+ import ContentText from '../molecules/ContentText.jsx'
7
8
  import { formatLength } from '../molecules/PlayTile.jsx'
8
9
  import { kindOf as dsKindOf, KIND_LABEL as DS_KIND_LABEL } from '../utilities/mediaKinds.js'
9
10
  import useGrabEdge from '../hooks/useGrabEdge.js'
@@ -368,15 +369,18 @@ function Row({
368
369
  </span>
369
370
  )}
370
371
 
371
- {/* ZONE 3 — name over meta */}
372
- {meta ? (
373
- <span className="flex-1 min-w-0 flex flex-col gap-0.5">
374
- <span className="kol-mono-12 truncate">{label}</span>
375
- <span className="kol-helper-10 text-fg-48 truncate">{meta}</span>
376
- </span>
377
- ) : (
378
- <span className="kol-mono-12 flex-1 truncate">{label}</span>
379
- )}
372
+ {/* ZONE 3 — name over meta, drawn by ContentText's row (no middot join: date and size are two
373
+ slots, date first as the Figma master). A folder's meta is the consumer's one string. */}
374
+ <ContentText
375
+ form="row"
376
+ title={label}
377
+ {...(typeof meta === 'object' && meta ? meta : { date: meta || null })}
378
+ gap={2}
379
+ titleClass="kol-mono-12 truncate"
380
+ dateClass="kol-helper-10 text-fg-48 truncate"
381
+ sizeClass="kol-helper-10 text-fg-48 truncate"
382
+ className="flex-1"
383
+ />
380
384
 
381
385
  {/* ZONE 4 */}
382
386
  {zones ? <span className="shrink-0 inline-flex justify-end" style={{ width: 20 }}>{trailing}</span> : trailing}
@@ -870,7 +874,7 @@ export default function ColumnBrowser({
870
874
  * it. */
871
875
  const rows = stackRows(objects, base, stackView === 'grid' ? () => false : (path) => expanded.has(path), partition)
872
876
 
873
- const metaOf = (o) => [o.size != null && formatSize(o.size), formatDate(o.uploaded)].filter(Boolean).join(' · ')
877
+ const metaOf = (o) => ({ date: formatDate(o.uploaded) || null, size: o.size != null ? formatSize(o.size) : null })
874
878
 
875
879
  return (
876
880
  <div
@@ -146,6 +146,8 @@ import useScrollFade from '../hooks/useScrollFade.js'
146
146
  * `icon` on any node at any depth (page, group label, action row, nested child), through `iconComponent`
147
147
  * `iconSize` `{ category, group, page }` (defaults 16, 12, 12); a node's own `iconSize` wins
148
148
  * `alignIcons` `true` (default): a level where any row has an icon reserves the icon column for all its rows
149
+ * `pageIcons` `'inline'` (default) — a page's glyph sits before its label (the column above) · `'gutter'` — it hangs
150
+ * in the gutter under the category glyph and the label stays where a plain page label sits
149
151
  * `collapsedIcons` `'category'` (default) — the collapsed rail shows category glyphs only; `'all'` also shows the
150
152
  * icon-bearing pages of an open category under it
151
153
  * per node `trailing` (a count, badge or node, right-aligned), `className`, `title` (the tooltip when the
@@ -244,6 +246,7 @@ export default function NavRailSite({
244
246
  casePage,
245
247
  iconSize: iconSizes,
246
248
  alignIcons = true,
249
+ pageIcons = 'inline',
247
250
  collapsedIcons = 'category',
248
251
  toggleRef,
249
252
  }) {
@@ -352,12 +355,27 @@ export default function NavRailSite({
352
355
  /* THE ICON COLUMN (NavRailRowProps): with `alignIcons`, a level where any row has an icon reserves the column for all
353
356
  * its rows, as wide as its widest glyph; a level with no icon draws exactly as before */
354
357
  const levelOf = (r) => (r.children ? 'group' : 'page')
355
- const iconW = rows.reduce((w, r) => (r.icon ? Math.max(w, sizeOf(r, levelOf(r))) : w), 0)
358
+ /* `pageIcons="gutter"`: a page row's glyph hangs in the gutter under the category's glyph, so its label stays where a
359
+ * plain page label sits — no column, no shift (kol-kerner via kol-hq 2026-11-08: "app rail has it") */
360
+ const hangs = (r) => pageIcons === 'gutter' && !r.children
361
+ const iconW = rows.reduce((w, r) => (r.icon && !hangs(r) ? Math.max(w, sizeOf(r, levelOf(r))) : w), 0)
356
362
  const aligned = alignIcons && iconW > 0
357
363
  /* a row with an icon, a reserved column or a tail lays out as glyph · label · tail; its case rides the label span
358
364
  * (a flex item, so `::first-letter` applies). A plain row keeps its text bare and the case rides the row. */
359
365
  const body = (row, cc) => {
360
366
  const tail = tailOf(row)
367
+ if (hangs(row) && row.icon) {
368
+ const size = sizeOf(row, 'page')
369
+ const glyph = (
370
+ /* centred under the category glyph's 16px column, left of the active dot */
371
+ <span className="kol-sidenav-hop-icon absolute top-1/2 -translate-y-1/2 inline-flex items-center justify-center" style={{ left: `calc(var(--kol-sidenav-pad-x) + ${depth} * var(--kol-spacing-3))`, width: 16 }} aria-hidden="true">
372
+ <Glyph name={row.icon} size={size} />
373
+ </span>
374
+ )
375
+ return tail
376
+ ? { rowCase: '', content: <>{glyph}<span className="flex items-center gap-2 min-w-0"><span className={withCls('flex-1 min-w-0 truncate', cc)}>{row.label}</span>{tail}</span></> }
377
+ : { rowCase: cc, content: <>{glyph}{row.label}</> }
378
+ }
361
379
  if (!row.icon && !aligned && !tail) return { rowCase: cc, content: row.label }
362
380
  const size = sizeOf(row, levelOf(row))
363
381
  return {