@kolkrabbi/kol-styleguide 0.12.0 → 0.13.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-styleguide",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "private": false,
5
5
  "description": "Brand guide components and the brand tool",
6
6
  "license": "MIT",
@@ -20,10 +20,10 @@
20
20
  "react-dom": "^18.3.0 || ^19.0.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@kolkrabbi/kol-framework": "^0.58.0",
24
- "@kolkrabbi/kol-theme": "^0.193.0",
23
+ "@kolkrabbi/kol-theme": "^0.194.0",
25
24
  "@kolkrabbi/kol-component": "^0.307.0",
26
- "@kolkrabbi/kol-icons": "^0.48.0"
25
+ "@kolkrabbi/kol-framework": "^0.59.0",
26
+ "@kolkrabbi/kol-icons": "^0.49.0"
27
27
  },
28
28
  "files": [
29
29
  "src",
@@ -124,7 +124,7 @@ export function Contents({ index, onNavigate }) {
124
124
  const go = (to) => (e) => { if (!onNavigate || e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return; e.preventDefault(); onNavigate(to) }
125
125
  const row = (s) => (
126
126
  <li key={s.to ?? s.id}>
127
- <IndexCard href={s.to ?? `#${s.id}`} onClick={s.to ? go(s.to) : scrollToAnchor} label={s.label} title={s.title ?? s.nav} meta={s.meta} />
127
+ <IndexCard href={s.href ?? s.to ?? `#${s.id}`} onClick={s.onClick ?? (s.to ? go(s.to) : scrollToAnchor)} label={s.label} title={s.title ?? s.nav} meta={s.meta} />
128
128
  </li>
129
129
  )
130
130
  return (
@@ -1,17 +1,45 @@
1
- import { PageHeader } from '@kolkrabbi/kol-component'
1
+ import { useState } from 'react'
2
+ import { FullscreenOverlay, KindPreview, PageHeader, QuickLookFrame, KIND_LABEL } from '@kolkrabbi/kol-component'
2
3
  import { Contents } from './BrandGuide.jsx'
3
4
 
4
5
  /* DOCUMENT INDEX — a folder's pages as the brand book's contents cards (BrandGuide's `Contents`, routed), grouped by
5
- * `part` (plan-2026-10-28-document W3.3). A compact page header, never a hero: the cards are the page.
6
+ * `part` (plan-2026-10-28-document W3.3; home here since W5.2). A compact page header, never a hero: the cards are the page.
6
7
  *
7
- * rows [{ id, to, label?, title, part }] — label is the card's eyebrow (an entry's parent), part the group
8
+ * A FILE IS A CARD TOO (DocumentIndexFilesAndIcons049, kol-website 2026-10-28 — a point of the MarkdownPage ticket: *"a
9
+ * folder may also hold PDFs and images; the contents index lists them beside the md pages and opens them in the DS
10
+ * QuickLook, not as pages"*): a row with `file` sits in its part like a page, its kind on the card's small line, and
11
+ * opens in the DS Quick Look window (`QuickLookFrame` over the dimmed page, `KindPreview` as the body — a PDF page by
12
+ * page, an image at its size), paging through the folder's files with ‹ ›. `documentFiles(glob)` in kol-framework makes
13
+ * the rows.
14
+ *
15
+ * rows [{ id, to, label?, title, part, meta? }] — a page: label is the card's eyebrow (an entry's parent), part the group
16
+ * [{ id, file, title, part, ext?, kind? }] — a file: the served URL; kind from the DS's `kindOf` when not given
8
17
  * title · lede the header, when the index is a page of its own (Reviews); a folder's index sits under its document
9
18
  * onNavigate(to) the app's router */
19
+ const fileLabel = (r) => KIND_LABEL[r.kind] ?? (r.ext ? r.ext.toUpperCase() : 'File')
20
+
10
21
  export default function DocumentIndex({ rows, title, lede, onNavigate }) {
22
+ const files = rows.filter((r) => r.file)
23
+ const [open, setOpen] = useState(null) // index into `files`
24
+ const index = rows.map((r) => (r.file
25
+ ? { ...r, href: r.file, meta: r.meta ?? fileLabel(r), onClick: (e) => { if (e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return; e.preventDefault(); setOpen(files.indexOf(r)) } }
26
+ : r))
27
+ const cur = open === null ? null : files[open]
28
+ const step = (d) => setOpen((i) => (i + d + files.length) % files.length)
11
29
  return (
12
30
  <div className="kol-page flex flex-col gap-6">
13
31
  {title && <PageHeader title={title} subtitle={lede} size="sm" voice="mono" />}
14
- <Contents index={rows} onNavigate={onNavigate} />
32
+ <Contents index={index} onNavigate={onNavigate} />
33
+ {cur && (
34
+ /* QUICK LOOK DIMS, it does not black out — the list stays in view (MediaLibraryPages' rule) */
35
+ <FullscreenOverlay open onClose={() => setOpen(null)} closeButton={false} scrim>
36
+ <QuickLookFrame title={cur.title} meta={fileLabel(cur)} onClose={() => setOpen(null)} nav={files.length > 1 ? { index: open, total: files.length, onPrev: () => step(-1), onNext: () => step(1) } : undefined}>
37
+ {cur.kind === 'image' || /^(png|jpe?g|webp|gif|svg|avif)$/i.test(cur.ext ?? '')
38
+ ? <img src={cur.file} alt={cur.title} className="kol-quicklook-media" />
39
+ : <KindPreview key={cur.file} o={{ key: cur.file.split('?')[0], url: cur.file }} fit="sheet" urlOf={(x) => x.url} />}
40
+ </QuickLookFrame>
41
+ </FullscreenOverlay>
42
+ )}
15
43
  </div>
16
44
  )
17
45
  }