@kolkrabbi/kol-component 0.339.1 → 0.340.1

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.339.1",
3
+ "version": "0.340.1",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,9 +29,9 @@
29
29
  "embla-carousel-react": "^8.6.0",
30
30
  "pdfjs-dist": "^6.3.289",
31
31
  "react-syntax-highlighter": "^16.1.1",
32
+ "@kolkrabbi/kol-growth": "^0.5.0",
32
33
  "@kolkrabbi/kol-markdown": "^0.2.0",
33
- "@kolkrabbi/kol-search": "^0.3.0",
34
- "@kolkrabbi/kol-growth": "^0.5.0"
34
+ "@kolkrabbi/kol-search": "^0.3.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@kolkrabbi/kol-icons": ">=0.61.1",
@@ -147,9 +147,15 @@ export function Menu({
147
147
  if (!open || !rootRef.current) return
148
148
  const cs = getComputedStyle(rootRef.current.firstElementChild ?? rootRef.current)
149
149
  const vars = {}
150
- for (const v of TONE_VARS) { const val = cs.getPropertyValue(v).trim(); if (val) vars[v] = val }
150
+ /* A FLOAT PANEL IS A FLOAT SURFACE (FloatMenuPanelInk, kol-website 2026-11-04): the theme's, as RailTrigger's card,
151
+ * the search modal and the float Dropdown (which pins `--kol-tone-panel-bg` on its trigger) — never the trigger's
152
+ * ground. Its rows read theme ink (fg-88, the fg-16 lift), so an inverted trigger's panel-bg painted them out. */
153
+ for (const v of TONE_VARS) {
154
+ if (variant === 'float' && v.startsWith('--kol-tone-panel')) continue
155
+ const val = cs.getPropertyValue(v).trim(); if (val) vars[v] = val
156
+ }
151
157
  setAmbient(vars)
152
- }, [open])
158
+ }, [open, variant])
153
159
 
154
160
  let rows = items ?? []
