@kolkrabbi/kol-shell 0.1.0 → 0.1.2
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 +5 -5
- package/src/ContentFilters.jsx +51 -45
- package/src/PageHeader.jsx +3 -1
- package/src/TabStrip.jsx +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-shell",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "KOL application shell — fixed 48px NavRail + AppShell layout root, PageShell/PageHeader scaffolds, ContentFilters catalog organism, GridCard, SettingsScaffold, WalkthroughPanel, ShortcutsOverlay. App chrome (kol-framework owns site chrome). Nav items, content, shortcuts and settings are consumer-injected. Sits above @kolkrabbi/kol-{theme,component,framework}.",
|
|
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-
|
|
24
|
-
"@kolkrabbi/kol-icons": "^0.
|
|
25
|
-
"@kolkrabbi/kol-
|
|
26
|
-
"@kolkrabbi/kol-
|
|
23
|
+
"@kolkrabbi/kol-framework": "^0.20.1",
|
|
24
|
+
"@kolkrabbi/kol-icons": "^0.17.0",
|
|
25
|
+
"@kolkrabbi/kol-theme": "^0.42.2",
|
|
26
|
+
"@kolkrabbi/kol-component": "^0.43.0"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"src",
|
package/src/ContentFilters.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useMemo, useRef, useEffect } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { Divider } from '@kolkrabbi/kol-component'
|
|
3
3
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
4
4
|
import TabStrip from './TabStrip.jsx'
|
|
5
5
|
|
|
@@ -132,29 +132,31 @@ const ContentFilters = ({
|
|
|
132
132
|
})
|
|
133
133
|
}, [items, activeFilters, customFilterKeys, searchText, searchKeys])
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
// Filter values wear the LIST/GRID strip idiom, not Tag chips — user ruling
|
|
136
|
+
// 2026-08-15 ("TAGS should be same style as LIST and GRID"). Label and values
|
|
137
|
+
// sit on ONE line so the group shares the row with the layout strip.
|
|
138
|
+
const renderFilterGroup = (group) => {
|
|
139
|
+
const prefix = `${group.key}:`
|
|
140
|
+
const selected = new Set(
|
|
141
|
+
Array.from(activeFilters)
|
|
142
|
+
.filter((f) => f.startsWith(prefix))
|
|
143
|
+
.map((f) => f.slice(prefix.length))
|
|
144
|
+
)
|
|
142
145
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
})}
|
|
146
|
+
return (
|
|
147
|
+
<div key={group.key} className="flex items-center gap-4">
|
|
148
|
+
<h4 className="kol-helper-12 text-fg-48">{group.label}</h4>
|
|
149
|
+
<TabStrip
|
|
150
|
+
options={group.values.map((v) => ({ value: v, label: v }))}
|
|
151
|
+
value={selected}
|
|
152
|
+
onChange={(v) => toggleFilter(group.key, v)}
|
|
153
|
+
size={12}
|
|
154
|
+
tracked
|
|
155
|
+
className="gap-4"
|
|
156
|
+
/>
|
|
155
157
|
</div>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
)
|
|
159
|
+
}
|
|
158
160
|
|
|
159
161
|
return (
|
|
160
162
|
<div className="w-full" style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
|
|
@@ -236,33 +238,37 @@ const ContentFilters = ({
|
|
|
236
238
|
|
|
237
239
|
<Divider className="mb-4" />
|
|
238
240
|
|
|
239
|
-
{
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
241
|
+
{/* ONE row BELOW the divider: filter groups on the LEFT (only while the
|
|
242
|
+
filter toggle is open), layout strip on the RIGHT and ALWAYS visible.
|
|
243
|
+
0.1.1 read "at the divider level" as the header row above it — the
|
|
244
|
+
filer's verdict corrected that; the strip never belongs in the header
|
|
245
|
+
(ShellHeaderFilterRefinements, 2026-08-15). */}
|
|
246
|
+
{(layoutOptions || isExpanded) && (
|
|
247
|
+
<div className="flex items-center justify-between gap-16 mb-4">
|
|
248
|
+
<div className="flex items-center gap-16">
|
|
249
|
+
{isExpanded && filterGroups.map((group) => renderFilterGroup(group))}
|
|
250
|
+
{isExpanded && activeFilters.size > 0 && (
|
|
251
|
+
<button
|
|
252
|
+
onClick={clearAllFilters}
|
|
253
|
+
className="kol-helper-12 transition-colors underline text-fg-48"
|
|
254
|
+
>
|
|
255
|
+
Clear all ({activeFilters.size})
|
|
256
|
+
</button>
|
|
257
|
+
)}
|
|
258
|
+
</div>
|
|
259
|
+
{layoutOptions && (
|
|
260
|
+
<TabStrip
|
|
261
|
+
options={layoutOptions}
|
|
262
|
+
value={layout}
|
|
263
|
+
onChange={setLayout}
|
|
264
|
+
size={12}
|
|
265
|
+
tracked
|
|
266
|
+
className="gap-4"
|
|
267
|
+
/>
|
|
250
268
|
)}
|
|
251
269
|
</div>
|
|
252
270
|
)}
|
|
253
271
|
|
|
254
|
-
{/* Layout toggle */}
|
|
255
|
-
{layoutOptions && (
|
|
256
|
-
<TabStrip
|
|
257
|
-
options={layoutOptions}
|
|
258
|
-
value={layout}
|
|
259
|
-
onChange={setLayout}
|
|
260
|
-
size={12}
|
|
261
|
-
tracked
|
|
262
|
-
className="justify-end gap-4 mt-4"
|
|
263
|
-
/>
|
|
264
|
-
)}
|
|
265
|
-
|
|
266
272
|
{/* Render filtered items */}
|
|
267
273
|
<div className="mt-8" style={{ display: 'flex', flexDirection: 'column', flex: 1 }}>
|
|
268
274
|
{renderItem(filteredItems, viewMode, layout)}
|
package/src/PageHeader.jsx
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
export default function PageHeader({ title, subtitle }) {
|
|
8
8
|
return (
|
|
9
9
|
<>
|
|
10
|
-
|
|
10
|
+
{/* gap inline, never in kol-heading-sm — margin in a shared type class
|
|
11
|
+
leaks estate-wide (ShellHeaderFilterRefinements, 2026-08-15) */}
|
|
12
|
+
<h1 className="text-fg-96 kol-heading-sm" style={{ marginBottom: 8 }}>{title}</h1>
|
|
11
13
|
<p className="text-fg-48 kol-mono-14" style={{ marginBottom: 40 }}>{subtitle}</p>
|
|
12
14
|
</>
|
|
13
15
|
)
|
package/src/TabStrip.jsx
CHANGED
|
@@ -8,16 +8,25 @@
|
|
|
8
8
|
* want GRID). `tracked` adds the 1px letter-spacing the view-mode strips
|
|
9
9
|
* carried.
|
|
10
10
|
*
|
|
11
|
+
* `value` takes a **Set** for a multi-select strip (ContentFilters' filter
|
|
12
|
+
* values, ruled 2026-08-15 to wear this exact idiom rather than Tag chips) or
|
|
13
|
+
* a scalar for the single-select tabs. One ink recipe, both behaviours — the
|
|
14
|
+
* alternative was a second copy of the active/rest classes, which is how the
|
|
15
|
+
* two shipped shells drifted in the first place.
|
|
16
|
+
*
|
|
11
17
|
* @param {Array} props.options `[{ value, label }]`
|
|
18
|
+
* @param {Set|*} props.value Set → multi-select · scalar → single-select
|
|
12
19
|
*/
|
|
13
20
|
export default function TabStrip({ options = [], value, onChange, size = 14, tracked = false, className = 'gap-6', style }) {
|
|
21
|
+
const isOn = (opt) => (value instanceof Set ? value.has(opt.value) : value === opt.value)
|
|
22
|
+
|
|
14
23
|
return (
|
|
15
24
|
<div className={`flex items-center ${className}`.trim()} style={style}>
|
|
16
25
|
{options.map((opt) => (
|
|
17
26
|
<span
|
|
18
27
|
key={opt.value}
|
|
19
28
|
onClick={() => onChange?.(opt.value)}
|
|
20
|
-
className={`kol-helper-${size} cursor-pointer select-none ${
|
|
29
|
+
className={`kol-helper-${size} cursor-pointer select-none ${isOn(opt) ? 'text-fg-96' : 'text-fg-32 hover:text-fg-48'}`}
|
|
21
30
|
style={tracked ? { letterSpacing: 1 } : undefined}
|
|
22
31
|
>
|
|
23
32
|
{opt.label}
|