@kolkrabbi/kol-component 0.345.0 → 0.347.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.345.0",
3
+ "version": "0.347.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,8 +30,8 @@
30
30
  "pdfjs-dist": "^6.3.289",
31
31
  "react-syntax-highlighter": "^16.1.1",
32
32
  "@kolkrabbi/kol-search": "^0.3.0",
33
- "@kolkrabbi/kol-markdown": "^0.2.0",
34
- "@kolkrabbi/kol-growth": "^0.5.0"
33
+ "@kolkrabbi/kol-growth": "^0.5.0",
34
+ "@kolkrabbi/kol-markdown": "^0.2.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@kolkrabbi/kol-icons": ">=0.61.1",
@@ -7,8 +7,11 @@
7
7
  * @param {number} max default 100
8
8
  * @param {boolean|ReactNode|Function} caption `true` → `value/max`; a node; or `(value, max) => node`; omit for none
9
9
  * @param {'success'|'warning'|'error'|'info'} tone the fill's colour (default the ink)
10
- * @param {'float'} variant the float track (float-everything W2 row 31, 2026-11-04): 4px, a capsule, oq-16 under
11
- * the emphasis ink; the caption in the float label role
10
+ * @param {'float'} variant the float track (float-everything W2 row 31, 2026-11-04): the float slider's 3px capsule,
11
+ * oq-16 under fg-64; the caption in the float label role
12
+ *
13
+ * The track is the Slider's (2026-11-07): `.kol-track` / `.kol-track-run` in kol-theme read the same tokens the range
14
+ * inputs do, so a ProgressBar and a Slider at the same variant draw one track. A tone sets `--kol-track-run`.
12
15
  * @param {string} ariaLabel
13
16
  */
14
17
  const TONE = { success: 'var(--ui-success)', warning: 'var(--ui-warning)', error: 'var(--ui-error)', info: 'var(--ui-info)' }