155
161
  if (search) {
@@ -4,6 +4,8 @@ import SearchInput from '../molecules/SearchInput.jsx'
4
4
  import Tag from '../atoms/Tag.jsx'
5
5
  import Kbd from '../atoms/Kbd.jsx'
6
6
  import OptionRow from '../molecules/OptionRow.jsx'
7
+ import Button from '../atoms/Button.jsx'
8
+ import { floatSurfaceClass } from '../utilities/tone.js'
7
9
  import { shortcutInScope } from './ShortcutsOverlay.jsx'
8
10
 
9
11
  /* ONE COLUMN (2026-09-30): rows, headings and footer sit on the field's own
@@ -148,6 +150,10 @@ function unfold(rows, opened) {
148
150
  * @param {string} [selectLabel] the footer's Enter line while a row is highlighted (default
149
151
  * `Go to page`) — a modal whose rows are not pages says what
150
152
  * Enter does instead (the rack's module search: `Add module`)
153
+ * @param {'solid'|'glass-dark'|'glass-light'} [surface] the float look (FloatSearchAndPanels, 2026-11-04): the card
154
+ * is RailTrigger's (`kol-more-sheet-float` on `--kol-float-menu-r`, the float surface and
155
+ * shadow), the field the float SearchInput, the rows float Buttons (Inter, `--kol-float-row`,
156
+ * the lit row fg-16). Unset, the search modal is drawn as before. FloatLayout's `search` passes its own
151
157
  */
152
158
  export default function CommandOverlay({
153
159
  open,
@@ -176,7 +182,9 @@ export default function CommandOverlay({
176
182
  mode = 'search',
177
183
  shortcuts = [],
178
184
  currentPath,
185
+ surface,
179
186
  }) {
187
+ const float = surface != null
180
188
  const panelRef = useRef(null)
181
189
  const listRef = useRef(null)
182
190
  const listId = useId()
@@ -322,7 +330,7 @@ export default function CommandOverlay({
322
330
  role="dialog"
323
331
  aria-modal="true"
324
332
  aria-label="Search"
325
- className={`kol-overlay-panel mx-4 ${noField ? 'outline-none ' : ''}${expanded ? 'max-w-[var(--kol-content-panel)]' : 'max-w-lg'}`}
333
+ className={`${float ? `kol-more-sheet kol-more-sheet-float kol-float-chrome ${floatSurfaceClass(surface, true)} relative w-full overflow-hidden` : 'kol-overlay-panel'} mx-4 ${noField ? 'outline-none ' : ''}${expanded ? 'max-w-[var(--kol-content-panel)]' : 'max-w-lg'}`}
326
334
  >
327
335
  {/* THE MODE, said out loud (user 2026-08-01: "how do you set search
328
336
  * mode? theres no helper, message or mode clearly readble"). Two
@@ -340,7 +348,7 @@ export default function CommandOverlay({
340
348
  {/* A REAL FIELD, inset in the panel (2026-09-30, shadcn's search modal as
341
349
  * the aim) — the flush `bare` strip read as a hole, not a control. */}
342
350
  {!noField && (
343
- <div className="kol-tone-grey p-2 flex items-center gap-2">
351
+ <div className={`${float ? '' : 'kol-tone-grey '}p-2 flex items-center gap-2`}>
344
352
  {/* THE BACK ARROW TAKES THE SEARCH GLYPH'S SLOT (user 2026-10-18: *"why would the back move the input?!"*) —
345
353
  * a button beside the field shrank it and shifted the caret on every drill-in */}
346
354
  <SearchInput
@@ -351,6 +359,7 @@ export default function CommandOverlay({
351
359
  onKeyDown={handleKeyDown}
352
360
  onBack={back}
353
361
  backLabel={backLabel}
362
+ variant={float ? 'float' : undefined}
354
363
  role="combobox"
355
364
  aria-expanded={results.length > 0}
356
365
  aria-controls={listId}
@@ -387,7 +396,7 @@ export default function CommandOverlay({
387
396
  ref={listRef}
388
397
  id={listId}
389
398
  role="listbox"
390
- className={`kol-tone-grey h-80 overflow-y-auto px-2 pb-2${noField ? ' pt-2' : ''}`}
399
+ className={float ? 'h-80 overflow-y-auto' : `kol-tone-grey h-80 overflow-y-auto px-2 pb-2${noField ? ' pt-2' : ''}`}
391
400
  >
392
401
  {results.map((item, i) => {
393
402
  const heading = (item.group ?? '') !== (results[i - 1]?.group ?? '') || i === 0
@@ -395,8 +404,31 @@ export default function CommandOverlay({
395
404
  <li key={item.id} role="presentation">
396
405
  {heading && item.group && (
397
406
  /* the rail's eyebrow (user 2026-10-18: *"sections shoudl be uppercase eyebrow like in siderail"*) */
398
- <p className="kol-eyebrow text-fg-80 px-4 border-x border-transparent pt-3 pb-2">{item.group}</p>
407
+ <p className={`kol-eyebrow text-fg-80 ${float ? 'px-3' : 'px-4 border-x border-transparent'} pt-3 pb-2`}>{item.group}</p>
399
408
  )}
409
+ {float ? (
410
+ /* the float row: RailTrigger's card row, lit on the float selection while it is the cursor */
411
+ <Button
412
+ id={optionId(item)}
413
+ role="option"
414
+ aria-selected={i === active}
415
+ aria-disabled={item.disabled || undefined}
416
+ tabIndex={-1}
417
+ variant="nav"
418
+ size="lg"
419
+ className={`kol-btn-float w-full justify-start${i === active ? ' kol-btn-pressed' : ''}`}
420
+ onMouseDown={(e) => e.preventDefault()}
421
+ onClick={() => select(item)}
422
+ onMouseEnter={() => { if (!item.disabled) { setActiveIndex(i); setNavigated(true) } }}
423
+ >
424
+ {/* the glyph drawn here, not as `iconLeft` — Button would wrap it and the label in a span that does not take the row */}
425
+ <span className="flex min-w-0 flex-1 items-center" style={{ gap: 'var(--kol-float-gap-ic)' }}>
426
+ {item.indent ? <span className="inline-block w-4 shrink-0" /> : item.icon && <Icon name={item.icon} size="var(--kol-float-ic)" className="shrink-0" />}
427
+ <span className="truncate text-left"><HighlightMatch label={item.label} query={query} ranges={item.highlights} /></span>
428
+ {((item.disabled && item.disabledHint) || item.hint) && <span className="kol-float-hint ml-auto truncate text-oq-64">{(item.disabled && item.disabledHint) || item.hint}</span>}
429
+ </span>
430
+ </Button>
431
+ ) : (
400
432
  <OptionRow
401
433
  id={optionId(item)}
402
434
  role="option"
@@ -414,6 +446,7 @@ export default function CommandOverlay({
414
446
  onClick={() => select(item)}
415
447
  onMouseEnter={() => { if (!item.disabled) { setActiveIndex(i); setNavigated(true) } }}
416
448
  />
449
+ )}
417
450
  </li>
418
451
  )
419
452
  })}