@kolkrabbi/kol-component 0.235.0 → 0.236.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.235.0",
3
+ "version": "0.236.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -128,6 +128,8 @@ export { default as ToolPalette } from './organisms/ToolPalette.jsx'
128
128
  export { default as DocumentEditor } from './organisms/DocumentEditor.jsx'
129
129
  export { default as SwatchControls, SwatchStack, EyedropPick } from './molecules/SwatchControls.jsx'
130
130
  export { default as TabsRow } from './molecules/TabsRow.jsx'
131
+ /* TabChips — tabs as chips, for inside a toolbar (2026-10-01; was the showcase's local DocTabs) */
132
+ export { default as TabChips } from './molecules/TabChips.jsx'
131
133
 
132
134
  // organisms
133
135
  /* monorepo sets (P6–P10) — organism members. Foundry members live in the
@@ -0,0 +1,39 @@
1
+ /**
2
+ * TabChips — Tabs as a row of chips. the active tab is a filled chip, the rest are quiet text.
3
+ *
4
+ * WHY IT EXISTS (user, 2026-10-01, on the showcase's Preview / Code and pnpm / npm / yarn / bun rows:
5
+ * *"what is this button? its not DS?"* → *"we can just make a tab chip for this purpose exactly
6
+ * like this"*). It was `DocTabs`, a strip local to the showcase, built there because neither
7
+ * shipped tab control fits a toolbar: `SegmentedToggle` is a joined strip with radiogroup
8
+ * semantics, `TabsRow` is an underline strip that wants a rule beneath it. This is the third tab
9
+ * idiom — small, unframed, sits inside a bar — promoted as it was, class for class.
10
+ *
11
+ * Labels render as authored. Selection is the parent's.
12
+ *
13
+ * @param {Array} tabs `[{ id, label }]`
14
+ * @param {string} value id of the active tab (controlled)
15
+ * @param {Function} onChange `(id) => void`
16
+ * @param {string} [ariaLabel] accessible name for the strip
17
+ * @param {string} [className] extra classes on the row
18
+ */
19
+ export default function TabChips({ tabs = [], value, onChange, ariaLabel, className = '' }) {
20
+ return (
21
+ <div className={`flex items-center gap-1 ${className}`.trim()} role="tablist" aria-label={ariaLabel}>
22
+ {tabs.map((t) => {
23
+ const active = t.id === value
24
+ return (
25
+ <button
26
+ key={t.id}
27
+ type="button"
28
+ role="tab"
29
+ aria-selected={active}
30
+ onClick={() => onChange?.(t.id)}
31
+ className={`kol-mono-12 rounded-[var(--kol-radius-sm)] px-3 py-1 transition-colors [@media(pointer:coarse)]:min-h-8 ${active ? 'bg-fg-08 text-emphasis' : 'text-meta hover:text-emphasis'}`}
32
+ >
33
+ {t.label}
34
+ </button>
35
+ )
36
+ })}
37
+ </div>
38
+ )
39
+ }