@@ -19,8 +22,8 @@ export default function ProgressBar({ value = 0, max = 100, caption, tone, varia
19
22
  const float = variant === 'float'
20
23
  return (
21
24
  <div className={`flex flex-col gap-1 ${className}`.trim()}>
22
- <div role="progressbar" aria-valuenow={value} aria-valuemin={0} aria-valuemax={max} aria-label={ariaLabel} className={`h-1 overflow-hidden ${float ? 'rounded-full bg-oq-16' : 'rounded bg-fg-08'}`}>
23
- <div className={`h-full transition-[width] duration-300 ${float ? 'rounded-full' : ''}`} style={{ width: `${pct}%`, background: TONE[tone] ?? (float ? 'var(--kol-fg-emphasis)' : 'var(--kol-fg-64)') }} />
25
+ <div role="progressbar" aria-valuenow={value} aria-valuemin={0} aria-valuemax={max} aria-label={ariaLabel} className={`kol-track ${float ? 'kol-track--float' : ''}`.trim()}>
26
+ <div className="kol-track-run transition-[width] duration-300" style={{ width: `${pct}%`, ...(TONE[tone] && { '--kol-track-run': TONE[tone] }) }} />
24
27
  </div>
25
28
  {text != null && text !== false && <span className={float ? 'kol-float-label text-fg-64' : 'kol-mono-10 text-meta'}>{text}</span>}
26
29
  </div>
@@ -19,6 +19,8 @@ import SliderPanel from './SliderPanel.jsx'
19
19
  * routes were documented and neither was wired, so consumers were reaching into
20
20
  * `.slider-black` by specificity from their own stylesheets).
21
21
  * `--kol-slider-playhead` works the same way on the dual rail.
22
+ * The minimal and float tracks read the shared track tokens (`--kol-track-h` · `-r` · `-bg` · `-run`, kol-theme
23
+ * `.kol-track`, 2026-11-07) — ProgressBar draws the same track from them.
22
24
  *
23
25
  * DUAL + PLAYHEAD (SliderDualThumbAndPlayhead, kol-mirror 2026-08-30):
24
26
  * `variant="dual"` stacks two native ranges on one rail for an in/out pair,
@@ -1,49 +1,66 @@
1
1
  /**
2
- * ProsePreview — Every long-form prose element in one view. a full rich-text specimen: one `.kol-prose` block exercising
3
- * every long-form element — H1–H4 ladder, section lede, body paragraph,
4
- * blockquote, indented passage, code block, pullout, and unordered/ordered
5
- * lists — so the KOL prose stylesheet can be reviewed end-to-end in one view.
6
- * The "long-form" member of the type-specimen kit.
2
+ * ProsePreview — A style collection in one view: every block a reading surface draws, set in ONE named collection's
3
+ * styles, so the collection can be reviewed end to end. Built from the collection's own parts — its text roles, its pull
4
+ * quote, its indent and its code block are the theme's named classes; no style is written in this file
5
+ * (plan-2026-11-07-figma-library-tiers 2.8, the user: *"should it not be made from other components? f.e. text style
6
+ * component, pull quote component, spacer component … it could be great and display workshop style, document style"*).
7
7
  *
8
- * Fixed structure; only the text slots vary. All element styling comes from
9
- * the prose stylesheet (kol-typography.css) plus the kit's
10
- * `.kol-prose-indented` / `.kol-prose-pullout` chrome — none lives here.
8
+ * collection="prose" (default) — the long-form stylesheet: `.kol-prose` element styles (H1–H4, p, blockquote, pre,
9
+ * lists) with `.kol-prose-indented` and `.kol-prose-pullout`. Today's view.
10
+ * collection="doc" — the documentation roles the workshop's DocumentationReader and the doc pages read:
11
+ * `kol-doc-heading` · `-section-title` · `-lede` · `-body` · `-code` · `-caption`
12
+ * (kol-type-roles.css), with the doc callout for the quote.
11
13
  *
14
+ * A utility (`utilities/`): it wears the theme's sets and imports no molecule. A collection is a map, block → class, in
15
+ * COLLECTIONS below — a new collection is a new row, never new styling.
16
+ *
17
+ * @param {'prose'|'doc'} collection which style set (default `prose`)
12
18
  * @param {string} h1 trailing text of the H1 (rendered as `H1 — {h1}`)
13
19
  * @param {string} paragraph body paragraph text
14
- * @param {string} code contents of the <pre><code> block
20
+ * @param {string} code contents of the code block
15
21
  * @param {string} pullout trailing text of the pullout (rendered as `Pullout — {pullout}`)
16
22
  * @param {string} quote blockquote text
17
23
  */
18
- export default function ProsePreview({ h1, paragraph, code, pullout, quote = 'Above as below — justice is a starfield.' }) {
24
+
25
+ const LEDE = 'Section lede — a larger paragraph used to introduce a section and establish tone before the body copy begins.'
26
+ const INDENT = 'Indented passage. Used for tangential copy, contextual notes, or nested argument that supports the main line.'
27
+
28
+ /* block → the collection's own class. `null` = the collection styles the bare element (prose's element sheet). */
29
+ const COLLECTIONS = {
30
+ prose: {
31
+ /* carried through verbatim from the one-block version, so `prose` renders exactly as before */
32
+ root: 'kol-prose', h1: null, h2: null, h3: null, h4: null, lede: 'kol-sans-body-01 text-strong mb-6', body: null,
33
+ quote: null, indent: 'kol-prose-indented', code: 'bg-fg-04 border border-fg-08',
34
+ pullout: 'kol-prose-pullout kol-helper-12 tracking-widest text-body', list: null,
35
+ },
36
+ doc: {
37
+ root: 'kol-doc-page', h1: 'kol-doc-heading', h2: 'kol-doc-section-title', h3: 'kol-doc-section-title', h4: 'kol-doc-eyebrow',
38
+ lede: 'kol-doc-lede', body: 'kol-doc-body', quote: 'docs-callout kol-doc-body', indent: 'kol-prose-indented kol-doc-body',
39
+ code: 'kol-doc-code', pullout: 'kol-doc-caption', list: 'kol-doc-body',
40
+ },
41
+ }
42
+
43
+ export default function ProsePreview({ collection = 'prose', h1, paragraph, code, pullout, quote = 'Above as below — justice is a starfield.' }) {
44
+ const c = COLLECTIONS[collection] ?? COLLECTIONS.prose
45
+ const k = (block) => c[block] ?? undefined
19
46
  return (
20
- <div className="kol-prose">
21
- <h1>H1 — {h1}</h1>
22
- <h2>H2 — Section title</h2>
23
- <h3>H3 — Subsection</h3>
24
- <h4>H4 — Block title</h4>
25
- <p className="kol-sans-body-01 text-strong mb-6">
26
- Section lede — a larger paragraph used to introduce a section and
27
- establish tone before the body copy begins.
28
- </p>
29
- <p>{paragraph}</p>
30
- <blockquote><p>{quote}</p></blockquote>
31
- <div className="kol-prose-indented">
32
- <p>
33
- Indented passage. Used for tangential copy, contextual notes, or
34
- nested argument that supports the main line.
35
- </p>
36
- </div>
37
- <pre className="bg-fg-04 border border-fg-08"><code>{code}</code></pre>
38
- <p className="kol-prose-pullout kol-helper-12 tracking-widest text-body">
39
- Pullout — {pullout}
40
- </p>
41
- <ul>
47
+ <div className={c.root} data-collection={collection}>
48
+ <h1 className={k('h1')}>H1 — {h1}</h1>
49
+ <h2 className={k('h2')}>H2 — Section title</h2>
50
+ <h3 className={k('h3')}>H3 — Subsection</h3>
51
+ <h4 className={k('h4')}>H4 — Block title</h4>
52
+ <p className={k('lede')}>{LEDE}</p>
53
+ <p className={k('body')}>{paragraph}</p>
54
+ <blockquote className={k('quote')}><p>{quote}</p></blockquote>
55
+ <div className={k('indent')}><p>{INDENT}</p></div>
56
+ <pre className={k('code')}><code>{code}</code></pre>
57
+ <p className={k('pullout')}>Pullout — {pullout}</p>
58
+ <ul className={k('list')}>
42
59
  <li>Unordered list — item one</li>
43
60
  <li>Item two</li>
44
61
  <li>Item three</li>
45
62
  </ul>
46
- <ol>
63
+ <ol className={k('list')}>
47
64
  <li>Ordered list — item one</li>
48
65
  <li>Item two</li>
49
66
  <li>Item three</li>