@kolkrabbi/kol-shell 0.1.1 → 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 +1 -1
- package/src/ContentFilters.jsx +47 -42
- 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",
|
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 }}>
|
|
@@ -231,9 +233,29 @@ const ContentFilters = ({
|
|
|
231
233
|
{viewModeOptions && (
|
|
232
234
|
<TabStrip options={viewModeOptions} value={viewMode} onChange={handleViewModeChange} tracked />
|
|
233
235
|
)}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
<Divider className="mb-4" />
|
|
240
|
+
|
|
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>
|
|
237
259
|
{layoutOptions && (
|
|
238
260
|
<TabStrip
|
|
239
261
|
options={layoutOptions}
|
|
@@ -245,23 +267,6 @@ const ContentFilters = ({
|
|
|
245
267
|
/>
|
|
246
268
|
)}
|
|
247
269
|
</div>
|
|
248
|
-
</div>
|
|
249
|
-
|
|
250
|
-
<Divider className="mb-4" />
|
|
251
|
-
|
|
252
|
-
{isExpanded && (
|
|
253
|
-
<div className="flex items-start gap-16">
|
|
254
|
-
{filterGroups.map((group) => renderFilterGroup(group))}
|
|
255
|
-
{activeFilters.size > 0 && (
|
|
256
|
-
<button
|
|
257
|
-
onClick={clearAllFilters}
|
|
258
|
-
className="kol-helper-12 transition-colors underline text-fg-48"
|
|
259
|
-
style={{ marginLeft: 'auto' }}
|
|
260
|
-
>
|
|
261
|
-
Clear all ({activeFilters.size})
|
|
262
|
-
</button>
|
|
263
|
-
)}
|
|
264
|
-
</div>
|
|
265
270
|
)}
|
|
266
271
|
|
|
267
272
|
{/* Render filtered items */}
|
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}
|