@kolkrabbi/kol-component 0.333.2 → 0.334.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.
@@ -0,0 +1,24 @@
1
+ import Dropdown from './Dropdown.jsx'
2
+
3
+ /**
4
+ * WorkspaceSwitcher — Which workspace you are in. `WORKSPACE · Personal / Kolkrabbi ⌄` (float-everything W4 row 58,
5
+ * 2026-11-04 — the exploration's workspace selector at the top of a rail). A label in the float label role, tracked
6
+ * and uppercased, over a `Dropdown` of the workspaces; `variant="float"` is the float select on the well, the default
7
+ * the sm dropdown. A workspace is `{ value, label, icon? }`; a nested one reads `Studio / Personal` in its label.
8
+ *
9
+ * @param {string} [label] default `Workspace`
10
+ * @param {Array} workspaces Dropdown options
11
+ * @param {string} value
12
+ * @param {Function} onChange `(value) => void`
13
+ * @param {'float'} [variant]
14
+ * @param {string} [className]
15
+ */
16
+ export default function WorkspaceSwitcher({ label = 'Workspace', workspaces = [], value, onChange, variant, className = '' }) {
17
+ const float = variant === 'float'
18
+ return (
19
+ <div className={`inline-flex flex-col gap-3 ${className}`.trim()}>
20
+ <span className="kol-float-label uppercase tracking-[0.03em] text-fg-64">{label}</span>
21
+ <Dropdown variant={float ? 'float' : undefined} size={float ? 'md' : undefined} options={workspaces} value={value} onChange={onChange} ariaLabel={label} />
22
+ </div>
23
+ )
24
+ }
@@ -70,9 +70,13 @@ import { filterItems } from '../utilities/searchItems.js'
70
70
  * @param {string} props.countClassName — the "N of N" type/ink
71
71
  * @param {string} props.tone — 'default' | 'inverse' — forwarded to the search field (ControlToneInverse,
72
72
  * 2026-08-27): a page on a wash sets its header row's tone in one place
73
+ * @param {'float'} props.variant — the float filter bar (float-everything W4 row 56, 2026-11-04): each group's
74
+ * chips are `Tag variant="float" size="md"` capsules with the count of items
75
+ * each would show, in a capsule track 5 in. Everything else stays.
73
76
  */
74
77
  const ContentFilters = ({
75
78
  tone = 'default',
79
+ variant,
76
80
  items,
77
81
  title,
78
82
  totalCount,
@@ -320,6 +324,9 @@ const ContentFilters = ({
320
324
  * rule sits in the components layer. */
321
325
  const stacked = group.stack ?? index === 0
322
326
  const first = index === 0 && stacked
327
+ const float = variant === 'float'
328
+ /* the float chip carries the count of items it would show (row 56) */
329
+ const countOf = (value) => items.filter((item) => { const v = item[group.key]; return Array.isArray(v) ? v.includes(value) : v === value }).length
323
330
  return (
324
331
  <div key={group.key} className={`flex flex-col gap-3 ${first ? 'kol-filters-first' : stacked ? 'shrink-0' : 'min-w-0 flex-1'} ${group.className ?? ''}`.trim()}>
325
332
  {/* THE CATEGORY LABEL IS THE ACTIVE INK — `kol-helper-12` at `text-fg-96`,
@@ -337,16 +344,17 @@ const ContentFilters = ({
337
344
  </h4>
338
345
  {/* the fluid group keeps 48px of room on its right (it ran flush to the
339
346
  * panel's edge); `group.wrapClassName` is the per-group seam */}
340
- <div className={`${stacked ? 'flex flex-col items-start gap-2' : 'flex flex-wrap gap-2 pr-12'} ${group.wrapClassName ?? ''}`.trim()}>
347
+ <div className={`${float ? 'inline-flex self-start flex-wrap items-center gap-1 rounded-full bg-oq-04 p-[5px]' : stacked ? 'flex flex-col items-start gap-2' : 'flex flex-wrap gap-2 pr-12'} ${group.wrapClassName ?? ''}`.trim()}>
341
348
  {group.values.map((value) => (
342
349
  <Tag
343
350
  key={value}
344
- size={tagSize}
345
- variant={tagVariant}
351
+ size={float ? 'md' : tagSize}
352
+ variant={float ? 'float' : tagVariant}
346
353
  hash={false}
354
+ count={float ? countOf(value) : undefined}
347
355
  active={activeFilters.has(`${group.key}:${value}`)}
348
356
  onClick={() => toggleFilter(group.key, value)}
349
- className={activeFilters.has(`${group.key}:${value}`) ? tagActiveClassName : tagRestClassName}
357
+ className={float ? undefined : activeFilters.has(`${group.key}:${value}`) ? tagActiveClassName : tagRestClassName}
350
358
  >
351
359
  {value}
352
360
  </Tag>